[20170611]關於數據塊地址的計算.txt

来源:http://www.cnblogs.com/lfree/archive/2017/06/12/6994996.html
-Advertisement-
Play Games

[20170611]關於數據塊地址的計算.txt--//如果資料庫出現一些問題,會在alert或者跟蹤文件,或者屏幕出現一些錯誤提示.例如:ORA-00600: internal error code, arguments: [2662], [3], [392066208], [3], [39206 ...


[20170611]關於數據塊地址的計算.txt

--//如果資料庫出現一些問題,會在alert或者跟蹤文件,或者屏幕出現一些錯誤提示.例如:

ORA-00600: internal error code, arguments: [2662], [3], [392066208], [3], [392066212], [4194825], [], [], [], [], [], []

ORA-600 [2662] [a] [b] {c} [d] [e]
Arg [a] Current SCN WRAP
Arg [b] Current SCN BASE
Arg {c} dependent SCN WRAP
Arg [d] dependent SCN BASE
Arg [e] Where present this is the DBA where the dependent SCN came from.

--//這裡第5個參數4194825就是dba也就是數據塊地址.
--//實際上簡單的計算很簡單,32位占4個位元組,前10位表示文件號,後22位表示:

SYS@test> select round(&dba/power(2,22),0) file# ,mod(&&dba,power(2,22)) block# from dual ;
old   1: select round(&dba/power(2,22),0) file# ,mod(&&dba,power(2,22)) block# from dual
new   1: select round(4194825/power(2,22),0) file# ,mod(4194825,power(2,22)) block# from dual
     FILE#     BLOCK#
---------- ----------
         1        521


--//我自己常用的腳本:
$ cat dfb10.sql
select
dbms_utility.data_block_address_file(&1) rfile#,
dbms_utility.data_block_address_block(&&1) block#
from dual;

select 'alter system dump datafile '||dbms_utility.data_block_address_file(&1)||' block '||
dbms_utility.data_block_address_block(&&1) ||' ;' text

$ cat dfb16.sql
column text format a60

select
dbms_utility.data_block_address_file(to_number(substr('&&1',3),'xxxxxxxxxxxxxxxx')) rfile#,
dbms_utility.data_block_address_block(to_number(substr('&&1',3),'xxxxxxxxxxxxxxxx')) block#,
'alter system dump datafile '||dbms_utility.data_block_address_file(to_number(substr('&1',3),'xxxxxxxxxxxxxxxx'))||' block '|| dbms_utility.data_block_address_block(to_number(substr('&&1',3),'xxxxxxxxxxxxxxxx')) ||' ;' text
from dual;

--//convert file#,block# 到 dba地址.
$ cat convrdba.sql
select
 TO_CHAR (dbms_utility.make_data_block_address(&1,&2), 'xxxxxxxxxxxxx') rdba16,
dbms_utility.make_data_block_address(&&1,&&2) rdba
from dual;

--//還有1種方法就是bbed,直接輸入例子:

BBED> set dba 1,521
        DBA             0x00400209 (4194825 1,521)

BBED> set dba 4194825
        DBA             0x00400209 (4194825 1,521)

BBED> set dba 0x00400209
        DBA             0x00400209 (4194825 1,521)

--//下午無聊,想完善以前[20121207]vim中使用bc做10與16進位計算.txt,鏈接http://blog.itpub.net/267265/viewspace-750731/
--//源代碼http://www.vim.org/scripts/script.php?script_id=219,我修改加入10,16進位的計算,
--//作者這麼多年2017/04/17 更新.以此為基礎加入10,16進位轉化,以及dba轉化為file#,block#.
--//這次修改代碼加入dba的計算.同時修複了windows下的許多問題.

--//做一些簡單說明,這個版本僅僅工作在windows版本.bc的安裝可以下載UnxUtils.zip包,設置好PATH路徑就ok了.
--//我註解 let str = escape (str, '*();&><|^') ,這樣運算存在*以及(),不再存在問題.
--//以前舊版本不支持冪運算(^),windows的轉化4個^才能正確執行.

--//簡單操作:
a3

在數字a3上面輸入\10,相當於a3當作16進位數據,給出結果=163.
在數字a3處於選擇模式,輸入;10,相當於a3當作16進位數據,在提示行上給出答案
(註:windows下要處於可視模式,不能處於選擇模式,使用ctrl+g切換)

123
在數字123上面輸入\16,相當於123當作10進位數據,給出結果=0x7b.
在數字123處於選擇模式,輸入;16,相當於123當作10進位數據,在提示行上給出答案

\bx 可以進行行運算
\bc 在提示行輸出結果.

;bc 選中文本,然後ctrl+g,輸入;bc,在提示行輸出結果.

\22
;22

--//參考10,16進位的計算,計算dba轉化為file#,block#.
--//做一個操作例子:
4194825 = set dba 1,521
--//打入\22,輸出如下:
4194825 = set dba 1,521

==================修改後代碼如下:
"" calculate expression entered on command line and give answer, e.g.:
" :Calculate sin (3) + sin (4) ^ 2
command! -nargs=+ Calculate echo "<args> = " . Calculate ("<args>")

"" calculate expression from selection, pick a mapping, or use the Leader form
"vnoremap ;bc "ey`>:call CalcLines()<CR>
"vnoremap <Leader>bc "ey`>:call<SID>CalcBC(1)<CR>
vnoremap ;bc "ey`>:call CalcLines(0)<CR>
vnoremap ;10 "ey`>:call CalcLines(10)<CR>
vnoremap ;16 "ey`>:call CalcLines(16)<CR>
vnoremap ;22 "ey`>:call CalcLines(22)<CR>
vnoremap ;32 "ey`>:call CalcLines(32)<CR>

"" calculate expression on current line, pick a mapping, or use the Leader
nnoremap  <Leader>bc "eyy$:call CalcLines(0)<CR>
nnoremap   <Leader>bx <Esc>A=<Esc>"eyy:call CalcLines(0)<CR>
nnoremap   <Leader>10 <Esc>A=<Esc>"eyy:call CalcLines(10)<CR>
nnoremap   <Leader>16 <Esc>A=<Esc>"eyy:call CalcLines(16)<CR>
nnoremap   <Leader>22 <Esc>A=<Esc>"eyy:call CalcLines(22)<CR>
nnoremap   <Leader>32 <Esc>A=<Esc>"eyy:call CalcLines(32)<CR>


"nnoremap  <Leader>bc "eyy$:call<SID>CalcBC(0)<CR>

"" calculate from insertmode
inoremap =: = <Esc>"eyy:call CalcLines()<CR>a

" ---------------------------------------------------------------------
"  Calculate:
"    clean up an expression, pass it to bc, return answer
function! Calculate (s,flag)

    let str = a:s

    " remove newlines and trailing spaces
    let str = substitute (str, "\n",   "", "g")
    let str = substitute (str, '\s*$', "", "g")

    " sub common func names for bc equivalent
    let str = substitute (str, '\csin\s*(',  's (', 'g')
    let str = substitute (str, '\ccos\s*(',  'c (', 'g')
    let str = substitute (str, '\catan\s*(', 'a (', 'g')
    let str = substitute (str, "\cln\s*(",   'l (', 'g')
    let str = substitute (str, '\clog\s*(',  'l (', 'g')
    let str = substitute (str, '\cexp\s*(',  'e (', 'g')

    " alternate exponitiation symbols
    let str = substitute (str, '\*\*', '^', "g")
    let str = substitute (str, '`', '^',    "g")
    let str = substitute (str, '\^', '^^^^',    "g")

    " escape chars for shell
    " let str = escape (str, '*();&><|^')

    let preload = exists ("g:bccalc_preload") ? g:bccalc_preload : ""

    " run bc
    " return str
    " let answer = system ("echo " . str . " \| bc -l " . preload)

    if a:flag == 0
         let answer = system ("echo " . str . " \| bc -l " . preload)
    endif
    if a:flag == 16
         let answer = system ("echo obase=16 ;" . str .  " \| bc -l " . preload)
         let answer = "0x" . tolower ( answer )
    endif
    if a:flag == 10
         let str = toupper ( str )
         let answer = system ("echo ibase=16 ;" . str .  " \| bc -l " . preload)
    endif
    if a:flag == 22
         let answer = system ("echo " . str . "/4194304" . " \| bc " . preload)
         let answer1 = system ("echo " . str . "%4194304" . " \| bc " . preload)
         let answer = " set dba " . answer . "," . answer1
    endif

    if a:flag == 32
         let answer = system ("echo " . str . "/4294967296" . " \| bc " . preload)
         let answer1 = system ("echo " . str . "%4294967296" . " \| bc " . preload)
         let answer = " scn_wrap,scn_base: " . answer . " " . answer1
    endif

    " strip newline
    let answer = substitute (answer, "\n", "", "g")

    " strip trailing 0s in decimals
    let answer = substitute (answer, '\.\(\d*[1-9]\)0\+', '.\1', "")

    return answer
endfunction

" ---------------------------------------------------------------------
" CalcLines:
"
" take expression from lines, either visually selected or the current line,
" pass to calculate function, echo or past answer after '='
function! CalcLines(flag)

    let has_equal = 0

    " remove newlines and trailing spaces
    let @e = substitute (@e, "\n", "",   "g")
    let @e = substitute (@e, '\s*$', "", "g")

    " if we end with an equal, strip, and remember for output
    if @e =~ "=$"
        let @e = substitute (@e, '=$', "", "")
        let has_equal = 1
    endif

    " if there is another equal in the line, assume chained equations, remove
    " leading ones
    let @e = substitute (@e, '^.\+=', '', '')

    let answer = Calculate (@e,a:flag)

    " append answer or echo
    if has_equal == 1
        exec "normal a" . answer
    else
        echo "answer = " . answer
    endif
endfunction


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 真機測試時提示Could not find Developer Disk Image.這該怎麼辦???? 這是由於真機系統過高或者過低,Xcode中沒有匹配的配置包文件,我們可以通過這個路徑進入配置包的存放目錄: /Applications/Xcode.app/Contents/Developer/ ...
  • UIKit Dynamic是iOS7 新增的一組類和方法,可賦予UIView逼真的行為和特征,不需要寫動畫效果那些繁瑣的代碼,讓開發人員能夠輕鬆地改善應用的用戶體驗。一共有6個可用於定製UIDynamicAnimator的類,這裡先只簡單介紹下碰撞的動畫效果,即UICollisionBehavior ...
  • 訂製EditText游標 設置背景android:background="@null" 設置游標樣式:android:textCursorDrawable="@drawable/edit_cursor_line" 去掉或設置游標下的圓點樣式:android:textSelectHandle="@dr ...
  • 代碼: RootViewController.m ...
  • 1.要實現的效果圖以及工程目錄結構: 先看看效果圖吧: 接著看看我們的工程的目錄結構: 2.實現流程: Step 1:寫下底部選項的一些資源文件 我們從圖上可以看到,我們底部的每一項點擊的時候都有不同的效果是吧! 我們是通過是否selected來判定的!我們要寫的資源文件有:首先是圖片,然後是文字, ...
  • SQL SERVER的表結構及索引轉換為MySQL的表結構及索引,其實在很多第三方工具中有提供,比如navicat、sqlyog等,但是,在處理某些數據類型、預設值及索引轉換的時候,總有些不盡人意並且需要安裝軟體,懶人開始想法子,所以基於SQL SERVER,寫了一個存儲過程,可以根據表名直接轉換為 ...
  • 之前一直有在關註微軟認證的一些消息,由於最新的SQL Server認證加入了2016的相關內容,導致課程資料需要大部分更新,但是微軟更新相對比較慢,並且經常改版,目前發現的最新的MCP Cert Path為2017年5月22日版。所以需要不定時翻閱相關站點查看最新情況,這裡把目前最新的情況述說一下, ...
  • 目錄 一、索引 二、索引類型 三、索引種類 四、操作索引 五、創建索引的時機 六、命中索引 七、其它註意事項 八、LIMIT分頁 九、執行計劃 十、慢查詢日誌 一、索引 MySQL索引的建立對於MySQL的高效運行是很重要的,索引可以大大提高MySQL的檢索速度。 打個比方,如果合理的設計且使用索引 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...