APPLIES TO:Oracle Database - Enterprise Edition - Version 11.2.0.1 and laterOracle Database Cloud Schema Service - Version N/A and later Oracle Database Exadata Cloud Machine - Version N/A and later Oracle Cloud Infrastructure - Database Service - Version N/A and later Oracle Database Backup Service - Version N/A and later Information in this document applies to any platform. ***Checked for relevance on 10-Dec-2015*** GOALRman 11g release 2 provides us the flexibility of creating the rman duplicate without connecting to the target database and recovery catalog.All rman needs here is the location of the backup pieces which is accessible and rman reads the backup pieces and restores the spfile,controlfile,datafiles and archivelog files to perform the duplicate operation. An example for this kind of duplicate operation is: RMAN> DUPLICATE DATABASE TO <auxiliary DB name> UNTIL TIME "TO_DATE('29-MAY-2010 14:16:42','DD-MON-YYYYHH24:MI:SS')" SPFILE set control_files='D:\<aux path>\c1.ctl' set db_file_name_convert='D:<target path>','D:<aux path>' set log_file_name_convert='D:<target path>','D:<aux path>' BACKUP LOCATION 'D:\<location of backup on disk>'; # Here use of the BACKUP LOCATION clause identifies the type of duplication as having no target connection, no recovery catalog and being backup-based.
This is a New Feature in 11gR2
http://docs.oracle.com/cd/E11882_01/backup.112/e10642/wnbradv.htm#BRADV021 Oracle® Database Backup and Recovery User's Guide 11g Release 2 (11.2) . What's New in Backup and Recovery? SOLUTIONProcess involved in this type of duplicate database++ Rman restores the spfile from the backup pieces located in the mentioned location.++ Once the spfile is restored, rman sets appropriate values to the parameters mentioned the duplicate command. For example: db_name control_files db_file_name_convert log_file_name_convert etc ... Once done, rman restarts the instance to no mount so that the changes can take effect. ++ Rman now changes the value of the parameter db_name to the target database name to achieve the restore of the controlfile. The restored controlfile will have the db_name as of the target database name and since we cannot have a different db_name in the spfile and in the controlfile, rman will have to set the parameter db_name to the target database name and perform the restore of the datafiles and controlfiles. Also here if the duplicate is happening on the same machine, then 2 controlfiles with the same db_name cannot be mounted. In order to achieve this the auxiliary instance will have the parameter db_unique_name set to a unique value. Rman takes care of this sets the db_uniqiue_name to the database name specified for the auxiliary database. ++ After the above operation,controlfile is restored from the backup piece to the location provided for the parameter control_files. ++ Now Rman restores the datafiles to the locations specified by the parameter db_file_name_convert. ++ Recovery of the datafiles are performed. ++ Once the recovery is completed, rman shuts down the database to reset the value of db_name to the value provided for the auxiliary database. ++ Once this is done, the database is taken to no mount phase and the controlfile is recreated to change the database name and the id.This is followed by the database getting opened with resetlogs. The steps involved in creating the duplicate database are as follows1) Take a backup of the spfile, controlfile, database, and archivelogs as follows:
RMAN> backup spfile ;
RMAN> backup database include current controlfile plus archivelog ; 2) Making the backup pieces available for duplicate operation.
++ If the duplicate is going to happen on different server, move the backup pieces to a new server using commands like ftp,scp etc.
++ If the duplicate is going to happen on the same server as target, then you can either retain them in the same location where the backup was done or copy it to a required location. 3) Create a password file for the auxiliary instance.
For unix copy the password file from the target database to $ORACLE_HOME/dbs and rename it.
For windows copy the password file from the target database to %ORACLE_HOME/database and rename it. 4) Create a initialization parameter (initTEST.ora) for the auxiliary instance with only one parameter DB_NAME.
DB_NAME=dup11r2
5) Now start the auxiliary instance to no mount mode.
Unix Example
============ Just set the environment variables and start the instance. % export ORACLE_SID=<auxiliary ORACLE_SID> % export ORACLE_HOME=/<oracle_home path> % export PATH=$ORACLE_HOME/bin:$PATH % sqlplus "/as sysdba" SQL > startup nomount
Windows Example
=============== Create a service and then set the necessary environment variables and start the instance. % oradim -new -sid <auxiliary ORACLE_SID> set ORACLE_SID=auxiliary ORACLE_SID> set ORACLE_HOME=D:\<oracle home path>\ set PATH=D:\<oracle home>\bin;%PATH% % sqlplus "/as sysdba" SQL > startup nomount 6) Connect to the auxiliary instance from RMAN and perform the rman duplicate as follows:
EXAMPLE
=======
% rman auxiliary /
RMAN > DUPLICATE DATABASE TO dup11r2
UNTIL TIME "TO_DATE('29-MAY-2010 14:16:42','DD-MON-YYYY HH24:MI:SS')"
SPFILE
set control_files='D:\<auxiliary path>\c1.ctl'
set db_file_name_convert='D:\<target path>','d:\<auxiliary path>'
set log_file_name_convert='D:\<target path>','d:\<auxiliary path>'
BACKUP LOCATION 'D:\<location of backup on disk>'
;
Unix
======
run{ duplicate database to "TEST" UNTIL TIME "TO_DATE('21-JAN-2020 12:30:00','DD-MON-YYYY HH24:MI:SS')" SPFILE set control_files='/u02/oradata/TEST/control01.ctl','/u02/oradata/TEST/control02.ctl','/u02/oradata/TEST/control03.ctl' set LOG_FILE_NAME_CONVERT='/u02/oradata/PROD/','/u02/oradata/TEST/' set db_file_name_convert='/u02/oradata/PROD/','/u02/oradata/TEST/' set LOCAL_LISTENER='' set audit_file_dest='/u01/app/oracle/admin/TEST/adump' set log_archive_dest_1='location=/u02/oradata/fast_recovery_area/TEST/archivelog' BACKUP LOCATION '/u02/rman/backup_files'; } |
This blog contains Oracle Database and RHEL and OEL support and troubleshoot documents. Most of them are copied from Oracle support Documents and references are mentioned.
Tuesday, January 21, 2020
Subscribe to:
Post Comments (Atom)
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...
-
DBCA Fails To Create Oracle 19c Database On AIX [DBT-05509] (Doc ID 2663388.1 ) In this Document ...
-
[oracle@db ~]$ dbca DISPLAY not set. Set DISPLAY environment variable, then re-run. [oracle@db dbhome_1]$ DISPLAY=:1.0 ; export DISPL...
-
Oracle auditing setup & configuration The Oracle audit command is used to to create specific audit trails for Oracle tables. to ena...
No comments:
Post a Comment