標籤:
本文的環境:Oracle Databae 12.1.0.2, rhel5.9 x86-64bit
[[email protected] orcl]$ pwd/u01/app/oracle/oradata/orcl[[email protected] orcl]$ ls -lrttotal 2386544drwxr-x--- 2 oracle oinstall 4096 Dec 26 2014 pdbseeddrwxr-x--- 2 oracle oinstall 4096 Dec 26 2014 PN1drwxr-x--- 2 oracle oinstall 4096 Dec 26 2014 PN2-rw-r----- 1 oracle oinstall 5251072 Jul 31 13:26 users01.dbf-rw-r----- 1 oracle oinstall 52429312 Jul 31 13:26 redo03.log-rw-r----- 1 oracle oinstall 52429312 Jul 31 13:26 redo01.log-rw-r----- 1 oracle oinstall 74457088 Jul 31 20:01 temp01.dbf-rw-r----- 1 oracle oinstall 602939392 Jul 31 20:25 undotbs01.dbf-rw-r----- 1 oracle oinstall 870326272 Jul 31 20:25 system01.dbf-rw-r----- 1 oracle oinstall 765468672 Jul 31 20:25 sysaux01.dbf-rw-r----- 1 oracle oinstall 52429312 Jul 31 20:26 redo02.log-rw-r----- 1 oracle oinstall 17973248 Jul 31 20:26 control01.ctl[[email protected] orcl]$ dd if=/u01/app/oracle/oradata/orcl/system01.dbf bs=512 count=1 | od -x1+0 records in1+0 records out512 bytes (512 B) copied, 0.027559 seconds, 18.6 kB/s0000000 a200 0000 0000 ffc0 0000 0000 0000 00000000020 6567 0000 2000 0000 9f00 0001 7c7d 7a7b0000040 81a0 0000 0000 0000 0000 0000 0000 00000000060 0000 0000 0000 0000 0000 0000 0000 0000*0001000[[email protected] orcl]$ dd if=/u01/app/oracle/oradata/orcl/system01.dbf bs=512 count=1 | od -i1+0 records in1+0 records out512 bytes (512 B) copied, 2.9e-05 seconds, 17.7 MB/s0000000 41472 -4194304 0 00000020 25959 8192 106240 20549131490000040 33184 0 0 00000060 0 0 0 0*0001000[[email protected] orcl]$ [[email protected] orcl]$ [[email protected] orcl]$ ls -lrt8192*106240=870318080而 ls -lrt的結果中顯示system01.dbf的大小為:870326272870326272-870318080=8192,這多出的一個就是datafile中的os header,參見文章:How to Detect and Fix a Corruption in the Datafile OS Header/Block Zero - ORA-27047 DBV-107 ORA-1157/ORA-27048 (文檔 ID 360032.1)
8192手工計算過程;
2000 0000 翻轉後:00002000,換算成十進位,就是8192
106240手工計算過程:
9f00 0001 翻轉後:00019f00, 換算成十進位,就是106240
參考文章:
HOW TO GET DATAFILE SIZE THROUGH DD (文檔 ID 274445.1)
註:該文章僅僅能提供計算的思路,其實裡邊的db block 的數量的換算過程是錯誤的。
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
Oracle database datafile header中記錄的datafile的大小