0 Flares Twitter 0 Facebook 0 Filament.io 0 Flares ×

Fala pessoal, beleza.

A ideia dessa série de posts é ajudar quem está começando a ter mais segurança quando precisar fazer uma operação de backup e, principalmente, uma operação de restore.

Existem N formas de fazer um backup. E N+1 formas de fazer um restore. Essa é só uma das formas, ou melhor, a forma mais simples possível para você ter um ponto de partida para seus testes.

Lembrando sempre que a utilização dessas dicas/roteiro/whatever é por sua conta e risco ahahahahha. Teste antes qualquer operação que for realizar no seu ambiente de testes, principalmente este tipo de situação.

Vamos começar pelo full. Vou usar a minha área de FRA para realizar esse backup.

Vamos ver o que eu tenho aqui:

SQL> show pdbs;

SQL> show pdbs;

CON_ID   CON_NAME    OPEN MODE   RESTRICTED
———-  ————–  ———–        ———-
2 PDB$SEED      READ ONLY     NO
3 THORPDB1     READ WRITE    NO
4 THORPDB2     READ WRITE    NO
5 THORPDB3     READ WRITE    NO
6 THORPDB5     READ WRITE    NO
7 THORPDB4     READ WRITE    NO

Tenho aqui 5 PDB’s abertos em minha máquina de testes.

Então vai ser assim. Vamos realizar o backup full (CDB + PDB’s). Depois disso vou criar uma tabela em um pdb qualquer, fazer um backup de archives e dropar essa tabela. Só ai iremos restaurar o banco todo.

Isso é só uma demonstração. Nos próximos posts vamos ver como restaurar apenas um PDB específico.

Então é isso. Vamos começar.

 

1) Vamos acertar o RMAN aqui para fazer os backup’s com paralelismo e o autobackup dp controldfile.

CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;

 

2) Esse é um script de backup bem básico. Agumas considerações antes de continuar:

— Ahhhh podia ser melhor? Podia…

— Ahhhh mas eu faço diferente. Ok, faça como quiser…

— Ahhh mas porque você faz esse ALTER SYSTEM? Por que assim é o jeito que eu gosto de fazer.

— Fique a vontade para fazer como quiser. O backup só precisa ser completo.

— Esse não é o script que eu uso no meu dia a dia, mas chega perto.

run {
SQL ‘ALTER SYSTEM ARCHIVE LOG CURRENT’;
SQL ‘ALTER SYSTEM CHECKPOINT’;
ALLOCATE CHANNEL d1 TYPE DISK MAXPIECESIZE 32G;
ALLOCATE CHANNEL d2 TYPE DISK MAXPIECESIZE 32G;
ALLOCATE CHANNEL d3 TYPE DISK MAXPIECESIZE 32G;
ALLOCATE CHANNEL d4 TYPE DISK MAXPIECESIZE 32G;
BACKUP
AS COMPRESSED BACKUPSET
DATABASE
CURRENT CONTROLFILE;
SQL ‘ALTER SYSTEM ARCHIVE LOG CURRENT’;
SQL ‘ALTER SYSTEM CHECKPOINT’;
BACKUP
AS COMPRESSED BACKUPSET
ARCHIVELOG ALL NOT BACKED UP 3 TIMES
CURRENT CONTROLFILE;
CROSSCHECK BACKUPSET;
CROSSCHECK ARCHIVELOG ALL;
CROSSCHECK COPY;
DELETE NOPROMPT ARCHIVELOG UNTIL TIME ‘SYSDATE – 3’;
DELETE NOPROMPT OBSOLETE DEVICE TYPE DISK;
}

 

3) Alguns trechos do log do backup.

— Alocação de canais
allocated channel: d1
channel d1: SID=96 device type=DISK
allocated channel: d2
channel d2: SID=95 device type=DISK
allocated channel: d3
channel d3: SID=90 device type=DISK
allocated channel: d4
channel d4: SID=89 device type=DISK

— CDB
input datafile file number=00001 name=+DATA/THOR/DATAFILE/system.257.965234485
channel d1: starting piece 1 at 26-JAN-18
channel d2: starting compressed full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/THOR/DATAFILE/sysaux.258.965234539
channel d2: starting piece 1 at 26-JAN-18
channel d3: starting compressed full datafile backup set
channel d3: specifying datafile(s) in backup set

— PDB
input datafile file number=00010 name=+DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/DATAFILE/sysaux.279.965235083
channel d3: starting piece 1 at 26-JAN-18
channel d4: starting compressed full datafile backup set
channel d4: specifying datafile(s) in backup set
input datafile file number=00014 name=+DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/DATAFILE/sysaux.284.965235107
channel d4: starting piece 1 at 26-JAN-18
channel d1: finished piece 1 at 26-JAN-18

— Outro PDB
channel d3: specifying datafile(s) in backup set
input datafile file number=00026 name=+DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/DATAFILE/sysaux.305.965485357
channel d3: starting piece 1 at 26-JAN-18
channel d4: finished piece 1 at 26-JAN-18
piece handle=+DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.533.966438637 tag=TAG20180126T151035 comment=NONE
channel d4: backup set complete, elapsed time: 00:02:53
channel d4: starting compressed full datafile backup set
channel d4: specifying datafile(s) in backup set

— Término do backup
channel d1: backup set complete, elapsed time: 00:00:18
Finished backup at 26-JAN-18

— Autobackup do controlfile
Starting Control File and SPFILE Autobackup at 26-JAN-18
piece handle=+DATA/THOR/AUTOBACKUP/2018_01_26/s_966439048.558.966439049 comment=NONE
Finished Control File and SPFILE Autobackup at 26-JAN-18

— Archives
current log archived
channel d1: starting compressed archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=41 RECID=76 STAMP=965658549
input archived log thread=1 sequence=42 RECID=78 STAMP=965658631
input archived log thread=1 sequence=43 RECID=80 STAMP=965659089
channel d1: starting piece 1 at 26-JAN-18
channel d2: starting compressed archived log backup set

 

4) Vamos criar uma tabela para o teste de restore.

SQL> alter session set container=thorpdb1;
Session altered.

SQL> create table teste as select * from dba_objects;
Table created.

SQL> select count(*) from teste;
COUNT(*)
———-
72622

 

5) Vamos fazer um backup de archives antes de dropar a tabela.

run {
SQL ‘ALTER SYSTEM ARCHIVE LOG CURRENT’;
SQL ‘ALTER SYSTEM CHECKPOINT’;
BACKUP
AS COMPRESSED BACKUPSET
ARCHIVELOG ALL NOT BACKED UP 3 TIMES
CURRENT CONTROLFILE;
}

 

6) Agora vamos dropar a tabela.

SQL> alter session set container = thorpdb1;
Session altered.

SQL> select sysdate from dual;
SYSDATE
——————-
26/01/2018 15:35:17

SQL> drop table teste;
Table dropped.

SQL> select sysdate from dual;
SYSDATE
——————-
26/01/2018 15:36:01
7) E vamos restaurar a base até o horário desejado. O nosso roteiro será esse:

rman target /
shutdown abort
startup nomount;

set DBID=412756195

run {
set until time “to_date(‘2018-01-26 15:35:17′,’YYYY-MM-DD HH24:MI:SS’)”;
restore controlfile from autobackup;
alter database mount;
restore database;
recover database;
alter database open resetlogs;
}

8) Depois do restore, vamos ver se a tabela foi recuperada.

sqlplus / as sysdba

SQL> alter session set container=thorpdb1;
Session altered.

SQL> select count(1) from teste;
COUNT(1)
———-
72622

 

9) Aqui os logs completos da operação de restore/recover.

[oracle@single122 sql]$ rman target /
Recovery Manager: Release 12.2.0.1.0 – Production on Fri Jan 26 15:39:24 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: THOR (DBID=412756195)

RMAN> shutdown abort
using target database control file instead of recovery catalog
Oracle instance shut down

RMAN> startup nomount;
connected to target database (not started)
Oracle instance started

Total System Global Area 1241513984 bytes

Fixed Size 8792248 bytes
Variable Size 452986696 bytes
Database Buffers 771751936 bytes
Redo Buffers 7983104 bytes

RMAN> set DBID=412756195
executing command: SET DBID

RMAN> run {
set until time “to_date(‘2018-01-26 15:35:17′,’YYYY-MM-DD HH24:MI:SS’)”;
restore controlfile from autobackup;
alter database mount;
restore database;
recover database;
alter database open resetlogs;
}

executing command: SET until clause
Starting restore at 26-JAN-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 device type=DISK

recovery area destination: +DATA
database name (or database unique name) used for search: THOR
channel ORA_DISK_1: AUTOBACKUP +DATA/THOR/AUTOBACKUP/2018_01_26/s_966440069.471.966440069 found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180126
channel ORA_DISK_1: restoring control file from AUTOBACKUP +DATA/THOR/AUTOBACKUP/2018_01_26/s_966440069.471.966440069
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=+DATA/THOR/CONTROLFILE/current.263.965234659
output file name=+DATA/THOR/CONTROLFILE/current.264.965234659
Finished restore at 26-JAN-18

Statement processed
released channel: ORA_DISK_1

Starting restore at 26-JAN-18
Starting implicit crosscheck backup at 26-JAN-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=46 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=49 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=50 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=51 device type=DISK
Crosschecked 79 objects
Finished implicit crosscheck backup at 26-JAN-18

Starting implicit crosscheck copy at 26-JAN-18
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
Crosschecked 3 objects
Finished implicit crosscheck copy at 26-JAN-18

searching for all files in the recovery area
cataloging files…
cataloging done

List of Cataloged Files
=======================
File Name: +DATA/thor/AUTOBACKUP/2018_01_26/s_966440069.471.966440069

using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4

skipping datafile 5; already restored to file +DATA/THOR/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/system.273.965234681
skipping datafile 6; already restored to file +DATA/THOR/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/sysaux.272.965234681
skipping datafile 8; already restored to file +DATA/THOR/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/undotbs1.274.965234681
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/THOR/DATAFILE/system.257.965234485
channel ORA_DISK_1: reading from backup piece +DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.530.966438637
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00010 to +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/DATAFILE/sysaux.279.965235083
channel ORA_DISK_2: reading from backup piece +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.532.966438637
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00014 to +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/DATAFILE/sysaux.284.965235107
channel ORA_DISK_3: reading from backup piece +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.533.966438637
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00003 to +DATA/THOR/DATAFILE/sysaux.258.965234539
channel ORA_DISK_4: reading from backup piece +DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.531.966438637
channel ORA_DISK_1: piece handle=+DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.530.966438637 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:56
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00018 to +DATA/THOR/6299EDF975680482E0530238A8C00AF8/DATAFILE/sysaux.291.965235853
channel ORA_DISK_1: reading from backup piece +DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.534.966438783
channel ORA_DISK_2: piece handle=+DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.532.966438637 tag=TAG20180126T151035
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:02:56
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00022 to +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/DATAFILE/sysaux.299.965485011
channel ORA_DISK_2: reading from backup piece +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.535.966438809
channel ORA_DISK_3: piece handle=+DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.533.966438637 tag=TAG20180126T151035
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:02:56
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00026 to +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/DATAFILE/sysaux.305.965485357
channel ORA_DISK_3: reading from backup piece +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.536.966438809
channel ORA_DISK_4: piece handle=+DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.531.966438637 tag=TAG20180126T151035
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:02:57
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00009 to +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/DATAFILE/system.278.965235083
channel ORA_DISK_4: reading from backup piece +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.538.966438937
channel ORA_DISK_4: piece handle=+DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.538.966438937 tag=TAG20180126T151035
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:01:05
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00013 to +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/DATAFILE/system.283.965235107
channel ORA_DISK_4: reading from backup piece +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.542.966438975
channel ORA_DISK_4: piece handle=+DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.542.966438975 tag=TAG20180126T151035
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:01:26
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00021 to +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/DATAFILE/system.298.965485011
channel ORA_DISK_4: reading from backup piece +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.539.966438973
channel ORA_DISK_4: piece handle=+DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.539.966438973 tag=TAG20180126T151035
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:01:06
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00025 to +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/DATAFILE/system.304.965485357
channel ORA_DISK_4: reading from backup piece +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.540.966438973
channel ORA_DISK_1: piece handle=+DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.534.966438783 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:40
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00011 to +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/DATAFILE/undotbs1.277.965235083
channel ORA_DISK_1: reading from backup piece +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.545.966439031
channel ORA_DISK_1: piece handle=+DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.545.966439031 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00015 to +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/DATAFILE/undotbs1.282.965235107
channel ORA_DISK_1: reading from backup piece +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.546.966439033
channel ORA_DISK_2: piece handle=+DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.535.966438809 tag=TAG20180126T151035
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:03:41
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00019 to +DATA/THOR/6299EDF975680482E0530238A8C00AF8/DATAFILE/undotbs1.289.965235853
channel ORA_DISK_2: reading from backup piece +DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.547.966439033
channel ORA_DISK_1: piece handle=+DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.546.966439033 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00023 to +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/DATAFILE/undotbs1.297.965485011
channel ORA_DISK_1: reading from backup piece +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.548.966439033
channel ORA_DISK_2: piece handle=+DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.547.966439033 tag=TAG20180126T151035
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00027 to +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/DATAFILE/undotbs1.303.965485357
channel ORA_DISK_2: reading from backup piece +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.549.966439035
channel ORA_DISK_3: piece handle=+DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.536.966438809 tag=TAG20180126T151035
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:03:43
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00004 to +DATA/THOR/DATAFILE/undotbs1.259.965234575
channel ORA_DISK_3: reading from backup piece +DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.550.966439035
channel ORA_DISK_1: piece handle=+DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.548.966439033 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00007 to +DATA/THOR/DATAFILE/users.260.965234577
channel ORA_DISK_1: reading from backup piece +DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.552.966439039
channel ORA_DISK_2: piece handle=+DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.549.966439035 tag=TAG20180126T151035
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:02
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00012 to +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/DATAFILE/users.281.965235105
channel ORA_DISK_2: reading from backup piece +DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.553.966439039
channel ORA_DISK_1: piece handle=+DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.552.966439039 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00016 to +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/DATAFILE/users.286.965235119
channel ORA_DISK_1: reading from backup piece +DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.554.966439041
channel ORA_DISK_2: piece handle=+DATA/THOR/6299C00259AD7C3AE0530238A8C0E90F/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.553.966439039 tag=TAG20180126T151035
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00020 to +DATA/THOR/6299EDF975680482E0530238A8C00AF8/DATAFILE/users.288.965235853
channel ORA_DISK_2: reading from backup piece +DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.555.966439041
channel ORA_DISK_1: piece handle=+DATA/THOR/6299C19B88C07EB1E0530238A8C0186C/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.554.966439041 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00024 to +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/DATAFILE/users.296.965485011
channel ORA_DISK_1: reading from backup piece +DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.556.966439041
channel ORA_DISK_2: piece handle=+DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.555.966439041 tag=TAG20180126T151035
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00028 to +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/DATAFILE/users.302.965485357
channel ORA_DISK_2: reading from backup piece +DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.557.966439041
channel ORA_DISK_1: piece handle=+DATA/THOR/62D3EADA70FC2F9FE0530238A8C0F70D/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.556.966439041 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00017 to +DATA/THOR/6299EDF975680482E0530238A8C00AF8/DATAFILE/system.290.965235853
channel ORA_DISK_1: reading from backup piece +DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.543.966439031
channel ORA_DISK_2: piece handle=+DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.557.966439041 tag=TAG20180126T151035
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
channel ORA_DISK_3: piece handle=+DATA/THOR/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.550.966439035 tag=TAG20180126T151035
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:06
channel ORA_DISK_4: piece handle=+DATA/THOR/62D405A2F8C03AB1E0530238A8C04E05/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.540.966438973 tag=TAG20180126T151035
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:00:36
channel ORA_DISK_1: piece handle=+DATA/THOR/6299EDF975680482E0530238A8C00AF8/BACKUPSET/2018_01_26/nnndf0_tag20180126t151035_0.543.966439031 tag=TAG20180126T151035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 26-JAN-18

Starting recover at 26-JAN-18
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4

starting media recovery

archived log for thread 1 with sequence 54 is already on disk as file +DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_54.560.966439051
archived log for thread 1 with sequence 55 is already on disk as file +DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_55.562.966439053
archived log for thread 1 with sequence 56 is already on disk as file +DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_56.499.966440061
archived log for thread 1 with sequence 57 is already on disk as file +DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_57.311.966440061
archived log for thread 1 with sequence 58 is already on disk as file +DATA/THOR/ONLINELOG/group_1.265.965234661
archived log file name=+DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_54.560.966439051 thread=1 sequence=54
archived log file name=+DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_55.562.966439053 thread=1 sequence=55
archived log file name=+DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_56.499.966440061 thread=1 sequence=56
archived log file name=+DATA/THOR/ARCHIVELOG/2018_01_26/thread_1_seq_57.311.966440061 thread=1 sequence=57
archived log file name=+DATA/THOR/ONLINELOG/group_1.265.965234661 thread=1 sequence=58
media recovery complete, elapsed time: 00:00:01
Finished recover at 26-JAN-18

Statement processed

 

Sim, eu sei.. Poderia ter usado o flashback e tal, ou ter voltado só o PDB. A ideia aqui é mostrar o restore completo.

 

É isso. Espero que ajude a você que está iniciando a poder fazer umas operações de backup/restore ai nos seus ambientes de testes.

Abraço

Mario

4 thoughts on “Vamos brincar de Backup e Restore? – Parte 1

  1. Marião, muito boa a parte do artigo que você diz:
    “— Ahhhh podia ser melhor? Podia…
    — Ahhhh mas eu faço diferente. Ok, faça como quiser…
    — Ahhh mas porque você faz esse ALTER SYSTEM? Por que assim é o jeito que eu gosto de fazer.”

    Por que digo que é muito boa? Porque realmente “existem mil maneiras de preparar NESTON”, e obviamente muitos DBAs vão ter maneiras diferentes de chegar ao mesmo resultado. Meus scripts de backup, por exemplo, são bem diferentes dos seus, mas produziriam o mesmo resultado. Para citar um exemplo para aqueles que são iniciantes, ao invés de executar os comandos abaixo:
    SQL ‘ALTER SYSTEM ARCHIVE LOG CURRENT’;
    SQL ‘ALTER SYSTEM CHECKPOINT’;

    eu prefiriria acrescentar a cláusula PLUS ARCHIVELOG no final do comando BACKUP…. DATABASE.

    []s

    1. AHAHAHAHAH Prado, foi só para descontrair 🙂

      Na verdade eu uso o PLUS ARCHIVELOG nos meus scripts. Alias eu uso meus scripts dinâmicos, com TAG’s dinâmicas, enfim, um pouco diferentes daquilo.

      O ideia de separar o backup de archives foi justamente para mostrar no log, bem destacado, cada fase. E também só para dar um rumo para o pessoal, eles podem (e devem) melhorar aquele script.

      Abraço

Leave a Reply

Your email address will not be published. Required fields are marked *