如何从control file中找到DBID和DBNAME

本文介绍了两种从损坏的Oracle Controlfile中恢复DBID和DBNAME的方法。一是通过BBED工具dump控制文件并解析,二是利用损坏的Controlfile启动数据库并通过tracefile获取相关信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

第一次在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

 

 

资源下载链接为: https://pan.quark.cn/s/9648a1f24758 这个HTML文件是一个专门设计的网页,适合在告白或纪念日这样的特殊时刻送给女朋友,给她带来惊喜。它通过HTML技术,将普通文字转化为富有情感创意的表达方式,让数字媒体也能传递深情。HTML(HyperText Markup Language)是构建网页的基础语言,通过标签描述网页结构内容,让浏览器正确展示页面。在这个特效网页中,开发者可能使用了HTML5的新特性,比如音频、视频、Canvas画布或WebGL图形,来提升视觉效果交互体验。 原本这个文件可能是基于ASP.NET技术构建的,其扩展名是“.aspx”。ASP.NET是微软开发的一个服务器端Web应用程序框架,支持多种编程语言(如C#或VB.NET)来编写动态网页。但为了在本地直接运行,不依赖服务器,开发者将其转换为纯静态的HTML格式,只需浏览器即可打开查看。 在使用这个HTML特效页时,建议使用Internet Explorer(IE)浏览器,因为一些老的或特定的网页特效可能只在IE上表现正常,尤其是那些依赖ActiveX控件或IE特有功能的页面。不过,由于IE逐渐被淘汰,现代网页可能不再对其进行优化,因此在其他现代浏览器上运行可能会出现问题。 压缩包内的文件“yangyisen0713-7561403-biaobai(html版本)_1598430618”是经过压缩的HTML文件,可能包含图片、CSS样式表JavaScript脚本等资源。用户需要先解压,然后在浏览器中打开HTML文件,就能看到预设的告白或纪念日特效。 这个项目展示了HTML作为动态互动内容载体的强大能力,也提醒我们,尽管技术在进步,但有时复古的方式(如使用IE浏览器)仍能唤起怀旧之情。在准备类似的个性化礼物时,掌握基本的HTML网页制作技巧非常
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值