You are on page 1of 5

DATABASE RECOVERY USING TAPE BACKUP

NOTE: Examples in this Document are taken Based on PROD TO DEV Restore. This method uses the soft links for file mounts. Pre Refresh Steps:

1. 2.
1.

Get Customer Request on Backup Date


Get the date/time customer want the backup of the data.

Rman Backup File info/Archives


If customer requested is just within the last 5 to 8 days, then there is a possibility of rman backup exists on the disk it self. Check the below mounts. PROD: ls lrt /RMAN/PROD_D1/*level0* If this not exists then run the scripts below. Check the level0 log file under ( /u01/PRODDB/admin/PROD/rman ) for the Start and completion time of backup. #Time of start:.................... Tue May 18 02:30:02 MDT 2010 #Time before level0 textfile create:Tue May 18 07:30:19 MDT 2010 Scripts to run to find the File info and Archive info. Input the date value. EX: select tag, (max(completion_time) - min(start_time))*24*60 Mins, sum(bytes)/1024/1024/1024 from v$backup_piece where tag in ('LEVEL0_20100518%') group by tag; TAG TIME size in gb --------------------------- -----------------------LEVEL0_20100518023001 32.1166667 263.955162 Once you derived the TAG info, get the file info for level0 now using below script. select handle from v$backup_piece where tag = 'LEVEL0_20100518023001' order by start_time desc HANDLE ------------------------------------------------------------/RMAN/PRHY_D1/PRHY_level0_285684_1_1_719290833.rmn /RMAN/PRHY_D2/PRHY_level0_285683_1_1_719290697.rmn /RMAN/PRHY_D1/PRHY_level0_285682_1_1_719290672.rmn /RMAN/PRHY_D2/PRHY_level0_285681_1_1_719290647.rmn 5. Now based on the Tag info with completion/start time get the info for archive files. select tag, to_char(start_time, 'dd-mon-yy hh24:mi:ss'), bytes from v$backup_piece where tag like 'ARCH%' and start_time between '18-may-2010' and to_date('18-may-2010 07:30:11', 'dd-mon-yyyy hh24:mi:ss')order by start_time desc Provide the control File info from log directory. Navigate to the rman directory ( /u01/PRODDB/admin/PROD/rman ) and look for the level0 log for the specific date and open the file and get the name of After control file and provde to BAS. PROD_20100518023000_level0_after.ctl y

2.

3.

4.

6.

3.

Pre Checks for Mounts / oratab / init.ora / soft links 3 A. Make sure all datafile mounts exists on the restored
server: Get a list of datafile mounts from PROD. Compare to the datafile mount on DEV server. send BASTeam to add the missing datafile mounts.

Inform BAS Team to Create the /RMAN Mounts on DEV Server Similar to PROD. Add entry for SID in DBA/RMAN_NOBACKUP/ Run all pre refresh tasks for backing up passwords, privs, dblinks, directories etc as per the refresh<SID> document. y y y

3 B. Add new entry to /etc/oratab


if refreshing DEV from PROD, add PROD to /etc/oratab Add new entry to /etc/oratab for PROD on DEVDB Create Soft links for the data file/temp/redo mounts ln -s /uv100/oradata/DEV /uv100/oradata/PROD ln -s /uv101/oradata/DEV /uv101/oradata/PROD :REDO MOUNT ln -s /uv1redoa/oradata/DEV /uc8redoa/oradata/PROD ln -s /uv1redoa/oradata/DEV /uc8redob/oradata/PROD :TEMP MOUNT ln -s /t_u4tmp/oradata/DEV /t_u4tmp/oradata/PROD

4.

5.

Modify the Control File Modify the control file info on DEVdb : /u01/DEVDB/product/10.2.0/dbs/initPROD.ora Modified control file to reflect :PROD_20100530120000_level0_after.ctl 1) *.control_files='/uv100/oradata/DEV/PROD_20100530120000_level 0_after.ctl','/uv101/oradata/DEV/PROD_20100530120000_level0 2) Db_name=PROD Startup Database y Source the Instance as PROD y Sqlplus /as sysdba y Startup mount y $rman target / --Then run below command. Decide the channels to use based on the cpu.
run {allocate channel d1 type disk; allocate channel d2 type disk; allocate channel d3 type disk; allocate channel d4 type disk; allocate channel d5 type disk; allocate channel d6 type disk; allocate channel d7 type disk; allocate channel d8 type disk; SET UNTIL TIME "to_date('30-05-2010 12:10:00','DD-MM-YYYY HH24:MI:SS')"; RESTORE DATABASE; RECOVER DATABASE; release channel d1; release channel d2; release channel d3; release channel d4; release channel d5; release channel d6; release channel d7; release channel d8;}

After successful completion of above Restore complete the following:

y y y 6.

<as source PROD> alter database open resetlogs; alter database backup controlfile to trace; get the latest .trc file from udump and keep set#2 PROD>shutdown immediate --( On D/T server )

7.

Rename Database & Open as Target ( For Ex: As DEV) y Copy the .trc from above step to /tmp/ as refresh.sql and modify the dbname and the mount names to reflect DEV. ( same step as regular refresh ) Startup Database & Add Tempfiles. y Alter database open resetlogs y ALTER TABLESPACE TEMP ADD TEMPFILE '/t_uv1tmp/oradata/DEV/temp_02.tbf' SIZE 8001M REUSE AUTOEXTEND OFF;

DATABASE RECOVERY USING DUPLICATE DATABASE


NOTE: This method uses the 2 pfile parameters for converting the directory name structures and avoids using the soft links like above method. y y DB_FILE_NAME_CONVERT LOG_FILE_NAME_CONVERT

Examples in this section are for DEVRefresh Using PRODTape backup of 17th May. Step 1: Complete all the Steps in above section upto 3.A. ( Pre refresh tasks, Validate mounts, rman file info for db, archive, control. ) Add PROD, PRMN to TNSNAMES Entries on DEVDB. Just in case rename the spfile DEV.ora on $ORACLE_HOME/dbs Modify the init DEV.ora file by adding the below two parameters with Source,Target dest for file conversion.

Step 2: Step 3: Step 4:

db_file_name_convert=('/uf800/oradata/PROD/','/uf800/oradata/DEV/', '/uf801/oradata/PROD/','/uf801/oradata/DEV/', /uf802/oradata /PROD/','/uf802/oradata/DEV/', '/uf803/oradata/PROD/','/uf803/oradata/DEV/', '/uf804/oradata/PROD/','/uf804/oradata/DEV/', '/uf805/oradata/PROD/','/uf805/oradata/DEV/',

'/uf806/oradata/PROD/','/uf806/oradata/DEV/', '/uf807/oradata/PROD/','/uf807/oradata/DEV/') log_file_name_convert='/uf8redoa/oradata/PROD/','/uf8redoa/oradata/DEV/', '/uf8redob/oradata/PROD/','/uf8redob/oradata/DEV/' Step 4: DEV>startup nomount --on one session

On a Second Session connect to rman: Step 5: $ rman RMAN> connect catalog rman/******@PRMN RMAN> connect target system/*****@PROD RMAN> connect auxiliary /

Step 6: run{ allocate channel d1 type disk; allocate channel d2 type disk; allocate channel d3 type disk; allocate channel d4 type disk; allocate channel d5 type disk; allocate channel d6 type disk; allocate channel d7 type disk; allocate channel d8 type disk; allocate auxiliary channel t2 type disk; SET UNTIL TIME "to_date('17-05-2010 19:00:00','DD-MM-YYYY HH24:MI:SS')"; duplicate target database to DEV; release channel d1; release channel d2; release channel d3; release channel d4; release channel d5; release channel d6; release channel d7; release channel d8; release channel t2; }

Step 7: Check Errors if any after the completion of Above. If no errors, should have been started DEV/

Step 8: DEV> alter database open resetlogs; Step 9: DEV>shutdown immediate; DEV>Startup;

Step 10: Run post refresh Steps (passwords, privs, dblinks, directories etc as per the refresh<SID>Documentation from sharepoint.