Estou tentando fazer um hot backup com rman que posso copiar para uma unidade USB para recuperá-lo em um novo servidor.
O backup foi feito há dois dias e o restore database
comando estava funcionando no mesmo dia, então acho que preciso usar UNTIL SCN
com o último SCN, mas receboRMAN-20208: UNTIL CHANGE is before RESETLOGS change
Vi na internet que deveria usar RESET DATABASE
mas entendi RMAN-06002: command not allowed when not connected to a recovery catalog
e acho que esse procedimento só pode funcionar com Oracle 10 e posterior (estou usando Oracle 9i).
Alguma ideia?
backup em rman
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'c:/brubru/auto/%F';
run
{
CROSSCHECK BACKUP;
CROSSCHECK COPY;
CROSSCHECK BACKUPSET;
CROSSCHECK COPY OF DATABASE;
CROSSCHECK archivelog all;
allocate channel d1 device type disk format 'c:/brubru/%U.bkp';
BACKUP CHECK LOGICAL DATABASE format ‘c:/brubru/data_%d_%s_%T.bak’ PLUS ARCHIVELOG DELETE INPUT;
release channel d1;
}
Restaurar (em um segundo servidor)
> oradim -new -sid PEM -intpwd sys
> set ORACLE_SID=PEM
> rman target /
Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file 'C:\ORACLE\ORA92\DATABASE\INITPEM.ORA'
trying to start the Oracle instance without parameter files ...
Oracle instance started
Total System Global Area 97589952 bytes
Fixed Size 453312 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
RMAN> set dbid 2176828955
executing command: SET DBID
RMAN> RUN {
2> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'C:\brubru\auto
\%F';
3> RESTORE SPFILE FROM AUTOBACKUP;
4> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
using target database controlfile instead of recovery catalog
Starting restore at 13-05-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20130520
channel ORA_DISK_1: looking for autobackup on day: 20130519
channel ORA_DISK_1: looking for autobackup on day: 20130518
channel ORA_DISK_1: autobackup found: C:\brubru\auto\c-2176828955-20130518-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 13-05-20
RMAN> shutdown immediate
Oracle instance shut down
RMAN> startup nomount
connected to target database (not started)
Oracle instance started
Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
RMAN> set dbid=2176828955
executing command: SET DBID
RMAN> RUN {
2> SET CONTROLFILE AUTOBACKUP FORMAT
3> FOR DEVICE TYPE DISK TO 'C:\brubru\auto\%F';
4> RESTORE CONTROLFILE FROM AUTOBACKUP;
5> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
Starting restore at 13-05-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=13 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20130520
channel ORA_DISK_1: looking for autobackup on day: 20130519
channel ORA_DISK_1: looking for autobackup on day: 20130518
channel ORA_DISK_1: autobackup found: C:\brubru\auto\c-2176828955-20130518-00
channel ORA_DISK_1: controlfile restore from autobackup complete
replicating controlfile
input filename=C:\BDD_ORACLE\ORADATA\PEM\CONTROL01.CTL
output filename=C:\BDD_ORACLE\ORADATA\PEM\CONTROL02.CTL
output filename=C:\BDD_ORACLE\ORADATA\PEM\CONTROL03.CTL
Finished restore at 13-05-20
RMAN> alter database mount;
database mounted
RMAN> run
2> {
3> allocate channel c1 device type disk format 'c:\brubru\%U.bkp';
4> restore database;
5> release channel c1;
6> }
released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=13 devtype=DISK
Starting restore at 13-05-20
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/20/2013 15:53:37
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 15 found to restore
RMAN-06023: no backup or copy of datafile 14 found to restore
RMAN-06023: no backup or copy of datafile 13 found to restore
RMAN-06023: no backup or copy of datafile 12 found to restore
RMAN-06023: no backup or copy of datafile 11 found to restore
RMAN-06023: no backup or copy of datafile 10 found to restore
RMAN-06023: no backup or copy of datafile 9 found to restore
RMAN-06023: no backup or copy of datafile 8 found to restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
RMAN> list backup;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
105 737M DISK 00:00:39 13-05-18
BP Key: 105 Status: AVAILABLE Tag: TAG20130518T124955
Piece Name: C:\BRUBRU\39O9ULFK_1_1.BKP
List of Archived Logs in backup set 105
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------- ---------- ---------
1 1156 245177104 13-05-11 245458552 13-05-12
1 1157 245458552 13-05-12 245647641 13-05-13
1 1158 245647641 13-05-13 245857439 13-05-14
1 1159 245857439 13-05-14 246084782 13-05-15
1 1160 246084782 13-05-15 246304002 13-05-16
1 1161 246304002 13-05-16 246519120 13-05-17
1 1162 246519120 13-05-17 246722961 13-05-18
1 1163 246722961 13-05-18 246779464 13-05-18
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
106 Full 1G DISK 00:02:14 13-05-18
BP Key: 106 Status: AVAILABLE Tag: TAG20130518T125043
Piece Name: C:\BRUBRU\DATA_PEM_106_20130518.BAK
List of Datafiles in backup set 106
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- -------- ----
1 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\SYSTEM01.DBF
2 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\UNDOTBS01.DBF
3 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\CWMLITE01.DBF
4 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\DRSYS01.DBF
5 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\EXAMPLE01.DBF
6 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\INDX01.DBF
7 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\ODM01.DBF
8 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\TOOLS01.DBF
9 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\USERS01.DBF
10 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\XDB01.DBF
11 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\USER.ORA
12 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\GDR2.ORA
13 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\PEM\USR.ORA
14 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\RMAN\RMAN01.DBF
15 Full 246779607 13-05-18 C:\BDD_ORACLE\ORADATA\RMAN3\RMAN301.DBF
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
107 163K DISK 00:00:01 13-05-18
BP Key: 107 Status: AVAILABLE Tag: TAG20130518T125258
Piece Name: C:\BRUBRU\3BO9ULLA_1_1.BKP
List of Archived Logs in backup set 107
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------- ---------- ---------
1 1164 246779464 13-05-18 246779907 13-05-18
RMAN> run
2> {
3> allocate channel c1 device type disk format 'c:\brubru\%U.bkp';
4> set until SCN 246779907;
5> restore database;
6> release channel c1;
7> }
allocated channel: c1
channel c1: sid=13 devtype=DISK
executing command: SET until clause
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of set command at 05/20/2013 15:59:11
RMAN-20208: UNTIL CHANGE is before RESETLOGS change
RMAN> LIST INCARNATION;
List of Database Incarnations
DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 PEM 2176828955 NO 190578 10-02-10
2 2 PEM 2176828955 YES 246779908 13-05-18
RMAN> RESET DATABASE TO INCARNATION 1;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of reset command at 05/20/2013 15:55:33
RMAN-06002: command not allowed when not connected to a recovery catalog
Sim, este cenário é possível no modo NOCATALOG. Fiz exatamente isso no 9.2 no último sábado, então posso garantir :) Sua tentativa quase foi bem-sucedida. A única coisa que você fez de errado foi restaurar o arquivo de controle que era muito novo, estava acima
Reset SCN 246779908
de . Se você se mudarC:\brubru\auto\c-2176828955-20130518-00
, provavelmente encontrará um arquivo de controle um pouco mais antigo e a restauração será bem-sucedida. CertifiqueLIST INCARNATIONS
-se de que não exibe a nova encarnação - controlfile não deve saber disso.