Restore 10gR2 Database incremental backup to a new server using RMAN. The method I used here will not use RMAN catalog database assuming that you have only database backup.
RMAN Backup Configuration
Daily : Incremental Level 1 cumulative
Weekly: Incremental Level 0
Retention Policy: RECOVERY WINDOW OF 7 DAYS
Device: Disk
Control File Autobackup: on
In this, assume that following directories are used to restoring DB
DB Name
|
ORCL1
|
u04/ORCL1/flash_recovery_area
|
Flash Recovery Area
|
/u01/ ORCL1/oracle/admin
|
ORACLE_BASE
|
/u04/ ORCL1/oradata
|
To store datafile
|
Pre-requisite for restore
1. You must know DBID of the database to be restored.
2. A valid backup is required.
3. Sufficient Disk Space on the server to restore the backup.
4. If restoring from tape, Tape Library must be configured to the server for restoring.
5. Server OS/Architecture must be same as the backed up database server.
6. All recommended patches and tuning must be done on the server as per Oracle documentation.
7. Oracle Software of same version of backed up database must be installed.
8. Oracle Software must be patched similar to backed up database.
Performing Complete Recovery
1. Restore the backup: Once the server is ready with all pre-requisites, restore the backup to the specific directory/directories. Here it will be to the flash recovery area
2. Verify the directory and file permissions: Oracle user and dba group must have full permission on the restored directory and files. Owner of the files must be oracle user.
3. Parameter file: Identify the backup piece from the Latest CONTROLFILE and SPFILE backups located in restored $Flash_Recovery_Area/autobackup/
4. Parameter file: Identify the backup piece from the Latest CONTROLFILE and SPFILE backups located in restored $Flash_Recovery_Area/autobackup/<latest date>. Filename usually starts with o1_mf_s_ if you are backing up spfile with controlfile autobackup, otherwise Filename look like o1_mf_n_
If the parameter file is not backed up as part of your backup strategy, you must create it manually.
5. Add entry for LISTENER_ORCL1 in $ORACLE_HOME/network/admin/tnsnames.ora
6. Restore SPFILE as follows. SPIFLE will be restored in $ORACLE_HOME/dbs (If you don’t have spfile in autobackup you will have to create it manually)
$ export ORACLE_SID= ORCL1
$ rman target /
RMAN> startup nomount
RMAN> set DBID=<DBID of your database>
RMAN> restore spfile from "<$FLASH_RECOVERY_AREA>/autobackup/<latest directory>/o1_mf_s_751194987_6wyrfc7d_.bkp ";
7. Create PFILE (initORCL1.ora) from SPFILE;
RMAN> sql 'create pfile from spfile';
8. Modify the PFILE(initORCL1.ora) and make the required changes.
9. Correct the following parameters as per new environment.
Control File = /new/path/controln1.dbf,/new/path/controln1.dbf
user_dump_dest = <ORACLE_BASE>/admin/<DBNAME>/udump
background_dump_dest = <ORACLE_BASE>/admin/<DBNAME>/bdump
core_dump_dest = <ORACLE_BASE>/admin/<DBNAME>/bdump
log_archive_dest_1 = 'location=/new/path'
10. Restore control file as follows
restore controlfile to '<path>' from "<restored/controlfile/autobackup/path>";
11. Force Mount the Instance as follows:
RMAN> startup force mount pfile=$ORACLE_HOME/dbs/initORCL1.ora
12. Create SPFILE from PFILE.
RMAN> sql 'create spfile from pfile'
13. Shutdown the Database and Mount the database:
RMAN> shutdown
RMAN> startup mount;
14. Disable Flashback Database as follows:
SQ> alter database flashback off;
15. Disable Block Change Tracking as follows:
SQ> alter database disable block change tracking;
16. Restore the Database as follows. Tail the alert log file and make sure database files are getting restored. Since we are restoring datafiles to new location, files to be renamed(Yu can generate a script to do this). This needs to be executed as one command in run
$ export ORACLE_SID= ORCL1
$ rman target /
RMAN>
run{
set newname for datafile '<old/path/>orcl1_system01.dbf' to '/u04/ORCL1/oradata/orcl1_system01.dbf';
.
.
.
<Rename all your DBFs>
.
.
restore database;
switch datafile all;
recover database;
}
17. Rename Log File:
If the restored log file path is different, then rename the restored log files in the control fileUse the below SQL to generate script to rename all data files and execute the generated script.
select 'alter database rename file '''|| member ||''' to '''|| replace(member,'<old/path/>','</new/path/>')||''';' from v$logfile
18. Open Database: Open the Database by executing following command
SQL> Alter database open resetlogs;
19. Create Temp Tablespace
SQL> CREATE TEMPORARY TABLESPACE temp2 TEMPFILE '/new/path/<db_name>_temp02.dbf' size 500m autoextend off ;
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;
SQL> DROP TABLESPACE temp;
20. Configure & change Flash Recovery Area:
SQL> alter system set db_recovery_file_dest='</new/path> /flash_recovery_area' scope=both;
No comments:
Post a Comment