你好,游客 登录 注册 搜索
背景:
阅读新闻

探索Oracle之RMAN_07 恢复

[日期:2012-07-10] 来源:Linux社区  作者:吴伟龙 [字体:大 中 小]

5、恢复控制文件

RMAN> restore controlfile fromautobackup;

Starting restoreat 23-MAY-12

using channelORA_DISK_1

channelORA_DISK_1: looking forautobackup on day: 20120523

channelORA_DISK_1: autobackup found:c-5520179-20120523-04

channelORA_DISK_1: control filerestore from autobackup complete

outputfilename=/DBSoft/product/10.2.0/db_1/dbs/cntrlWWL.dbf

Finished restoreat 23-MAY-12

RMAN>

 

重启数据库到mount状态---很重要

SQL> startup mount;

Oracle instancestarted.

Total SystemGlobal Area 285212672bytes

Fixed Size 1218968 bytes

VariableSize 79693416 bytes

DatabaseBuffers 197132288 bytes

RedoBuffers 7168000 bytes

Databasemounted.

SQL> exit

Disconnectedfrom Oracle Database 10gEnterprise Edition Release 10.2.0.1.0 - Production

With thePartitioning, OLAP and DataMining options

[oracle@wwldb dbs]$ rman target /

RecoveryManager: Release 10.2.0.1.0- Production on Wed May 23 19:04:15 2012

Copyright (c)1982, 2005, Oracle. Allrights reserved.

connected totarget database: WWL(DBID=5520179, not open)

 

注意:详细参考如下:

http://blog.csdn.net/wuweilong/article/details/7596056

http://space.itpub.net/?uid-20674423-action-viewspace-itemid-730717

 

6、恢复数据库其它的数据文件:

RMAN> restore database;

Starting restoreat 23-MAY-12

using targetdatabase control fileinstead of recovery catalog

allocatedchannel: ORA_DISK_1

channelORA_DISK_1: sid=156devtype=DISK

channelORA_DISK_1: starting datafilebackupset restore

channelORA_DISK_1: specifyingdatafile(s) to restore from backup set

restoringdatafile 00004 to/DBData/WWL/users01.dbf

channelORA_DISK_1: reading frombackup piece /DBBak/bak_WWL_05_23_0cnbn2a3_1_1

channelORA_DISK_1: restored backuppiece 1

piecehandle=/DBBak/bak_WWL_05_23_0cnbn2a3_1_1tag=TAG20120523T133147

channelORA_DISK_1: restore complete,elapsed time: 00:00:02

channelORA_DISK_1: starting datafilebackupset restore

channelORA_DISK_1: specifyingdatafile(s) to restore from backup set

restoringdatafile 00001 to/DBData/WWL/system01.dbf

restoringdatafile 00002 to/DBData/WWL/undotbs01.dbf

restoringdatafile 00003 to/DBData/WWL/sysaux01.dbf

channelORA_DISK_1: reading frombackup piece /DBBak/bak_WWL_05_23_0enbn2bk_1_1

channelORA_DISK_1: restored backuppiece 1

piecehandle=/DBBak/bak_WWL_05_23_0enbn2bk_1_1tag=TAG20120523T133235

channelORA_DISK_1: restore complete,elapsed time: 00:01:05

Finished restoreat 23-MAY-12

RMAN>

RMAN> recover database;

Starting recoverat 23-MAY-12

using channel ORA_DISK_1

starting mediarecovery

media recovery complete,elapsedtime: 00:00:05

Finished recoverat 23-MAY-12

RMAN> alter database open; ---------我们看到数据库已经打开了处于open状态

database opened

SQL> select instance_name,statusfrom v$instance;

INSTANCE_NAME STATUS

----------------------------

WWL OPEN

SQL>

 

6、     装载数据文件的磁盘损坏数据恢复

有的时候在企业里面难免会出现由于磁盘损坏而导致数据库的故障乃至数据的丢失,那么这个时候数据的备份就显得尤为的重要。在这一节我们重点讨论下由于装载数据文件,redo日志文件,controlfile控制文件的磁盘损坏的数据恢复。

 

6.1 通过强制卸载磁盘模拟数据磁盘损坏:

[root@wwldb ~]# umount -f /DBData/

umount2: 资源或设备忙

umount: /DBData: device is busy

umount2: 资源或设备忙

umount: /DBData: device is busy

 

[root@wwldb ~]# fuser -m -k /DBData/     查看设备占用情况

/DBData/: 3508 3510  3512  3514 3516  3518  3529 3531  3535  3541  3610c

 

[root@wwldb ~]# fuser -m -k -i -k /DBData/   强制kill  /DBData相关进程

[root@wwldb ~]# umount -f /DBData/       卸载/DBData

[root@wwldb ~]#

 

6.2 umount 后,通过alert看到实例也随之宕机了。

Fri Jul  616:03:33 2012

Errors in file/DBSoft/admin/WWL/bdump/wwl_pmon_3502.trc:

ORA-00471: DBWR process terminated with error

Fri Jul  616:03:33 2012

PMON: terminating instance due to error 471

Instance terminated by PMON, pid = 3502

 

[root@wwldb bdump]# ps -ef|grep ora

root     2965  2943  0 14:39 ?        00:00:00 hald-addon-storage: polling/dev/hdc

root     3944  3050  0 16:07 pts/2    00:00:00 su - oracle

oracle   3945  3944  0 16:07 pts/2    00:00:00 -bash

oracle   3977  3945  0 16:07 pts/2    00:00:00 rlwrap sqlplus / as sysdba

oracle   3978  3977  0 16:07 pts/3    00:00:00 sqlplus   as sysdba

oracle   3979  3978  0 16:07 ?        00:00:00 oracleWWL(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

root     4022  3980  0 16:10 pts/4    00:00:00 grep ora

[root@wwldb bdump]#

linux
相关资讯       Oracle高级培训 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款