To perform cancel-based recovery

RMAN> rman target / auxiliary sys/oracle@ROJA nocatalog

Recovery Manager: Release 10.2.0.2.0 - Production on Sun Nov 30 23:12:56 2008

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

connected to target database: PROD (DBID=78671012)
using target database control file instead of recovery catalog
connected to auxiliary database: ROJA (not mounted)


RMAN> @/u02/oracle/visarch/clone.rcv

RMAN> run
2> {
3> allocate auxiliary channel aux1 device type disk format '/u02/oracle/visarch';
4> allocate auxiliary channel aux2 device type disk format '/u02/oracle/visarch';
5> allocate auxiliary channel aux3 device type disk format '/u02/oracle/visarch';
6> allocate auxiliary channel aux4 device type disk format '/u02/oracle/visarch';
7> duplicate target database to "ROJA";
8> }
allocated channel: aux1
channel aux1: sid=386 devtype=DISK

allocated channel: aux2
channel aux2: sid=385 devtype=DISK

allocated channel: aux3
channel aux3: sid=384 devtype=DISK

allocated channel: aux4
channel aux4: sid=383 devtype=DISK

Starting Duplicate Db at 30-NOV-08

contents of Memory Script:


{
set until scn 5965096246191;
set newname for datafile 1 to
"/u01/oramgr/PROD/db/rojadata/system01.dbf";
set newname for datafile 2 to
"/u01/oramgr/PROD/db/rojadata/system02.dbf";
set newname for datafile 3 to
"/u01/oramgr/PROD/db/rojadata/system03.dbf";
set newname for datafile 4 to
"/u01/oramgr/PROD/db/rojadata/system04.dbf";
set newname for datafile 5 to
"/u01/oramgr/PROD/db/rojadata/system05.dbf";

.
.
.
.
.
.
.
.
.


"/u01/oramgr/PROD/db/rojadata/a_txn_ind04.dbf";
set newname for datafile 406 to
"/u01/oramgr/PROD/db/rojadata/a_txn_ind05.dbf";
set newname for datafile 407 to
"/u01/oramgr/PROD/db/rojadata/a_ref02.dbf";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME
.
.
.
.
.
.
.


executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 30-NOV-08

channel aux1: starting datafile backupset restore
channel aux1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/oramgr/PROD/db/rojadata/system01.dbf
restoring datafile 00002 to /u01/oramgr/PROD/db/rojadata/system02.dbf
restoring datafile 00003 to /u01/oramgr/PROD/db/rojadata/system03.dbf
restoring datafile 00004 to /u01/oramgr/PROD/db/rojadata/system04.dbf
.
.
.
.
.
.

restoring datafile 00406 to /u01/oramgr/PROD/db/rojadata/a_txn_ind05.dbf
restoring datafile 00407 to /u01/oramgr/PROD/db/rojadata/a_ref02.dbf
channel aux1: reading from backup piece /u02/oracle/visarch/datafile_t672174776_s1_p1
channel aux1: restored backup piece 1
piece handle=/u02/oracle/visarch/datafile_t672174776_s1_p1 tag=TAG20081130T191256
channel aux1: restore complete, elapsed time: 00:24:57
Finished restore at 30-NOV-08
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ROJA" RESETLOGS ARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 5
MAXDATAFILES 512
MAXINSTANCES 8
MAXLOGHISTORY 14607
LOGFILE
GROUP 1 ( '/u01/oramgr/PROD/db/rojadata/log01a.dbf', '/u01/oramgr/PROD/db/rojadata/log01b.dbf' ) SIZE 1000 M REUSE,
GROUP 2 ( '/u01/oramgr/PROD/db/rojadata/log02a.dbf', '/u01/oramgr/PROD/db/rojadata/log02b.dbf' ) SIZE 1000 M REUSE
DATAFILE
'/u01/oramgr/PROD/db/rojadata/system01.dbf'
CHARACTER SET US7ASCII


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

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=672190745 filename=/u01/oramgr/PROD/db/rojadata/system02.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=672190745 filename=/u01/oramgr/PROD/db/rojadata/system03.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=672190745 filename=/u01/oramgr/PROD/db/rojadata/system04.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=672190745 filename=/u01/oramgr/PROD/db/rojadata/system05.dbf
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=672190745 filename=/u01/oramgr/PROD/db/rojadata/ctxd01.dbf
.

.
.
.
.
.


datafile 406 switched to datafile copy
input datafile copy recid=41 stamp=672190747 filename=/u01/oramgr/PROD/db/rojadata/a_txn_ind05.dbf
datafile 407 switched to datafile copy
input datafile copy recid=42 stamp=672190747 filename=/u01/oramgr/PROD/db/rojadata/a_ref02.dbf

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

executing command: SET until clause

Starting recover at 30-NOV-08

starting media recovery

channel aux1: starting archive log restore to default destination
channel aux1: restoring archive log
archive log thread=1 sequence=6
channel aux1: restoring archive log
archive log thread=1 sequence=7
channel aux1: reading from backup piece /u02/oracle/backup/VIS_arch_3_672176329_%r.arc
ORA-19870: error reading backup piece /u02/oracle/backup/VIS_arch_3_672176329_%r.arc
ORA-19505: failed to identify file "/u02/oracle/backup/VIS_arch_3_672176329_%r.arc"
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory

Additional information: 3
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/oramgr/PROD/db/rojadata/system01.dbf'


released channel: aux1
released channel: aux2
released channel: aux3
released channel: aux4
RMAN-00571: ===========================================================
RMAN-00569: ERROR MESSAGE STACK FOLLOWS
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/30/2008 23:40:08
RMAN-03015: error occurred in stored script Memory Script
RMAN-20506: no backup of archivelog found
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 7 lowscn 5965096246186 found to restore
RMAN-06025: no backup of log thread 1 seq 6 lowscn 5965096244536 found to restore

RMAN>
RMAN> **end-of-file**

RMAN> exit


Recovery Manager complete.

*********************************************************************
To perform cancel-based recovery:

1. Start SQL*Plus and connect to Oracle with administrator privileges. For example, enter:
sqlplus '/ AS SYSDBA'

2. Start a new instance and mount the database:

STARTUP MOUNT

3. Begin cancel-based recovery by issuing the following command:

If you are using a backup control file with this incomplete recovery, then specify the USING BACKUP CONTROLFILE option in the RECOVER command.

SQL> RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE


--------------------------------------------------------------------------------
Note:
If you fail to specify the UNTIL clause on the RECOVER command, then you will not be able to open the database until a complete recovery is done.

--------------------------------------------------------------------------------


4. Oracle applies the necessary redo log files to reconstruct the restored datafiles. Oracle supplies the name it expects to find from LOG_ARCHIVE_DEST_1 and requests you to stop or proceed with applying the log file. Note that if the control file is a backup, then you must supply the names of the online logs if you want to apply the changes in these logs.


--------------------------------------------------------------------------------
Note:
If you use an Oracle Real Application Clusters configuration, and you are performing incomplete recovery or using a backup control file, then Oracle can only compute the name of the first archived redo log file from the first thread. The first redo log file from the other threads must be supplied by the user. After the first log file in a given thread has been supplied, Oracle can suggest the names of the subsequent log files in this thread.

--------------------------------------------------------------------------------


5. Continue applying redo log files until the last log has been applied to the restored datafiles, then cancel recovery by executing the following command:
CANCEL


Oracle returns a message indicating whether recovery is successful. Note that if you cancel recovery before all the datafiles have been recovered to a consistent SCN and then t rtry to open the database, you will get an ORA-1113 error if more recovery is necessary for the file. You can query V$RECOVER_FILE to determine whether more recovery is needed, or if a backup of a datafile was not restored prior to starting incomplete recovery.

6. Open the database in RESETLOGS mode. You must always reset the online logs after incomplete recovery or recovery with a backup control file. For example, enter:
ALTER DATABASE OPEN RESETLOGS;"


You copy that archivelog and change log name and apply it

cp PROD_arch_6_1_666832683.arc5 /u01/oramgr/PROD/db/tech_st/10.2.0/dbs/arch1_6_666832683.dbf
cp PROD_arch_7_1_666832683.arc6 /u01/oramgr/PROD/db/tech_st/10.2.0/dbs/arch1_7_666832683.dbf


Database is now mount stage, so controlfile created sucessfully, but database unable to open.
So we need to apply the archivelog files, you just apply two or more archive log and type cancel.

SQL> select open_mode from v$database;

OPEN_MODE
----------
MOUNTED

SQL> RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE

ORA-00279: change 5965096245461 generated at 11/30/2008 19:12:57 needed for
thread 1
ORA-00289: suggestion :
/u01/oramgr/PROD/db/tech_st/10.2.0/dbs/arch1_6_666832683.dbf
ORA-00280: change 5965096245461 for thread 1 is in sequence #6


Specify log: {=suggested filename AUTO CANCEL}
arch1_6_666832683.dbf
ORA-00279: change 5965096246186 generated at 11/30/2008 19:38:46 needed for
thread 1
ORA-00289: suggestion :
/u01/oramgr/PROD/db/tech_st/10.2.0/dbs/arch1_7_666832683.dbf
ORA-00280: change 5965096246186 for thread 1 is in sequence #7
ORA-00278: log file 'arch1_6_666832683.dbf' no longer needed for this recovery


Specify log: {=suggested filename AUTO CANCEL}
arch1_7_666832683.dbf
ORA-00279: change 5965096246191 generated at 11/30/2008 19:38:47 needed for
thread 1
ORA-00289: suggestion :
/u01/oramgr/PROD/db/tech_st/10.2.0/dbs/arch1_8_666832683.dbf
ORA-00280: change 5965096246191 for thread 1 is in sequence #8
ORA-00278: log file 'arch1_7_666832683.dbf' no longer needed for this recovery


Specify log: {=suggested filename AUTO CANCEL}
CANCEL (Here i typed Cancel), Now recovery is canceld and Database is now consistent stage.
Then try resetlogs.
Media recovery cancelled.

SQL> ALTER DATABASE OPEN RESETLOGS;

Database altered.

Finally bounce and startup the database.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size 1264892 bytes
Variable Size 427819780 bytes
Database Buffers 633339904 bytes
Redo Buffers 11317248 bytes
Database mounted.
Database opened.