Tag Archives: RMAN

Clone/Refresh Database using RMAN

For our understanding

Source Database: PRIM (It would be TARGET in case of RMAN Terminology)

Auxiliary/Clone Database: TEST

1) Take FULL backup on source database using RMAN:

Verify Source database is configured in archivelog mode.

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

RMAN> backup database plus archivelog;

2) Perform following preparation tasks in Auxiliary Database:

Create a password file for the duplicate/Target instance, create password file in source and copy to auxiliary would also work here.

orapwd file=/u01/oracle/product/12c/dbs/orapwTEST password=password entries=10

Configure listener and tnsnames files for Auxiliary/TEST database server. Configure listener and tnsnames files

Create pfile for auxiliary environment and start the database to nomount status:

Add following entries to pfile, in case directory path for Auxiliary server is different for DB and log files when compare to source database.

Db_file_name_convert=’target db(PRIM) oradata path’,’clone db(TEST) oradata path’
Log_file_name_convert=’target db(PRIM) oradata path’,’clone db(TEST) oradata path

SQL> conn /as sysdba
SQL> startup nomount pfile=/u01/oracle/product/12c/dbs/initTEST.ora

 Add tnsentries of source database in Auxiliary, please do vice versa

3) duplicate command to create TEST database:

Veryfy the RMAN connection connecting to TARGET Database(PRIM):

rman TARGET sys/password@PRIM

Veryfy the RMAN connection connecting to TARGET Database(PRIM) and AUXILIARY(TEST):

rman TARGET sys/password@PRIM auxiliary /

Now We can use duplicate database command to create TEST database.

rman > duplicate target database to ‘TEST’;

This process takes a while depending on the size of database and server configuration.

Thank you !!

 

 

DROP DATABASE THROUGH RMAN

In Oracle Database 10gR1 Oracle introduced the RMAN command DROP DATABSE. This one simple statement has the ability to completely remove a database including all RMAN backups with the optional INCLUDING BACKUPS clause.

sqlplus “/ as sysdba”

SQL> shutdown immediate;

SQL> startup mount exclusive

SQL> alter system enable restricted session

SQL> exit

rman target /

RMAN> drop database including backups;

 

Thank You !!