日期:2014-05-16  浏览次数:20515 次

如何从control file中找到DBID和DBNAME

第一次在JavaEye写博客,真紧张啊! ?


场景如下:

[ 给定一个坏掉的control file,如何从中找出DBID和DBNAME ]


方法1: 使用BBED(block browser edit),dump出control file,从中寻找dbid,dbname


1.1 配置bbed


1.1.1 安装bbed

[oracle@single ~]$ cd $ORACLE_HOME/rdbms/lib
[oracle@single lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed


1.1.2 设置bbed.par, filelist.txt文件


1.1.2.1 新建一个名为bbed.par的文件,文件内容如下。等会启动bbed.par的时候要用

bbed.par?
[oracle@single lib]$ cat /home/oracle/chou/bbed.par
blocksize=8192
listfile=/home/oracle/chou/filelist.txt
mode=edit



1.1.2.2 新建一个名为filelist.txt的文件,文件内容就是你想要操作的数据文件

filelist.txt
[oracle@single lib]$ cat /home/oracle/chou/filelist.txt
1 /home/oracle/chou/control01.ctl 7389184

依次为:文件编号(随意), 文件名, 文件大小(KB)

?

?

1.2 启动BBED

[oracle@single lib]$ bbed parfile=/home/oracle/chou/bbed.par
Password: <== 密码:blockedit


BBED: Release 2.0.0.0.0 - Limited Production on Mon Jul 12 19:03:27 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED>
BBED> dump file 1 block 1 count 500
File: /home/oracle/chou/control01.ctl (1)
Block: 1 Offsets: 0 to 499 Dba:0x00400001
------------------------------------
15c20000 01000000 00000000 00000104 58ff0000 00000000 0003200a cd71717d
?4d4f4e53 54455200 e2130000 c2010000 00400000 00000100 00000000 00000000
?00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
?38836a07 d1c6322a c7834400 00080000 3ac51a2b 000000