首页 > 软件使用 > Oracle数据库不能open时的数据恢复

Oracle数据库不能open时的数据恢复

前几天,公司开发用的数据库,应该是硬盘坏了,导致redo文件损坏,还有system表空间也有点儿问题(oracle提示的)。试了网上网上非常流行的那种通过resetlog方式强制打开数据库的方法,无效。最后,数据库只能mount,不能open,由于是开发用的数据库,不想要了,反正从生产库可以重新导过来,但是有一个数据库,是没有备份的,比较重要,要想办法恢复。

google一段时间,了解到oracle有一个dul的工具,可以不启动instance,直接从数据文件中恢复数据,也有人开发了类似的工具,可以实现这些功能。我是使用的这里的工具:

http://www.itpub.net/viewthread.php?tid=1094660&extra=&page=1

步骤如下:

1、编写control.gdul文件

这个文件的内容,是mount数据库以后,使用下面的语句获得:

select rfile#||’,'||name from v$datafile;

2、然后就是一个表一个表的恢复:

[oracle@oracle10g gdulimp]$ ./gdul
Geng's Data Unloader for Oracle 8i/9i/10g, release 1.0.2.

Copyright (c) 2007-2008,Andy Geng. All Rights Reserved.
If you have any advises and suggestions,
please contact me:gengyonghui@hotmail.com.

GDUL>bootstrap
bootstrap finished.
GDUL>set user confluence
GDUL>unload user confluence
About to unload CONFLUENCE's tables...

2009-06-24 14:15:55...unloading table LINKS 1200rows unloaded.
2009-06-24 14:15:55...unloading table USERS 40rows unloaded.
2009-06-24 14:15:55...unloading table CONTENT_PERM_SET 19rows unloaded.
2009-06-24 14:15:55...unloading table BANDANA 47rows unloaded.
2009-06-24 14:15:56...unloading table OS_PROPERTYENTRY 902rows unloaded.
2009-06-24 14:15:56...unloading table EXTERNAL_MEMBERS 0rows unloaded.
2009-06-24 14:15:56...unloading table SPACEPERMISSIONS 500rows unloaded.
2009-06-24 14:15:56...unloading table CONTENT 4360rows unloaded.
2009-06-24 14:15:56...unloading table EXTRNLNKS 0rows unloaded.
2009-06-24 14:15:56...unloading table CONFVERSION 2rows unloaded.
2009-06-24 14:15:56...unloading table EXTERNAL_ENTITIES 0rows unloaded.
2009-06-24 14:15:56...unloading table INDEXQUEUEENTRIES 6rows unloaded.
2009-06-24 14:15:56...unloading table CONFANCESTORS 613rows unloaded.
2009-06-24 14:15:56...unloading table GROUPS 11rows unloaded.
2009-06-24 14:15:56...unloading table CLUSTERSAFETY 1rows unloaded.
2009-06-24 14:15:56...unloading table TRACKBACKLINKS 0rows unloaded.
2009-06-24 14:15:56...unloading table TRUSTEDAPPRESTRICTION 0rows unloaded.
2009-06-24 14:15:56...unloading table ATTACHMENTDATA 0rows unloaded.
2009-06-24 14:15:56...unloading table LABEL 52rows unloaded.
2009-06-24 14:15:56...unloading table OS_GROUP 11rows unloaded.
2009-06-24 14:15:56...unloading table SPACES 22rows unloaded.
2009-06-24 14:16:06...unloading table BODYCONTENT 4345rows unloaded.
2009-06-24 14:16:06...unloading table NOTIFICATIONS 22rows unloaded.
2009-06-24 14:16:06...unloading table CONTENT_PERM 20rows unloaded.
2009-06-24 14:16:06...unloading table TRUSTEDAPP 0rows unloaded.
2009-06-24 14:16:06...unloading table KEYSTORE 2rows unloaded.
2009-06-24 14:16:06...unloading table PLUGINDATA 0rows unloaded.
2009-06-24 14:16:06...unloading table CONTENT_LABEL 238rows unloaded.
2009-06-24 14:16:06...unloading table SPACEGROUPS 0rows unloaded.
2009-06-24 14:16:06...unloading table OS_USER_GROUP 55rows unloaded.
2009-06-24 14:16:06...unloading table LOCAL_MEMBERS 72rows unloaded.
2009-06-24 14:16:06...unloading table CONTENTLOCK 0rows unloaded.
2009-06-24 14:16:06...unloading table ATTACHMENTS 594rows unloaded.
2009-06-24 14:16:06...unloading table OS_USER 36rows unloaded.
2009-06-24 14:16:06...unloading table DECORATOR 0rows unloaded.
2009-06-24 14:16:06...unloading table PAGETEMPLATES 0rows unloaded.
2009-06-24 14:16:06...unloading table HIBERNATE_UNIQUE_KEY 1rows unloaded.
GDUL>

最后,会在当前目录下,每一个表生成一个exp格式导出的文件。

3、重建数据库,然后把每一个表imp进去。

首页 > 软件使用 > Oracle数据库不能open时的数据恢复

Return to page top