advertisements
_____________________________________________________________________________________________________________________
Here is the Scenario:
We have 3 RMAN backup pieces from the source database (SOURCE)
Backup pieces which is already trasfered from ASM to file system :
mfmtiqi3_1_1, mhmtiqk5_1_1, SOURCE_cf_c-3981864101-20111207-00
SCN Number to be recovered which I got from Source database from the backup control file backup tag: 181169521
Target Database Name: (TARGET)
Steps to be done in TARGET Server.
- Create a initSOURCE.ora file
db_name='SOUCE’
DB_FILE_NAME_CONVERT=('+DATA/source/datafile/','+DATA/target/datafile/','+DATA/source/tempfile/','+DATA/target/tempfile/')
LOG_FILE_NAME_CONVERT=('+DATA/source/onlinelog/','+DATA/target/onlinelog/')
cluster_database=false
control_files='+RECO/target/controlfile
- Shutdown the TARGET database if already present and startup nomount the SOURCE database.
export ORACLE_SID=TARGET
SQL> shutdown immediate;
export ORACLE_SID=SOURCE;
startup nomount pfile=initSOURCE.ora
- Restore the control file from backupset.
RMAN> restore controlfile from '/u01/oracle/RMANBKUP/SOURCE_cf_c-3981864101-20111207-00';
- Update the initSOURCE.ora file with new control files details.
Controlfile=( +RECO/target/controlfile/current.515.767828343, +DATA/target/controlfile/current.438.767828343)
- Connect to sqlplus and rename the redo log files to new location
alter database rename file
alter database rename file '+DATA/source/onlinelog/group_1.285.752872271' to '+DATA/target/onlinelog/group_1.285.752872271';
alter database rename file '+DATA/source/onlinelog/group_2.296.752872277' to '+DATA/target/onlinelog/group_2.296.752872277';
alter database rename file '+DATA/source/onlinelog/group_3.295.752872279' to '+DATA/target/onlinelog/group_3.295.752872279';
alter database rename file '+RECO/source/onlinelog/group_1.1877.764270427' to '+RECO/target/onlinelog/group_1.1877.764270427';
alter database rename file '+RECO/source/onlinelog/group_2.4749.764270429' to '+RECO/target/onlinelog/group_2.4749.764270429';
alter database rename file '+RECO/source/onlinelog/group_3.4743.764270433' to '+RECO/target/onlinelog/group_3.4743.764270433';
- Connect to RAMN and catalog the backup pieces.
catalog backuppiece '/u01/oracle/RMANBKUP/mfmtiqi3_1_1';
catalog backuppiece '/u01/oracle/RMANBKUP/mhmtiqk5_1_1';
- Connect to RMAN and run the following script. The green colored items needs to be modified as per your standard
run {
set until scn 181169521;
set newname for datafile 1 to '+DATA/target/datafile/system.289.752871853';
set newname for datafile 2 to '+DATA/target/datafile/sysaux.306.752871879';
set newname for datafile 3 to '+DATA/target/datafile/undotbs1.307.752871903';
set newname for datafile 4 to '+DATA/target/datafile/users.287.752871931';
set newname for datafile 5 to '+DATA/target/datafile/data.303.752871809';
set newname for datafile 6 to '+DATA/target/datafile/undotbs2.290.752873397';
restore database;
switch datafile all;
recover database;
alter database open resetlogs;
}
Now your database cloning is completed. You have to rename the control file.
- Rename the database. You can use following methods.
- In RAC most of the cases you have to rename the datafiles as it restore the datafiles to original location
a. Get the datafile list from the database using
Select file_name from dba_data_files; query
b. Shutdown the database and mount it
c. Connect to RMAN and use following command to files from one location to another
RMAN> copy datafile '+DATA/target/datafile/system.289.752871853' to '+DATA';
_____________________________________________________________________________________________________________________
0 comments:
Post a Comment