[20160405]bbed的assign命令.txt
[20160405]bbed的assign命令.txt
--我記得開始學習bbed的時候,看的是一份pdf文件,提到assign的用法,摘要如下:
assign
The assign command does symbolic assignment, with type and range checking. Either target or source can be omitted for the
current offset. For example, the following command assigns structure at current offset to file 4,block 2 's first ITL
entry
BBED> assign dba 4, 2 ktbbhitl[0]
--感覺不是非常靈活,實際上assign非常靈活.
BBED> help assign
ASSIGN[/x|d|u|o] <target spec>=<source spec>
<target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
<source spec> : [ value | <target spec options> ]
--使用這個命令,可以避免大小頭問題,修改資料塊變得非常簡單,我感覺許多人都不知道很好的使用assign.透過一個例子來說明:
1.環境:
SYS@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
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ NAME TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------- ----------------
1 13227505290 2016-04-05 12:16:40 7 13227286650 ONLINE 1016 YES /mnt/ramdisk/book/system01.dbf SYSTEM
2 13227505290 2016-04-05 12:16:40 1834 13227286650 ONLINE 1012 YES /mnt/ramdisk/book/sysaux01.dbf SYSAUX
3 13227505290 2016-04-05 12:16:40 923328 13227286650 ONLINE 932 YES /mnt/ramdisk/book/undotbs01.dbf UNDOTBS1
4 13227505290 2016-04-05 12:16:40 16143 13227286650 ONLINE 1016 YES /mnt/ramdisk/book/users01.dbf USERS
5 13227505290 2016-04-05 12:16:40 952916 13227286650 ONLINE 929 YES /mnt/ramdisk/book/example01.dbf EXAMPLE
6 13227505290 2016-04-05 12:16:40 1314508 13227286650 ONLINE 945 YES /mnt/ramdisk/book/sugar01.dbf SUGAR
7 13227505290 2016-04-05 12:16:40 13227207527 13227286650 ONLINE 40 YES /mnt/ramdisk/book/tea01.dbf TEA
7 rows selected.
2.假設我修改file#=7,CHECKPOINT_CHANGE#=13227505290-1.
select 13227505289,trunc(13227505289/power(2,32)) scn_wrap,mod(13227505289,power(2,32)) scn_base from dual
13227505289 SCN_WRAP SCN_BASE
------------ ------------ ------------
13227505289 3 342603401
SYS@book> @ &r/10to16 13227505289
10 to 16 HEX REVERSE16
-------------- -----------------------------------
00003146bb689 0x89b66b14-03000000
BBED> p /x dba 7,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0x146bb68a
BBED> p /x dba 1,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0x146bb68a
--我可以寫成:
BBED> assign dba 7,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas = 342603401
ub4 kscnbas @484 0x146bb689
BBED> assign dba 7,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas = 0x146bb689
ub4 kscnbas @484 0x146bb689
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name FROM v$datafile_header where file# in (1,7);
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ NAME TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- ------------------------------- ---------------
1 13227505290 2016-04-05 12:16:40 7 13227286650 ONLINE 1016 YES /mnt/ramdisk/book/system01.dbf SYSTEM
7 13227505289 2016-04-05 12:16:40 13227207527 13227286650 ONLINE 40 YES /mnt/ramdisk/book/tea01.dbf TEA
BBED> assign dba 7,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas = dba 1,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0x146bb68a
--這樣就不要考慮大小頭的轉換,修改更加方便快捷,減少錯誤的發生.
--再舉一個例子,調整scn某個塊的scn增加10000,產生ORA-00600: internal error code, arguments: [2662].錯誤.
SYS@book> select current_scn from v$database ;
CURRENT_SCN
------------
13227510828
SYS@book> select ora_rowscn ,rowid,a.* from scott.empx a where rownum<=1;
ORA_ROWSCN ROWID EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
------------ ------------------ ------------ ---------- --------- ------------ ------------------- ------------ ------------ ------------
13227501857 AAAWe/AAHAAAACDAAA 7369 ZZZZ CLERK 7902 1980-12-17 00:00:00 800 20
select 13227501857,trunc(13227501857/power(2,32)) scn_wrap,mod(13227501857,power(2,32)) scn_base from dual
13227501857 SCN_WRAP SCN_BASE
------------ ------------ ------------
13227501857 3 342599969
SYS@book> @ &r/rowid AAAWe/AAHAAAACDAAA
OBJECT FILE BLOCK ROW DBA TEXT
------------ ------------ ------------ ------------ -------------------- ----------------------------------------
92095 7 131 0 7,131 alter system dump datafile 7 block 131 ;
select 13227520828,trunc(13227520828/power(2,32)) scn_wrap,mod(13227520828,power(2,32)) scn_base from dual
13227520828 SCN_WRAP SCN_BASE
------------ ------------ ------------
13227520828 3 342618940
--比當前多1萬.
BBED> set dba 7,131
DBA 0x01c00083 (29360259 7,131)
BBED> p /d kcbh.bas_kcbh
ub4 bas_kcbh @8 342599969
BBED> assign dba 7,131 kcbh.bas_kcbh=342618940;
ub4 bas_kcbh @8 0x146bf33c
--直接指定十進位制.
BBED> modify /x 3cf3 offset 8190
File: /mnt/ramdisk/book/tea01.dbf (7)
Block: 131 Offsets: 8190 to 8191 Dba:0x01c00083
-------------------------------------------------------
3cf3
<80 bytes per line>
--要顛倒一下,不小心很容易錯誤,這是不能使用assign dba 7,131 tailchk = 0xf33c0602;,不知道為什麼
--BBED> assign dba 7,131 tailchk = 0xf33c0602;
-- BBED-00207: invalid offset specifier (f33c0602)
BBED> p tailchk
ub4 tailchk @8188 0xf33c0602
SYS@book> select ora_rowscn ,rowid,a.* from scott.empx a where rownum<=1;
select ora_rowscn ,rowid,a.* from scott.empx a where rownum<=1
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [2662], [3], [342609366], [3], [342618940], [29360259], [], [], [], [], [], []
SYS@book> Select current_scn from v$database ;
CURRENT_SCN
------------
13227511270
--資料塊的scn超前了,需要等一會.
SCOTT@book> select ora_rowscn ,rowid,a.* from scott.empx a where rownum<=1;
ORA_ROWSCN ROWID EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
------------ ------------------ ------------ ---------- --------- ------------ ------------------- ------------ ------------ ------------
13227501857 AAAWe/AAHAAAACDAAA 7369 ZZZZ CLERK 7902 1980-12-17 00:00:00 800 20
SCOTT@book> select current_scn from v$database ;
CURRENT_SCN
------------
13227521335
--ok,現在正常了.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2075550/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20210920]bbed的assign命令.txt
- [20210304]bbed的assign命令.txt
- [20180628]顯示bbed x命令格式.txt
- [20180627]測試bbed是否支援管道命令.txt
- [20231109]bbed p命令dba引數問題.txt
- [20210218]Select vs Assign – How To Assign PLSQL Variables.txtSQL
- [20181227]bbed的使用問題.txt
- [20231008]bbed探究lob段.txt
- [20220223]bbed ktbbh.ktbbhict.txt
- [20181204]bbed修改問題.txt
- [20180619]bbed verify問題.txt
- 【BBED】Oracle bbed常用命令參考Oracle
- [20210906]bbed讀取資料塊(bbed-wrap.sh).txt
- [20231021]生成bbed的執行指令碼.txt指令碼
- [20230224]bbed設定偏移技巧.txt
- [20210901]cygwin下使用bbed.txt
- [20210223]bbed itl ktbitflg 2.txt
- [20210303]bbed使用小問題.txt
- [20190104]bbed手工插入資料.txt
- [20210930]bbed恢復刪除的資料.txt
- [20210318]bbed讀取資料塊.txt
- [20210311]如何建立bbed安裝包.txt
- [20190104]bbed手動修改資料.txt
- [20231023]生成bbed的執行指令碼(bash shell).txt指令碼
- [20230427]bbed sum apply問題2.txtAPP
- [20210831]bbed讀取資料塊6.txt
- [20210817]如何通過bbed確定undo段.txt
- [20210323]bbed讀取資料塊5.txt
- [20210318]bbed讀取資料塊2.txt
- [20210319]bbed讀取資料塊3.txt
- [20180604]在記憶體修改資料(bbed).txt記憶體
- [20231020]rename IDL_UB1$後使用bbed的恢復.txt
- [20190213]學習bbed-恢復刪除的資料.txt
- [20181122]bbed人為修改事務提交標誌.txt
- [20231026]bbed檢視索引kd_off結構的問題.txt索引
- [20220909]bbed關於刪除記錄恢復的問題.txt
- [20210930]bbed讀取資料塊7 fffext.sh.txt
- [20190124]bbed恢復資料遇到延遲塊清除的問題.txt
- [20231103]rename IDL_UB1$後使用bbed的恢復的後遺症.txt