Home Database Mysql Tutorial bbed修改undo段状态(ORA-01578)

bbed修改undo段状态(ORA-01578)

Jun 07, 2016 pm 04:06 PM
undo Revise state

ZBDBA@orcl11gselect * from zbdba;select * from zbdba *ERROR at line 1:ORA-01578: ORACLE data block corrupted (file # 3, block # 1449)ORA-01110: data file 3: /opt/oracle/oradata/orcl11g/undotbs01.dbf 这里是事务正在执行,但是数据库直接以abor

ZBDBA@orcl11g>select * from zbdba;
select * from zbdba
              *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 3, block # 1449)
ORA-01110: data file 3: '/opt/oracle/oradata/orcl11g/undotbs01.dbf'
Copy after login

这里是事务正在执行,但是数据库直接以abort方式关机,并且对应的回滚段损坏

当然这里其实不需要bbed,只需要用_offline_rollback_segments 隐含参数标记对应的回滚段,然后使用drop rollback segment 该回滚段即可
这里使用bbed目的是在于研究undo回滚段的状态存于何处以及如何修改

这里我们创建另外一个undo表空间,并且切换到该表空间

ZBDBA@orcl11g>create undo tablespace undotbs02 datafile '/opt/oracle/oradata/orcl11g/undotb02.dbf' size 100m;

Tablespace created.

ZBDBA@orcl11g>alter system set undo_tablespace=undotbs02;

System altered.

ZBDBA@orcl11g>show parameter undo
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
undo_management                      string                 AUTO
undo_retention                       integer                900
undo_tablespace                      string                 UNDOTBS02
Copy after login
我们查看回滚段的状态,发现即使切换了,还有一个回滚段处于online状态,因为这个回滚段上面还存在需要恢复的数据,但是这个回滚段已经被损坏,无法进行恢复。那么我们只能将其删除。
ZBDBA@orcl11g>select segment_name,tablespace_name,status from dba_rollback_segs;
SEGMENT_NAME                   TABLESPACE_NAME      STATUS
------------------------------ -------------------- ------------------------------------------------------------
SYSTEM                         SYSTEM               ONLINE
_SYSSMU10_3550978943$          UNDOTBS1             ONLINE
_SYSSMU9_1424341975$           UNDOTBS1             OFFLINE
_SYSSMU8_2012382730$           UNDOTBS1             OFFLINE
_SYSSMU7_3286610060$           UNDOTBS1             OFFLINE
_SYSSMU6_2443381498$           UNDOTBS1             OFFLINE
_SYSSMU5_1527469038$           UNDOTBS1             OFFLINE
_SYSSMU4_1152005954$           UNDOTBS1             OFFLINE
_SYSSMU3_2097677531$           UNDOTBS1             OFFLINE
_SYSSMU2_2232571081$           UNDOTBS1             OFFLINE
_SYSSMU1_3780397527$           UNDOTBS1             OFFLINE
_SYSSMU20_3705739785$          UNDOTBS02            ONLINE
_SYSSMU19_3920348761$          UNDOTBS02            ONLINE
_SYSSMU18_2539622763$          UNDOTBS02            ONLINE
_SYSSMU17_178842559$           UNDOTBS02            ONLINE
_SYSSMU16_3035903491$          UNDOTBS02            ONLINE
_SYSSMU15_444141832$           UNDOTBS02            ONLINE
_SYSSMU14_3021863913$          UNDOTBS02            ONLINE
_SYSSMU13_3717211136$          UNDOTBS02            ONLINE
_SYSSMU12_3182721254$          UNDOTBS02            ONLINE
_SYSSMU11_3909920883$          UNDOTBS02            ONLINE
Copy after login
通过以下可以看到不同的数字对应不同的状态:
undo segment 的状态:
1表示offline并且被删除
2 表示offline
3 表示online
4 未知
5 表示need recovery
SYS@orcl11g>select name,status$ from undo$;
NAME                                                            STATUS$
------------------------------------------------------------ ----------
SYSTEM                                                                3
_SYSSMU1_3780397527$                                                  2
_SYSSMU2_2232571081$                                                  2
_SYSSMU3_2097677531$                                                  2
_SYSSMU4_1152005954$                                                  2
_SYSSMU5_1527469038$                                                  2
_SYSSMU6_2443381498$                                                  2
_SYSSMU7_3286610060$                                                  2
_SYSSMU8_2012382730$                                                  2
_SYSSMU9_1424341975$                                                  2
_SYSSMU10_3550978943$                                                 3
_SYSSMU11_3909920883$                                                 3
_SYSSMU12_3182721254$                                                 3
_SYSSMU13_3717211136$                                                 3
_SYSSMU14_3021863913$                                                 3
_SYSSMU15_444141832$                                                  3
_SYSSMU16_3035903491$                                                 3
_SYSSMU17_178842559$                                                  3
_SYSSMU18_2539622763$                                                 3
_SYSSMU19_3920348761$                                                 3
_SYSSMU20_3705739785$                                                 3
Copy after login
强制将该回滚段offline,发现还是无法删除:
SYS@orcl11g>alter rollback segment "_SYSSMU10_3550978943$" offline;

Rollback segment altered.

SYS@orcl11g>drop tablespace UNDOTBS1;
drop tablespace UNDOTBS1
*
ERROR at line 1:
ORA-30013: undo tablespace 'UNDOTBS1' is currently in use
Copy after login
此时,我们关闭数据库使用bbed更改该回滚段的状态:
在数据库启动的时候,我们可以是oradebug 10046事件追踪,通过trace文件分析:
PARSING IN CURSOR #2 len=142 dep=1 uid=0 oct=3 lid=0 tim=1414654507002840 hv=361892850 ad='78938c58' sqlid='7bd391hat42zk'
select /*+ rule */ name,file#,block#,status$,user#,undosqn,xactsqn,scnbas,scnwrp,DECODE(inst#,0,NULL,inst#),ts#,spare1 from undo$ where us#=:1
END OF STMT
PARSE #2:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=3,plh=906473769,tim=1414654507002839
BINDS #2:
Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7fcf70adc448  bln=22  avl=02  flg=05
  value=7
Copy after login
undo段的状态是从undo$基表中获取的,那么我们看看这里的基表对应的物理块号
SYS@orcl11g>select rowid,dbms_rowid.rowid_object(rowid) robject,
  2  dbms_rowid.rowid_relative_fno(rowid) fno,
  3  dbms_rowid.rowid_block_number(rowid) bno,
  4  dbms_rowid.rowid_row_number(rowid) rno from undo$ where rownum=1;


ROWID                 ROBJECT        FNO        BNO        RNO
------------------ ---------- ---------- ---------- ----------
AAAAAPAABAAAADhAAA         15          1        225          0
Copy after login
然后我们使用bbed查看该数据块:
BBED> map
File: /opt/oracle/oradata/orcl11g/system01.dbf (1)
Block: 225                                   Dba:0x004000e1
------------------------------------------------------------
KTB Data Block (Table/Cluster)

struct kcbh, 20 bytes                      @0      

struct ktbbh, 48 bytes                     @20     

struct kdbh, 14 bytes                      @68     

struct kdbt[1], 4 bytes                    @82     

sb2 kdbr[21]                               @86     

ub1 freespace[3752]                        @128    

ub1 rowdata[4308]                          @3880   

ub4 tailchk                                @8188   
Copy after login
这里可以看出与视图对应的21个回滚段:
BBED> p kdbr
sb2 kdbr[0]                                 @86       8078
sb2 kdbr[1]                                 @88       4071
sb2 kdbr[2]                                 @90       5156
sb2 kdbr[3]                                 @92       5088
sb2 kdbr[4]                                 @94       4206
sb2 kdbr[5]                                 @96       4952
sb2 kdbr[6]                                 @98       4341
sb2 kdbr[7]                                 @100      4816
sb2 kdbr[8]                                 @102      4748
sb2 kdbr[9]                                 @104      4680
sb2 kdbr[10]                                @106      4611
sb2 kdbr[11]                                @108      4008
sb2 kdbr[12]                                @110      5880
sb2 kdbr[13]                                @112      5817
sb2 kdbr[14]                                @114      5751
sb2 kdbr[15]                                @116      3943
sb2 kdbr[16]                                @118      5622
sb2 kdbr[17]                                @120      3878
sb2 kdbr[18]                                @122      5490
sb2 kdbr[19]                                @124      3812
sb2 kdbr[20]                                @126      5360


BBED> p *kdbr[10]
rowdata[799]
------------
ub1 rowdata[799]                            @4679     0x2c

BBED> x /1rnnnnnnnn
rowdata[799]                                @4679   
------------
flag@4679: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@4680: 0x00
cols@4681:   17

col    0[2] @4682: 10
col   1[21] @4685: -0
col    2[2] @4707: 1
col    3[2] @4710: 3
col    4[3] @4713: 272
col    5[5] @4717: 5168854
col    6[1] @4723: 0
col    7[3] @4725: 866
col    8[3] @4729: 350
col    9[1] @4733: 0
col   10[2] @4735: 3
col   11[2] @4738: 2
col   12[0] @4741: *NULL*
col   13[0] @4742: *NULL*
col   14[0] @4743: *NULL*
col   15[0] @4744: *NULL*
col   16[2] @4745: 2
Copy after login
在这里我们将回滚段的状态修改为2,表示offline

BBED> modify /x 02 offset 4737
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/oracle/oradata/orcl11g/system01.dbf (1)
Block: 225              Offsets: 4737 to 5248           Dba:0x004000e1
------------------------------------------------------------------------
0202c103 ffffffff 02c1032c 011102c1 0a145f53 5953534d 55395f31 34323433
34313937 352402c1 0202c104 03c20339 05c40614 12210180 03c20b5e 03c2045e
018002c1 0302c103 ffffffff 02c1032c 001102c1 09145f53 5953534d 55385f32
30313233 38323733 302402c1 0202c104 03c20329 05c40614 11380180 03c20b40
03c20334 018002c1 0302c103 ffffffff 02c1032c 001102c1 08145f53 5953534d
55375f33 32383636 31303036 302402c1 0202c104 03c20319 05c40614 11350180
03c20953 03c20418 018002c1 0302c103 ffffffff 02c1032c 001102c1 07145f53
5953534d 55365f32 34343333 38313439 382402c1 0202c104 03c20309 05c40220
295a0180 03c20944 03c20261 018002c1 0402c103 ffffffff 02c1032c 001102c1
06145f53 5953534d 55355f31 35323734 36393033 382402c1 0202c104 03c2025d
05c40614 11340180 03c20d4c 03c20512 018002c1 0302c103 ffffffff 02c1032c
001102c1 05145f53 5953534d 55345f31 31353230 30353935 342402c1 0202c104
03c2024d 05c4023e 14400180 03c2084c 03c20461 018002c1 0402c103 ffffffff
02c1032c 001102c1 04145f53 5953534d 55335f32 30393736 37373533 312402c1
0202c104 03c2023d 05c40614 11360180 03c20b5d 03c2053a 018002c1 0302c103
ffffffff 02c1032c 001102c1 03145f53 5953534d 55325f32 32333235 37313038

<32 bytes per line>

BBED> p *kdbr[10]
rowdata[799]
------------
ub1 rowdata[799]                            @4679     0x2c

BBED> x /1rnnnnnnnn
rowdata[799]                                @4679   
------------
flag@4679: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@4680: 0x00
cols@4681:   17

col    0[2] @4682: 10
col   1[21] @4685: -0
col    2[2] @4707: 1
col    3[2] @4710: 3
col    4[3] @4713: 272
col    5[5] @4717: 5168854
col    6[1] @4723: 0
col    7[3] @4725: 866
col    8[3] @4729: 350
col    9[1] @4733: 0
col   10[2] @4735: 1
col   11[2] @4738: 2
col   12[0] @4741: *NULL*
col   13[0] @4742: *NULL*
col   14[0] @4743: *NULL*
col   15[0] @4744: *NULL*
col   16[2] @4745: 2


BBED> sum apply;
Check value for File 1, Block 225:
current = 0x93df, required = 0x93df

BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/orcl11g/system01.dbf
BLOCK = 225


DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED
Copy after login
刷新缓存,重新查看视图:
SYS@orcl11g>alter system flush buffer_cache;

System altered.

SYS@orcl11g>select segment_name,tablespace_name,status from dba_rollback_segs;
SEGMENT_NAME                   TABLESPACE_NAME      STATUS
------------------------------ -------------------- ------------------------------------------------------------
SYSTEM                         SYSTEM               ONLINE
_SYSSMU10_3550978943$          UNDOTBS1             OFFLINE
_SYSSMU9_1424341975$           UNDOTBS1             OFFLINE
_SYSSMU8_2012382730$           UNDOTBS1             OFFLINE
_SYSSMU7_3286610060$           UNDOTBS1             OFFLINE
_SYSSMU6_2443381498$           UNDOTBS1             OFFLINE
_SYSSMU5_1527469038$           UNDOTBS1             OFFLINE
_SYSSMU4_1152005954$           UNDOTBS1             OFFLINE
_SYSSMU3_2097677531$           UNDOTBS1             OFFLINE
_SYSSMU2_2232571081$           UNDOTBS1             OFFLINE
_SYSSMU1_3780397527$           UNDOTBS1             OFFLINE
_SYSSMU20_3705739785$          UNDOTBS02            ONLINE
_SYSSMU19_3920348761$          UNDOTBS02            ONLINE
_SYSSMU18_2539622763$          UNDOTBS02            ONLINE
_SYSSMU17_178842559$           UNDOTBS02            ONLINE
_SYSSMU16_3035903491$          UNDOTBS02            ONLINE
_SYSSMU15_444141832$           UNDOTBS02            ONLINE
_SYSSMU14_3021863913$          UNDOTBS02            ONLINE
_SYSSMU13_3717211136$          UNDOTBS02            ONLINE
_SYSSMU12_3182721254$          UNDOTBS02            ONLINE
_SYSSMU11_3909920883$          UNDOTBS02            ONLINE

SYS@orcl11g>select name,status$ from undo$;
NAME                                                            STATUS$
------------------------------------------------------------ ----------
SYSTEM                                                                3
_SYSSMU1_3780397527$                                                  2
_SYSSMU2_2232571081$                                                  2
_SYSSMU3_2097677531$                                                  2
_SYSSMU4_1152005954$                                                  2
_SYSSMU5_1527469038$                                                  2
_SYSSMU6_2443381498$                                                  2
_SYSSMU7_3286610060$                                                  2
_SYSSMU8_2012382730$                                                  2
_SYSSMU9_1424341975$                                                  2
_SYSSMU10_3550978943$                                                 1
_SYSSMU11_3909920883$                                                 3
_SYSSMU12_3182721254$                                                 3
_SYSSMU13_3717211136$                                                 3
_SYSSMU14_3021863913$                                                 3
_SYSSMU15_444141832$                                                  3
_SYSSMU16_3035903491$                                                 3
_SYSSMU17_178842559$                                                  3
_SYSSMU18_2539622763$                                                 3
_SYSSMU19_3920348761$                                                 3
_SYSSMU20_3705739785$                                                 3


SYS@orcl11g>select name,status$ from undo$;
NAME                                                            STATUS$
------------------------------------------------------------ ----------
SYSTEM                                                                3
_SYSSMU1_3780397527$                                                  1
_SYSSMU2_2232571081$                                                  1
_SYSSMU3_2097677531$                                                  1
_SYSSMU4_1152005954$                                                  1
_SYSSMU5_1527469038$                                                  1
_SYSSMU6_2443381498$                                                  1
_SYSSMU7_3286610060$                                                  1
_SYSSMU8_2012382730$                                                  1
_SYSSMU9_1424341975$                                                  1
_SYSSMU10_3550978943$                                                 1
_SYSSMU11_3909920883$                                                 3
_SYSSMU12_3182721254$                                                 3
_SYSSMU13_3717211136$                                                 3
_SYSSMU14_3021863913$                                                 3
_SYSSMU15_444141832$                                                  3
_SYSSMU16_3035903491$                                                 3
_SYSSMU17_178842559$                                                  3
_SYSSMU18_2539622763$                                                 3
_SYSSMU19_3920348761$                                                 3
_SYSSMU20_3705739785$                                                 3

21 rows selected.
Copy after login

重新启动数据库,发现offline的回滚段不存在:
SYS@orcl11g>col segment_name for a30;
SYS@orcl11g>col tablespace_name for a30;
SYS@orcl11g>select segment_name,tablespace_name,status from dba_rollback_segs;
SEGMENT_NAME                   TABLESPACE_NAME                STATUS
------------------------------ ------------------------------ ------------------------------------------------------------
SYSTEM                         SYSTEM                         ONLINE
_SYSSMU20_3705739785$          UNDOTBS02                      ONLINE
_SYSSMU19_3920348761$          UNDOTBS02                      ONLINE
_SYSSMU18_2539622763$          UNDOTBS02                      ONLINE
_SYSSMU17_178842559$           UNDOTBS02                      ONLINE
_SYSSMU16_3035903491$          UNDOTBS02                      ONLINE
_SYSSMU15_444141832$           UNDOTBS02                      ONLINE
_SYSSMU14_3021863913$          UNDOTBS02                      ONLINE
_SYSSMU13_3717211136$          UNDOTBS02                      ONLINE
_SYSSMU12_3182721254$          UNDOTBS02                      ONLINE
_SYSSMU11_3909920883$          UNDOTBS02                      ONLINE

这时候我们来查看该表:
SYS@orcl11g>conn zbdba/oracle;
Connected.
ZBDBA@orcl11g>select * from zbdba;
NAME
------------------------------------------------------------
zbbda
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to change the personal name in the group on DingTalk_How to modify the personal name in the group on DingTalk How to change the personal name in the group on DingTalk_How to modify the personal name in the group on DingTalk Mar 29, 2024 pm 08:41 PM

1. First open DingTalk. 2. Open the group chat and click the three dots in the upper right corner. 3. Find my nickname in this group. 4. Click to enter to modify and save.

Connection status in standby: Disconnected, reason: NIC Compliance Connection status in standby: Disconnected, reason: NIC Compliance Feb 19, 2024 pm 03:15 PM

"The connection status in the event log message shows Standby: Disconnected due to NIC compliance. This means that the system is in standby mode and the network interface card (NIC) has been disconnected. Although this is usually a network issue , but can also be caused by software and hardware conflicts. In the following discussion, we will explore how to solve this problem." What is the reason for standby connection disconnection? NIC compliance? If you see the "ConnectivityStatusinStandby:DisConnected,Reason:NICCompliance" message in Windows Event Viewer, this indicates that there may be a problem with your NIC or network interface controller. This situation is usually

How to Change User Folder Name: Win11 Tutorial How to Change User Folder Name: Win11 Tutorial Jan 09, 2024 am 10:34 AM

Some games will be automatically installed into the user folder and require an English folder. However, many friends do not know how to modify the user folder name in win11. In fact, we only need to modify the user name. Modify the user folder name in win11: The first step is to press the "Win+R" key combination on the keyboard. In the second step, enter "gpedit.msc" and press Enter to open the Group Policy Editor. Step 3: Expand "Security Settings" under "Windows Settings" Step 4: Open "Security Options" in "Local Policies" Step 5: Double-click to open the "Account: Rename System Administrator Account" policy on the right. Step 6: Enter the name of the folder you want to modify below and click "OK" to save. Modify user folder

Can Douyin Blue V change its name? What are the steps to change the name of corporate Douyin Blue V account? Can Douyin Blue V change its name? What are the steps to change the name of corporate Douyin Blue V account? Mar 22, 2024 pm 12:51 PM

Douyin Blue V certification is the official certification of a company or brand on the Douyin platform, which helps enhance brand image and credibility. With the adjustment of corporate development strategy or the update of brand image, the company may want to change the name of Douyin Blue V certification. So, can Douyin Blue V change its name? The answer is yes. This article will introduce in detail the steps to modify the name of the enterprise Douyin Blue V account. 1. Can Douyin Blue V change its name? You can change the name of Douyin Blue V account. According to Douyin’s official regulations, corporate Blue V certified accounts can apply to change their account names after meeting certain conditions. Generally speaking, enterprises need to provide relevant supporting materials, such as business licenses, organization code certificates, etc., to prove the legality and necessity of changing the name. 2. What are the steps to modify the name of corporate Douyin Blue V account?

How to set Momo status How to set Momo status Mar 01, 2024 pm 12:10 PM

Momo, a well-known social platform, provides users with a wealth of functional services for their daily social interactions. On Momo, users can easily share their life status, make friends, chat, etc. Among them, the setting status function allows users to show their current mood and status to others, thereby attracting more people's attention and communication. So how to set your own Momo status? The following will give you a detailed introduction! How to set status on Momo? 1. Open Momo, click More in the lower right corner, find and click Daily Status. 2. Select the status. 3. The setting status will be displayed.

Win10 sleep time modification tips revealed Win10 sleep time modification tips revealed Mar 08, 2024 pm 06:39 PM

Win10 Sleep Time Modification Tips Revealed As one of the currently widely used operating systems, Windows 10 has a sleep function to help users save power and protect the screen when not using the computer. However, sometimes the default sleep time does not meet the needs of users, so it is particularly important to know how to modify the Win10 sleep time. This article will reveal the tips for modifying the sleep time of Win10, allowing you to easily customize the system’s sleep settings. 1. Modify Win10 sleep time through “Settings” First, the simplest fix

PyCharm background color adjustment tips: Master it quickly! PyCharm background color adjustment tips: Master it quickly! Feb 03, 2024 am 09:39 AM

To quickly master the skills of modifying the background color of PyCharm, you need specific code examples. In recent years, the Python language has become more and more popular in the field of program development, and PyCharm, as an integrated development environment (IDE), is loved and used by the majority of developers. In PyCharm, some developers often personalize the IDE interface, including changing the background color. This article will introduce the technique of modifying the background color of PyCharm and give specific code examples to help readers quickly master this skill.

Accelerate pip source and solve the problem of slow download speed Accelerate pip source and solve the problem of slow download speed Jan 17, 2024 am 10:18 AM

Quickly modify the pip source to solve the problem of slow download speed. Specific code examples are required. Introduction: During the development process of using Python, we often need to use pip to install various third-party libraries. However, due to network environment limitations or default source issues, pip download speeds are often very slow, which brings inconvenience to our development. Therefore, this article will introduce how to quickly modify the pip source to solve the problem of slow download speed, and provide specific code examples. 1. Problem Analysis When using pip to download third-party libraries, I

See all articles