Because the parameter file for TEST has db_name = 'TEST'
the DUPLICATE DATABASE command handles this by executing ALTER SYSTEM SET DB_NAME and DB_UNIQUE_NAME
In your current test, you need to update the db_name in the TEST parameter file.
Note : I would also have removed the TEST database properly before doing a DUPLICATE. There may be a mismatch between the numbers of datafiles (even Tablespaces) in PROD and TEST (i.e. the existing TEST before the DUPLICATE)
Hemant K Chitale
I believe your error is due to the archivelogs not being available which are required to recover the database.
I was able to replicate your issue on one of my test environments.
So i suspect that when the database was backed up it was done so without backing up your archivelogs.
I backed up my database the same way (ie backup database include current controlfile format 'xyz') and during the duplicate database it used the archivelogs which were still on disk from the target database.
starting media recovery
archived log for thread 1 with sequence 37 is already on disk as file /u01/fast_recovery_area/ORCL/archivelog/2014_06_11/o1_mf_1_37_9sj7rwjo_.arc
archived log file name=/u01/fast_recovery_area/ORCL/archivelog/2014_06_11/o1_mf_1_37_9sj7rwjo_.arc thread=1 sequence=37
media recovery complete, elapsed time: 00:00:00
Once I removed the archivelogs from disk I got the error you are having:
RMAN-03002: failure of Duplicate Db command at 06/11/2014 11:46:28
RMAN-05501: aborting duplication of target database
RMAN-05541: no archived logs found in target database
As such the backups you have seem to be useless and there are no archivelog backups or archivelogs on disk from which you can recover the database from.
Obviously you can test out this theory yourself.
Thanks. As you said it was issue with the following two
1. No Archive Logs in Backup.
2. Duplicating the backup of ORCL database to TEST, where I have already installed a Database called TEST.
So now As Hemant said, I'm working on the restore of a Fresh where OLD TEST Database to be dropped/deleted. To drop/delete I need the database to be in mount stage, since I messed up with the control file I couldn't do it. Creation of control file is halfway in progress for OLD TEST database.
So for the status as follows:
1. Restored the Database as ORCL itself and trying to rename the Database using NID.
Now the issue is with ASM File Structure, I'm halfway in renaming with editing the parameter files. I couldn't rename a Directory in ASM since it is an ASM System generated file.
SQL> ALTER DISKGROUP DATA1 RENAME DIRECTORY '+DATA1/ORCL' TO '+DATA1/OLD_ORCL';
ALTER DISKGROUP DATA1 RENAME DIRECTORY '+DATA1/ORCL' TO '+DATA1/OLD_ORCL'
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15177: cannot operate on system aliases
So for I'm done with Restore and Rename of ORCL to TEST. But as I said in my previous post I need to update the ASM Storage File paths.
RMAN> report schema;
Report of database schema for database with db_unique_name TEST
List of Permanent Datafiles
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 1060 SYSTEM *** +DATA1/orcl/datafile/system.309.8499 36179
2 1060 SYSAUX *** +DATA1/orcl/datafile/sysaux.307.8499 36179
3 220 UNDOTBS1 *** +DATA1/orcl/datafile/undotbs1.308.84 9936181
4 11 USERS *** +DATA1/orcl/datafile/users.310.84993 6183
5 150 UNDOTBS2 *** +DATA1/orcl/datafile/undotbs2.305.84 9936181
List of Temporary Files
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 20 TEMP 32767 +DATA1/orcl/tempfile/temp.345.84 9936353
2 100 RAC_IAS_TEMP 100 +DATA1/orcl/tempfile/rac_ias_tem p.346.849936353
Stuck here: I need to Rename the Directory from "orcl" to "TEST".
Note: Already there is a Folder called "TEST" is available in ASM.
Either I need to RENAME the Directory or
I need to DROP the OLD TEST Directory.
I couldn't move further. Once again Thanks a lot for your valuable effort and Time Hemant and Freddie.
Restore of Contorol file is doing good
RMAN> restore controlfile from '/home/oracle/backup/ORCL/ORCL_18_0ip6c3so_1_1';
Starting restore at 11-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA1/test/controlfile/current.297.848048479
Finished restore at 11-JUN-14
but after this when I tried to do alter database mount; it shows the db name mismatch error as said preivous post.
Quoting Freddie Essex from earlier in the thread: "You will need to use the db_file_name_convert and log_file_name_convert parameters as this is on the same host and presumably you will be using a different directory structure."
I have a weekly job that does a DUPLICATE DATABASE from a prod to a test database, and for another system I have an on-demand script that also does DUPLICATE DATABASE from prod to test. The key to both is correct setting of the above two parms in the spfile of the test database. Of course, this also pre-supposes that the specified target directories actually exist.
Changing the folder names is handled by using db_file_name_convert when running the DUPLICATE DATABASE (A RESTORE DATABASE does not use db_file_name_convert)
If you want to rename the files and folders after the restore, refer to Oracle Support Note "How to rename/move a datafile in the same ASM diskgroup (Doc ID 564993.1)"
Hemant K Chitale
Thanks Hemant. Finally resolved my restore and also the following 2 links helped and found useful.