Monday, March 28, 2011

Duplicating Oracle 11g Database using Active database option


Source DB
===========
Host Name=oradbsrvr1
DB Name=racdb
Oracle Version=11.2.0.1.0
Oracle Home=/u01/oracle/product/11.2.0/db
dbfiles_loc=/u01/oradata/racdb

Target DB
===========
Host Name= oradbsrvr2
DB Name=testdb
Oracle Version=11.2.0.1.0
Oracle Home=/u01/oracle/product/11.2.0/db1
dbfiles_loc=/u02/oradata/testdb

Step1: Creating Init.ora File on target system
=================================================
*.audit_file_dest='/u01/oracle/oraclebase/admin/testdb/adump'
*.compatible='11.2.0'
*.control_files='/u02/oradata/testdb/control01.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u02/oradata'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='TESTDB'#Modified by RMAN duplicate
*.db_recovery_file_dest_size=2147483648
*.db_recovery_file_dest='/u02/oradata'
*.db_unique_name='TESTDB'#Modified by RMAN duplicate
*.diagnostic_dest='/u01/oracle/oraclebase'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testdbXDB)'
*.java_pool_size=134217728
*.job_queue_processes=10
*.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=oradbsrvr2)(PORT=1521))'
*.log_buffer=11485660
*.open_cursors=300
*.pga_aggregate_target=298844160
*.processes=600
*.remote_login_passwordfile='EXCLUSIVE'
*.session_cached_cursors=300
*.sga_target=897581056
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.db_file_name_convert='/u01/oradata/racdb/','/u02/oradata/testdb/'
*.log_file_name_convert='/u01/oradata/racdb/','/u02/oradata/testdb/'

Step2: Creating password files
==================================
orapwd file=orapwtestdb password=oracle ignorecase=y entries=5

Step3: Configuring Listener
==============================
First I tried to connect to database without adding any entries

oracle@oradbsrvr2:/appl/oracle>sqlplus sys/oracle@testdb as sysdba 

SQL*Plus: Release 11.2.0.1.0 Production on Mon Mar 28 16:51:46 2011

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:
ORA-12528: TNS:listener: all appropriate instances are blocking new connections

After this error I checked the listener status

oracle@oradbsrvr2:/appl/oracle>lsnrctl status    

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-MAR-2011 16:52:15

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-MAR-2011 19:16:26
Uptime                    6 days 21 hr. 35 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /u01/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/oracle/oraclebase/diag/tnslsnr/oradbsrvr2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.100)(PORT=1521)))
Services Summary...
Service "testdb" has 1 instance(s).
  Instance "testdb", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

testdb instance status was blocked so I added sid_list_listener values

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/oracle/product/11.2.0/grid)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = testdb)
      (SID_NAME = testdb)
      (ORACLE_HOME = /u01/oracle/product/11.2.0/grid)
    )
  )

Then restarted the listener

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-MAR-2011 16:56:41
Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                28-MAR-2011 16:56:37
Uptime                    0 days 0 hr. 0 min. 4 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /u01/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/oracle/oraclebase/diag/tnslsnr/oradbsrvr2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.100)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "testdb" has 1 instance(s).
  Instance "testdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

Step4: Duplicating Database
===============================

oracle@oradbsrvr2:/home/oracle>rman target sys/oracle@racdb auxiliary sys/oracle@testdb

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Mar 28 18:53:59 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=3431901857)
connected to auxiliary database: TESTDB (not mounted)

RMAN> run
2>  {
duplicate target database to testdb from active database;
3> 4>  }

Starting Duplicate Db at 28-MAR-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
''RACDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
''TESTDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u02/oradata/testdb/controlfile/control01.ctl';
   alter clone database mount;
}
executing Memory Script
sql statement: alter system set  db_name =  ''RACDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set  db_unique_name =  ''TESTDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started

Total System Global Area     893562880 bytes
Fixed Size                     2218512 bytes
Variable Size                343934448 bytes
Database Buffers             532676608 bytes
Redo Buffers                  14733312 bytes

Starting backup at 28-MAR-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=93 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/28/2011 18:54:32
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 18:54:32
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server

RMAN> exit

This error was occurred because the TNS entries of our auxiliary database were missing on the source database. This is required as we are duplicating the active database and it need connection to auxiliary database. After adding TNS entries, the rman process was started again

oracle@oradbsrvr2:/home/oracle>rman target sys/oracle@racdb auxiliary sys/oracle@testdb

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Mar 28 19:13:57 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=3431901857)
connected to auxiliary database: TESTDB (not mounted)

RMAN> run
2>  {
3>  duplicate target database to testdb from active database;
4>  }

Starting Duplicate Db at 28-MAR-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
''RACDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
''TESTDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u02/oradata/testdb/controlfile/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''RACDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set  db_unique_name =  ''TESTDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area     893562880 bytes
Fixed Size                     2218512 bytes
Variable Size                343934448 bytes
Database Buffers             532676608 bytes
Redo Buffers                  14733312 bytes

Starting backup at 28-MAR-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=93 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/28/2011 19:14:17
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 19:14:17
ORA-17628: Oracle error 19505 returned by remote Oracle server

RMAN> exit

This error was occurred because the controlfile location was specified wrongly. After correcting the control file path, the script executed once again

oracle@oradbsrvr2:/home/oracle>rman target sys/oracle@racdb auxiliary sys/oracle@testdb

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Mar 28 19:17:12 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=3431901857)
connected to auxiliary database: TESTDB (not mounted)

RMAN> run
2>  {
3>  duplicate target database to testdb from active database;
4>  }

Starting Duplicate Db at 28-MAR-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
''RACDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
''TESTDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u02/oradata/testdb/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''RACDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''TESTDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     893562880 bytes

Fixed Size                     2218512 bytes
Variable Size                343934448 bytes
Database Buffers             532676608 bytes
Redo Buffers                  14733312 bytes

Starting backup at 28-MAR-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=107 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/oracle/product/11.2.0/db/dbs/snapcf_racdb.f tag=TAG20110328T191731 RECID=4 STAMP=746997451
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 28-MAR-11

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to
"/u02/oradata/racdb/system01.dbf";
   set newname for datafile  2 to
"/u02/oradata/racdb/sysaux01.dbf";
   set newname for datafile  3 to
"/u02/oradata/racdb/undotbs01.dbf";
   set newname for datafile  4 to
"/u02/oradata/racdb/users01.dbf";
   set newname for datafile  5 to
"/u02/oradata/racdb/example01.dbf";
   set newname for datafile  6 to
"/u02/oradata/racdb/user_data01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
"/u02/oradata/racdb/system01.dbf"   datafile
2 auxiliary format
"/u02/oradata/racdb/sysaux01.dbf"   datafile
3 auxiliary format
"/u02/oradata/racdb/undotbs01.dbf"   datafile
4 auxiliary format
"/u02/oradata/racdb/users01.dbf"   datafile
5 auxiliary format
"/u02/oradata/racdb/example01.dbf"   datafile
6 auxiliary format
"/u02/oradata/racdb/user_data01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 28-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/oradata/racdb/system01.dbf
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 19:17:42
ORA-17628: Oracle error 19505 returned by remote Oracle server
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/oradata/racdb/sysaux01.dbf
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 19:17:43
ORA-17628: Oracle error 19505 returned by remote Oracle server
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/oradata/racdb/example01.dbf
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 19:17:45
ORA-17628: Oracle error 19505 returned by remote Oracle server
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/oradata/racdb/undotbs01.dbf
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 19:17:46
ORA-17628: Oracle error 19505 returned by remote Oracle server
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/oradata/racdb/user_data01.dbf
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 19:17:47
ORA-17628: Oracle error 19505 returned by remote Oracle server
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/racdb/users01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/28/2011 19:17:48
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/28/2011 19:17:48
ORA-17628: Oracle error 19505 returned by remote Oracle server

RMAN> exit

This time the duplicate process was failed because the two parameters were not specified in init.ora parameter file:

*.db_file_name_convert='/u01/oradata/racdb/','/u02/oradata/testdb/'
*.log_file_name_convert='/u01/oradata/racdb/','/u02/oradata/testdb/'

After putting these two parameters, the script was started once again

oracle@oradbsrvr2:/home/oracle>rman target sys/oracle@racdb auxiliary sys/oracle@testdb

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Mar 28 19:24:43 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=3431901857)
connected to auxiliary database: TESTDB (not mounted)

RMAN> run
2>  {
3>  duplicate target database to testdb from active database;
4>  }

Starting Duplicate Db at 28-MAR-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
''RACDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
''TESTDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u02/oradata/testdb/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''RACDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set  db_unique_name =  ''TESTDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area     893562880 bytes
Fixed Size                     2218512 bytes
Variable Size                343934448 bytes
Database Buffers             532676608 bytes
Redo Buffers                  14733312 bytes
Starting backup at 28-MAR-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=96 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/oracle/product/11.2.0/db/dbs/snapcf_racdb.f tag=TAG20110328T192504 RECID=5 STAMP=746997905
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 28-MAR-11

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to
"/u02/oradata/testdb/system01.dbf";
   set newname for datafile  2 to
"/u02/oradata/testdb/sysaux01.dbf";
   set newname for datafile  3 to
"/u02/oradata/testdb/undotbs01.dbf";
   set newname for datafile  4 to
"/u02/oradata/testdb/users01.dbf";
   set newname for datafile  5 to
"/u02/oradata/testdb/example01.dbf";
   set newname for datafile  6 to
"/u02/oradata/testdb/user_data01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
"/u02/oradata/testdb/system01.dbf"   datafile
2 auxiliary format
"/u02/oradata/testdb/sysaux01.dbf"   datafile
3 auxiliary format
"/u02/oradata/testdb/undotbs01.dbf"   datafile
4 auxiliary format
"/u02/oradata/testdb/users01.dbf"   datafile
5 auxiliary format
"/u02/oradata/testdb/example01.dbf"   datafile
6 auxiliary format
"/u02/oradata/testdb/user_data01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 28-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/oradata/racdb/system01.dbf
output file name=/u02/oradata/testdb/system01.dbf tag=TAG20110328T192512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:06
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/oradata/racdb/sysaux01.dbf
output file name=/u02/oradata/testdb/sysaux01.dbf tag=TAG20110328T192512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:05
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/oradata/racdb/example01.dbf
output file name=/u02/oradata/testdb/example01.dbf tag=TAG20110328T192512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/oradata/racdb/undotbs01.dbf
output file name=/u02/oradata/testdb/undotbs01.dbf tag=TAG20110328T192512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/oradata/racdb/user_data01.dbf
output file name=/u02/oradata/testdb/user_data01.dbf tag=TAG20110328T192512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/racdb/users01.dbf
output file name=/u02/oradata/testdb/users01.dbf tag=TAG20110328T192512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 28-MAR-11

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/u01/flash_recovery/RACDB/archivelog/2011_03_28/o1_mf_1_143_6s26j8mh_.arc" auxiliary format
"/u02/oradata/TESTDB/archivelog/2011_03_28/o1_mf_1_143_%u_.arc"   ;
   catalog clone recovery area;
   switch clone datafile all;
}
executing Memory Script

Starting backup at 28-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=143 RECID=272 STAMP=746998218
output file name=/u02/oradata/TESTDB/archivelog/2011_03_28/o1_mf_1_143_1am8ciee_.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:07
Finished backup at 28-MAR-11

searching for all files in the recovery area

List of Files Unknown to the Database
=====================================
File Name: /u02/oradata/TESTDB/archivelog/2011_03_28/o1_mf_1_143_1am8ciee_.arc
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u02/oradata/TESTDB/archivelog/2011_03_28/o1_mf_1_143_1am8ciee_.arc

datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=746998230 file name=/u02/oradata/testdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=746998230 file name=/u02/oradata/testdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=746998231 file name=/u02/oradata/testdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=746998231 file name=/u02/oradata/testdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=9 STAMP=746998231 file name=/u02/oradata/testdb/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=10 STAMP=746998231 file name=/u02/oradata/testdb/user_data01.dbf

contents of Memory Script:
{
   set until scn  4176301;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 28-MAR-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

starting media recovery

archived log for thread 1 with sequence 143 is already on disk as file /u02/oradata/TESTDB/archivelog/2011_03_28/o1_mf_1_143_1am8ciee_.arc
archived log file name=/u02/oradata/TESTDB/archivelog/2011_03_28/o1_mf_1_143_1am8ciee_.arc thread=1 sequence=143
media recovery complete, elapsed time: 00:00:01
Finished recover at 28-MAR-11

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
''TESTDB'' comment=
''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     893562880 bytes

Fixed Size                     2218512 bytes
Variable Size                343934448 bytes
Database Buffers             532676608 bytes
Redo Buffers                  14733312 bytes

sql statement: alter system set  db_name =  ''TESTDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     893562880 bytes

Fixed Size                     2218512 bytes
Variable Size                343934448 bytes
Database Buffers             532676608 bytes
Redo Buffers                  14733312 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TESTDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
LOGFILE
  GROUP  1 ( '/u02/oradata/testdb/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/u02/oradata/testdb/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/u02/oradata/testdb/redo03.log' ) SIZE 50 M  REUSE
DATAFILE
  '/u02/oradata/testdb/system01.dbf'
CHARACTER SET WE8MSWIN1252

contents of Memory Script:
{
   set newname for tempfile  1 to
"/u02/oradata/testdb/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u02/oradata/testdb/sysaux01.dbf",
"/u02/oradata/testdb/undotbs01.dbf",
"/u02/oradata/testdb/users01.dbf",
"/u02/oradata/testdb/example01.dbf",
"/u02/oradata/testdb/user_data01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u02/oradata/testdb/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u02/oradata/testdb/sysaux01.dbf RECID=1 STAMP=746998255
cataloged datafile copy
datafile copy file name=/u02/oradata/testdb/undotbs01.dbf RECID=2 STAMP=746998255
cataloged datafile copy
datafile copy file name=/u02/oradata/testdb/users01.dbf RECID=3 STAMP=746998255
cataloged datafile copy
datafile copy file name=/u02/oradata/testdb/example01.dbf RECID=4 STAMP=746998255
cataloged datafile copy
datafile copy file name=/u02/oradata/testdb/user_data01.dbf RECID=5 STAMP=746998255

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=746998255 file name=/u02/oradata/testdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=746998255 file name=/u02/oradata/testdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=746998255 file name=/u02/oradata/testdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=746998255 file name=/u02/oradata/testdb/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=746998255 file name=/u02/oradata/testdb/user_data01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 28-MAR-11

RMAN>exit

This time we were succeeded in duplicating the database with active database option.

Hope this help

14 comments:

Sreedhar Reddy said...

malik its helped me a lot. from last 2 days iam trying to resolve those error but its was a awsome explanation. thanks and alot dude.

Anonymous said...

Thanks Buddy. It definitely helped me when i ran into ORA-17629 ORA-17627 ORA-12154 and the other issue where you need to specify db_file_name_convert and log_file_name_convert. Thanks a lot and keep up ur good work.

Unknown said...

A perfect solution for the problem [ ora-17628....] which I have been facing since morning.Thank you very much Mr. Farooq.

Vishal Devgan.

srilatha said...

It helped me a lot.Nice article and clear explanation. Thanks a lot

Anonymous said...

Excellent job. Thanks a lot.

ismail said...

THANKS ,
NOW I SOLVED MY ERROR

Anonymous said...

Most complete web post walking through sequentially the multiple contributors of errors to the generic RMAN-03009 and ORA-12154 errors I have found, after Googling and MOS searches for hours. Thanks for the complete log examples and corrections, in particular the listener, tnsnames.ora and filename convert. Kudos to you. The thorough details always support the end result!

Anonymous said...

Perfect !!! you have solved my issue on DG configuration... Thanks a lot...

Anonymous said...

Thank you. The missing of TNS entry in the source database causing me losing 6 hours. Your write up help me from losing more hours.

Unknown said...

I would like to contribute with a detail: When you are duplicating a datase to copy and asm groups are different, you need to change the name of auxiliary database to another. If they are the same only changing ips, when you duplicate you will see a error ORA-17628 because the script mounted internally try to copy a controlfile from target with path from auxiliary.

S.H.E.M.E.E.M said...


Hi, You said : -
" This time the duplicate process was failed because the two parameters were not specified in init.ora parameter file:

*.db_file_name_convert='/u01/oradata/racdb/','/u02/oradata/testdb/'
*.log_file_name_convert='/u01/oradata/racdb/','/u02/oradata/testdb/'
"

How you knew the above were the problems ? What's the source of that infos?

thanks

Farooq Malik said...

Shameen, This Error ORA-17628 tells that something wrong with the output file names or location parameters associated with the restore.
Also there was no output file message in the log which clearly indicate that something to do with source to target filepath conversion.
After fixing that you can see the output was different.

channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/oradata/racdb/system01.dbf
output file name=/u02/oradata/testdb/system01.dbf tag=TAG20110328T192512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:06

Unknown said...

Many thanks for your help, saved my day today.

Unknown said...

I ran into a similar issue with the same error message
ORA-17628: Oracle error 19505 returned by remote Oracle server

We had a previous cloning job that errored out due to space constraints. When we restarted it we got the error above because some of the datafiles were still present on ASM. After deleting the files, the cloning job completed successfully.