Skip to main content

duplicate database without rman catalog db

############################################################################
Source db            :               PROG RAC on agcoux169/agcoux170
Auxiliary               :               PROGRM on agcoux136
Date, author      :               July 10, 2013, Jiulu Sun
Goal                       :               duplicate PROGRM database from PROG without rman catalog db
prerequisite: database and archivelog backup is transferred to auxiliary database server
##############################################################################

Reference           :               http://docs.oracle.com/cd/B19306_01/backup.102/b14191/rcmdupdb.htm
"By default, the DUPLICATE command creates the duplicate database from the most recent backups of the target database and then performs recovery to the most recent consistent point contained in the archived redo logs. You can duplicate a database as it stood at a past point in time in the current incarnation, by using a RUN block with a SET UNTIL command, or by including an UNTIL clause with the DUPLICATE command to cause RMAN to recover the duplicate database to a past point in time within the current incarnation. (You cannot, however, use DUPLICATE with a point in time in an earlier incarnation.)
"
Test script           :
$> rman target sys/password@prog auxiliary / <<EOF
duplicate target database;
EOF
The result            :               failed, because rman in memory script “set until scn  8290829691596”, which looks for the archivelog that have this scn, but the archivelog is not backed up and available on the remote server yet.

I think the scn number is generated from v$archived_log view from target db by rman, as shown below.

select min(next_change#) from
(
select thread#,max(next_change#) next_change#
from v$archived_log group by thread#
)
  MIN(NEXT_CHANGE#)
-------------------
      8290829691596
The output including the error is in the frame below.
allocated channel: ORA_AUX_DISK_7
channel ORA_AUX_DISK_7: SID=1150 device type=DISK
allocated channel: ORA_AUX_DISK_8
channel ORA_AUX_DISK_8: SID=4 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /export/rman/PROG/PROG_c-354910189-20130709-01
channel ORA_AUX_DISK_1: piece handle=/export/rman/PROG/PROG_c-354910189-20130709-01 tag=TAG20130709T232325
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA2/progrm/controlfile/current.356.820419507
output file name=+FRA2/progrm/controlfile/current.305.820419507
Finished restore at 10-JUL-13

database mounted
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

contents of Memory Script:
{
   set until scn  8290829691596;
   sql clone 'alter database flashback off';
   set newname for datafile  1 to
 "+data2";
   set newname for datafile  2 to
 "+data2";
   set newname for datafile  3 to
 "+data2";
   set newname for datafile  4 to
 "+data2";
   set newname for datafile  5 to
 "+data2";
   set newname for datafile  6 to
 "+data2";
   set newname for datafile  7 to
 "+data2";
   set newname for datafile  8 to
 "+data2";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database flashback off

executing command: SET NEWNAME

executing command: SET NEWNAME

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 restore at 10-JUL-13
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to +data2
channel ORA_AUX_DISK_1: reading from backup piece /export/rman/PROG/PROG_data_3foebh6u_20130709
channel ORA_AUX_DISK_2: starting datafile backup set restore
channel ORA_AUX_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_2: restoring datafile 00003 to +data2
channel ORA_AUX_DISK_2: reading from backup piece /export/rman/PROG/PROG_data_3coebh6u_20130709
channel ORA_AUX_DISK_3: starting datafile backup set restore
channel ORA_AUX_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_3: restoring datafile 00004 to +data2
channel ORA_AUX_DISK_3: reading from backup piece /export/rman/PROG/PROG_data_3ioebh6u_20130709
channel ORA_AUX_DISK_4: starting datafile backup set restore
channel ORA_AUX_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_4: restoring datafile 00008 to +data2
channel ORA_AUX_DISK_4: reading from backup piece /export/rman/PROG/PROG_data_3goebh6u_20130709
channel ORA_AUX_DISK_5: starting datafile backup set restore
channel ORA_AUX_DISK_5: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_5: restoring datafile 00001 to +data2
channel ORA_AUX_DISK_5: reading from backup piece /export/rman/PROG/PROG_data_3hoebh6u_20130709
channel ORA_AUX_DISK_6: starting datafile backup set restore
channel ORA_AUX_DISK_6: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_6: restoring datafile 00007 to +data2
channel ORA_AUX_DISK_6: reading from backup piece /export/rman/PROG/PROG_data_3eoebh6u_20130709
channel ORA_AUX_DISK_7: starting datafile backup set restore
channel ORA_AUX_DISK_7: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_7: restoring datafile 00006 to +data2
channel ORA_AUX_DISK_7: reading from backup piece /export/rman/PROG/PROG_data_3doebh6u_20130709
channel ORA_AUX_DISK_8: starting datafile backup set restore
channel ORA_AUX_DISK_8: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_8: restoring datafile 00002 to +data2
channel ORA_AUX_DISK_8: reading from backup piece /export/rman/PROG/PROG_data_3boebh6u_20130709
channel ORA_AUX_DISK_1: piece handle=/export/rman/PROG/PROG_data_3foebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
channel ORA_AUX_DISK_3: piece handle=/export/rman/PROG/PROG_data_3ioebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_3: restored backup piece 1
channel ORA_AUX_DISK_3: restore complete, elapsed time: 00:00:16
channel ORA_AUX_DISK_4: piece handle=/export/rman/PROG/PROG_data_3goebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_4: restored backup piece 1
channel ORA_AUX_DISK_4: restore complete, elapsed time: 00:00:26
channel ORA_AUX_DISK_2: piece handle=/export/rman/PROG/PROG_data_3coebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_2: restored backup piece 1
channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:00:56
channel ORA_AUX_DISK_5: piece handle=/export/rman/PROG/PROG_data_3hoebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_5: restored backup piece 1
channel ORA_AUX_DISK_5: restore complete, elapsed time: 00:01:16
channel ORA_AUX_DISK_6: piece handle=/export/rman/PROG/PROG_data_3eoebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_6: restored backup piece 1
channel ORA_AUX_DISK_6: restore complete, elapsed time: 00:02:56
channel ORA_AUX_DISK_7: piece handle=/export/rman/PROG/PROG_data_3doebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_7: restored backup piece 1
channel ORA_AUX_DISK_7: restore complete, elapsed time: 00:04:46
channel ORA_AUX_DISK_8: piece handle=/export/rman/PROG/PROG_data_3boebh6u_20130709 tag=PROG2_ONLINE_20130709
channel ORA_AUX_DISK_8: restored backup piece 1
channel ORA_AUX_DISK_8: restore complete, elapsed time: 00:17:25
Finished restore at 10-JUL-13

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=820420579 file name=+DATA2/progrm/datafile/system.341.820419535
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=820420579 file name=+DATA2/progrm/datafile/sysaux.338.820419535
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=820420579 file name=+DATA2/progrm/datafile/undotbs1.344.820419533
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=820420579 file name=+DATA2/progrm/datafile/users.343.820419533
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=820420579 file name=+DATA2/progrm/datafile/undotbs2.355.820419533
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=820420580 file name=+DATA2/progrm/datafile/progdat.339.820419535
datafile 7 switched to datafile copy
input datafile copy RECID=16 STAMP=820420580 file name=+DATA2/progrm/datafile/progidx.340.820419535
datafile 8 switched to datafile copy
input datafile copy RECID=17 STAMP=820420580 file name=+DATA2/progrm/datafile/tools.342.820419533

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

executing command: SET until clause

Starting recover at 10-JUL-13
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

starting media recovery

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2228344 bytes
Variable Size                570429320 bytes
Database Buffers             490733568 bytes
Redo Buffers                   5545984 bytes

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

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

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/10/2013 14:36:36
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 2 with sequence 1916 and starting SCN of 8290829691557 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1915 and starting SCN of 8290829690849 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1914 and starting SCN of 8290829689398 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1913 and starting SCN of 8290829688737 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1912 and starting SCN of 8290829665623 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1911 and starting SCN of 8290829643315 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1910 and starting SCN of 8290829640164 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1909 and starting SCN of 8290829618968 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1908 and starting SCN of 8290829616120 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1907 and starting SCN of 8290829607848 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1906 and starting SCN of 8290829597219 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1905 and starting SCN of 8290829586022 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1904 and starting SCN of 8290829585014 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1903 and starting SCN of 8290829584851 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1902 and starting SCN of 8290829545257 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1901 and starting SCN of 8290829534071 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1900 and starting SCN of 8290829523298 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1899 and starting SCN of 8290829511311 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1898 and starting SCN of 8290829499366 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1897 and starting SCN of 8290829488618 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1896 and starting SCN of 8290829473173 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1895 and starting SCN of 8290829462094 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1894 and starting SCN of 8290829450117 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1893 and starting SCN of 8290829439309 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1892 and starting SCN of 8290829433102 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1891 and starting SCN of 8290829432265 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1890 and starting SCN of 8290829431979 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1889 and starting SCN of 8290814870564 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 1888 and starting SCN of 8290776135402 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2393 and starting SCN of 8290829688741 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2392 and starting SCN of 8290829640673 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2391 and starting SCN of 8290829608139 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2390 and starting SCN of 8290829585976 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2389 and starting SCN of 8290829535460 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2388 and starting SCN of 8290829502892 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2387 and starting SCN of 8290829465344 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2386 and starting SCN of 8290829433239 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2385 and starting SCN of 8290829431525 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2384 and starting SCN of 8290814851356 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2383 and starting SCN of 8290776135405 found to restore

RMAN>

So I cannot rely on rman’s default behavior to duplicate database, I need to tell rman the “until scn number”. I used the following script to get the scn number:

rcode=`${ORACLE_HOME}/bin/sqlplus -s sys/password@$TARGETDBNAME as sysdba <<- EOF
set heading off
SET VERIFY OFF
start ${CMDDIR}/rac_getscn_target.sql
EOF`
export rcode
echo "the scn number for $TARGETDBNAME in RMAN is :"$rcode
$ORACLE_HOME/bin/rman target sys/password@PROG auxiliary / <<- EOF
spool log to /home/oracle/dba/log/dup_progrm.log ;
duplicate target database to PROGRM until scn $rcode nofilenamecheck;
EOF
The rac_getscn_target.sql script is posted below, the return value is 8290776135402, it’s same as what I used to query rman catalog database.
-- this script should be run on target database during duplication process, it should not be run on rman catalog database.
col min(next_change#) format 999999999999999999
select min(next_change#) from
(select thread#,max(next_change#) next_change#
from v$backup_archivelog_details
group by thread#)
;

  MIN(NEXT_CHANGE#)
-------------------
      8290776135402
The script I used to get scn from rman catalog database is posted below, same result as the one above.
col min(next_change#) format 999999999999999999
select min(next_change#) from
(select thread#,max(next_change#) next_change#
from rc_backup_archivelog_details
where db_name='&&1' group by thread#)
;

After adjust the script, the duplication use the correct scn (the latest backed up archivelogs) and the duplication run successfully.
The rman output is posted below:

Spooling started in log file: /home/oracle/dba/log/dup_progrm.log

Recovery Manager11.2.0.3.0

RMAN> 2>
Starting Duplicate Db at 10-JUL-13
using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=195 device type=DISK allocated channel: ORA_AUX_DISK_2 channel ORA_AUX_DISK_2: SID=386 device type=DISK allocated channel: ORA_AUX_DISK_3 channel ORA_AUX_DISK_3: SID=576 device type=DISK allocated channel: ORA_AUX_DISK_4 channel ORA_AUX_DISK_4: SID=767 device type=DISK allocated channel: ORA_AUX_DISK_5 channel ORA_AUX_DISK_5: SID=960 device type=DISK allocated channel: ORA_AUX_DISK_6 channel ORA_AUX_DISK_6: SID=1150 device type=DISK allocated channel: ORA_AUX_DISK_7 channel ORA_AUX_DISK_7: SID=1341 device type=DISK allocated channel: ORA_AUX_DISK_8 channel ORA_AUX_DISK_8: SID=4 device type=DISK

contents of Memory Script:
{
   set until scn  8290776135402;
   sql clone "alter system set  control_files =
  ''+DATA2/progrm/controlfile/current.356.820419507'', ''+FRA2/progrm/controlfile/current.305.820419507'' comment=  ''Set by RMAN'' scope=spfile";
   sql clone "alter system set  db_name =  ''PROG'' comment=  ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =  ''PROGRM'' comment=  ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile;
   alter clone database mount;
}
executing Memory Script

executing command: SET until clause

sql statement: alter system set  control_files =   ''+DATA2/progrm/controlfile/current.356.820419507'', ''+FRA2/progrm/controlfile/current.305.820419507'' comment= ''Set by RMAN'' scope=spfile

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2228344 bytes
Variable Size                570429320 bytes
Database Buffers             490733568 bytes
Redo Buffers                   5545984 bytes

Starting restore at 10-JUL-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=194 device type=DISK allocated channel: ORA_AUX_DISK_2 channel ORA_AUX_DISK_2: SID=386 device type=DISK allocated channel: ORA_AUX_DISK_3 channel ORA_AUX_DISK_3: SID=576 device type=DISK allocated channel: ORA_AUX_DISK_4 channel ORA_AUX_DISK_4: SID=769 device type=DISK allocated channel: ORA_AUX_DISK_5 channel ORA_AUX_DISK_5: SID=958 device type=DISK allocated channel: ORA_AUX_DISK_6 channel ORA_AUX_DISK_6: SID=1150 device type=DISK allocated channel: ORA_AUX_DISK_7 channel ORA_AUX_DISK_7: SID=1341 device type=DISK allocated channel: ORA_AUX_DISK_8 channel ORA_AUX_DISK_8: SID=4 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: restoring control file channel ORA_AUX_DISK_1: reading from backup piece /export/rman/PROG/PROG_c-354910189-20130709-00
channel ORA_AUX_DISK_1: piece handle=/export/rman/PROG/PROG_c-354910189-20130709-00 tag=TAG20130709T230048 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02 output file name=+DATA2/progrm/controlfile/current.356.820419507
output file name=+FRA2/progrm/controlfile/current.305.820419507
Finished restore at 10-JUL-13

database mounted
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

contents of Memory Script:
{
   set until scn  8290776135402;
   sql clone 'alter database flashback off';
   set newname for datafile  1 to
 "+data2";
   set newname for datafile  2 to
 "+data2";
   set newname for datafile  3 to
 "+data2";
   set newname for datafile  4 to
 "+data2";
   set newname for datafile  5 to
 "+data2";
   set newname for datafile  6 to
 "+data2";
   set newname for datafile  7 to
 "+data2";
   set newname for datafile  8 to
 "+data2";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database flashback off

executing command: SET NEWNAME

executing command: SET NEWNAME

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 restore at 10-JUL-13
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00005 to +data2 channel ORA_AUX_DISK_1: reading from backup piece /export/rman/PROG/PROG_data_3foebh6u_20130709
channel ORA_AUX_DISK_2: starting datafile backup set restore channel ORA_AUX_DISK_2: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_2: restoring datafile 00003 to +data2 channel ORA_AUX_DISK_2: reading from backup piece /export/rman/PROG/PROG_data_3coebh6u_20130709
channel ORA_AUX_DISK_3: starting datafile backup set restore channel ORA_AUX_DISK_3: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_3: restoring datafile 00004 to +data2 channel ORA_AUX_DISK_3: reading from backup piece /export/rman/PROG/PROG_data_3ioebh6u_20130709
channel ORA_AUX_DISK_4: starting datafile backup set restore channel ORA_AUX_DISK_4: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_4: restoring datafile 00008 to +data2 channel ORA_AUX_DISK_4: reading from backup piece /export/rman/PROG/PROG_data_3goebh6u_20130709
channel ORA_AUX_DISK_5: starting datafile backup set restore channel ORA_AUX_DISK_5: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_5: restoring datafile 00001 to +data2 channel ORA_AUX_DISK_5: reading from backup piece /export/rman/PROG/PROG_data_3hoebh6u_20130709
channel ORA_AUX_DISK_6: starting datafile backup set restore channel ORA_AUX_DISK_6: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_6: restoring datafile 00007 to +data2 channel ORA_AUX_DISK_6: reading from backup piece /export/rman/PROG/PROG_data_3eoebh6u_20130709
channel ORA_AUX_DISK_7: starting datafile backup set restore channel ORA_AUX_DISK_7: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_7: restoring datafile 00006 to +data2 channel ORA_AUX_DISK_7: reading from backup piece /export/rman/PROG/PROG_data_3doebh6u_20130709
channel ORA_AUX_DISK_8: starting datafile backup set restore channel ORA_AUX_DISK_8: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_8: restoring datafile 00002 to +data2 channel ORA_AUX_DISK_8: reading from backup piece /export/rman/PROG/PROG_data_3boebh6u_20130709
channel ORA_AUX_DISK_1: piece handle=/export/rman/PROG/PROG_data_3foebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08 channel ORA_AUX_DISK_3: piece handle=/export/rman/PROG/PROG_data_3ioebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_3: restored backup piece 1 channel ORA_AUX_DISK_3: restore complete, elapsed time: 00:00:26 channel ORA_AUX_DISK_4: piece handle=/export/rman/PROG/PROG_data_3goebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_4: restored backup piece 1 channel ORA_AUX_DISK_4: restore complete, elapsed time: 00:00:26 channel ORA_AUX_DISK_2: piece handle=/export/rman/PROG/PROG_data_3coebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_2: restored backup piece 1 channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:01:06 channel ORA_AUX_DISK_5: piece handle=/export/rman/PROG/PROG_data_3hoebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_5: restored backup piece 1 channel ORA_AUX_DISK_5: restore complete, elapsed time: 00:01:16 channel ORA_AUX_DISK_6: piece handle=/export/rman/PROG/PROG_data_3eoebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_6: restored backup piece 1 channel ORA_AUX_DISK_6: restore complete, elapsed time: 00:03:06 channel ORA_AUX_DISK_7: piece handle=/export/rman/PROG/PROG_data_3doebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_7: restored backup piece 1 channel ORA_AUX_DISK_7: restore complete, elapsed time: 00:04:56 channel ORA_AUX_DISK_8: piece handle=/export/rman/PROG/PROG_data_3boebh6u_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_8: restored backup piece 1 channel ORA_AUX_DISK_8: restore complete, elapsed time: 00:17:35 Finished restore at 10-JUL-13

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=820426099 file name=+DATA2/progrm/datafile/system.342.820425043
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=820426099 file name=+DATA2/progrm/datafile/sysaux.355.820425043
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=820426099 file name=+DATA2/progrm/datafile/undotbs1.339.820425043
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=820426099 file name=+DATA2/progrm/datafile/users.340.820425043
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=820426099 file name=+DATA2/progrm/datafile/undotbs2.338.820425043
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=820426099 file name=+DATA2/progrm/datafile/progdat.344.820425043
datafile 7 switched to datafile copy
input datafile copy RECID=16 STAMP=820426099 file name=+DATA2/progrm/datafile/progidx.343.820425043
datafile 8 switched to datafile copy
input datafile copy RECID=17 STAMP=820426099 file name=+DATA2/progrm/datafile/tools.341.820425043

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

executing command: SET until clause

Starting recover at 10-JUL-13
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: restoring archived log archived log thread=2 sequence=1886 channel ORA_AUX_DISK_1: reading from backup piece /export/rman/PROG/PROG_arch_39oebh5h_20130709

channel ORA_AUX_DISK_2: starting archived log restore to default destination channel ORA_AUX_DISK_2: restoring archived log archived log thread=1 sequence=2381 channel ORA_AUX_DISK_2: reading from backup piece /export/rman/PROG/PROG_arch_3aoebh5h_20130709

channel ORA_AUX_DISK_3: starting archived log restore to default destination channel ORA_AUX_DISK_3: restoring archived log archived log thread=1 sequence=2382 channel ORA_AUX_DISK_3: reading from backup piece /export/rman/PROG/PROG_arch_3joebif9_20130709

channel ORA_AUX_DISK_4: starting archived log restore to default destination channel ORA_AUX_DISK_4: restoring archived log archived log thread=2 sequence=1887 channel ORA_AUX_DISK_4: reading from backup piece /export/rman/PROG/PROG_arch_3koebif9_20130709

channel ORA_AUX_DISK_2: piece handle=/export/rman/PROG/PROG_arch_3aoebh5h_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_2: restored backup piece 1 channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:00:01 archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_1_seq_2381.307.820426103 thread=1 sequence=2381 channel ORA_AUX_DISK_3: piece handle=/export/rman/PROG/PROG_arch_3joebif9_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_3: restored backup piece 1 channel ORA_AUX_DISK_3: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_4: piece handle=/export/rman/PROG/PROG_arch_3koebif9_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_4: restored backup piece 1 channel ORA_AUX_DISK_4: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: piece handle=/export/rman/PROG/PROG_arch_39oebh5h_20130709 tag=PROG2_ONLINE_20130709 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15 archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_2_seq_1886.301.820426103 thread=2 sequence=1886 channel clone_default: deleting archived log(s) archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_1_seq_2381.307.820426103 RECID=5880 STAMP=820426103 archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_1_seq_2382.306.820426103 thread=1 sequence=2382 channel clone_default: deleting archived log(s) archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_2_seq_1886.301.820426103 RECID=5883 STAMP=820426118 archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_2_seq_1887.308.820426103 thread=2 sequence=1887 channel clone_default: deleting archived log(s) archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_1_seq_2382.306.820426103 RECID=5881 STAMP=820426103 channel clone_default: deleting archived log(s) archived log file name=+FRA2/progrm/archivelog/2013_07_10/thread_2_seq_1887.308.820426103 RECID=5882 STAMP=820426104 media recovery complete, elapsed time: 00:00:02 Finished recover at 10-JUL-13 Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2228344 bytes
Variable Size                574623624 bytes
Database Buffers             486539264 bytes
Redo Buffers                   5545984 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =  ''PROGRM'' 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

sql statement: alter system set  db_name =  ''PROGRM'' 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    1068937216 bytes

Fixed Size                     2228344 bytes
Variable Size                574623624 bytes
Database Buffers             486539264 bytes
Redo Buffers                   5545984 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "PROGRM" RESETLOGS ARCHIVELOG
  MAXLOGFILES    192
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES    32
  MAXLOGHISTORY      584
 LOGFILE
  GROUP   1 ( '+data2', '+fra' ) SIZE 100 M  REUSE,
  GROUP   2 ( '+data2', '+fra' ) SIZE 100 M  REUSE,
  GROUP   3 ( '+data2', '+fra' ) SIZE 100 M  REUSE
 DATAFILE
  '+DATA2/progrm/datafile/system.342.820425043'
 CHARACTER SET US7ASCII

sql statement: ALTER DATABASE ADD LOGFILE
 
 
  INSTANCE 'i2'
  GROUP   4 ( '+data2', '+fra' ) SIZE 100 M  REUSE,
  GROUP   5 ( '+data2', '+fra' ) SIZE 100 M  REUSE,
  GROUP   6 ( '+data2', '+fra' ) SIZE 100 M  REUSE

contents of Memory Script:
{
   set newname for tempfile  1 to
 "+data2";
   set newname for tempfile  2 to
 "+data2";
   switch clone tempfile all;
   catalog clone datafilecopy  "+DATA2/progrm/datafile/sysaux.355.820425043",
 "+DATA2/progrm/datafile/undotbs1.339.820425043",
 "+DATA2/progrm/datafile/users.340.820425043",
 "+DATA2/progrm/datafile/undotbs2.338.820425043",
 "+DATA2/progrm/datafile/progdat.344.820425043",
 "+DATA2/progrm/datafile/progidx.343.820425043",
 "+DATA2/progrm/datafile/tools.341.820425043";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to +data2 in control file renamed tempfile 2 to +data2 in control file

cataloged datafile copy
datafile copy file name=+DATA2/progrm/datafile/sysaux.355.820425043 RECID=1 STAMP=820426142 cataloged datafile copy datafile copy file name=+DATA2/progrm/datafile/undotbs1.339.820425043 RECID=2 STAMP=820426142 cataloged datafile copy datafile copy file name=+DATA2/progrm/datafile/users.340.820425043 RECID=3 STAMP=820426142 cataloged datafile copy datafile copy file name=+DATA2/progrm/datafile/undotbs2.338.820425043 RECID=4 STAMP=820426143 cataloged datafile copy datafile copy file name=+DATA2/progrm/datafile/progdat.344.820425043 RECID=5 STAMP=820426143 cataloged datafile copy datafile copy file name=+DATA2/progrm/datafile/progidx.343.820425043 RECID=6 STAMP=820426143 cataloged datafile copy datafile copy file name=+DATA2/progrm/datafile/tools.341.820425043 RECID=7 STAMP=820426143

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=820426142 file name=+DATA2/progrm/datafile/sysaux.355.820425043
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=820426142 file name=+DATA2/progrm/datafile/undotbs1.339.820425043
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=820426142 file name=+DATA2/progrm/datafile/users.340.820425043
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=820426143 file name=+DATA2/progrm/datafile/undotbs2.338.820425043
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=820426143 file name=+DATA2/progrm/datafile/progdat.344.820425043
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=820426143 file name=+DATA2/progrm/datafile/progidx.343.820425043
datafile 8 switched to datafile copy
input datafile copy RECID=7 STAMP=820426143 file name=+DATA2/progrm/datafile/tools.341.820425043
Reenabling controlfile options for auxiliary database
Executing: alter database force logging

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

database opened
Executing: alter database flashback on
Finished Duplicate Db at 10-JUL-13

RMAN>

Recovery Manager complete.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1068937216 bytes                                      
Fixed Size                  2228344 bytes                                      
Variable Size             574623624 bytes                                      
Database Buffers          486539264 bytes                                      
Redo Buffers                5545984 bytes                                      
Database mounted.
SQL> alter database flashback off;

Database altered.

SQL> alter database noarchivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL>




Comments

Popular posts from this blog

Opatch apply/lsinventory error: oneoff is corrupted or does not exist

I am applying the quarterly patch for 19c RDBMS, I tried using napply but failed, but somehow it corrupted the inventory though nothing applied. further apply and lsinventory command ran into error like this: $ ./OPatch/opatch lsinventory Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation.  All rights reserved. Oracle Home       : /u02/app/oracle/19.0.0 Central Inventory : /u01/app/oraInventory    from           : /u02/app/oracle/19.0.0/oraInst.loc OPatch version    : 12.2.0.1.21 OUI version       : 12.2.0.7.0 Log file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/opatch2020-09-08_13-35-59PM_1.log Lsinventory Output file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/lsinv/lsinventory2020-09-08_13-35-59PM.txt -------------------------------------------------------------------------------- Inventory load failed... OPatch cannot load inventory for the given Oracle Home. LsInventorySession failed: Unable to create patchObject Possible ca

non-existent process lock port on windows server

I have a database link created between oracle and sqlserver using oracle tg4odbc, the product is installed on windows server and run as service "OracleOraGtw11g_home1TNSListener", but sometime the service cannot started, the root cause of this problem is that the port number 1521 is used by an non-existent process. The first step is to use netstat -bano|find "1521" to get the process id, in my case it's 5844, which shows the connection is from my oracle server 10.8.0.169 H:\>netstat -bano|find "1521"   TCP    0.0.0.0:1521           0.0.0.0:0              LISTENING       5844   TCP    10.14.45.33:1521       10.8.0.169:42987       ESTABLISHED     5844 however the process id does not show in either task manager or process explorer. The next step is to run tcpview, which shows non-existent under process column, there are three rows, two show status as "listening", the other one shows status "established", right click and k

oracle dba_hist_sysmetric_summary

found this blog is helpful to get CPU and IO statistics on oracle database. http://shob-dbadmin.blogspot.ca/2012/12/how-to-find-total-io-of-database.html courtesy to  Shomil Bansal , below are hist writing, not mine. How to find total IO of the database instance Total IO of database instance is sum of the physical reads, physical writes and redo writes. There are several views to find these values. v$sysmetric  - Reports metric values for only the most current time sample 60 secs. v$sysmetric_summary  - Reports metric values for time sample of 1 hour. v$sysmetric_history  - Reports metric values every 60 sec from the time instance is up. Better way to analyse IO using this view to take deltas between two time periods. dba_hist_sysmetric_history  - All the above views are refreshed when the instance is restarted. This view, part of AWR, stores the historical stats. I have used this view for my report. Query: ====== set lines 350 pages 50 feedback off set markup html