1、使用RMAN恢复整个数据库
先 shutdown database,然后连接上RMAN,把数据库startup 到 mount状态,使用 database restore命令直接恢复整个数据库,要在恢复文件的目录下有备份文件。
~/app/oracle/flash_recovery_area> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 7 20:21:31 2013
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> 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
oracle@linux-tpch:~/app/oracle/flash_recovery_area> rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Apr 7 20:22:21 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area 107963772928 bytes
Fixed Size 2218032 bytes
Variable Size 58518931408 bytes
Database Buffers 49392123904 bytes
Redo Buffers 50499584 bytes
RMAN> restore database;
Starting restore at 07-APR-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2186 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 /home/oracle/app/oracle/oradata/test/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/app/oracle/oradata/test/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/app/oracle/oradata/test/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/app/oracle/oradata/test/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /home/oracle/app/oracle/oradata/test/example01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/app/oracle/flash_recovery_area/TEST/backupset/2013_04_05/o1_mf_nnndf_TAG20130405T194349_8oxg84o4_.bkp
channel ORA_DISK_1: piece handle=/home/oracle/app/oracle/flash_recovery_area/TEST/backupset/2013_04_05/o1_mf_nnndf_TAG20130405T194349_8oxg84o4_.bkp tag=TAG20130405T194349
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 07-APR-13
RMAN>
2、recover database
RMAN> restore database;
Starting restore at 07-APR-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2186 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 /home/oracle/app/oracle/oradata/test/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/app/oracle/oradata/test/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/app/oracle/oradata/test/undotbs01.dbf
3、最后打开数据库
media recovery complete, elapsed time: 00:01:16
Finished recover at 07-APR-13
RMAN> alter database open ;
database opened
RMAN>