Showing posts with label database refresh with RMAN backup.. Show all posts
Showing posts with label database refresh with RMAN backup.. Show all posts

Wednesday, 13 April 2016

DB refresh with RMAN DUPLICATE command

Source:
==============================

1. take backup using RMAN.

Ex:
run
{
backup as compressed backupset database format="/u10/<dbname>_datafiles_%U";
sql 'alter system archive log current';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT "/u10/<dbname>_archive_%U";
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT "/u10/<dbname>_control_%U" ;
}

2.take logfiles and datafiles locations.

3.take the undo tablespace name.

sql>show parameter undo


Target(database to be refresh):
===============================

4. taken target database backup for safe side.

5. create pfile from spfile.

 SQL> create pfile from spfile.

6. take user's DDL in target database.

7. take logfile and datafile locations.

8.drop the databse.

 sql>shut immediate
 sql>startup mount restrict
 sql>select name from v$database.
 sql>drop database.

9. Open the pfile and set the convert parameters to new paths to which your datafiles to be stored while restoring. Please check the paths carefully.

 Ex:

db_file_name_convert='/u02/oradata/PAPRD/','/u02/oradata/PADV1/'
log_file_name_convert='/u02/oradata/PAPRD/','/u02/oradata/PADV1/','/u10/oradata/PAPRD/','/u10/oradata/PADV1/'

10. change the undo tablespace name according to source undo tablespace.

11.export ORACLE_HOME,ORACLE_SID (target database to be refreshed)

12. start instance in nomount

13. connect rman as auxiliary.

rman auxiliary /

14. run the duplicate command in RMAN prompt.

RMAN>duplicate database to CSTRN backup location '/u10/cold/CSTRN/2016_01_13'; -- use the path to which we taken the source backup.

15.restart the database.

sql>shut immediate
sql>create spfile from pfile.
sql>startup