Backup And Recovery User's Guide-從RMAN開始-恢復整個資料庫

shilei1發表於2015-03-26

使用RESTORE DATABASERECOVER DATABASE來還原整個資料庫。

之前必須對所有需要的檔案做過備份。

這裡假設可以還原所有的資料檔案到原來的位置,如果原來的位置不可訪問,則要使用SET NEWNAME命令。

練習:恢復整個資料庫

# 1. 準備恢復(上一練習)

# 2. 使資料庫處於MOUNT狀態

sys@TESTDB12>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

sys@TESTDB12>startup mount;

ORACLE instance started.

Total System Global Area  839282688 bytes

Fixed Size                  2233000 bytes

Variable Size             532680024 bytes

Database Buffers          301989888 bytes

Redo Buffers                2379776 bytes

Database mounted.

# 3. 還原資料庫

oracle@Redhat55.cuug.net:/home/oracle> rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jul 12 05:35:30 2013

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

connected to target database: TESTDB12 (DBID=2811829300, not open)

RMAN> restore database;

Starting restore at 12-JUL-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=20 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/TestDB12/system01.dbf

channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/TestDB12/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/TestDB12/undotbs01.dbf

channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/TestDB12/users01.dbf

channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/TestDB12/example01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_12/o1_mf_nnndf_TAG20130712T053213_8xzm8xhf_.bkp

channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_12/o1_mf_nnndf_TAG20130712T053213_8xzm8xhf_.bkp tag=TAG20130712T053213

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:01:05

Finished restore at 12-JUL-13

# 4. 恢復資料庫

RMAN> recover database;

Starting recover at 12-JUL-13

using channel ORA_DISK_1

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 12-JUL-13

# 5. 開啟資料庫

sys@TESTDB12>alter database open;

Database altered.

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

相關文章