1. 目标说明
xbbed主要实现一键读取asm数据块到文件系统或更新文件系统数据块到asm。 下载地址: https://www.modb.pro/download/221215 欢迎关注公众号交流沟通“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: 182
file_number: 4
filesystem_filename: /tmp/xbbed/4_182.dd
asm_datafile_name: ocr_vote/epmsn/datafile/users.259.1076411313
pl/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 2021
米乐app官网下载 copyright (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 0x2c
bbed> x /rccc
rowdata[0] @8174
----------
flag@8174: 0x2c (kdrhfl, kdrhff, kdrhfh)
lock@8175: 0x01
cols@8176: 1
col 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 8182
warning: 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 apply
check value for file 1, block 1:
current = 0x233d, required = 0x233d
bbed> 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 0x2c
bbed> x /rccc
rowdata[0] @8174
----------
flag@8174: 0x2c (kdrhfl, kdrhff, kdrhfh)
lock@8175: 0x01
cols@8176: 1
col 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 2021
米乐app官网下载 copyright (c) 1982, 2013, oracle. all rights reserved.
connected to:
oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production
with the partitioning, automatic storage management, olap, data mining
and real application testing options
sql> 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”
最后修改时间:2021-11-08 15:31:10
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。