xbbed一鍵讀取ASM block到檔案系統
1. 目標說明
xbbed主要實現一鍵讀取asm資料塊到檔案系統或更新檔案系統資料塊到asm。 下載地址: 歡迎關注公眾號交流溝通“xaoug”
2. Oracle sudo許可權設定
--root使用者執行grep 'oracle' /etc/sudoers echo "oracle ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers grep 'oracle' /etc/sudoers su - oracle sudo su - grid -c pwd
3. 測試表建立
drop table hsql.t1 purge;create table hsql.t1(c1 char(10));insert into hsql.t1 values('enmo');commit;alter system flush buffer_cache;select dbms_rowid.rowid_object(rowid) object_id, dbms_rowid.rowid_relative_fno(rowid) file_id, dbms_rowid.rowid_block_number(rowid) block_id, dbms_rowid.rowid_row_number(rowid) row_number,* from hsql.t1; OBJECT_ID FILE_ID BLOCK_ID ROW_NUMBER C1---------- ---------- ---------- ---------- ------------------------------ 87925 4 182 0 enmo
4. cp asm block to os
[oracle@snyxdb1 x_recovery]$ sh x_reco.sh -------------------------------------------------------------------------------- |**********************WELCOME: x_rec for Oracle*******************************| |1). install_bbed: bbed install one key | |2). xbbed: cp asm block to os block or reverse. | |3). exit: quit the x_rec | |*****************if you need any help contact my wechat: xidoublestar*********| -------------------------------------------------------------------------------- pls,input operation name:xbbed ********************************WELCOM XBBED******************************** |method: | |1) get dba a,b <-- cp file#: a,blk#: b from asm to /tmp/xbbed/a_b.dd | |2) save dba a,b <-- cp /tmp/xbbed/a_b.dd to asm | |3) exit | **************************************************************************** xbbed>get dba 4,182**********get dba 4,182********** block_id_in_datafile: 182file_number: 4filesystem_filename: /tmp/xbbed/4_182.dd asm_datafile_name: +OCR_VOTE/epmsn/datafile/users.259.1076411313PL/SQL procedure successfully completed. xbbed>
5. 使用bbed修改資料內容
[oracle@snyxdb1 bbed]$ cat listfile.txt 1 /tmp/xbbed/4_182.dd [oracle@snyxdb1 bbed]$ sh l_bbed.sh BBED: Release 2.0.0.0.0 - Limited Production on Mon Nov 1 10:27:13 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> set dba 1,1 DBA 0x00400001 (4194305 1,1) BBED> BBED> p *kdbr[0] rowdata[0]----------ub1 rowdata[0] @8174 0x2cBBED> x /rccc rowdata[0] @8174 ----------flag@8174: 0x2c (KDRHFL, KDRHFF, KDRHFH)lock@8175: 0x01cols@8176: 1col 0[10] @8177: enmo BBED> d offset 8177 count 16 File: /tmp/xbbed/4_182.dd (1) Block: 1 Offsets: 8177 to 8191 Dba:0x00400001------------------------------------------------------------------------ 0a656e6d 6f202020 20202001 065139 <32 bytes per line> BBED> m /x 65 offset 8182Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y File: /tmp/xbbed/4_182.dd (1) Block: 1 Offsets: 8182 to 8191 Dba:0x00400001------------------------------------------------------------------------ 65202020 20200106 5139 <32 bytes per line> BBED> sum applyCheck value for File 1, Block 1:current = 0x233d, required = 0x233dBBED> d offset 8177 count 16 File: /tmp/xbbed/4_182.dd (1) Block: 1 Offsets: 8177 to 8191 Dba:0x00400001------------------------------------------------------------------------ 0a656e6d 6f652020 20202001 065139 <32 bytes per line> BBED> p *kdbr[0] rowdata[0]----------ub1 rowdata[0] @8174 0x2cBBED> x /rccc rowdata[0] @8174 ----------flag@8174: 0x2c (KDRHFL, KDRHFF, KDRHFH)lock@8175: 0x01cols@8176: 1col 0[10] @8177: enmoe BBED>
5. cp os block to asm
xbbed>save dba 4,182 **********save dba 4,182********** file_with_patched_block: /tmp/xbbed/4_182.dd file_to_patch_in_ASM: +OCR_VOTE/epmsn/datafile/users.259.1076411313 v_offstart: 182 PL/SQL procedure successfully completed. xbbed>
6. 結果檢查
[oracle@snyxdb1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 1 10:29:17 2021Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Automatic Storage Management, OLAP, Data Miningand Real Application Testing optionsSQL> alter system flush buffer_cache; System altered. SQL> select * from hsql.t1; C1------------------------------enmoe SQL>
7. 重置Oracle sudo許可權設定
grep 'oracle' /etc/sudoers sed -ri 's/^oracle/#oracle/' /etc/sudoers grep 'oracle' /etc/sudoers su - oracle sudo su - grid -c pwd
歡迎關注公眾號交流溝通“xaoug”
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31442014/viewspace-2841110/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ASM與檔案系統之間copy資料檔案--檔案系統到ASMASM
- asm拷貝檔案到檔案系統ASM
- 將ASM裡面的檔案copy到檔案系統ASM
- 移動資料檔案從ASM到檔案系統ASM
- 如何遷移ASM資料檔案到檔案系統ASM
- HDFS讀檔案過程分析:讀取檔案的Block資料BloC
- 從ASM磁碟中複製檔案到本地檔案系統ASM
- 10G下從ASM複製檔案到檔案系統ASM
- 移動資料檔案從檔案系統到ASM磁碟組中ASM
- c# 讀取多個路徑檔案到一個檔案
- HDFS讀檔案過程分析:獲取檔案對應的Block列表BloC
- ASM檔案系統遷移ASM
- asm 檔案系統遷移ASM
- 使用RMAN遷移檔案系統資料庫到ASM資料庫ASM
- 遷移檔案系統管理下的db到asm下ASM
- 12c複製 RAC ASM中的密碼檔案到檔案系統ASM密碼
- xtts from檔案系統到ASM儲存(dbms_file_transfer)TTSASM
- 用rman從檔案系統遷移資料庫到asm資料庫ASM
- Go讀取yaml檔案到struct類GoYAMLStruct
- ASM叢集檔案系統ACFS(ASM Cluster File System)ASM
- 採用DUPLICATE 把asm資料庫複製到檔案系統ASM資料庫
- 四、用rman從檔案系統遷移資料庫到asm資料庫ASM
- 直播系統原始碼,讀取多行文字、讀取檔案分割多行文字原始碼
- 使用shell指令碼及asm cp或RMAN copy批量將資料檔案從ASM拷貝到檔案系統指令碼ASM
- 從檔案系統遷移到ASM上ASM
- oralce 從檔案系統遷移到ASMASM
- Hibernate 讀取檔案到資料庫的一個bug資料庫
- Maui 讀取外部檔案顯示到Blazor中UIBlazor
- 使用RAM將檔案系統遷移到ASMASM
- 利用RMAN將非ASM檔案移動到ASM裡 - [ASM]ASM
- Java 讀取檔案Java
- tiff檔案讀取
- 讀取檔案最後一行
- 把檔案系統的資料檔案遷移到ASM儲存ASM
- C++ 讀取二進位制檔案到char*C++
- 將spfile從ASM裡遷移到檔案系統ASM
- 資料庫從檔案系統遷移到ASM資料庫ASM
- python讀取檔案——python讀取和儲存mat檔案Python