在一些特殊的情況下(比如ORA-00600 [15267],ORA-00600 [KKDLCOB-OBJN-EXISTS],Ora-600 [15260]),考慮需要把dba_objects中的object_id往前推進,這裡通過實驗的方法實現該功能
資料庫版本資訊
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
分析obj和dataobj
SQL> select max(obj#),max(dataobj#) from obj$;
MAX(OBJ#) MAX(DATAOBJ#)
---------- -------------
51887 51907
SQL> select name from obj$ where obj#=51887;
NAME
------------------------------
T_DUL
SQL> select name from obj$ where dataobj#=51907;
NAME
------------------------------
_NEXT_OBJECT
SQL> select object_id,data_object_id from dba_objects where object_name='_NEXT_OBJECT';
no rows selected
為什麼dba_objects中無_NEXT_OBJECT
因為dba_objects視圖中跳過了_NEXT_OBJECT這條記錄
_next_object
測試建立新表後obj和dataobj的變化
SQL> create table t_xff as select * from dual;
Table created.
SQL> select max(obj#),max(dataobj#) from obj$;
MAX(OBJ#) MAX(DATAOBJ#)
---------- -------------
51898 51907
SQL> select name from obj$ where obj#=51898;
NAME
------------------------------
T_XFF
SQL> select max(object_id),max(data_object_id) from dba_objects where object_name='T_XFF';
MAX(OBJECT_ID) MAX(DATA_OBJECT_ID)
-------------- -------------------
51898 51898
通過測試可以確定,obj發生增加,但是dataobj不一定增加(因為dataobj本身比obj大,如果出現obj>dataobj那屬於異常情況)
測試資料庫重啟obj和dataobj是否會跳號
---正常重啟資料庫
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORACLE instance started.
Total System Global Area 260046848 bytes
Fixed Size 1266920 bytes
Variable Size 83888920 bytes
Database Buffers 171966464 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
SQL> select max(obj#),max(dataobj#) from obj$;
MAX(OBJ#) MAX(DATAOBJ#)
---------- -------------
51898 51907
---強制重啟資料庫
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 260046848 bytes
Fixed Size 1266920 bytes
Variable Size 83888920 bytes
Database Buffers 171966464 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
SQL> select max(obj#),max(dataobj#) from obj$;
MAX(OBJ#) MAX(DATAOBJ#)
---------- -------------
51898 51907
通過這個證明obj和dataobj沒有因為資料庫重啟而發生改變
實現obj跳號
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup restrict
ORACLE instance started.
Total System Global Area 260046848 bytes
Fixed Size 1266920 bytes
Variable Size 83888920 bytes
Database Buffers 171966464 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
SQL> update obj$ set dataobj#=1000000 where name='_NEXT_OBJECT';
1 row updated.
SQL> commit;
Commit complete.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 260046848 bytes
Fixed Size 1266920 bytes
Variable Size 83888920 bytes
Database Buffers 171966464 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
SQL> select max(obj#),max(dataobj#) from obj$;
MAX(OBJ#) MAX(DATAOBJ#)
---------- -------------
51898 1000000
SQL> create table t_www_xifenfei_com as select * from dual;
Table created.
SQL> select max(obj#),max(dataobj#) from obj$;
MAX(OBJ#) MAX(DATAOBJ#)
---------- -------------
1000000 1000010
SQL> select max(object_id),max(data_object_id) from dba_objects;
MAX(OBJECT_ID) MAX(DATA_OBJECT_ID)
-------------- -------------------
1000000 1000000
SQL> select object_name from dba_objects where object_id=1000000;
OBJECT_NAME
----------------------------------------------------------------
T_WWW_XIFENFEI_COM
通過丟_NEXT_OBJECT的更新實現obj和dataobj跳號(變成100w)