oracle RMAN 非歸檔資料庫恢復

feelpurple發表於2015-10-26
關閉資料庫並啟動到 MOUNT 狀態

[oracle@host148 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 26 09:34:13 2015

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

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

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

Total System Global Area 1653518336 bytes
Fixed Size    2213896 bytes
Variable Size 1258293240 bytes
Database Buffers  385875968 bytes
Redo Buffers    7135232 bytes
Database mounted.

檢視備份

RMAN> list backup;

using target database control file instead of recovery catalog

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
1       Full    9.83M      DISK        00:00:01     2015-10-23 11:26:01
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20151023T112559
        Piece Name: /u01/app/bk/bak_02qke3i8_1_1
  SPFILE Included: Modification time: 2015-10-23 11:22:28
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 2448054411   Ckp time: 2015-10-23 11:26:00

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
2       Full    9.83M      DISK        00:00:01     2015-10-23 13:38:21
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20151023T133819
        Piece Name: /u01/app/bk/bak_04qkebac_1_1
  SPFILE Included: Modification time: 2015-10-23 13:38:07
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 2448059222   Ckp time: 2015-10-23 13:38:20

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
3       Full    9.83M      DISK        00:00:01     2015-10-23 13:40:57
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: FULL_DB_BACKUP
        Piece Name: /u01/app/bk/db_t893857256_s6_p1
  SPFILE Included: Modification time: 2015-10-23 13:38:07
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 2448059294   Ckp time: 2015-10-23 13:40:56

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
4       Full    1.88G      DISK        00:05:03     2015-10-23 13:47:12
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: FULL_DB_BACKUP
        Piece Name: /u01/app/bk/db_t893857329_s7_p1
  List of Datafiles in backup set 4
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/system01.dbf
  2       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/sysaux01.dbf
  3       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/undotbs01.dbf
  4       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/users01.dbf
  5       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_DATA.dbf
  6       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_DATA01.dbf
  7       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_DATA02.dbf
  8       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_DATA03.dbf
  9       Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_FLOW.dbf
  10      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_FLOW01.dbf
  11      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_FLOW02.dbf
  12      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_FLOW03.dbf
  13      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_INDEX.dbf
  14      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_INDEX01.dbf
  15      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_INDEX02.dbf
  16      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/TS_MIS_INDEX03.dbf
  17      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/ts_dist_data.dbf
  18      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/ts_dist_index.dbf
  19      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/ts_cds_index.dbf
  20      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/ts_cds_data.dbf
  21      Full 2448059459 2015-10-23 13:41:30 /u01/app/oracle/oradata/orcl/ts_mis_data04.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
5       Full    9.83M      DISK        00:00:02     2015-10-23 13:47:17
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: FULL_DB_BACKUP
        Piece Name: /u01/app/bk/db_t893857635_s8_p1
  SPFILE Included: Modification time: 2015-10-23 13:41:43
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 2448059459   Ckp time: 2015-10-23 13:41:30

恢復資料庫

RMAN> restore database;

Starting restore at 2015-10-26 09:40:46
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 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 /u01/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/orcl/TS_MIS_DATA.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/orcl/TS_MIS_DATA01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/orcl/TS_MIS_DATA02.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/orcl/TS_MIS_DATA03.dbf
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/orcl/TS_MIS_FLOW.dbf
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/orcl/TS_MIS_FLOW01.dbf
channel ORA_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/orcl/TS_MIS_FLOW02.dbf
channel ORA_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/orcl/TS_MIS_FLOW03.dbf
channel ORA_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/orcl/TS_MIS_INDEX.dbf
channel ORA_DISK_1: restoring datafile 00014 to /u01/app/oracle/oradata/orcl/TS_MIS_INDEX01.dbf
channel ORA_DISK_1: restoring datafile 00015 to /u01/app/oracle/oradata/orcl/TS_MIS_INDEX02.dbf
channel ORA_DISK_1: restoring datafile 00016 to /u01/app/oracle/oradata/orcl/TS_MIS_INDEX03.dbf
channel ORA_DISK_1: restoring datafile 00017 to /u01/app/oracle/oradata/orcl/ts_dist_data.dbf
channel ORA_DISK_1: restoring datafile 00018 to /u01/app/oracle/oradata/orcl/ts_dist_index.dbf
channel ORA_DISK_1: restoring datafile 00019 to /u01/app/oracle/oradata/orcl/ts_cds_index.dbf
channel ORA_DISK_1: restoring datafile 00020 to /u01/app/oracle/oradata/orcl/ts_cds_data.dbf
channel ORA_DISK_1: restoring datafile 00021 to /u01/app/oracle/oradata/orcl/ts_mis_data04.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/bk/db_t893857329_s7_p1
channel ORA_DISK_1: piece handle=/u01/app/bk/db_t893857329_s7_p1 tag=FULL_DB_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:29:59
Finished restore at 2015-10-26 10:10:50

SQL> select status from v$instance;

STATUS
------------
MOUNTED

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'

RMAN> recover database;

Starting recover at 2015-10-26 10:12:01
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 8332 is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log
archived log file name=/u01/app/oracle/oradata/orcl/redo01.log thread=1 sequence=8332
media recovery complete, elapsed time: 00:00:09
Finished recover at 2015-10-26 10:12:12

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open noresetlogs;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
s[oracle@host148 orcl]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 26 10:13:36 2015

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

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

SQL> select status from v$instance;

STATUS
------------
OPEN

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-1816322/,如需轉載,請註明出處,否則將追究法律責任。

相關文章