使用RESTORE DATABASE和RECOVER 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/17013648/viewspace-1081152/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/17013648/viewspace-1081152/