ITPub博客

首页 > 数据库 > Oracle > BBED测试

BBED测试

原创 Oracle 作者:liiinuuux 时间:2014-01-27 16:38:34 0 删除 编辑

原创文章,转载请标明出处

http://bbs.itpub.net:8080/26239116/viewspace-1075966/

编译bbed
[oracle@db3 lib]$ pwd
/u01/app/oracle/product/db_1/rdbms/lib
[oracle@db3 lib]$ make -f ins_rdbms.mk  BBED=$ORACLE_HOME/bin/bbed  $ORACLE_HOME/bin/bbed

Linking BBED utility (bbed)
rm -f /u01/app/oracle/product/db_1//bin/bbed
gcc -o /u01/app/oracle/product/db_1//bin/bbed -L/u01/app/oracle/product/db_1//rdbms/lib/ -L/u01/app/oracle/product/db_1//lib/ -L/u01/app/oracle/product/db_1//lib/stubs/ -L/usr/lib -lirc  /u01/app/oracle/product/db_1//lib/s0main.o /u01/app/oracle/product/db_1//rdbms/lib/ssbbded.o /u01/app/oracle/product/db_1//rdbms/lib/sbbdpt.o `cat /u01/app/oracle/product/db_1//lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 /u01/app/oracle/product/db_1//rdbms/lib/defopt.o -ldbtools10 -lclntsh  `cat /u01/app/oracle/product/db_1//lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /u01/app/oracle/product/db_1//lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /u01/app/oracle/product/db_1//lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /u01/app/oracle/product/db_1//lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10   -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10   `cat /u01/app/oracle/product/db_1//lib/sysliblist` -Wl,-rpath,/u01/app/oracle/product/db_1//lib -lm    `cat /u01/app/oracle/product/db_1//lib/sysliblist` -ldl -lm   -L/u01/app/oracle/product/db_1//lib

生成bbed需要的文件列表
SQL> select file#||' '||name||' '||bytes from v$datafile ;

FILE#||''||NAME||''||BYTES
--------------------------------------------------------------------------------
1 /oradata/PROD/disk1/system01.dbf 340787200
2 /oradata/PROD/disk1/undotbs01.dbf 209715200
3 /oradata/PROD/disk1/sysaux01.dbf 340787200
4 /oradata/PROD/disk1/tbs_1.dbf 10485760

[oracle@db3 script]$ cat file_list.bbed
1 /oradata/PROD/disk1/system01.dbf 340787200
2 /oradata/PROD/disk1/undotbs01.dbf 209715200
3 /oradata/PROD/disk1/sysaux01.dbf 340787200
4 /oradata/PROD/disk1/tbs_1.dbf 10485760

创建bbed参数文件,文件中需要指定上一步生成的文件列表
[oracle@db3 script]$ cat config.bbed
blocksize=8192
listfile=/home/oracle/script/file_list.bbed
mode=edit

进入bbed,密码blockedit
[oracle@db3 script]$ bbed parfile=config.bbed
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jan 27 14:31:54 2014

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

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

BBED> info
File#  Name                                                        Size(blks)
-----  ----                                                        ----------
     1  /oradata/PROD/disk1/system01.dbf                                 41600
     2  /oradata/PROD/disk1/undotbs01.dbf                                25600
     3  /oradata/PROD/disk1/sysaux01.dbf                                 41600
     4  /oradata/PROD/disk1/tbs_1.dbf                                     1280


使用例子1
修改scott.emp中,将FORD的名字改成ABCD
注意事项:
     1 由于是原地修改,因此修改前后的值长度必须一致
     2 此修改不会记录redo,因此修改后需要做备份

1 查看数据的物理地址
Wrote file afiedt.buf

  1  select
  2  e.rowid,
  3  dbms_rowid.rowid_object(e.rowid) object_id,
  4  dbms_rowid.rowid_relative_fno(e.rowid) file_id,
  5  dbms_rowid.rowid_block_number(e.rowid) block_id,
  6  dbms_rowid.rowid_row_number(e.rowid) num,
  7  e.*
  8* from scott.emp e
SQL>
SQL>
SQL> /

ROWID              OBJECT_ID     FILE_ID   BLOCK_ID        NUM         EMPNO ENAME      JOB           MGR HIREDATE        SAL          COMM     DEPTNO
------------------ ---------- ---------- ---------- ---------- ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
AAACb8AAEAAAAAaAAA     9980            4     26          0          7369 SMITH      CLERK          7902 17-DEC-80        800                 20
AAACb8AAEAAAAAaAAB     9980            4     26          1          7499 ALLEN      SALESMAN          7698 20-FEB-81       1600           300       30
AAACb8AAEAAAAAaAAC     9980            4     26          2          7521 WARD          SALESMAN          7698 22-FEB-81       1250           500       30
AAACb8AAEAAAAAaAAD     9980            4     26          3          7566 JONES      MANAGER          7839 02-APR-81       2975                 20
AAACb8AAEAAAAAaAAE     9980            4     26          4          7654 MARTIN     SALESMAN          7698 28-SEP-81       1250          1400       30
AAACb8AAEAAAAAaAAF     9980            4     26          5          7698 BLAKE      MANAGER          7839 01-MAY-81       2850                 30
AAACb8AAEAAAAAaAAG     9980            4     26          6          7782 CLARK      MANAGER          7839 09-JUN-81       2450                 10
AAACb8AAEAAAAAaAAH     9980            4     26          7          7788 SCOTT      ANALYST          7566 19-APR-87       3000                 20
AAACb8AAEAAAAAaAAI     9980            4     26          8          7839 KING          PRESIDENT            17-NOV-81       5000                 10
AAACb8AAEAAAAAaAAJ     9980            4     26          9          7844 TURNER     SALESMAN          7698 08-SEP-81       1500          0       30
AAACb8AAEAAAAAaAAK     9980            4     26         10          7876 ADAMS      CLERK          7788 23-MAY-87       1100                 20
AAACb8AAEAAAAAaAAL     9980            4     26         11          7900 JAMES      CLERK          7698 03-DEC-81        950                 30
AAACb8AAEAAAAAaAAM     9980            4     26         12          7902 FORD          ANALYST          7566 03-DEC-81       3000                 20
AAACb8AAEAAAAAaAAN     9980            4     26         13          7934 MILLER     CLERK          7782 23-JAN-82       1300                 10

14 rows selected.

2 在BBED中找到该处(如果该值被修改过,行迁移等,数据文件里可能会找到多处。需要对找到的结果反复确认。)

[oracle@db3 script]$ bbed parfile=config.bbed
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jan 27 14:43:22 2014

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

************* !!! For Oracle Internal Use only !!! ***************
BBED> info
File#  Name                                                        Size(blks)
-----  ----                                                        ----------
     1  /oradata/PROD/disk1/system01.dbf                                 41600
     2  /oradata/PROD/disk1/undotbs01.dbf                                25600
     3  /oradata/PROD/disk1/sysaux01.dbf                                 41600
     4  /oradata/PROD/disk1/tbs_1.dbf                                     1280

BBED>

设置4号文件第26个数据块
BBED> set dba 4,26
     DBA                 0x0100001a (16777242 4,26)

以字符形式查找FORD, TOP表示从开头开始找,如果是CURR则表示从当前位置开始找
找到之后,会显示当前的数据块内的偏移量(7668)
BBED> f /c FORD TOP
File: /oradata/PROD/disk1/tbs_1.dbf (4)
Block: 26               Offsets: 7668 to 8179           Dba:0x0100001a
------------------------------------------------------------------------
464f5244 07414e41 4c595354 03c24c43 0777b50c 03010101 02c21fff 02c1152c
010802c2 50054a41 4d455305 434c4552 4b03c24d 630777b5 0c030101 0103c20a
33ff02c1 1f2c0108 03c24f4d 05414441 4d530543 4c45524b 03c24e59 0777bb05
17010101 02c20cff 02c1152c 010803c2 4f2d0654 55524e45 52085341 4c45534d
414e03c2 4d630777 b5090801 010102c2 10018002 c11f2c01 0803c24f 28044b49
4e470950 52455349 44454e54 ff0777b5 0b110101 0102c233 ff02c10b 2c010803
c24e5905 53434f54 5407414e 414c5953 5403c24c 430777bb 04130101 0102c21f
ff02c115 2c010803 c24e5305 434c4152 4b074d41 4e414745 5203c24f 280777b5
06090101 0103c219 33ff02c1 0b2c0108 03c24d63 05424c41 4b45074d 414e4147
455203c2 4f280777 b5050101 010103c2 1d33ff02 c11f2c01 0803c24d 37064d41
5254494e 0853414c 45534d41 4e03c24d 630777b5 091c0101 0103c20d 3302c20f
02c11f2c 010803c2 4c43054a 4f4e4553 074d414e 41474552 03c24f28 0777b504
02010101 03c21e4c ff02c115 2c010803 c24c1604 57415244 0853414c 45534d41
4e03c24d 630777b5 02160101 0103c20d 3302c206 02c11f2c 010803c2 4b640541
4c4c454e 0853414c 45534d41 4e03c24d 630777b5 02140101 0102c211 02c20402
c11f2c01 0803c24a 4605534d 49544805 434c4552 4b03c250 030777b4 0c110101

<32 bytes="" per="" line="">

找到之后,可以用d /v以asc码查看内容,确认是FORD
BBED> d /v
File: /oradata/PROD/disk1/tbs_1.dbf (4)
Block: 26      Offsets: 7668 to 8179  Dba:0x0100001a
-------------------------------------------------------
464f5244 07414e41 4c595354 03c24c43 l FORD.ANALYST.?C
0777b50c 03010101 02c21fff 02c1152c l .w?.....?..?,
010802c2 50054a41 4d455305 434c4552 l ...?.JAMES.CLER
4b03c24d 630777b5 0c030101 0103c20a l K.?c.w?.....?
33ff02c1 1f2c0108 03c24f4d 05414441 l 3..?,...?M.ADA
4d530543 4c45524b 03c24e59 0777bb05 l MS.CLERK.?Y.w?
17010101 02c20cff 02c1152c 010803c2 l .....?..?,...
4f2d0654 55524e45 52085341 4c45534d l O-.TURNER.SALESM
414e03c2 4d630777 b5090801 010102c2 l AN.?c.w?.....
10018002 c11f2c01 0803c24f 28044b49 l ....?,...?(.KI
4e470950 52455349 44454e54 ff0777b5 l NG.PRESIDENT..w
0b110101 0102c233 ff02c10b 2c010803 l ......?..?,...
c24e5905 53434f54 5407414e 414c5953 l ?Y.SCOTT.ANALYS
5403c24c 430777bb 04130101 0102c21f l T.?C.w?.....?
ff02c115 2c010803 c24e5305 434c4152 l ..?,...?S.CLAR
4b074d41 4e414745 5203c24f 280777b5 l K.MANAGER.?(.w
06090101 0103c219 33ff02c1 0b2c0108 l ......?3..?,..
03c24d63 05424c41 4b45074d 414e4147 l .?c.BLAKE.MANAG
455203c2 4f280777 b5050101 010103c2 l ER.?(.w?.....
1d33ff02 c11f2c01 0803c24d 37064d41 l .3..?,...?7.MA
5254494e 0853414c 45534d41 4e03c24d l RTIN.SALESMAN.?
630777b5 091c0101 0103c20d 3302c20f l c.w?.....?3.?
02c11f2c 010803c2 4c43054a 4f4e4553 l .?,...?C.JONES
074d414e 41474552 03c24f28 0777b504 l .MANAGER.?(.w?
02010101 03c21e4c ff02c115 2c010803 l .....?L..?,...
c24c1604 57415244 0853414c 45534d41 l ?..WARD.SALESMA
4e03c24d 630777b5 02160101 0103c20d l N.?c.w?.....?
3302c206 02c11f2c 010803c2 4b640541 l 3.?.?,...?d.A
4c4c454e 0853414c 45534d41 4e03c24d l LLEN.SALESMAN.?
630777b5 02140101 0102c211 02c20402 l c.w?.....?.?.
c11f2c01 0803c24a 4605534d 49544805 l ?,...?F.SMITH.
434c4552 4b03c250 030777b4 0c110101 l CLERK.?..w?...

<16 bytes="" per="" line="">

3 在BBED中将FORD改为ABCD
BBED> m /c ABCD dba 4,26 offset 7668
File: /oradata/PROD/disk1/tbs_1.dbf (4)
Block: 26               Offsets: 7668 to 8179           Dba:0x0100001a
------------------------------------------------------------------------
41424344 07414e41 4c595354 03c24c43 0777b50c 03010101 02c21fff 02c1152c
010802c2 50054a41 4d455305 434c4552 4b03c24d 630777b5 0c030101 0103c20a
33ff02c1 1f2c0108 03c24f4d 05414441 4d530543 4c45524b 03c24e59 0777bb05
17010101 02c20cff 02c1152c 010803c2 4f2d0654 55524e45 52085341 4c45534d
414e03c2 4d630777 b5090801 010102c2 10018002 c11f2c01 0803c24f 28044b49
4e470950 52455349 44454e54 ff0777b5 0b110101 0102c233 ff02c10b 2c010803
c24e5905 53434f54 5407414e 414c5953 5403c24c 430777bb 04130101 0102c21f
ff02c115 2c010803 c24e5305 434c4152 4b074d41 4e414745 5203c24f 280777b5
06090101 0103c219 33ff02c1 0b2c0108 03c24d63 05424c41 4b45074d 414e4147
455203c2 4f280777 b5050101 010103c2 1d33ff02 c11f2c01 0803c24d 37064d41
5254494e 0853414c 45534d41 4e03c24d 630777b5 091c0101 0103c20d 3302c20f
02c11f2c 010803c2 4c43054a 4f4e4553 074d414e 41474552 03c24f28 0777b504
02010101 03c21e4c ff02c115 2c010803 c24c1604 57415244 0853414c 45534d41
4e03c24d 630777b5 02160101 0103c20d 3302c206 02c11f2c 010803c2 4b640541
4c4c454e 0853414c 45534d41 4e03c24d 630777b5 02140101 0102c211 02c20402
c11f2c01 0803c24a 4605534d 49544805 434c4552 4b03c250 030777b4 0c110101

<32 bytes="" per="" line="">

BBED> d /v
File: /oradata/PROD/disk1/tbs_1.dbf (4)
Block: 26      Offsets: 7668 to 8179  Dba:0x0100001a
-------------------------------------------------------
41424344 07414e41 4c595354 03c24c43 l ABCD.ANALYST.?C
0777b50c 03010101 02c21fff 02c1152c l .w?.....?..?,
010802c2 50054a41 4d455305 434c4552 l ...?.JAMES.CLER
4b03c24d 630777b5 0c030101 0103c20a l K.?c.w?.....?
33ff02c1 1f2c0108 03c24f4d 05414441 l 3..?,...?M.ADA
4d530543 4c45524b 03c24e59 0777bb05 l MS.CLERK.?Y.w?
17010101 02c20cff 02c1152c 010803c2 l .....?..?,...
4f2d0654 55524e45 52085341 4c45534d l O-.TURNER.SALESM
414e03c2 4d630777 b5090801 010102c2 l AN.?c.w?.....
10018002 c11f2c01 0803c24f 28044b49 l ....?,...?(.KI
4e470950 52455349 44454e54 ff0777b5 l NG.PRESIDENT..w
0b110101 0102c233 ff02c10b 2c010803 l ......?..?,...
c24e5905 53434f54 5407414e 414c5953 l ?Y.SCOTT.ANALYS
5403c24c 430777bb 04130101 0102c21f l T.?C.w?.....?
ff02c115 2c010803 c24e5305 434c4152 l ..?,...?S.CLAR
4b074d41 4e414745 5203c24f 280777b5 l K.MANAGER.?(.w
06090101 0103c219 33ff02c1 0b2c0108 l ......?3..?,..
03c24d63 05424c41 4b45074d 414e4147 l .?c.BLAKE.MANAG
455203c2 4f280777 b5050101 010103c2 l ER.?(.w?.....
1d33ff02 c11f2c01 0803c24d 37064d41 l .3..?,...?7.MA
5254494e 0853414c 45534d41 4e03c24d l RTIN.SALESMAN.?
630777b5 091c0101 0103c20d 3302c20f l c.w?.....?3.?
02c11f2c 010803c2 4c43054a 4f4e4553 l .?,...?C.JONES
074d414e 41474552 03c24f28 0777b504 l .MANAGER.?(.w?
02010101 03c21e4c ff02c115 2c010803 l .....?L..?,...
c24c1604 57415244 0853414c 45534d41 l ?..WARD.SALESMA
4e03c24d 630777b5 02160101 0103c20d l N.?c.w?.....?
3302c206 02c11f2c 010803c2 4b640541 l 3.?.?,...?d.A
4c4c454e 0853414c 45534d41 4e03c24d l LLEN.SALESMAN.?
630777b5 02140101 0102c211 02c20402 l c.w?.....?.?.
c11f2c01 0803c24a 4605534d 49544805 l ?,...?F.SMITH.
434c4552 4b03c250 030777b4 0c110101 l CLERK.?..w?...

<16 bytes="" per="" line="">

4 应用修改
BBED> sum apply
Check value for File 4, Block 26:
current = 0xa73f, required = 0xa73f


5 在数据库中查看
SQL>  alter system flush BUFFER_CACHE;

System altered.

SQL> select * from scott.emp;

     EMPNO ENAME      JOB            MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80         800              20
      7499 ALLEN      SALESMAN           7698 20-FEB-81        1600        300        30
      7521 WARD       SALESMAN           7698 22-FEB-81        1250        500        30
      7566 JONES      MANAGER           7839 02-APR-81        2975              20
      7654 MARTIN     SALESMAN           7698 28-SEP-81        1250       1400        30
      7698 BLAKE      MANAGER           7839 01-MAY-81        2850              30
      7782 CLARK      MANAGER           7839 09-JUN-81        2450              10
      7788 SCOTT      ANALYST           7566 19-APR-87        3000              20
      7839 KING       PRESIDENT         17-NOV-81        5000              10
      7844 TURNER     SALESMAN           7698 08-SEP-81        1500      0        30
      7876 ADAMS      CLERK           7788 23-MAY-87        1100              20
      7900 JAMES      CLERK           7698 03-DEC-81         950              30
      7902 ABCD       ANALYST           7566 03-DEC-81        3000              20
      7934 MILLER     CLERK           7782 23-JAN-82        1300              10

14 rows selected.


使用例子2
修改数据文件头的scn
使用场景举例
1 一个数据文件的数据从来不会改变,但是经过一致性关库,SCN发生了变化。此时如果数据文件损坏且没有归档,只有老的备份。即使从备份开始数据没有改变,由于备份的数据文件头SCN太老,数据库无法打开。
2 一个数据文件被长期置于OFFLINE状态,归档已经删除,重启后,该数据文件无法ONLINE。

1 重现异常
SQL> alter database datafile 4 offline;

Tablespace altered.

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> select file#, name, checkpoint_change# from v$datafile_header;

     FILE# NAME                                CHECKPOINT_CHANGE#
---------- -------------------------------------------------- ------------------
     1 /oradata/PROD/disk1/system01.dbf                      210863
     2 /oradata/PROD/disk1/undotbs01.dbf                      210863
     3 /oradata/PROD/disk1/sysaux01.dbf                      210863
     4                                               0

删除归档,关闭数据库
[oracle@db3 arch]$ rm -f 1_*

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

此处演示先mount再online的情况,虽然可以online,但是数据库无法open。
而假如先open,虽然OPEN可以成功,但是online会报错。
总之4号文件再也无法使用了。
SQL> startup mount
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size              1219184 bytes
Variable Size             96470416 bytes
Database Buffers       213909504 bytes
Redo Buffers              2973696 bytes
Database mounted.

SQL> alter database datafile 4 online;

Database altered.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/oradata/PROD/disk1/tbs_1.dbf'


SQL> recover database;
ORA-00279: change 292790 generated at 01/27/2014 15:42:37 needed for thread 1
ORA-00289: suggestion : /oradata/PROD/disk1/arch/1_60_837957443.dbf
ORA-00280: change 292790 for thread 1 is in sequence #60


Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log '/oradata/PROD/disk1/arch/1_60_837957443.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3


ORA-00308: cannot open archived log '/oradata/PROD/disk1/arch/1_60_837957443.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

SQL> select file#, name, checkpoint_change# from v$datafile_header;

     FILE# NAME                                CHECKPOINT_CHANGE#
---------- -------------------------------------------------- ------------------
     1 /oradata/PROD/disk1/system01.dbf                     252319 
     2 /oradata/PROD/disk1/undotbs01.dbf                     252319 
     3 /oradata/PROD/disk1/sysaux01.dbf                     252319 
     4 /oradata/PROD/disk1/tbs_1.dbf                      231531


2 将4号文件的SCN和其它文件的SCN转换成16进制
252319 = 3D99F
231531 = 3886B

3 在BBED中找到SCN位置
[oracle@db3 script]$ bbed parfile=config.bbed
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jan 27 15:23:10 2014

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

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

BBED> set dba 4,1
     DBA                 0x01000001 (16777217 4,1)

打印块头信息kcvfh
或直接看块头的检查点信息,kscnbas就是scn,@484说明偏移量是484
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x0003886b
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x31f24857
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x00000035
         ub4 kcrbabno                       @504      0x00000062
         ub2 kcrbabof                       @508      0x0010
   ub1 kcvcpetb[0]                          @512      0x02
   ub1 kcvcpetb[1]                          @513      0x00
   ub1 kcvcpetb[2]                          @514      0x00
   ub1 kcvcpetb[3]                          @515      0x00
   ub1 kcvcpetb[4]                          @516      0x00
   ub1 kcvcpetb[5]                          @517      0x00
   ub1 kcvcpetb[6]                          @518      0x00
   ub1 kcvcpetb[7]                          @519      0x00

再次确认scn信息
这里对SCN的存储是两个数字一组,位置变换的,如此处就是将 00 03 88 6B 存储成 6B 88 03 00
BBED> set dba 4,1 offset 484
     DBA                 0x01000001 (16777217 4,1)
     OFFSET              484

BBED> d /v
File: /oradata/PROD/disk1/tbs_1.dbf (4)
Block: 1       Offsets:  484 to  995  Dba:0x01000001
-------------------------------------------------------
6b880300 00000000 5748f231 01009232 l k.......WH?...2
35000000 62000000 1000ffbf 02000000 l 5...b......?...
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................

需要按类似的顺序,将3D99F写入此处,即 9F D9 03
BBED> m /x 98D703 dba 4,1 offset 484
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /oradata/PROD/disk1/tbs_1.dbf (4)
Block: 1                Offsets:  484 to  995           Dba:0x01000001
------------------------------------------------------------------------
98d70300 00000000 5748f231 01009232 35000000 62000000 1000ffbf 02000000
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
0a000a00 0a000100 00000000 00000000 00000000 02000001 00000000 00000000

应用修改
BBED> sum apply
Check value for File 4, Block 1:
current = 0x21bc, required = 0x21bc 

SQL> select file#, name, checkpoint_change# from v$datafile_header;

     FILE# NAME                                CHECKPOINT_CHANGE#
---------- -------------------------------------------------- ------------------
     1 /oradata/PROD/disk1/system01.dbf                     252319
     2 /oradata/PROD/disk1/undotbs01.dbf                     252319
     3 /oradata/PROD/disk1/sysaux01.dbf                     252319
     4 /oradata/PROD/disk1/tbs_1.dbf                      252319

启动数据库
此时必须做一个recover database,客套一番,然后再alter database open
SQL> alter database open;

Database altered.

SQL>
SQL>
SQL> set lines 120
SQL> select * from scott.emp;

     EMPNO ENAME      JOB            MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80         800              20
      7499 ALLEN      SALESMAN           7698 20-FEB-81        1600        300        30
      7521 WARD       SALESMAN           7698 22-FEB-81        1250        500        30
      7566 JONES      MANAGER           7839 02-APR-81        2975              20
      7654 MARTIN     SALESMAN           7698 28-SEP-81        1250       1400        30
      7698 BLAKE      MANAGER           7839 01-MAY-81        2850              30
      7782 CLARK      MANAGER           7839 09-JUN-81        2450              10
      7788 SCOTT      ANALYST           7566 19-APR-87        3000              20
      7839 KING       PRESIDENT         17-NOV-81        5000              10
      7844 TURNER     SALESMAN           7698 08-SEP-81        1500      0        30
      7876 ADAMS      CLERK           7788 23-MAY-87        1100              20

     EMPNO ENAME      JOB            MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7900 JAMES      CLERK           7698 03-DEC-81         950              30
      7902 ABCD       ANALYST           7566 03-DEC-81        3000              20
      7934 MILLER     CLERK           7782 23-JAN-82        1300              10

14 rows selected.




来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26239116/viewspace-1075966/,如需转载,请注明出处,否则将追究法律责任。

上一篇: iptables 读书笔记
请登录后发表评论 登录
全部评论

注册时间:2012-11-12

  • 博文量
    94
  • 访问量
    309080