Scenerio:
RMAN backup has been taken on the production server and now it is required to restore it on the new fresh server. OS environment is Windows 64bit. Source system was on RAC 11gR2 and Destination was 11gR2 Single instance.
1- First take the backup on the production server. Have the backup location folders same both on source (Production) and destination (New Server)
eg; D:\rmanbackup\db (for DB), D:\rmanbackup\ar (for archivelogs)
RUN {
ALLOCATE CHANNEL ch00 TYPE DISK FORMAT 'D:\rmanbackup\db\%d_DB_%u_%s_%p';
backup
filesperset 4
INCREMENTAL LEVEL 0 AS COMPRESSED BACKUPSET database include current controlfile;
sql "alter system archive log current";
release channel ch00;
ALLOCATE CHANNEL CH01 TYPE DISK FORMAT 'D:\RMANBACKUP\AR\al_%U';
backup
filesperset 4
AS COMPRESSED BACKUPSET archivelog all;
RELEASE CHANNEL CH01;
}
2- Add Instance on Destination Server, create directory structure and init file for the instance
C:\Windows\system32>oradim -new -sid homedb
Instance created.
Create directory structure on Destination server and copy backup pieces from the source
D:\rmanbackup\db
D:\rmanbackup\ar
inithomedb.ora
large_pool_size=100m
shared_pool_size=1024m
db_cache_size=300m
audit_file_dest='D:\app\inam\admin\homedb\adump'
audit_trail='db'
compatible='11.2.0.0.0'
control_files='D:\app\inam\oradata\homedb\CONTROL1.CTL'
db_block_size=8192
db_domain=''
db_name='homedb'
#db_recovery_file_dest='D:\app\inam\fast_recovery_area'
#db_recovery_file_dest_size=572354723840
diagnostic_dest='D:\app\inam'
remote_login_passwordfile='exclusive'
In dummy parameter file don't use db_recovery_file_dest and db_recovery_file_dest_size
parameters otherwise you will encounter this error
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/26/2013 12:26:32
RMAN-06026: some targets not found - aborting 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
Explanation to this error at the end of this post.
3- Connect to rman and first check availability in backup pieces using "preview" in addition to restore command
C:\Windows\system32>rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 15 11:57:50 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: not started
RMAN> set dbid 1547250382
RMAN> startup nomount pfile='d:\rmanbackup\inithomedb.ora';
RMAN> restore controlfile to 'D:\app\inam\oradata\homedb\CONTROL01.CTL' from 'D:\rmanbackup\db\HOMEDB_DB_BSNVCO24_5500_1' preview;
Starting restore at 15-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=218 device type=DISK
Finished restore at 15-JAN-13
Run same command to restore CONTROLFILE without preview
RMAN> restore controlfile to 'D:\app\inam\oradata\homedb\CONTROL01.CTL' from 'D:\rmanbackup\db\HOMEDB_DB_BSNVCO24_5500_1' ;
Starting restore at 15-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=218 device type=DISK
Finished restore at 15-JAN-13
You can also use auto backup for restoring controlfile using
restore controlfile to 'D:\app\inam\oradata\homedb\CONTROL01.CTL' from autobackup ;
4- Mount databases
RMAN> alter database mount;
5- Restore Database
run {
ALLOCATE CHANNEL ch00 device TYPE DISK;
set newname for datafile 1 to 'D:\app\inam\oradata\homedb\system.256.770482167';
set newname for datafile 2 to 'D:\app\inam\oradata\homedb\sysaux.257.770482167';
set newname for datafile 3 to 'D:\app\inam\oradata\homedb\undotbs1.258.770482167';
set newname for datafile 4 to 'D:\app\inam\oradata\homedb\users.259.770482167';
set newname for datafile 5 to 'D:\app\inam\oradata\homedb\example.264.770482273';
set newname for datafile 6 to 'D:\app\inam\oradata\homedb\undotbs2.265.770482381';
set newname for datafile 7 to 'D:\app\inam\oradata\homedb\homelog01.dbf';
set newname for datafile 8 to 'D:\app\inam\oradata\homedb\test_netbkup.dbf';
set newname for datafile 9 to 'D:\app\inam\oradata\homedb\recop1.dbf';
set newname for datafile 10 to 'D:\app\inam\oradata\homedb\homelog02.dbf';
set newname for datafile 11 to 'D:\app\inam\oradata\homedb\home_ts01.dbf';
set newname for datafile 12 to 'D:\app\inam\oradata\homedb\home_ts02.dbf';
set newname for datafile 13 to 'D:\app\inam\oradata\homedb\home_ts03.dbf';
set newname for datafile 14 to 'D:\app\inam\oradata\homedb\home_ts04.dbf';
set newname for datafile 15 to 'D:\app\inam\oradata\homedb\home_ts05.dbf';
set newname for datafile 16 to 'D:\app\inam\oradata\homedb\undotbs1.278.770746419';
set newname for datafile 17 to 'D:\app\inam\oradata\homedb\undotbs2.279.770746495';
restore database;
switch datafile all;
RELEASE CHANNEL ch00;
}
8-Recover Database
RMAN> run {
ALLOCATE CHANNEL ch00 device TYPE DISK;
set until SCN 1855075485;
recover database;
alter database open resetlogs;
RELEASE CHANNEL ch00;
}
allocated channel: ch00
channel ch00: SID=216 device type=DISK
executing command: SET until clause
Starting recover at 15-JAN-13
starting media recovery
archived log for thread 1 with sequence 30165 is already on disk as file D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\AR
C0000030165_0770482257.0001
archived log for thread 1 with sequence 30166 is already on disk as file D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\AR
C0000030166_0770482257.0001
archived log for thread 2 with sequence 27601 is already on disk as file D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\AR
C0000027601_0770482257.0002
archived log file name=D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\ARC0000030165_0770482257.0001 thread=1 sequence=3016
5
archived log file name=D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\ARC0000027601_0770482257.0002 thread=2 sequence=2760
1
archived log file name=D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\ARC0000030166_0770482257.0001 thread=1 sequence=3016
6
media recovery complete, elapsed time: 00:00:20
Finished recover at 15-JAN-13
released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 01/15/2013 11:14:31
ORA-00392: log 2 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 2 thread 1: '+homedbdata'
ORA-00312: online log 2 thread 1: '+homedbflash'
9- Normally your database will be recovered and opened at this point ,In case you get the error (in step 8 as our source was RAC DB ) do the below.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>set oracle_sid=homedb
C:\Windows\system32>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 15 11:15:04 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
recovery_parallelism integer 0
SQL> alter system set db_recovery_file_dest_size='50G';
System altered.
SQL> alter system set db_recovery_file_dest='D:\app\inam\fast_recovery_area';
System altered.
SQL> alter database clear logfile group 2;
Database altered.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 4 of thread 2 is being cleared, operation not allowed
ORA-00312: online log 4 thread 2: '+homedbdata'
ORA-00312: online log 4 thread 2: '+homedbflash'
SQL> alter database clear logfile group 4;
Database altered.
SQL> alter database open resetlogs;
Database altered.
SQL>
NOTE:
Explanation to error at point 8
Metalink document 965122.1.
The problem were those autobackups in FRA that I showed before. That files belonged to different incarnation than the available backups current incarnation.
[From Metalink document]
If we start a RESTORE database with a BACKUP controlfile and Flash Recovery Area is defined, RMAN execute and implicit crosscheck and catalog of all the objects in the Flash Recovery Area.
RMAN will catalog any objects in the Flash Recovery Area that will not be registered in the controlfile and if any of this files belongs to an incarnation different from CURRENT incarnation in the controlfile then changes controlfile CURRENT incarnation to the one found in the file that is being cataloged.
This prevents database from restoring backups that belong to old CURRENT incarnation.
RMAN considers backup availble for being restored if the backup incarnation and CURRENT incarnation in controlfile are the same.
So I’ve decided to temporary disable FRA during recovery process commenting db_recovery_file_dest and db_recovery_file_dest_size parameters in parameter file.
RMAN backup has been taken on the production server and now it is required to restore it on the new fresh server. OS environment is Windows 64bit. Source system was on RAC 11gR2 and Destination was 11gR2 Single instance.
1- First take the backup on the production server. Have the backup location folders same both on source (Production) and destination (New Server)
eg; D:\rmanbackup\db (for DB), D:\rmanbackup\ar (for archivelogs)
RUN {
ALLOCATE CHANNEL ch00 TYPE DISK FORMAT 'D:\rmanbackup\db\%d_DB_%u_%s_%p';
backup
filesperset 4
INCREMENTAL LEVEL 0 AS COMPRESSED BACKUPSET database include current controlfile;
sql "alter system archive log current";
release channel ch00;
ALLOCATE CHANNEL CH01 TYPE DISK FORMAT 'D:\RMANBACKUP\AR\al_%U';
backup
filesperset 4
AS COMPRESSED BACKUPSET archivelog all;
RELEASE CHANNEL CH01;
}
2- Add Instance on Destination Server, create directory structure and init file for the instance
C:\Windows\system32>oradim -new -sid homedb
Instance created.
Create directory structure on Destination server and copy backup pieces from the source
D:\rmanbackup\db
D:\rmanbackup\ar
inithomedb.ora
large_pool_size=100m
shared_pool_size=1024m
db_cache_size=300m
audit_file_dest='D:\app\inam\admin\homedb\adump'
audit_trail='db'
compatible='11.2.0.0.0'
control_files='D:\app\inam\oradata\homedb\CONTROL1.CTL'
db_block_size=8192
db_domain=''
db_name='homedb'
#db_recovery_file_dest='D:\app\inam\fast_recovery_area'
#db_recovery_file_dest_size=572354723840
diagnostic_dest='D:\app\inam'
remote_login_passwordfile='exclusive'
In dummy parameter file don't use db_recovery_file_dest and db_recovery_file_dest_size
parameters otherwise you will encounter this error
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/26/2013 12:26:32
RMAN-06026: some targets not found - aborting 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
Explanation to this error at the end of this post.
3- Connect to rman and first check availability in backup pieces using "preview" in addition to restore command
C:\Windows\system32>rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 15 11:57:50 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: not started
RMAN> set dbid 1547250382
RMAN> startup nomount pfile='d:\rmanbackup\inithomedb.ora';
RMAN> restore controlfile to 'D:\app\inam\oradata\homedb\CONTROL01.CTL' from 'D:\rmanbackup\db\HOMEDB_DB_BSNVCO24_5500_1' preview;
Starting restore at 15-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=218 device type=DISK
Finished restore at 15-JAN-13
Run same command to restore CONTROLFILE without preview
RMAN> restore controlfile to 'D:\app\inam\oradata\homedb\CONTROL01.CTL' from 'D:\rmanbackup\db\HOMEDB_DB_BSNVCO24_5500_1' ;
Starting restore at 15-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=218 device type=DISK
Finished restore at 15-JAN-13
You can also use auto backup for restoring controlfile using
restore controlfile to 'D:\app\inam\oradata\homedb\CONTROL01.CTL' from autobackup ;
4- Mount databases
RMAN> alter database mount;
5- Restore Database
run {
ALLOCATE CHANNEL ch00 device TYPE DISK;
set newname for datafile 1 to 'D:\app\inam\oradata\homedb\system.256.770482167';
set newname for datafile 2 to 'D:\app\inam\oradata\homedb\sysaux.257.770482167';
set newname for datafile 3 to 'D:\app\inam\oradata\homedb\undotbs1.258.770482167';
set newname for datafile 4 to 'D:\app\inam\oradata\homedb\users.259.770482167';
set newname for datafile 5 to 'D:\app\inam\oradata\homedb\example.264.770482273';
set newname for datafile 6 to 'D:\app\inam\oradata\homedb\undotbs2.265.770482381';
set newname for datafile 7 to 'D:\app\inam\oradata\homedb\homelog01.dbf';
set newname for datafile 8 to 'D:\app\inam\oradata\homedb\test_netbkup.dbf';
set newname for datafile 9 to 'D:\app\inam\oradata\homedb\recop1.dbf';
set newname for datafile 10 to 'D:\app\inam\oradata\homedb\homelog02.dbf';
set newname for datafile 11 to 'D:\app\inam\oradata\homedb\home_ts01.dbf';
set newname for datafile 12 to 'D:\app\inam\oradata\homedb\home_ts02.dbf';
set newname for datafile 13 to 'D:\app\inam\oradata\homedb\home_ts03.dbf';
set newname for datafile 14 to 'D:\app\inam\oradata\homedb\home_ts04.dbf';
set newname for datafile 15 to 'D:\app\inam\oradata\homedb\home_ts05.dbf';
set newname for datafile 16 to 'D:\app\inam\oradata\homedb\undotbs1.278.770746419';
set newname for datafile 17 to 'D:\app\inam\oradata\homedb\undotbs2.279.770746495';
restore database;
switch datafile all;
RELEASE CHANNEL ch00;
}
8-Recover Database
RMAN> run {
ALLOCATE CHANNEL ch00 device TYPE DISK;
set until SCN 1855075485;
recover database;
alter database open resetlogs;
RELEASE CHANNEL ch00;
}
allocated channel: ch00
channel ch00: SID=216 device type=DISK
executing command: SET until clause
Starting recover at 15-JAN-13
starting media recovery
archived log for thread 1 with sequence 30165 is already on disk as file D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\AR
C0000030165_0770482257.0001
archived log for thread 1 with sequence 30166 is already on disk as file D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\AR
C0000030166_0770482257.0001
archived log for thread 2 with sequence 27601 is already on disk as file D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\AR
C0000027601_0770482257.0002
archived log file name=D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\ARC0000030165_0770482257.0001 thread=1 sequence=3016
5
archived log file name=D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\ARC0000027601_0770482257.0002 thread=2 sequence=2760
1
archived log file name=D:\APP\INAM\PRODUCT\11.2.0.3\DBHOME_1\RDBMS\ARC0000030166_0770482257.0001 thread=1 sequence=3016
6
media recovery complete, elapsed time: 00:00:20
Finished recover at 15-JAN-13
released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 01/15/2013 11:14:31
ORA-00392: log 2 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 2 thread 1: '+homedbdata'
ORA-00312: online log 2 thread 1: '+homedbflash'
9- Normally your database will be recovered and opened at this point ,In case you get the error (in step 8 as our source was RAC DB ) do the below.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>set oracle_sid=homedb
C:\Windows\system32>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 15 11:15:04 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
recovery_parallelism integer 0
SQL> alter system set db_recovery_file_dest_size='50G';
System altered.
SQL> alter system set db_recovery_file_dest='D:\app\inam\fast_recovery_area';
System altered.
SQL> alter database clear logfile group 2;
Database altered.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 4 of thread 2 is being cleared, operation not allowed
ORA-00312: online log 4 thread 2: '+homedbdata'
ORA-00312: online log 4 thread 2: '+homedbflash'
SQL> alter database clear logfile group 4;
Database altered.
SQL> alter database open resetlogs;
Database altered.
SQL>
NOTE:
Explanation to error at point 8
Metalink document 965122.1.
The problem were those autobackups in FRA that I showed before. That files belonged to different incarnation than the available backups current incarnation.
[From Metalink document]
If we start a RESTORE database with a BACKUP controlfile and Flash Recovery Area is defined, RMAN execute and implicit crosscheck and catalog of all the objects in the Flash Recovery Area.
RMAN will catalog any objects in the Flash Recovery Area that will not be registered in the controlfile and if any of this files belongs to an incarnation different from CURRENT incarnation in the controlfile then changes controlfile CURRENT incarnation to the one found in the file that is being cataloged.
This prevents database from restoring backups that belong to old CURRENT incarnation.
RMAN considers backup availble for being restored if the backup incarnation and CURRENT incarnation in controlfile are the same.
So I’ve decided to temporary disable FRA during recovery process commenting db_recovery_file_dest and db_recovery_file_dest_size parameters in parameter file.
No comments:
Post a Comment