您的位置:首页 > 数据库 > Oracle

Oracle database 16章 数据库恢复 整个数据库的完全恢复 恢复整个数据库 理论试验

2013-04-07 20:15 405 查看
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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: