Martins Blog

Trying to explain complex things in simple terms

Duplicate from the standby instead from the primary in 12c

Posted by Martin Bach on April 2, 2014

This post is related to 12c and an active database duplication for a standby I did in my lab environment. I’d say although I first encountered it on 12c there is a chance you run into a similar situation with earlier releases too.

I would normally use ASM for all my databases to make my life easier but this time I had to be mindful of the available memory on the laptop-which at 8 GB-is not plenty. So I went with file system setup instead. After the initial preparations I was ready to launch the one-liner on the standby database:

RMAN> duplicate target database for standby from active database;

This worked away happily for a few moments only to come to an abrupt halt with the below error message. I have started the duplication process on the standby.

...
executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 01-APR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00012 name=/u01/oradata/CDB1/valid/sysaux01.dbf
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/01/2014 20:34:42
ORA-17628: Oracle error 19505 returned by remote Oracle server
ORA-19505: failed to identify file ""
channel ORA_DISK_1 disabled, job failed on it will be run on another channel
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/01/2014 20:34:42
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script

RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/01/2014 20:34:42
ORA-17628: Oracle error 19505 returned by remote Oracle server
ORA-19505: failed to identify file ""

Huh? File 12 is part of a PDB named VALID. It was definitely available on the file system on the source, and I even had a backup on disk for it… I first thought it had to do with the PDBs all closed on the source datbase but that was not the case. After opening the PDBs read-write I still had the same error. Strange. I thought about debugging and tracing RMAN but then decided to first try the duplication from the primary. Which was a good idea, because the primary actually gave me a more meaningful error message:

Starting restore at 19.03.2014 10:17:08
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/oradata/STDBY1/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/oradata/STDBY1/pdbseed/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/19/2014 10:17:26
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-19849: error while reading backup piece from service cdb1
ORA-19504: failed to create file "/u01/oradata/STDBY1/pdbseed/system01.dbf"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1

So I forgot to create the needed directories on the standby. For consistency I created a subdirectory per PDB on the primary, which I forgot on the standby host. You can see this here:

RMAN> report schema;

Report of database schema for database with db_unique_name CDB1

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    790      SYSTEM               ***     /u01/oradata/CDB1/system01.dbf
3    750      SYSAUX               ***     /u01/oradata/CDB1/sysaux01.dbf
4    90       UNDOTBS1             ***     /u01/oradata/CDB1/undotbs01.dbf
5    250      PDB$SEED:SYSTEM      ***     /u01/oradata/CDB1/pdbseed/system01.dbf
6    5        USERS                ***     /u01/oradata/CDB1/users01.dbf
7    590      PDB$SEED:SYSAUX      ***     /u01/oradata/CDB1/pdbseed/sysaux01.dbf
11   270      VALID:SYSTEM         ***     /u01/oradata/CDB1/valid/system01.dbf
12   610      VALID:SYSAUX         ***     /u01/oradata/CDB1/valid/sysaux01.dbf
13   260      RCAT:SYSTEM          ***     /u01/oradata/CDB1/rcat/system01.dbf
14   610      RCAT:SYSAUX          ***     /u01/oradata/CDB1/rcat/sysaux01.dbf
15   100      RCAT:RMAN_CATALOG    ***     /u01/oradata/CDB1/rcat/rman_catalog01.dbf
16   50       VALID:USERS          ***     /u01/oradata/CDB1/valid/users01.dbf
17   250      DGTEST:SYSTEM        ***     /u01/oradata/CDB1/dgtest/system01.dbf
18   590      DGTEST:SYSAUX        ***     /u01/oradata/CDB1/dgtest/sysaux01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    60       TEMP                 32767       /u01/oradata/CDB1/temp01.dbf
2    20       PDB$SEED:TEMP        32767       /u01/oradata/CDB1/pdbseed/pdbseed_temp01.dbf
4    20       VALID:TEMP           32767       /u01/oradata/CDB1/valid/pdbseed_temp01.dbf
5    20       RCAT:TEMP            32767       /u01/oradata/CDB1/rcat/pdbseed_temp01.dbf
6    20       DGTEST:TEMP          32767       /u01/oradata/CDB1/dgtest/dgtest_temp01.dbf

All right, after creating the directories I retried the duplication and it worked:

...
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=843771196 file name=/u01/oradata/STDBY1/undotbs01.dbf

datafile 5 switched to datafile copy
input datafile copy RECID=6 STAMP=843771198 file name=/u01/oradata/STDBY1/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=7 STAMP=843771198 file name=/u01/oradata/STDBY1/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=8 STAMP=843771199 file name=/u01/oradata/STDBY1/pdbseed/sysaux01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=9 STAMP=843771199 file name=/u01/oradata/STDBY1/valid/system01.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=10 STAMP=843771199 file name=/u01/oradata/STDBY1/valid/sysaux01.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=11 STAMP=843771199 file name=/u01/oradata/STDBY1/rcat/system01.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=12 STAMP=843771200 file name=/u01/oradata/STDBY1/rcat/sysaux01.dbf
datafile 15 switched to datafile copy
input datafile copy RECID=13 STAMP=843771200 file name=/u01/oradata/STDBY1/rcat/rman_catalog01.dbf
datafile 16 switched to datafile copy
input datafile copy RECID=14 STAMP=843771200 file name=/u01/oradata/STDBY1/valid/users01.dbf
datafile 17 switched to datafile copy
input datafile copy RECID=15 STAMP=843771200 file name=/u01/oradata/STDBY1/dgtest/system01.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=16 STAMP=843771200 file name=/u01/oradata/STDBY1/dgtest/sysaux01.dbf
Finished Duplicate Db at 19.03.2014 10:28:42

Summary

Although not a big problem and probably known by everyone besides me the error message on the standby shouldn’t be of the scary type ‘can’t identify datafile “”‘ followed by the process aborting. Instead something more meaningful would have been nice.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 2,367 other followers

%d bloggers like this: