Category Archives: RMAN Recovery Options

Migrate Database without OPEN RESETLOGS

Please find below an example for how to migrate a Database to another ser using RMAN BACKUPS and without use OPEN RESETLOGS option.

Database: db01
Source Server: srv001
Target Server: srv002

1.) Copy Password File from Source to Target;

[oracle@srv001 dbs]$ scp orapwdb01 oracle@srv002:/opt/oracle/product/11.2.0.3/dbhome_1/dbs
The authenticity of host ‘srv002 (10.163.3.14)’ can’t be established.
RSA key fingerprint is 2f:60:86:4a:3f:7c:16:97:8d:d8:6e:21:f5:27:a5:75.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘srv002,10.163.3.14’ (RSA) to the list of known hosts.
oracle@srv002’s password:
orapwdb01 100% 1536 1.5KB/s 00:00

2.) Copy init.ora Source to Target

[oracle@srv001 dbs]$ sql

SQL*Plus: Release 12.1.0.2.0 Production on Fri May 18 14:24:17 2018

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

 

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create pfile=’initcheck.ora’ from spfile;

File created.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@srv001 dbs]$ ls -tlr
total 24
-rw-r–r–. 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r—–. 1 oracle oinstall 24 May 18 14:11 lkDB01
-rw-r—–. 1 oracle oinstall 1536 May 18 14:13 orapwdb01
-rw-rw—-. 1 oracle oinstall 1544 May 18 14:15 hc_db01.dat
-rw-r—–. 1 oracle oinstall 2560 May 18 14:16 spfiledb01.ora
-rw-r–r–. 1 oracle oinstall 947 May 18 14:24 initcheck.ora
[oracle@srv001 dbs]$ scp initcheck.ora oracle@srv002:/opt/oracle/product/11.2.0.3/dbhome_1/dbs
oracle@srv002’s password:
initcheck.ora 100% 947 0.9KB/s 00:00
[oracle@srv001 dbs]$

[oracle@srv002 dbs]$ ls -ltr
total 12
-rw-r–r– 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r—– 1 oracle oinstall 1536 May 18 14:19 orapwdb01
-rw-r–r– 1 oracle oinstall 947 May 18 14:22 initcheck.ora
[oracle@srv002 dbs]$ mv initcheck.ora initdb01.ora

3.) Adjust the Init parameters in the target:

Check all directories also

4.) Backup Source Database:

rman target /

RMAN> backup incremental level 0 database plus archivelog delete input;

 

Starting backup at 18-MAY-18
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=144 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=7 RECID=1 STAMP=976458696
channel ORA_DISK_1: starting piece 1 at 18-MAY-18
channel ORA_DISK_1: finished piece 1 at 18-MAY-18
piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T143136_fhxkx8g8_.bkp tag=TAG20180518T143136 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_7_fhxkx7nv_.arc RECID=1 STAMP=976458696
Finished backup at 18-MAY-18

Starting backup at 18-MAY-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/opt/oracle/oradata/db01/system01.dbf
input datafile file number=00002 name=/opt/oracle/oradata/db01/sysaux01.dbf
input datafile file number=00003 name=/opt/oracle/oradata/db01/undotbs01.dbf
input datafile file number=00004 name=/opt/oracle/oradata/db01/users01.dbf
channel ORA_DISK_1: starting piece 1 at 18-MAY-18
channel ORA_DISK_1: finished piece 1 at 18-MAY-18
piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_nnnd0_TAG20180518T143137_fhxkx9sn_.bkp tag=TAG20180518T143137 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 18-MAY-18

Starting backup at 18-MAY-18
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=2 STAMP=976458712
channel ORA_DISK_1: starting piece 1 at 18-MAY-18
channel ORA_DISK_1: finished piece 1 at 18-MAY-18
piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T143152_fhxkxs1y_.bkp tag=TAG20180518T143152 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_8_fhxkxrvy_.arc RECID=2 STAMP=976458712
Finished backup at 18-MAY-18

Starting Control File and SPFILE Autobackup at 18-MAY-18
piece handle=/opt/oracle/fast_recovery_area/DB01/autobackup/2018_05_18/o1_mf_s_976458714_fhxkxxhy_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAY-18

 

5) Copy the Backup to target

RMAN> list backup of database;

List of Backup Sets
===================

 

BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
8 Incr 0 1.09G DISK 00:00:13 18-MAY-18
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20180518T153053
Piece Name: /opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_nnnd0_TAG20180518T153053_fhxodg74_.bkp
List of Datafiles in backup set 8
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ——— —-
1 0 Incr 1066831 18-MAY-18 /opt/oracle/oradata/db01/system01.dbf
2 0 Incr 1066831 18-MAY-18 /opt/oracle/oradata/db01/sysaux01.dbf
3 0 Incr 1066831 18-MAY-18 /opt/oracle/oradata/db01/undotbs01.dbf
4 0 Incr 1066831 18-MAY-18 /opt/oracle/oradata/db01/users01.dbf

RMAN> list backup of controlfile;

 

List of Backup Sets
===================

 

BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
10 Full 9.36M DISK 00:00:03 18-MAY-18
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20180518T153110
Piece Name: /opt/oracle/fast_recovery_area/DB01/autobackup/2018_05_18/o1_mf_s_976462270_fhxodz38_.bkp
Control File Included: Ckp SCN: 1066849 Ckp time: 18-MAY-18

[oracle@srv001 DB01]$ pwd
/opt/oracle/fast_recovery_area/DB01
[oracle@srv001 DB01]$ ls -tlr
total 16
drwxr-x—. 2 oracle oinstall 4096 May 18 14:11 onlinelog
drwxr-x—. 3 oracle oinstall 4096 May 18 14:31 archivelog
drwxr-x—. 3 oracle oinstall 4096 May 18 14:31 backupset
drwxr-x—. 3 oracle oinstall 4096 May 18 14:31 autobackup
[oracle@srv001 DB01]$ pwd
/opt/oracle/fast_recovery_area/DB01
[oracle@srv001 DB01]$ tar -cvf backup.tar *
archivelog/
archivelog/2018_05_18/
autobackup/
autobackup/2018_05_18/
autobackup/2018_05_18/o1_mf_s_976458714_fhxkxxhy_.bkp
backupset/
backupset/2018_05_18/
backupset/2018_05_18/o1_mf_annnn_TAG20180518T143152_fhxkxs1y_.bkp
backupset/2018_05_18/o1_mf_nnnd0_TAG20180518T143137_fhxkx9sn_.bkp
backupset/2018_05_18/o1_mf_annnn_TAG20180518T143136_fhxkx8g8_.bkp
onlinelog/

target:
mkdir -p /opt/oracle/fast_recovery_area/DB01

source:
[oracle@srv001 DB01]$ pwd
/opt/oracle/fast_recovery_area/DB01
[oracle@srv001 DB01]$ scp backup.tar oracle@srv002:/opt/oracle/fast_recovery_area/DB01
oracle@srv002’s password:
backup.tar 100% 1152MB 115.2MB/s 00:10

Target:
[oracle@srv002 dbs]$ cd /opt/oracle/fast_recovery_area/DB01
[oracle@srv002 DB01]$ ls -ltr
total 1180072
-rw-r–r– 1 oracle oinstall 1208381440 May 18 14:34 backup.tar
[oracle@srv002 DB01]$
[oracle@srv002 DB01]$
[oracle@srv002 DB01]$ tar -xvf backup.tar
archivelog/
archivelog/2018_05_18/
autobackup/
autobackup/2018_05_18/
autobackup/2018_05_18/o1_mf_s_976458714_fhxkxxhy_.bkp
backupset/
backupset/2018_05_18/
backupset/2018_05_18/o1_mf_annnn_TAG20180518T143152_fhxkxs1y_.bkp
backupset/2018_05_18/o1_mf_nnnd0_TAG20180518T143137_fhxkx9sn_.bkp
backupset/2018_05_18/o1_mf_annnn_TAG20180518T143136_fhxkx8g8_.bkp
onlinelog/

6.) Set the environment variable

[oracle@srv002 dbhome_1]$ . oraenv
ORACLE_SID = [cdb01] ? db01
The Oracle base remains unchanged with value /opt/oracle

7.) Restore Controlfile into the target:

[oracle@srv002 dbhome_1]$ sql

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 18 14:38:59 2018

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

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 281019576 bytes
Database Buffers 780140544 bytes
Redo Buffers 5541888 bytes

 

Using the “LIST BACKUP OF CONTROLFILE: command execute on the Source, restore the file:

rman target /
restore controlfile from ‘/opt/oracle/fast_recovery_area/DB01/autobackup/2018_05_18/o1_mf_s_976458714_fhxkxxhy_.bkp’;

Starting restore at 18-MAY-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/opt/oracle/oradata/db01/control01.ctl
output file name=/opt/oracle/fast_recovery_area/db01/control02.ctl
Finished restore at 18-MAY-18

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

8.) Restore Database:

RMAN> restore database;

Starting restore at 18-MAY-18
Starting implicit crosscheck backup at 18-MAY-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 18-MAY-18

Starting implicit crosscheck copy at 18-MAY-18
using channel ORA_DISK_1
Finished implicit crosscheck copy at 18-MAY-18

searching for all files in the recovery area
cataloging files…
cataloging done

List of Cataloged Files
=======================
File Name: /opt/oracle/fast_recovery_area/DB01/autobackup/2018_05_18/o1_mf_s_976462270_fhxodz38_.bkp

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /opt/oracle/oradata/db01/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /opt/oracle/oradata/db01/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /opt/oracle/oradata/db01/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /opt/oracle/oradata/db01/users01.dbf
channel ORA_DISK_1: reading from backup piece /opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_nnnd0_TAG20180518T153053_fhxodg74_.bkp
channel ORA_DISK_1: piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_nnnd0_TAG20180518T153053_fhxodg74_.bkp tag=TAG20180518T153053
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 18-MAY-18

 

9.) Simulating operations on Production

Target:

SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
————–
8
Source:

SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
————–
8

SQL> alter system switch logfile;

System altered.

SQL> create user x identified by x;

User created.

SQL> grant dba to x;

Grant succeeded.

SQL> create table x.t1 as select * from dba_users;

Table created.

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

 

10) compare Archivelog Sequence:
Source:
SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
————–
13

 

Target:
SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
————–
8

 

SQL>

11.) Take the last backup

SOurce:

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 281019576 bytes
Database Buffers 780140544 bytes
Redo Buffers 5541888 bytes
Database mounted.

[oracle@srv001 ~]$ $ORACLE_HOME/bin/rman target /

Recovery Manager: Release 11.2.0.3.0 – Production on Fri May 18 16:09:30 2018

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

connected to target database: DB01 (DBID=1607725526, not open)

RMAN> backup archivelog all delete input;

Starting backup at 18-MAY-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=15 STAMP=976464537
input archived log thread=1 sequence=22 RECID=16 STAMP=976464538
input archived log thread=1 sequence=23 RECID=17 STAMP=976464541
channel ORA_DISK_1: starting piece 1 at 18-MAY-18
channel ORA_DISK_1: finished piece 1 at 18-MAY-18
piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T160938_fhxqo2vh_.bkp tag=TAG20180518T160938 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_21_fhxqmsww_.arc RECID=15 STAMP=976464537
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_22_fhxqmtsp_.arc RECID=16 STAMP=976464538
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_23_fhxqmxg9_.arc RECID=17 STAMP=976464541
Finished backup at 18-MAY-18

Starting Control File and SPFILE Autobackup at 18-MAY-18
piece handle=/opt/oracle/fast_recovery_area/DB01/autobackup/2018_05_18/o1_mf_s_976464550_fhxqo578_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAY-18

 

12) Copy backup files to target to be restored:
[oracle@srv001 ~]$ scp /opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T160938_fhxqo2vh_.bkp oracle@srv002:/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/
oracle@srv002’s password:
o1_mf_annnn_TAG20180518T160938_fhxqo2vh_.bkp 100% 1340KB 1.3MB/s 00:00
[oracle@srv001 ~]$ scp /opt/oracle/fast_recovery_area/DB01/autobackup/2018_05_18/o1_mf_s_976464550_fhxqo578_.bkp oracle@srv002:/opt/oracle/fast_recovery_area/DB01/autobackup/2018_05_18/
oracle@srv002’s password:
o1_mf_s_976464550_fhxqo578_.bkp 100% 9600KB 9.4MB/s 00:00

 

13) Copy Redo Log Files/ Controlfiles to Target Database:
Source:
SQL> shut immediate
ORA-01109: database not open

 

Database dismounted.
ORACLE instance shut down.

target:
Please confirm that TARGET database is down before copy:

SQL> select member from v$logfile;

MEMBER
——————————————————————————–
/opt/oracle/oradata/db01/redo03.log
/opt/oracle/oradata/db01/redo02.log
/opt/oracle/oradata/db01/redo01.log

SQL> select name from v$controlfile;

NAME
——————————————————————————–
/opt/oracle/oradata/db01/control01.ctl
/opt/oracle/fast_recovery_area/db01/control02.ctl

[oracle@srv001 ~]$ scp /opt/oracle/oradata/db01/redo01.log oracle@srv002:/opt/oracle/oradata/db01/redo01.log
oracle@srv002’s password:
redo01.log 100% 50MB 50.0MB/s 00:01
[oracle@srv001 ~]$ scp /opt/oracle/oradata/db01/redo02.log oracle@srv002:/opt/oracle/oradata/db01/redo02.log
oracle@srv002’s password:
redo02.log 100% 50MB 50.0MB/s 00:00
[oracle@srv001 ~]$ scp /opt/oracle/oradata/db01/redo03.log oracle@srv002:/opt/oracle/oradata/db01/redo03.log
oracle@srv002’s password:
redo03.log 100% 50MB 50.0MB/s 00:00
[oracle@srv001 ~]$ scp /opt/oracle/oradata/db01/control01.ctl oracle@srv002:/opt/oracle/oradata/db01/control01.ctl
oracle@srv002’s password:
control01.ctl 100% 9520KB 9.3MB/s 00:00
[oracle@srv001 ~]$ scp /opt/oracle/fast_recovery_area/db01/control02.ctl oracle@srv002:/opt/oracle/fast_recovery_area/db01/control02.ctl
oracle@srv002’s password:
control02.ctl 100% 9520KB 9.3MB/s 00:00

14) Start TARGET database in mount state:

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 18 16:13:05 2018

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 281019576 bytes
Database Buffers 780140544 bytes
Redo Buffers 5541888 bytes
Database mounted.

 

15) recover database:

RMAN> recover database;

Starting recover at 18-MAY-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=15
channel ORA_DISK_1: reading from backup piece /opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T153109_fhxodxgs_.bkp
channel ORA_DISK_1: piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T153109_fhxodxgs_.bkp tag=TAG20180518T153109
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_15_fhxqwv4f_.arc thread=1 sequence=15
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_15_fhxqwv4f_.arc RECID=18 STAMP=976464827
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=16
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=17
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=18
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=19
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=20
channel ORA_DISK_1: reading from backup piece /opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T154918_fhxpgyhh_.bkp
channel ORA_DISK_1: piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T154918_fhxpgyhh_.bkp tag=TAG20180518T154918
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_16_fhxqwwdh_.arc thread=1 sequence=16
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_16_fhxqwwdh_.arc RECID=23 STAMP=976464828
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_17_fhxqwwhs_.arc thread=1 sequence=17
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_17_fhxqwwhs_.arc RECID=22 STAMP=976464828
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_18_fhxqwwfj_.arc thread=1 sequence=18
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_18_fhxqwwfj_.arc RECID=21 STAMP=976464828
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_19_fhxqwwdw_.arc thread=1 sequence=19
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_19_fhxqwwdw_.arc RECID=19 STAMP=976464828
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_20_fhxqwwf6_.arc thread=1 sequence=20
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_20_fhxqwwf6_.arc RECID=20 STAMP=976464828
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=21
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=22
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=23
channel ORA_DISK_1: reading from backup piece /opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T160938_fhxqo2vh_.bkp
channel ORA_DISK_1: piece handle=/opt/oracle/fast_recovery_area/DB01/backupset/2018_05_18/o1_mf_annnn_TAG20180518T160938_fhxqo2vh_.bkp tag=TAG20180518T160938
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_21_fhxqx0rw_.arc thread=1 sequence=21
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_21_fhxqx0rw_.arc RECID=26 STAMP=976464832
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_22_fhxqx0t5_.arc RECID=25 STAMP=976464832
channel default: deleting archived log(s)
archived log file name=/opt/oracle/fast_recovery_area/DB01/archivelog/2018_05_18/o1_mf_1_23_fhxqx0sf_.arc RECID=24 STAMP=976464832
media recovery complete, elapsed time: 00:00:01
Finished recover at 18-MAY-18

RMAN>

RMAN> alter database open;

database opened

Advertisements

RMAN Restore Database

-- Before start
get the info on the ALERT.LOG regarding last TIMESTAMP valid, 
the last time before the crash;

Example:

Wed Jan 04 15:28:43 2017
Thread 1 advanced to log sequence 8725 (LGWR switch)
  Current log# 3 seq# 8725 mem# 0: /u01/oradata/dbtst/redo03.log
Wed Jan 04 15:28:43 2017 <------------------------------------------------------------ * THIS ON THIS CASE
Archived Log entry 13322 added for thread 1 sequence 8724 ID 0xee867f48 dest 1:
Wed Jan 04 15:43:40 2017
Errors in file /u01/oracle/diag/rdbms/dbtst/dbtst/trace/dbtst_m002_10209.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/oradata/dbtst/redo01.log'
ORA-27037: unable to obtain file status
/15:43:40 2017 


1.)
rman target /

list backup of controlfile:

(take the last one)

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8421    Full    14.92M     DISK        00:00:01     04-JAN-17
        BP Key: 8421   Status: AVAILABLE  Compressed: NO  Tag: TAG20170104T051133
        Piece Name: /oracle_backups/ITT/dbtst_ctl_s_DBTST932361094u5rp5cs6_1_1
  Standby Control File Included: Ckp SCN: 60656341385   Ckp time: 04-JAN-17


2.)
Controlfile Location:

sqlplus / as sysdba

show parameter control;

/u01/oradata/dbtst/control01.ctl, /u01/oradata/dbtst/control02.ctl

3.) Check if still have the controlfiles:

[oracle@lnx01/ SID : dbtst]$ ls -ltr
total 45744
-rw-r----- 1 oracle oinstall 15613952 Jan  4 13:48 snapcf_dbtst.ctl
-rw-r----- 1 oracle oinstall 15613952 Jan  4 16:26 control02.ctl
-rw-r----- 1 oracle oinstall 15613952 Jan  4 16:26 control01.ctl

4.) Try first do the restore using the existent controlfile, 
if doesn't have anymore the files you need use the backup on the STEP 1, 
to restore the latest controlfile before start
the restore database operation;

JUST in case of you don't have any more the CONTROLFILES execute the step below:

rman target /

startup nomount;

RESTORE CONTROLFILE FROM "/oracle_backups/ITT/dbtst_ctl_s_DBTST932361094u5rp5cs6_1_1"; 

If the CONTROLFILES are in place, proceed like below:

rman target /
startup mount;

run
{
set until time "to_date('04-JAN-2017:15:28:43', 'DD-MON-YYYY:HH24:MI:SS')" ; 
restore database;
recover database;
}

RMAN> alter database open resetlogs;

Statement processed

Recover Table – RMAN 12c

$ rman target=/
Recovery Manager: Release 12.1.0.1.0 - Production on Thu Dec 26 17:26:12 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
connected to target database: DB12C (DBID=1289223812)
RECOVER TABLE 'TEST'.'T1'
 UNTIL SCN 1853267
 AUXILIARY DESTINATION '/u01/aux'
 DATAPUMP DESTINATION '/u01/export'
 DUMP FILE 'test_t1_prev.dmp'
 NOTABLEIMPORT;
Starting recover at 26-DEC-13
 using target database control file instead of recovery catalog
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: SID=264 device type=DISK
 RMAN-05026: WARNING: presuming following set of tablespaces applies to specified Point-in-Time
List of tablespaces expected to have UNDO segments
 Tablespace SYSTEM
 Tablespace UNDOTBS1
Creating automatic instance, with SID='ytEa'
initialization parameters used for automatic instance:
 db_name=DB12C
 db_unique_name=ytEa_pitr_DB12C
 compatible=12.1.0.0.0
 db_block_size=8192
 db_files=200
 sga_target=1G
 processes=80
 diagnostic_dest=/u01/app/oracle
 db_create_file_dest=/u01/aux
 log_archive_dest_1='location=/u01/aux'
 #No auxiliary parameter file used
starting up automatic instance DB12C
Oracle instance started
Total System Global Area    1068937216 bytes
Fixed Size                     2296576 bytes
 Variable Size                281019648 bytes
 Database Buffers             780140544 bytes
 Redo Buffers                   5480448 bytes
 Automatic instance created
contents of Memory Script:
 {
 # set requested point in time
 set until  scn 1853267;
 # restore the controlfile
 restore clone controlfile;
 # mount the controlfile
 sql clone 'alter database mount clone database';
 # archive current online log
 sql 'alter system archive log current';
 }
 executing Memory Script
executing command: SET until clause
Starting restore at 26-DEC-13
 allocated channel: ORA_AUX_DISK_1
 channel ORA_AUX_DISK_1: SID=83 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 /u01/app/oracle/fast_recovery_area/DB12C/autobackup/2013_12_26/o1_mf_s_835203240_9crqs93z_.bkp
 channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DB12C/autobackup/2013_12_26/o1_mf_s_835203240_9crqs93z_.bkp tag=TAG20131226T165400
 channel ORA_AUX_DISK_1: restored backup piece 1
 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
 output file name=/u01/aux/DB12C/controlfile/o1_mf_9crsqbtl_.ctl
 Finished restore at 26-DEC-13
sql statement: alter database mount clone database
sql statement: alter system archive log current
contents of Memory Script:
 {
 # set requested point in time
 set until  scn 1853267;
 # set destinations for recovery set and auxiliary set datafiles
 set newname for clone datafile  1 to new;
 set newname for clone datafile  4 to new;
 set newname for clone datafile  3 to new;
 set newname for clone tempfile  1 to new;
 # switch all tempfiles
 switch clone tempfile all;
 # restore the tablespaces in the recovery set and the auxiliary set
 restore clone datafile  1, 4, 3;
 switch clone datafile all;
 }
 executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /u01/aux/DB12C/datafile/o1_mf_temp_%u_.tmp in control file
Starting restore at 26-DEC-13
 using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: restoring datafile 00001
 input datafile copy RECID=1 STAMP=835203194 file name=/u01/app/oracle/fast_recovery_area/DB12C/datafile/o1_mf_system_9crqq7tj_.dbf
 destination for restore of datafile 00001: /u01/aux/DB12C/datafile/o1_mf_system_%u_.dbf
 channel ORA_AUX_DISK_1: copied datafile copy of datafile 00001
 output file name=/u01/aux/DB12C/datafile/o1_mf_system_9crsqq4q_.dbf RECID=5 STAMP=835205289
 channel ORA_AUX_DISK_1: restoring datafile 00004
 input datafile copy RECID=3 STAMP=835203231 file name=/u01/app/oracle/fast_recovery_area/DB12C/datafile/o1_mf_undotbs1_9crqrtww_.dbf
 destination for restore of datafile 00004: /u01/aux/DB12C/datafile/o1_mf_undotbs1_%u_.dbf
 channel ORA_AUX_DISK_1: copied datafile copy of datafile 00004
 output file name=/u01/aux/DB12C/datafile/o1_mf_undotbs1_9crssgvd_.dbf RECID=6 STAMP=835205302
 channel ORA_AUX_DISK_1: restoring datafile 00003
 input datafile copy RECID=2 STAMP=835203221 file name=/u01/app/oracle/fast_recovery_area/DB12C/datafile/o1_mf_sysaux_9crqr1k4_.dbf
 destination for restore of datafile 00003: /u01/aux/DB12C/datafile/o1_mf_sysaux_%u_.dbf
 channel ORA_AUX_DISK_1: copied datafile copy of datafile 00003
 output file name=/u01/aux/DB12C/datafile/o1_mf_sysaux_9crssybx_.dbf RECID=7 STAMP=835205396
 Finished restore at 26-DEC-13
datafile 1 switched to datafile copy
 input datafile copy RECID=8 STAMP=835205407 file name=/u01/aux/DB12C/datafile/o1_mf_system_9crsqq4q_.dbf
 datafile 4 switched to datafile copy
 input datafile copy RECID=9 STAMP=835205408 file name=/u01/aux/DB12C/datafile/o1_mf_undotbs1_9crssgvd_.dbf
 datafile 3 switched to datafile copy
 input datafile copy RECID=10 STAMP=835205408 file name=/u01/aux/DB12C/datafile/o1_mf_sysaux_9crssybx_.dbf
contents of Memory Script:
 {
 # set requested point in time
 set until  scn 1853267;
 # online the datafiles restored or switched
 sql clone "alter database datafile  1 online";
 sql clone "alter database datafile  4 online";
 sql clone "alter database datafile  3 online";
 # recover and open database read only
 recover clone database tablespace  "SYSTEM", "UNDOTBS1", "SYSAUX";
 sql clone 'alter database open read only';
 }
 executing Memory Script
executing command: SET until clause
sql statement: alter database datafile  1 online
sql statement: alter database datafile  4 online
sql statement: alter database datafile  3 online
Starting recover at 26-DEC-13
 using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 10 is already on disk as file /u01/app/oracle/fast_recovery_area/DB12C/archivelog/2013_12_26/o1_mf_1_10_9crrn5od_.arc
 channel ORA_AUX_DISK_1: starting archived log restore to default destination
 channel ORA_AUX_DISK_1: restoring archived log
 archived log thread=1 sequence=9
 channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DB12C/backupset/2013_12_26/o1_mf_annnn_DB12C_INCR_BACKUP_9crqs5hv_.bkp
 channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DB12C/backupset/2013_12_26/o1_mf_annnn_DB12C_INCR_BACKUP_9crqs5hv_.bkp tag=DB12C_INCR_BACKUP
 channel ORA_AUX_DISK_1: restored backup piece 1
 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
 archived log file name=/u01/aux/1_9_835199044.dbf thread=1 sequence=9
 archived log file name=/u01/app/oracle/fast_recovery_area/DB12C/archivelog/2013_12_26/o1_mf_1_10_9crrn5od_.arc thread=1 sequence=10
 media recovery complete, elapsed time: 00:00:06
 Finished recover at 26-DEC-13
sql statement: alter database open read only
contents of Memory Script:
 {
 sql clone "create spfile from memory";
 shutdown clone immediate;
 startup clone nomount;
 sql clone "alter system set  control_files =
 ''/u01/aux/DB12C/controlfile/o1_mf_9crsqbtl_.ctl'' comment=
 ''RMAN set'' scope=spfile";
 shutdown clone immediate;
 startup clone nomount;
 # mount database
 sql clone 'alter database mount clone database';
 }
 executing Memory Script
sql statement: create spfile from memory
database closed
 database dismounted
 Oracle instance shut down
connected to auxiliary database (not started)
 Oracle instance started
Total System Global Area    1068937216 bytes
Fixed Size                     2296576 bytes
 Variable Size                285213952 bytes
 Database Buffers             775946240 bytes
 Redo Buffers                   5480448 bytes
sql statement: alter system set  control_files =   ''/u01/aux/DB12C/controlfile/o1_mf_9crsqbtl_.ctl'' comment= ''RMAN set'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
 Oracle instance started
Total System Global Area    1068937216 bytes
Fixed Size                     2296576 bytes
 Variable Size                285213952 bytes
 Database Buffers             775946240 bytes
 Redo Buffers                   5480448 bytes
sql statement: alter database mount clone database
contents of Memory Script:
 {
 # set requested point in time
 set until  scn 1853267;
 # set destinations for recovery set and auxiliary set datafiles
 set newname for datafile  6 to new;
 # restore the tablespaces in the recovery set and the auxiliary set
 restore clone datafile  6;
 switch clone datafile all;
 }
 executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
Starting restore at 26-DEC-13
 allocated channel: ORA_AUX_DISK_1
 channel ORA_AUX_DISK_1: SID=11 device type=DISK
channel ORA_AUX_DISK_1: restoring datafile 00006
 input datafile copy RECID=4 STAMP=835203234 file name=/u01/app/oracle/fast_recovery_area/DB12C/datafile/o1_mf_users_9crqs296_.dbf
 destination for restore of datafile 00006: /u01/aux/YTEA_PITR_DB12C/datafile/o1_mf_users_%u_.dbf
 channel ORA_AUX_DISK_1: copied datafile copy of datafile 00006
 output file name=/u01/aux/YTEA_PITR_DB12C/datafile/o1_mf_users_9crt0tl5_.dbf RECID=11 STAMP=835205530
 Finished restore at 26-DEC-13
datafile 6 switched to datafile copy
 input datafile copy RECID=12 STAMP=835205531 file name=/u01/aux/YTEA_PITR_DB12C/datafile/o1_mf_users_9crt0tl5_.dbf
contents of Memory Script:
 {
 # set requested point in time
 set until  scn 1853267;
 # online the datafiles restored or switched
 sql clone "alter database datafile  6 online";
 # recover and open resetlogs
 recover clone database tablespace  "USERS", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
 alter clone database open resetlogs;
 }
 executing Memory Script
executing command: SET until clause
sql statement: alter database datafile  6 online
Starting recover at 26-DEC-13
 using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 10 is already on disk as file /u01/app/oracle/fast_recovery_area/DB12C/archivelog/2013_12_26/o1_mf_1_10_9crrn5od_.arc
 channel ORA_AUX_DISK_1: starting archived log restore to default destination
 channel ORA_AUX_DISK_1: restoring archived log
 archived log thread=1 sequence=9
 channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DB12C/backupset/2013_12_26/o1_mf_annnn_DB12C_INCR_BACKUP_9crqs5hv_.bkp
 channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DB12C/backupset/2013_12_26/o1_mf_annnn_DB12C_INCR_BACKUP_9crqs5hv_.bkp tag=DB12C_INCR_BACKUP
 channel ORA_AUX_DISK_1: restored backup piece 1
 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
 archived log file name=/u01/aux/1_9_835199044.dbf thread=1 sequence=9
 channel clone_default: deleting archived log(s)
 archived log file name=/u01/aux/1_9_835199044.dbf RECID=3 STAMP=835205538
 archived log file name=/u01/app/oracle/fast_recovery_area/DB12C/archivelog/2013_12_26/o1_mf_1_10_9crrn5od_.arc thread=1 sequence=10
 media recovery complete, elapsed time: 00:00:02
 Finished recover at 26-DEC-13
database opened
contents of Memory Script:
 {
 # create directory for datapump import
 sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
 /u01/export''";
 # create directory for datapump export
 sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
 /u01/export''";
 }
 executing Memory Script
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/export''
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/export''
Performing export of tables...
 EXPDP> Starting "SYS"."TSPITR_EXP_ytEa_eihl":
 EXPDP> Estimate in progress using BLOCKS method...
 EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
 EXPDP> Total estimation using BLOCKS method: 64 KB
 EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
 EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
 EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
 EXPDP> . . exported "TEST"."T1"                                 5.023 KB       1 rows
 EXPDP> Master table "SYS"."TSPITR_EXP_ytEa_eihl" successfully loaded/unloaded
 EXPDP> ******************************************************************************
 EXPDP> Dump file set for SYS.TSPITR_EXP_ytEa_eihl is:
 EXPDP>   /u01/export/test_t1_prev.dmp
 EXPDP> Job "SYS"."TSPITR_EXP_ytEa_eihl" successfully completed at Thu Dec 26 17:34:41 2013 elapsed 0 00:00:59
 Export completed
Not performing table import after point-in-time recovery
Removing automatic instance
 shutting down automatic instance
 Oracle instance shut down
 Automatic instance removed
 auxiliary instance file /u01/aux/DB12C/datafile/o1_mf_temp_9crsy2bq_.tmp deleted
 auxiliary instance file /u01/aux/YTEA_PITR_DB12C/onlinelog/o1_mf_3_9crt177x_.log deleted
 auxiliary instance file /u01/aux/YTEA_PITR_DB12C/onlinelog/o1_mf_2_9crt160q_.log deleted
 auxiliary instance file /u01/aux/YTEA_PITR_DB12C/onlinelog/o1_mf_1_9crt15cg_.log deleted
 auxiliary instance file /u01/aux/YTEA_PITR_DB12C/datafile/o1_mf_users_9crt0tl5_.dbf deleted
 auxiliary instance file /u01/aux/DB12C/datafile/o1_mf_sysaux_9crssybx_.dbf deleted
 auxiliary instance file /u01/aux/DB12C/datafile/o1_mf_undotbs1_9crssgvd_.dbf deleted
 auxiliary instance file /u01/aux/DB12C/datafile/o1_mf_system_9crsqq4q_.dbf deleted
 auxiliary instance file /u01/aux/DB12C/controlfile/o1_mf_9crsqbtl_.ctl deleted
 Finished recover at 26-DEC-13
RMAN>