[20210803]刪除user$的恢復準備.txt

lfree發表於2021-08-03

[20210803]刪除user$的恢復準備.txt

--//昨天看了連結,據說根據某廠商給出來的建議對對oracle的user$
--//的系統預設使用者update等操作,很奇葩的事情,不知道是否類似等保的要求,還是自己內部打著等保的要求,提出這種建議。

--//我曾經在如下連結做了一些測試。
[20190531]ORA-600 kokasgi1故障模擬與恢復(後續).txt =>http://blog.itpub.net/267265/viewspace-2646419/
[20190531]ORA-600 kokasgi1故障模擬與恢復.txt =>http://blog.itpub.net/267265/viewspace-2646340/

--//http://blog.itpub.net/16807927/viewspace-2776888/ 提到了刪除,我測試看看,先測試前看看sys.user$.

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

SYS@book> select owner,object_name,object_id,data_object_id from dba_objects where object_name='USER$';
OWNER  OBJECT_NAME           OBJECT_ID DATA_OBJECT_ID
------ -------------------- ---------- --------------
SYS    USER$                        22             10

SELECT ROWNUM - 1 rn
      ,OWNER
      ,OBJECT_NAME
      ,SUBOBJECT_NAME
      ,OBJECT_ID
      ,DATA_OBJECT_ID
      ,OBJECT_TYPE
      ,CREATED
      ,LAST_DDL_TIME
      ,TIMESTAMP
      ,STATUS
  FROM (  SELECT *
            FROM dba_objects
           WHERE owner = 'SYS' AND data_object_id = 10
        ORDER BY object_id) a;

 RN OWNER  OBJECT_NAME SUBOBJECT_  OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE         CREATED             LAST_DDL_TIME       TIMESTAMP           STATUS
--- ------ ----------- ---------- ---------- -------------- ------------------- ------------------- ------------------- ------------------- -------
  0 SYS    C_USER#                        10             10 CLUSTER             2013-08-24 11:37:35 2013-08-24 11:37:35 2013-08-24:11:37:35 VALID
  1 SYS    USER$                          22             10 TABLE               2013-08-24 11:37:35 2013-08-24 11:59:25 2013-08-24:11:37:35 VALID
  2 SYS    TSQ$                           67             10 TABLE               2013-08-24 11:37:35 2013-08-24 11:37:35 2013-08-24:11:37:35 VALID
--//可以發現sys.user$僅僅是cluster table C_USER# 中的1個.而是是第1個表(從0算起,0是cluster table).

SYS@book> select * from dba_extents where owner='SYS' and segment_name='C_USER#'
  2  @ prxx
==============================
OWNER                         : SYS
SEGMENT_NAME                  : C_USER#
PARTITION_NAME                :
SEGMENT_TYPE                  : CLUSTER
TABLESPACE_NAME               : SYSTEM
EXTENT_ID                     : 0
FILE_ID                       : 1
BLOCK_ID                      : 208
BYTES                         : 65536
BLOCKS                        : 8
RELATIVE_FNO                  : 1
PL/SQL procedure successfully completed.

--//僅僅佔用1個段,恢復相對容易.
--//我以前的刪除tab$恢復指令碼就修改dba 1,208就ok了.有時間嘗試看看.

$ echo "p /d dba 1,208"  ktetb | rlbbed | egrep 'ktetbdba|ktetbnbk' |awk -v OFS== '{print $2,$4}' |paste -d ";" - -
ktetbdba=4194513;ktetbnbk=7

$ echo p /d dba 1,208 ktech.hwmark_ktech.blkno_ktehw | rlbbed | grep blkno_ktehw | awk  '{print $5}' | tr -d " "
5

--//高水位標識在5,這樣掃描的塊更少.先看看我原來寫的指令碼,時間太久了,自己都差點讀不懂程式程式碼.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2784843/,如需轉載,請註明出處,否則將追究法律責任。

相關文章