Disclaimer

Tuesday 20 October 2020

Restore and Recovery using RMAN

Restore and Recovery using RMAN Scenario:

 

1)   Dropping database

[oracle@rac3 dbs]$ sqlplus '/as sysdba'

 

SQL*Plus: Release 12.2.0.1.0 Production on Fri Feb 8 01:08:30 2019

 

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

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

 

SQL> shut immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

SQL> startup mount restrict exclusive;

ORACLE instance started.

 

Total System Global Area 1342177280 bytes

Fixed Size                  8620464 bytes

Variable Size             352323152 bytes

Database Buffers          973078528 bytes

Redo Buffers                8155136 bytes

Database mounted.

SQL>

SQL> drop database;

 

Database dropped.

 

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

SQL>

SQL> exit

 

2)   Start the database in nomount stage

[oracle@rac3 dbs]$

[oracle@rac3 dbs]$

[oracle@rac3 dbs]$ sqlplus '/as sysdba'

 

SQL*Plus: Release 12.2.0.1.0 Production on Fri Feb 8 01:16:31 2019

 

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

 

Connected to an idle instance.

 

SQL> startup nomount;

ORACLE instance started.

 

Total System Global Area 1342177280 bytes

Fixed Size                  8620464 bytes

Variable Size             352323152 bytes

Database Buffers          973078528 bytes

Redo Buffers                8155136 bytes

SQL>

SQL>

SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

 

3)   Restore and Recovery steps

[oracle@rac3 dbs]$

 

[oracle@rac3 dbs]$ rman target /

 

Recovery Manager: Release 12.2.0.1.0 - Production on Fri Feb 8 01:17:17 2019

 

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

 

connected to target database: ORCL (not mounted)

 

RMAN> SET DBID 1483248919

 

executing command: SET DBID

 

RMAN>

 

RMAN> sql 'alter session set NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"';

 

using target database control file instead of recovery catalog

sql statement: alter session set NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"

 

RMAN>

 

RMAN> run

{

ALLOCATE CHANNEL ch1 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch2 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch3 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch4 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch5 DEVICE TYPE DISK;

set until time '2018-05-18 23:00:00';

restore controlfile;

restore controlfile from '/backup/rman_backup_orcl';

alter database mount;

restore database;

recover database;

RELEASE CHANNEL ch1;

RELEASE CHANNEL ch2;

RELEASE CHANNEL ch3;

RELEASE CHANNEL ch4;

RELEASE CHANNEL ch5;

}2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19>

 

allocated channel: ch1

channel ch1: SID=35 device type=DISK

 

allocated channel: ch2

channel ch2: SID=36 device type=DISK

 

allocated channel: ch3

channel ch3: SID=37 device type=DISK

 

allocated channel: ch4

channel ch4: SID=38 device type=DISK

 

allocated channel: ch5

channel ch5: SID=39 device type=DISK

 

executing command: SET until clause

 

Starting restore at 08-FEB-19

released channel: ch1

released channel: ch2

released channel: ch3

released channel: ch4

released channel: ch5

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 02/08/2019 01:19:37

ORA-01507: database not mounted

 

RMAN>

 

 

 

RMAN>

 

RMAN>

 

RMAN>

RMAN>

 

RMAN>

 

RMAN>

 

RMAN> run

{

ALLOCATE CHANNEL ch1 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch2 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch3 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch4 DEVICE TYPE DISK;

ALLOCATE CHANNEL ch5 DEVICE TYPE DISK;

set until time '2018-05-18 23:00:00';

restore controlfile from '/backup/rman_backup_orcl';

alter database mount;

restore database;

recover database;

RELEASE CHANNEL ch1;

RELEASE CHANNEL ch2;

RELEASE CHANNEL ch3;

RELEASE CHANNEL ch4;

RELEASE CHANNEL ch5;

}2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18>

 

allocated channel: ch1

channel ch1: SID=35 device type=DISK

 

allocated channel: ch2

channel ch2: SID=36 device type=DISK

 

allocated channel: ch3

channel ch3: SID=37 device type=DISK

 

allocated channel: ch4

channel ch4: SID=38 device type=DISK

 

allocated channel: ch5

channel ch5: SID=39 device type=DISK

 

executing command: SET until clause

 

Starting restore at 08-FEB-19

 

channel ch1: no AUTOBACKUP in 7 days found

channel ch2: no AUTOBACKUP in 7 days found

channel ch3: no AUTOBACKUP in 7 days found

channel ch4: no AUTOBACKUP in 7 days found

channel ch5: no AUTOBACKUP in 7 days found

released channel: ch1

released channel: ch2

released channel: ch3

released channel: ch4

released channel: ch5

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 02/08/2019 01:20:34

RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

 

RMAN>

 

RMAN> restore controlfile from '/backup/rman_backup_orcl';

 

Starting restore at 08-FEB-19

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=35 device type=DISK

 

channel ORA_DISK_1: no AUTOBACKUP in 7 days found

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 02/08/2019 01:21:23

RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

 

RMAN>

 

RMAN> restore controlfile from '/backup/rman_backup_orcl/c-1483248919-20180923-00';

 

Starting restore at 08-FEB-19

using channel ORA_DISK_1

 

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:04

output file name=/data2/oradata/control.ctl

Finished restore at 08-FEB-19

 

RMAN> alter database mount;

 

Statement processed

released channel: ORA_DISK_1

 

RMAN>

 

RMAN> restore database;

 

Starting restore at 08-FEB-19

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=41 device type=DISK

 

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 /data2/oradata/system01.dbf

channel ORA_DISK_1: restoring datafile 00002 to /data2/oradata/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00003 to /data2/oradata/undotbs01.dbf

channel ORA_DISK_1: restoring datafile 00004 to /data2/oradata/users01.dbf

channel ORA_DISK_1: restoring datafile 00005 to /data2/oradata/usertbs01.dbf

channel ORA_DISK_1: restoring datafile 00006 to /data2/oradata/sam_ts1.dbf

channel ORA_DISK_1: restoring datafile 00007 to /data2/oradata/sam_idx1.dbf

channel ORA_DISK_1: reading from backup piece /backup/rman_backup_orcl/orcl_ORCL_T987634506_S72_P1

 

 

channel ORA_DISK_1: piece handle=/backup/rman_backup_orcl/orcl_ORCL_T987634506_S72_P1 tag=TAG20180923T225506

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:03:40

Finished restore at 08-FEB-19

 

RMAN>

RMAN>

RMAN>

 

RMAN>

 

RMAN>

 

RMAN> recover database;

 

Starting recover at 08-FEB-19

using channel ORA_DISK_1

 

starting media recovery

 

archived log for thread 1 with sequence 19 is already on disk as file /data2/oradata/arch/1_19_976441199.arch

archived log file name=/data2/oradata/arch/1_19_976441199.arch thread=1 sequence=19

archived log file name=/data2/oradata/arch/1_20_976441199.arch thread=1 sequence=20

archived log file name=/data2/oradata/arch/1_21_976441199.arch thread=1 sequence=21

unable to find archived log

archived log thread=1 sequence=22

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 02/08/2019 01:29:35

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 22 and starting SCN of 1056033

 

RMAN>

 

RMAN> sql 'alter database open resetlogs';

 

sql statement: alter database open resetlogs

 

RMAN>

 

RMAN>

 

RMAN>

No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...