08103错误情景再现及解决

$ oerr ora 8103
08103, 00000, "object no longer exists"
// *Cause:  The object has been deleted by another user since the operation
//          began, or a prior incomplete recovery restored the database to
//          a point in time during the deletion of the object.
// *Action: Delete the object if this is the result of an incomplete
//          recovery.

在 Master Note for Handling Oracle Database Corruption Issues (文档 ID 1088018.1)中对ORA-8103错误的描述如下:

The object has been deleted by another user since the operation began.
If the error is reproducible, following may be the reasons:-
a.) The header block has an invalid block type.
b.) The data_object_id (seg/obj) stored in the block is different than the data_object_id stored in the segment header.

See dba_objects.data_object_id and compare it to the decimal value stored in the block (field seg/obj).

--//以前做过的测试.链接:
--//听别人提起高水位下的块出现了未格式化的块.自己模拟测试看看.

1.环境:
SCOTT@book> @ 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

--//建立表空间:
CREATE TABLESPACE TEA DATAFILE
  '/mnt/ramdisk/book/tea01.dbf' SIZE 40M AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT MANUAL
FLASHBACK ON;

--//顺便做1个备份.
RMAN> backup as copy datafile 6 format '/home/oracle/backup/%b' ;
Starting backup at 2018-11-22 16:22:12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=67 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=94 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=106 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
output file name=/home/oracle/backup/tea01.dbf tag=TAG20181122T162213 RECID=13 STAMP=992881334
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2018-11-22 16:22:15

Starting Control File and SPFILE Autobackup at 2018-11-22 16:22:15
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2018_11_22/o1_mf_s_992881335_fzdssq4g_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2018-11-22 16:22:16

2.建立测试环境:
SCOTT@book> create table t tablespace tea as select * from all_objects where rownum<=1e4;
Table created.

SCOTT@book> select object_id,data_object_id from dba_objects where object_name = 'T' and owner = user;
 OBJECT_ID DATA_OBJECT_ID
---------- --------------
    90463          90463

SCOTT@book> select segment_type, HEADER_FILE, HEADER_BLOCK from dba_segments where owner = user and segment_name = 'T';
SEGMENT_TYPE      HEADER_FILE HEADER_BLOCK
------------------ ----------- ------------
TABLE                        6          128

SCOTT@book> select FILE_ID, block_id, blocks from dba_extents where owner = user and segment_name = 'T';
  FILE_ID  BLOCK_ID    BLOCKS
---------- ---------- ----------
        6        128          8
        6        136          8
        6        144          8
        6        152          8
        6        160          8
        6        168          8
        6        176          8
        6        184          8
        6        192          8
        6        200          8
        6        208          8
        6        216          8
        6        224          8
        6        232          8
        6        240          8
        6        248          8
        6        256        128
17 rows selected.

2.破坏数据块看看:
SCOTT@book> alter system flush buffer_cache;
System altered.

SCOTT@book> select max(rowid) from t ;
MAX(ROWID)
------------------
AAAWFfAAGAAAAEBABJ

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4ceff946d439246654ccbd64af36fcaa.html