To duplicate an Oracle database with backups you have taken with RMAN there are several ways to do it.
Make sure to have a full backup of the source database.
The backups are located at: /home/oracle/backup
The first method I will show you is with a minimal pfile, only the db_name.
The second method will be with more info in the pfile.
For both cases, assume that the ORACLE_SID is oradb2 and db_unique_name is oradb21, change them accordingly.
Make sure that the folders for DB_CREATE_FILE_DEST, DB_RECOVERY_FILE_DEST and AUDIT_FILE_DEST exist.
If you are using ASM, replace accordingly.
Table of Contents
1. RMAN duplicate database with minimal pfile
You add to the pfile only the db_name.
cat $ORACLE_HOME/dbs/initoradb2.ora
*.db_name='ORADB2'
Start the database in nomount mode
sqlplus / as sysdba
startup nomount
You connect to RMAN with
rman auxiliary /
You run this command inside an RMAN block
run
{
duplicate database to oradb2
spfile
set db_unique_name 'oradb21'
set control_files '/u01/app/oracle/oradata/ORADB21/datafile/control1.ctl'
set db_create_file_dest '/u01/app/oracle/oradata'
set db_recovery_file_dest '/u01/app/oracle/fra/'
set db_recovery_file_dest_size '22g'
set audit_file_dest '/u01/app/oracle/audit'
set pga_aggregate_target '210m'
set sga_target '900m'
backup location '/home/oracle/backup';
}
2. RMAN duplicate database with more info in the pfile
The second option is with more info inside the pfile
cat $ORACLE_HOME/dbs/initoradb2.ora
*.audit_file_dest='/u01/app/oracle/audit'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='/u01/app/oracle/oradata/ORADB21/datafile/control1.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain='localdomain'
*.db_name='ORADB2'
*.db_unique_name='ORADB21'
*.db_recovery_file_dest='/u01/app/oracle/fra'
*.db_recovery_file_dest_size=22G
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oradbXDB)'
*.enable_pluggable_database=true
*.local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=srv2.localdomain)(PORT=1521))'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=200M
*.processes=500
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=900M
*.undo_tablespace='UNDOTBS1'
You have to startup the database in nomount
sqlplus / as sysdba
startup nomount
Now connect to RMAN
rman auxiliary /
Then run the duplicate command.
run
{
duplicate datavase to oradb2
backup location '/home/oracle/backup';
}
I hope this was helpful.