[20160606]windows下使用bbed的疑問.txt
[20160606]windows下使用bbed的疑問.txt
--連結:http://blog.itpub.net/267265/viewspace-2109019/
http://blog.itpub.net/267265/viewspace-2109558/
--我曾經提到要訪問的塊要+1,比如:
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SCOTT@book> create table dept2 tablespace tea as select * from dept ;
Table created.
SCOTT@book> select ora_rowscn,rowid,dept2.* from dept2 ;
ORA_ROWSCN ROWID DEPTNO DNAME LOC
------------ ------------------ ------------ -------------- -------------
13238134154 AAAW9NAAHAAAACDAAA 10 ACCOUNTING NEW YORK
13238134154 AAAW9NAAHAAAACDAAB 20 RESEARCH DALLAS
13238134154 AAAW9NAAHAAAACDAAC 30 SALES CHICAGO
13238134154 AAAW9NAAHAAAACDAAD 40 OPERATIONS BOSTON
SCOTT@book> @ &r/rowid AAAW9NAAHAAAACDAAA
OBJECT FILE BLOCK ROW DBA TEXT
------------ ------------ ------------ ------------ -------------------- ----------------------------------------
94029 7 131 0 7,131 alter system dump datafile 7 block 131 ;
SCOTT@book> alter system checkpoint;
System altered.
SCOTT@book> select * from v$dbfile where file#=7;
FILE# NAME
------------ ----------------------------------------
7 /mnt/ramdisk/book/tea01.dbf
2.複製資料檔案到windows:
BBED> set dba 7,132
DBA 0x01c00084 (29360260 7,132)
--//注意windwos下使用bbedb lock+1.而在在9i的windows下測試,就不需要+1,不知道為什麼?
--而我今天在取出9i(windows)的一個資料檔案到另外的機器檢視:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for 32-bit Windows: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
CREATE TABLESPACE INDX DATAFILE
'D:\ORACLE\ORADATA\ORCL\INDX01.DBF' SIZE 10M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
LOGGING
ONLINE
PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO;
SQL> create table deptx tablespace indx as select * from scott.dept ;
SQL> select rowid x,deptx.* from deptx;
X DEPTNO DNAME LOC
------------------ ---------- -------------- -------------
AAALOOAAGAAAAAMAAA 10 ACCOUNTING NEW YORK
AAALOOAAGAAAAAMAAB 20 RESEARCH DALLAS
AAALOOAAGAAAAAMAAC 30 SALES CHICAGO
AAALOOAAGAAAAAMAAD 40 OPERATIONS BOSTON
SCOTT@book> @ &r/rowid AAALOOAAGAAAAAMAAA
OBJECT FILE BLOCK ROW DBA TEXT
---------- ---------- ---------- ---------- -------------------- ----------------------------------------
45966 6 12 0 6,12 alter system dump datafile 6 block 12 ;
--然後把資料檔案複製到另外一臺機器.
BED> set dba 6,12
DBA 0x0180000c (25165836 6,12)
BED> map
File: R:\INDX01.DBF (6)
Block: 12 Dba:0x0180000c
-----------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
struct ktbbh, 96 bytes @20
struct kdbh, 14 bytes @124
struct kdbt[1], 4 bytes @138
sb2 kdbr[4] @142
ub1 freespace[7946] @150
ub1 rowdata[92] @8096
ub4 tailchk @8188
BBED> p *kdbr[0]
rowdata[66]
-----------
ub1 rowdata[66] @8162 0x2c
BBED> x /rncc
rowdata[66] @8162
-----------
flag@8162: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8163: 0x00
cols@8164: 3
col 0[2] @8165: 10
col 1[10] @8168: ACCOUNTING
col 2[8] @8179: NEW YORK
--可以發現訪問9i的資料檔案是正常的,不需要在block上+1.為什麼?這樣很容易確定問題在塊頭.
$ od -tx1 -N 8192 tea01.dbf
0000000 00 a2 00 00 00 00 c0 ff 00 00 00 00 00 00 00 00
0000020 66 ff 00 00 00 20 00 00 00 05 00 00 7d 7c 7b 7a
~~~~~
0000040 a0 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0020000
$ od -tx1 -N 8192 INDX01.DBF
0000000 00 00 00 00 00 20 00 00 00 05 00 00 6d 6c 6b 6a
~~~~~
0000020 06 23 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0020000
--說明:tea01.dbf是11g的資料檔案,而INDX01.DBF是9i的資料檔案.對比可以發現兩者存在很大的不同.不過表示塊大小的
--8192 = 0x2000,11g與10g的位置不一樣.
--7d 7c 7b 7a 出現的位置與9i的也不一致.
--反過來在linux的bbed開啟9i的檔案看看:
BBED> set filename '/home/oracle/xxx/INDX01.DBF'
FILENAME /home/oracle/xxx/INDX01.DBF
BBED> set block 12
BLOCK# 12
BBED> x /1rncc rowdata
rowdata[0] @8096
----------
flag@8096: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8097: 0x00
cols@8098: 3
col 0[2] @8099: 40
col 1[10] @8102: OPERATIONS
col 2[6] @8113: BOSTON
--ok正常的.看來是windows9i版本的bbed不能向上相容,或者講表示塊大小0x2000的位置不對.注意看~
--如果你使用9i的os檔案頭替換11g的資料檔案,就正常了.
--注意:千萬不要生產系統做這個動作!!我這裡僅僅測試的需要.
R:\>od -tx1 -N 8192 tea01.dbf
od -tx1 -N 8192 tea01.dbf
0000000 00 00 00 00 00 20 00 00 00 05 00 00 6d 6c 6b 6a
0000020 06 23 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0020000
BBED> set dba 7,131
DBA 0x01c00083 (29360259 7,131)
BBED> map
File: R:\tea01.dbf (7)
Block: 131 Dba:0x01c00083
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
struct ktbbh, 96 bytes @20
struct kdbh, 14 bytes @124
struct kdbt[1], 4 bytes @138
sb2 kdbr[4] @142
ub1 freespace[7946] @150
ub1 rowdata[92] @8096
ub4 tailchk @8188
BBED> x /1rncc rowdata
rowdata[0] @8096
----------
flag@8096: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8097: 0x00
cols@8098: 3
col 0[2] @8099: 40
col 1[10] @8102: OPERATIONS
col 2[6] @8113: BOSTON
--總之問題在於windows下的bbed(目前9i版本),無法識別11g(沒有測試10g)的OS頭,導致計算塊時出現偏移.
--也就是要訪問11g的資料塊要在原來的基礎上+1.
--連結:http://blog.itpub.net/267265/viewspace-2109019/
http://blog.itpub.net/267265/viewspace-2109558/
--我曾經提到要訪問的塊要+1,比如:
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SCOTT@book> create table dept2 tablespace tea as select * from dept ;
Table created.
SCOTT@book> select ora_rowscn,rowid,dept2.* from dept2 ;
ORA_ROWSCN ROWID DEPTNO DNAME LOC
------------ ------------------ ------------ -------------- -------------
13238134154 AAAW9NAAHAAAACDAAA 10 ACCOUNTING NEW YORK
13238134154 AAAW9NAAHAAAACDAAB 20 RESEARCH DALLAS
13238134154 AAAW9NAAHAAAACDAAC 30 SALES CHICAGO
13238134154 AAAW9NAAHAAAACDAAD 40 OPERATIONS BOSTON
SCOTT@book> @ &r/rowid AAAW9NAAHAAAACDAAA
OBJECT FILE BLOCK ROW DBA TEXT
------------ ------------ ------------ ------------ -------------------- ----------------------------------------
94029 7 131 0 7,131 alter system dump datafile 7 block 131 ;
SCOTT@book> alter system checkpoint;
System altered.
SCOTT@book> select * from v$dbfile where file#=7;
FILE# NAME
------------ ----------------------------------------
7 /mnt/ramdisk/book/tea01.dbf
2.複製資料檔案到windows:
BBED> set dba 7,132
DBA 0x01c00084 (29360260 7,132)
--//注意windwos下使用bbedb lock+1.而在在9i的windows下測試,就不需要+1,不知道為什麼?
--而我今天在取出9i(windows)的一個資料檔案到另外的機器檢視:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for 32-bit Windows: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
CREATE TABLESPACE INDX DATAFILE
'D:\ORACLE\ORADATA\ORCL\INDX01.DBF' SIZE 10M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
LOGGING
ONLINE
PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO;
SQL> create table deptx tablespace indx as select * from scott.dept ;
SQL> select rowid x,deptx.* from deptx;
X DEPTNO DNAME LOC
------------------ ---------- -------------- -------------
AAALOOAAGAAAAAMAAA 10 ACCOUNTING NEW YORK
AAALOOAAGAAAAAMAAB 20 RESEARCH DALLAS
AAALOOAAGAAAAAMAAC 30 SALES CHICAGO
AAALOOAAGAAAAAMAAD 40 OPERATIONS BOSTON
SCOTT@book> @ &r/rowid AAALOOAAGAAAAAMAAA
OBJECT FILE BLOCK ROW DBA TEXT
---------- ---------- ---------- ---------- -------------------- ----------------------------------------
45966 6 12 0 6,12 alter system dump datafile 6 block 12 ;
--然後把資料檔案複製到另外一臺機器.
BED> set dba 6,12
DBA 0x0180000c (25165836 6,12)
BED> map
File: R:\INDX01.DBF (6)
Block: 12 Dba:0x0180000c
-----------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
struct ktbbh, 96 bytes @20
struct kdbh, 14 bytes @124
struct kdbt[1], 4 bytes @138
sb2 kdbr[4] @142
ub1 freespace[7946] @150
ub1 rowdata[92] @8096
ub4 tailchk @8188
BBED> p *kdbr[0]
rowdata[66]
-----------
ub1 rowdata[66] @8162 0x2c
BBED> x /rncc
rowdata[66] @8162
-----------
flag@8162: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8163: 0x00
cols@8164: 3
col 0[2] @8165: 10
col 1[10] @8168: ACCOUNTING
col 2[8] @8179: NEW YORK
--可以發現訪問9i的資料檔案是正常的,不需要在block上+1.為什麼?這樣很容易確定問題在塊頭.
$ od -tx1 -N 8192 tea01.dbf
0000000 00 a2 00 00 00 00 c0 ff 00 00 00 00 00 00 00 00
0000020 66 ff 00 00 00 20 00 00 00 05 00 00 7d 7c 7b 7a
~~~~~
0000040 a0 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0020000
$ od -tx1 -N 8192 INDX01.DBF
0000000 00 00 00 00 00 20 00 00 00 05 00 00 6d 6c 6b 6a
~~~~~
0000020 06 23 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0020000
--說明:tea01.dbf是11g的資料檔案,而INDX01.DBF是9i的資料檔案.對比可以發現兩者存在很大的不同.不過表示塊大小的
--8192 = 0x2000,11g與10g的位置不一樣.
--7d 7c 7b 7a 出現的位置與9i的也不一致.
--反過來在linux的bbed開啟9i的檔案看看:
BBED> set filename '/home/oracle/xxx/INDX01.DBF'
FILENAME /home/oracle/xxx/INDX01.DBF
BBED> set block 12
BLOCK# 12
BBED> x /1rncc rowdata
rowdata[0] @8096
----------
flag@8096: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8097: 0x00
cols@8098: 3
col 0[2] @8099: 40
col 1[10] @8102: OPERATIONS
col 2[6] @8113: BOSTON
--ok正常的.看來是windows9i版本的bbed不能向上相容,或者講表示塊大小0x2000的位置不對.注意看~
--如果你使用9i的os檔案頭替換11g的資料檔案,就正常了.
--注意:千萬不要生產系統做這個動作!!我這裡僅僅測試的需要.
R:\>od -tx1 -N 8192 tea01.dbf
od -tx1 -N 8192 tea01.dbf
0000000 00 00 00 00 00 20 00 00 00 05 00 00 6d 6c 6b 6a
0000020 06 23 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0020000
BBED> set dba 7,131
DBA 0x01c00083 (29360259 7,131)
BBED> map
File: R:\tea01.dbf (7)
Block: 131 Dba:0x01c00083
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
struct ktbbh, 96 bytes @20
struct kdbh, 14 bytes @124
struct kdbt[1], 4 bytes @138
sb2 kdbr[4] @142
ub1 freespace[7946] @150
ub1 rowdata[92] @8096
ub4 tailchk @8188
BBED> x /1rncc rowdata
rowdata[0] @8096
----------
flag@8096: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8097: 0x00
cols@8098: 3
col 0[2] @8099: 40
col 1[10] @8102: OPERATIONS
col 2[6] @8113: BOSTON
--總之問題在於windows下的bbed(目前9i版本),無法識別11g(沒有測試10g)的OS頭,導致計算塊時出現偏移.
--也就是要訪問11g的資料塊要在原來的基礎上+1.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2116311/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20160529]windows下使用bbed.txtWindows
- [20161006]windows下bbed使用注意.txtWindows
- [20180420]windows下使用cmd的小問題.txtWindows
- windows下vim的使用問題Windows
- asynchttpclient 使用的一點疑問HTTPclient
- 11g下編譯使用BBED編譯
- [20150529]使用bbed解決丟失的歸檔.txt
- [20160405]bbed的assign命令.txt
- [20170515]資料庫啟動的一個疑問.txt資料庫
- 請教:jive中使用mysql的疑問MySql
- [20121004]11G下編譯bbed.txt編譯
- Windows XP 安裝問題疑難解答(轉)Windows
- [20230427]bbed sum apply問題2.txtAPP
- [20190411]linux stat 命令疑問.txtLinux
- 我的疑問
- Oracle bbed工具的使用Oracle
- 【BBED】使用bbed 修改日期型別的資料型別
- Macaca使用過程中的疑問Mac
- oracle bbed使用Oracle
- [20150527]bbed解決資料檔案大小問題.txt
- [20160516]SQL共享游標的測試疑問.txtSQL
- 使用BBED修改檔案頭解決資料庫Open驗證問題(下)資料庫
- [20210304]bbed的assign命令.txt
- [20220308]查詢x$ksmmem遇到的疑問.txt
- Ibatis的疑問BAT
- 快取的疑問快取
- 橋模式的疑問模式
- windows下的gcc使用WindowsGC
- [20170419]bbed探究資料塊.txt
- [20160405]bbed修改檔案頭.txt
- [20160531]windows下bbed修復corrupt資料塊Windows
- 【BBED】使用bbed修改數字型別資料型別
- 【BBED】使用bbed修改字元型別資料字元型別
- [BBED]Oracle 11.2.0.4 Centos6.5下編譯bbedOracleCentOS編譯
- [20141008]使用bbed檢視索引結構.txt索引
- Windows XP 系統疑難問題巧解決(轉)Windows
- 有些疑問
- [20210920]bbed的assign命令.txt