如何从control file中找到DBID和DBNAME

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

第一次在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://renmaiwang.cn/s/0e6hs 数字信号处理实习实验二离散信号的频谱分析MATLAB本实验旨在掌握离散时间信号的DTFTDFT的MATLAB实现,熟悉DTFTDFT之间的关系,了解信号不同变形的DFT与原信号DFT之间的关系,掌握系统函数频率响应之间的关系。一、DTFTDFT的概念DTFT(Discrete-Time Fourier Transform)是对离散时间信号进行频谱分析的重要工具,它可以将时域信号转换为频域信号,从而分析信号的频率特性。DFT(Discrete Fourier Transform)是DTFT的一种近似实现形式,它可以将有限长信号转换为频域信号。二、实验目的1. 掌握离散时间信号的DTFTDFT的MATLAB实现2. 熟悉DTFTDFT之间的关系3. 了解信号不同变形的DFT与原信号DFT之间的关系4. 掌握系统函数频率响应之间的关系三、实验内容1. 自定义一个长度为8点的信号,信号幅度值也由自己任意指定,对该信号作DTFT,分别画出幅度谱相位谱2. 对信号分别做8点、16点、32点DFT,分别与DTFT合并作图并比较DFT与DTFT之间的关系3. 在信号每两个相邻样本之间插入一个零值,扩充为16点序列,作DFT,画出幅度谱相位谱,并与原序列的DFT进行比较4. 将信号以8为周期扩展,得到长为16的两个周期,作DFT,画出幅度谱相位谱,并与原序列的DFT进行比较5. 已知离散时间系统差分方程为y(n)-0.5y(n-1)+0.06y(n-2)=x(n)+x(n-1),求出并画出其频率响应6. 求该系统系统函数,并画极零点图,并通过freqz函数求频率响应四、设计流程1. 自定义序列为x=[1,2,3,4,5,8,9,7]2. 使用MATLAB实现DTFTDFT3. 画出幅度谱
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值