Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The important block from oracle asm dd

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The previous article wrote the dd output file in asm, this article only dd blocks, mainly for the case of large files.

Take the scott mode as an example:

Table information before modification

SQL > select * from emp where mgr=7566 and empno=77887788 SCOTT ANALYST 7566 1987-4-19 3000.00 20

1 AU calculation:

SQL > selectextent_Id,block_id,blocks,file_id 2 fromdba_extents where segment_name='EMP'SQL > / EXTENT_ID BLOCK_ID BLOCKS FILE_ID- 0 144 8 5SQL > selectname from v$datafile where file#=5 NAME---+DATA/db/datafile/users.276.899048797SQL > selectname,group_number,file_number from v$asm_alias where name like'% USERS%' andfile_number=276 NAME GROUP_NUMBER FILE_NUMBER-----USERS.276.899048797 1 276SQL > selectdisk_kffxp,au_kffxp Xnum_kffxp from x$kffxp where group_kffxp=1 andnumber_kffxp=276 DISK_KFFXP AU_KFFXP XNUM_KFFXP- 1 426 0 0 289 1

It is calculated here that the block_id is 144m and the block size is 8KB, then its position is 144m, and the block size is 1024m, which is no more than 4m. The second disk path should be taken on the first AU (AU size is 4m) and on the 426th AU of the second disk:

SQL > selectdisk_number,path from v$asm_disk where disk_number=1;DISK_NUMBERPATH- 1 / dev/raw/raw2

Take out the maximum and minimum data_object_id of the table, and then dd.

SQL > select dbms_rowid.rowid_relative_fno (rowid) rel_fno, max (dbms_rowid.rowid_block_number (rowid)) max_block, min (dbms_rowid.rowid_block_number (rowid)) min_block from emp group by dbms_rowid.rowid_relative_fno (rowid) REL_FNO MAX_BLOCK MIN_BLOCK--5 149 [oracle@mysql-1] $ddif=/dev/raw/raw2 bs=1024 count=8 skip=1746088 of=emp.dd

Let me explain: skip=426*4*1024+149*8

Check it out:

[oracle@mysql-1~] $strings emp.ddMILLERCLERKFORDANALYSTJAMESCLERKADAMSCLERKTURNERSALESMANKING PRESIDENTSCOTTANALYSTSMITHCLERK

As can be seen from above, it is the content of emp.

2 bbed modify content

In 11g, bbed should be installed first. Record the installation process:

Copy oracle 10g sbbdpt.o,ssbbded.o to $ORACLE_HOME/rdbms/lib copybbedus.msb to $ORACLE_HOME/mesg cd$ORACLE_HOME/rdbms/libmake-fins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbedcp bbed$ORACLE_HOME/ bindings [oracle @ mysql-1~] $bbedBBED > set filename'/home/oracle/emp.dd'; FILENAME / home/oracle/emp.dd# check the next block with bbed. BBED > verifyDBVERIFY-Verification startingFILE = / home/oracle/emp.ddBLOCK = 0Block 0 is corruptCorrupt block relative dba: 0x01400000 (file 0 Block 0) Bad header found during verificationData in bad block: type: 6 format: 2 rdba: 0x01400095 lastchange scn: 0x0000.0004dec0 seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x00000000 check value in block header: 0x89af computed block checksum: 0xd6b DBVERIFY-Verification completeTotal Blocks Examined: 1Total Blocks Processed (Data): 0Total Blocks Failing (Data): 0Total Blocks Processed (Index): 0Total Blocks Failing (Index): 0Total Blocks Empty: 0Total Blocks Marked Corrupt: 1Total Blocks Influx: 0Message 531 not found Product=RDBMS; facility=BBED

Use bbed to view the contents of dd output files

BBED > set blocksize 8192 BLOCKSIZE 8192BBED > p kdbrBBED > find / c SCOTT File: / home/oracle/emp.dd (0) Block: 1 Offsets: 7864 to 8191 Dba:0x00000000- -53434f54 5407414e 414c5953 5403c24c 430777bb04130101 0102c21f ff02c115BBED > dump / v File: / home/oracle/emp.dd (0) Block: 1 Offsets: 7864 to 8191 Dba:0x00000000--- 53434f54 5407414e 414c5953 5403c24c lSCOTT.ANALYST..L 430777bb04130101 0102c21f ff02c115 lC.w. 2c010803 c24e5305 434c4152 4b074d41 l.CLARK.MA 4e414745 5203c24f 280777b5 06090101 lNAGER..O (.w. 0103c219 33ff02c1 0b2c0108 03c24d63 l....3....,....Mc

Modify with bbed:

Set mode editset blocksize 8192find / c SCOTTm / c SNOWHBBED > dump / v File: / home/oracle/emp.dd (0) Block: 1 Offsets: 7864 to 8191 Dba:0x00000000--- 534e4f57 4807414e 414c5953 5403c24c lSNOWH.ANALYST..LBBED > sumCheck value for File 0, Block 1:current = 0x89af, required = 0x87b3 BBED > sum applyCheck value for File 0 Block 1:current = 0x87b3, required = 0x87b3

Close the library and import the modified data:

[oracle@mysql-1~] $srvctl stop database-d DB [oracle @ mysql-1~] $dd of=/dev/raw/raw2 bs=1024 count=8 seek=1746088 if=emp.dd8+0 records in8+0 records out8192 bytes (8.2 kB) copied, 0.00208818 smai 3.9 MB/s

Query table information:

[oracle@mysql-1~] $srvctl start database-d dbSQL > select* from emp where mgr=7566 and empno=7788 2 EMPNOENAME JOB MGR HIREDATE SAL COMM DEPTNO- 7788 SNOWH ANALYST 7566 1987-4-19 3000.00 20

OVER

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report