HOW TO DUPLICATE DATABASE USING RMAN? (BONUS: DELETE DATABASE STEP BY STEP)
Channel: Wealth of Wisdom
Date: 2020-07-24

Oracle DBAs routinely create duplicate databases by using source database backup files or by using active database duplication, which lets you duplicate a database without any backups of the source database. Duplicate databases help you test database upgrades and application changes and serve as reporting databases under some circumstances. Duplicating a database comes in handy when you need to test a backup and recovery strategy. You can duplicate a database when you accidentally lose a very large table and must recover it from a backup. Instead of performing a time-consuming database recovery, you can simply create a duplicate database and export the
table and then import it into the production database. Starting with Oracle 12c, you can run the RMAN command recover table to restore a table to a point in time in the past by restoring the table from an RMAN backup. However, duplicating a database may be the best solution when dealing with earlier releases.

Besides duplicating databases, RMAN’s duplicate database capability also helps you set up standby databases, which are not merely one-time copies of the production databases but are continually updated versions of the production database. The primary purpose of a standby database is to serve as the production server during recovery and failover situations. You can’t use a duplicate database to perform a standby recovery and failover.  

Although you can duplicate databases without using RMAN, there are several advantages to duplicating a database with the help of RMAN:
- You can duplicate a database without even making a backup of the source database by using
network-enabled duplication, also called active database duplication.
- You can register a duplicated database in the same recovery catalog as the primary database,
since the duplicate database will have its own unique DBID.
- You can exclude certain tablespaces, such as read-only tablespaces.
- You can duplicate the database on the same server or on a remote host.
- You also have the option, if you want, of duplicating a database to a past point in time.
- When you duplicate a database with RMAN, the duplicate command assigns the duplicate
database a different DBID (except in cases where you duplicate a database for use as a standby
database) so you don’t have to change the DBID manually with the DBNEWID utility.

Any database duplication you make with the help of RMAN backups is called backup-based duplication. Prior to the Oracle Database 11g release, this was your only means of duplicating a database with RMAN. 
Backup-based database duplication requires a source database and a backup copy of that source database, either on the source host or on tape. Once you back up the source database, you need to transfer these source database backups to the destination server to create a duplicate database.

You may transfer backups of database files and the archived redo logs in various ways:
*** Manually transfer backups from the target host to the host on which you are duplicating the
database by using identical directory paths. For example, if the backups are stored in /u01/
backup on the source host, move them to the /u01/backup directory on the destination host.

*** Manually transfer backups from the target host to the duplicate host using different directory
paths (to a different location on the host where you’re creating the duplicate database). For
example, if the backups are in the /u01/backup directory on the source host, copy them to the
/u02/backup directory on the destination host. You must then update the source database
control file using the catalog (catalog start with directory_name) command so it’s aware of
the new location of the backups. You must do this because RMAN checks the backup metadata
in the control file for the location of the backup files and archived redo logs. Of course, this
means that for the catalog command to work you must have the /u02/backup directory on
the source host as well!

*** Use a network file system (NFS), and ensure that the source and destination hosts can both
access the same NFS mount point.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Matthew 5:37 ESV / 3 
Let what you say be simply ‘Yes’ or ‘No’; anything more than this comes from evil.

Please help subscribe, thank you and God bless.

To God be the Glory!