您的位置:首页 > 其它

RS-232接口定义及连线

2007-11-05 09:52 267 查看
第一次在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 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 08000000 08000000 08000000 00000000 00000000 00000000

 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED>

( 请参考 => http://www.udpwork.com/item/1929.html )

将cd71717d 做一个顺序上的变换,得到dbid如下:

DBID:7d7171cd  转换为十进制 => 2104586701 

DBNAME:

4d4f4e53 54455200

,转换为字符



SQL> select utl_raw.cast_to_varchar2('4d4f4e5354455200') from dual;

UTL_RAW.CAST_TO_VARCHAR2('4D4F4E5354455200')

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

MONSTER

方法2: 用坏的control file 启动数据库,从trace file中寻找dbid, dbname

2.1 用坏control file 代替原先的control file,然后startup DB

[oracle@single oradata]$ ls -ltr

合計 7240

drwxr-x--- 2 oracle dba 4096 2月 19 09:53 single

-rwxrwxr-x 1 oracle dba 7389184 7月 6 13:27 control01.ctl

drwxr-x--- 2 oracle dba 4096 7月 11 15:02 tesy

drwxr-x--- 2 oracle dba 4096 7月 12 07:41 test

[oracle@single oradata]$ cd test

[oracle@single test]$ mv control01.ctl control01.ctl.bak

[oracle@single test]$ cd ..

[oracle@single oradata]$ cp control01.ctl test/.

[oracle@single test]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 12 07:41:26 2010

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

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218992 bytes

Variable Size 96470608 bytes

Database Buffers 184549376 bytes

Redo Buffers 2973696 bytes

ORA-00227: corrupt block detected in control file: (block 1, # blocks 1)

ORA-00202: control file: '/opt/ora10g/oradata/test/control01.ctl'

2.2  检查trace file

[oracle@single udump]$ view test_ora_5628.trc

1 /opt/ora10g/admin/test/udump/test_ora_5628.trc

2 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

3 With the Partitioning, OLAP and Data Mining options

4 ORACLE_HOME = /opt/ora10g/product/10.2.0/db_1

5 System name: Linux

6 Node name: single

7 Release: 2.6.18-92.el5PAE

8 Version: #1 SMP Fri May 23 22:26:05 EDT 2008

9 Machine: i686

10 Instance name: test

11 Redo thread mounted by this instance: 0 <none>

12 Oracle process number: 15

13 Unix process pid: 5628, image: oracle@single (TNS V1-V3)

14

15 *** SERVICE NAME:() 2010-07-12 07:41:29.190

16 *** SESSION ID:(159.1) 2010-07-12 07:41:29.190

17 Hex dump of (file 0, block 1)

18 Dump of memory from 0xB7FB7E00 to 0xB7FBBE00

19 B7FB7E00 0000C215 00000001 00000000 04010000 [................]

20 B7FB7E10 0000FF58 00000000 0A200300 7D7171CD
[X......... ..qq}]

21 B7FB7E20 534E4F4D 00524554 000013E2 000001C2 [MONSTER
.........]

22 B7FB7E30 00004000 00010000 00000000 00000000 [.@..............]

23 B7FB7E40 00000000 00000000 00000000 00000000 [................]

这样得到的dbid不用转换顺序,换为十进制就可以了,dbname就在下面一行,这就不多说了。

DBID:

7D7171CD

  转换为十进制 => 2104586701 

DBNAME:

MONSTER

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: