[20240826]奇怪ORA-01031 insufficient privileges報錯.txt
--//遇到的奇怪ORA-01031 insufficient privileges情況,做一個分析:
1.環境:
SYS@book01p> @ver2
==============================
PORT_STRING : x86_64/Linux 2.4.xx
VERSION : 21.0.0.0.0
BANNER : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
BANNER_FULL : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
BANNER_LEGACY : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
CON_ID : 0
PL/SQL procedure successfully completed.
2.測試:
SYS@book01p> select count(1) from hist_head$ ;
COUNT(1)
----------
50435
--//沒有任何問題.
SYS@book01p> select * from hist_head$ ;
select * from hist_head$
*
ERROR at line 1:
ORA-01031: insufficient privileges
--//換成*報錯,感覺是否表出了問題,因為前面透過索引就可以完成執行計劃.
SYS@book01p> select /*+ full(hist_head$) */ count(1) from hist_head$ ;
COUNT(1)
----------
50435
SYS@book01p> select /*+ index(hist_head$) */ * from hist_head$ where rownum=1;
select /*+ index(hist_head$) */ * from hist_head$ where rownum=1
*
ERROR at line 1:
ORA-01031: insufficient privileges
--//仔細看*位置執行hist_head$,仔細看拼寫也沒有錯誤啊.
SYS@book01p> @ desc hist_head$
Name Null? Type
------------------------------- -------- ----------------------------
1 OBJ# NOT NULL NUMBER
2 COL# NOT NULL NUMBER
3 BUCKET_CNT NOT NULL NUMBER
4 ROW_CNT NOT NULL NUMBER
5 CACHE_CNT NUMBER
6 NULL_CNT NUMBER
7 TIMESTAMP# DATE
8 SAMPLE_SIZE NUMBER
9 MINIMUM NUMBER
10 MAXIMUM NUMBER
11 DISTCNT NUMBER
12 LOWVAL RAW(1000)
13 HIVAL RAW(1000)
14 DENSITY NUMBER
15 INTCOL# NOT NULL NUMBER
16 SPARE1 NUMBER
17 SPARE2 NUMBER
18 AVGCLN NUMBER
19 SPARE3 NUMBER
20 SPARE4 NUMBER
21 MINIMUM_ENC RAW(1000)
22 MAXIMUM_ENC RAW(1000)
--//有4個raw型別.難道是不能訪問raw型別嗎?
SYS@book01p> select DENSITY,AVGCLN from hist_head$ where rownum=1;
DENSITY AVGCLN
---------- ----------
0 0
--//這樣看視乎是裡面某個訪問某個欄位時報錯.5個5個一組嘗試.
SYS@book01p> select OBJ#,COL#,BUCKET_CNT,ROW_CNT,CACHE_CNT from hist_head$ where rownum=1;
OBJ# COL# BUCKET_CNT ROW_CNT CACHE_CNT
---------- ---------- ---------- ---------- ----------
10040 3 0 0 0
SYS@book01p> select TIMESTAMP#,SAMPLE_SIZE,MINIMUM,MAXIMUM,DISTCNT from hist_head$ where rownum=1;
select TIMESTAMP#,SAMPLE_SIZE,MINIMUM,MAXIMUM,DISTCNT from hist_head$ where rownum=1
*
ERROR at line 1:
ORA-01031: insufficient privileges
--//分開嘗試發現
SYS@book01p> select MINIMUM from hist_head$ where rownum=1;
select MINIMUM from hist_head$ where rownum=1
*
ERROR at line 1:
ORA-01031: insufficient privileges
SYS@book01p> select MAXIMUM from hist_head$ where rownum=1;
select MAXIMUM from hist_head$ where rownum=1
*
ERROR at line 1:
ORA-01031: insufficient privileges
--//發現MINIMUM,MAXIMUM存在問題.
SYS@book01p> select LOWVAL from hist_head$ where rownum=1;
select LOWVAL from hist_head$ where rownum=1
*
ERROR at line 1:
ORA-01031: insufficient privileges
SYS@book01p> select HIVAL from hist_head$ where rownum=1;
select HIVAL from hist_head$ where rownum=1
*
ERROR at line 1:
ORA-01031: insufficient privileges
--//發現LOWVAL,HIVAL存在問題.
SYS@book01p> select DENSITY,INTCOL#,SPARE1,SPARE2,AVGCLN,SPARE3,SPARE4,MINIMUM_ENC,MAXIMUM_ENC from hist_head$ where rownum=1
2 @ pr
==============================
DENSITY : 0
INTCOL# : 3
SPARE1 : 0
SPARE2 : 2
AVGCLN : 0
SPARE3 :
SPARE4 :
MINIMUM_ENC :
MAXIMUM_ENC :
PL/SQL procedure successfully completed.
--//MINIMUM_ENC,MAXIMUM_ENC也是raw型別,沒有報錯。
SYS@book01p> select DENSITY,INTCOL#,SPARE1,SPARE2,AVGCLN,SPARE3,SPARE4,MINIMUM_ENC,MAXIMUM_ENC from hist_head$ where rownum=1 and MINIMUM_ENC is not null
2 @pr
PL/SQL procedure successfully completed.
SYS@book01p> select DENSITY,INTCOL#,SPARE1,SPARE2,AVGCLN,SPARE3,SPARE4,MINIMUM_ENC,MAXIMUM_ENC from hist_head$ where rownum=1 and MAXIMUM_ENC is not null
2 @pr
PL/SQL procedure successfully completed.
--//MINIMUM_ENC,MAXIMUM_ENC全部都是null.
SYS@book01p> select * from v$reserved_words where KEYWORD in ('MINIMUM','MAXIMUM','LOWVAL','HIVAL')
2 @pr
==============================
KEYWORD : MINIMUM
LENGTH : 7
RESERVED : N
RES_TYPE : N
RES_ATTR : N
RES_SEMI : N
DUPLICATE : N
CON_ID : 0
PL/SQL procedure successfully completed.
--//就1個MINIMUM是保留字.RES*欄位的值都是N,表示怎麼意思。
SCOTT@book01p> create table t1( MINIMUM number);
Table created.
SCOTT@book01p> select * from t1;
no rows selected
SCOTT@book01p> insert into t1 values (1);
1 row created.
SCOTT@book01p> commit ;
Commit complete.
SCOTT@book01p> select * from t1;
MINIMUM
----------
1
--//建表也沒有問題啊.
select
OBJ#
,COL#
,BUCKET_CNT
,ROW_CNT
,CACHE_CNT
,NULL_CNT
,TIMESTAMP#
,SAMPLE_SIZE
--,MINIMUM
--,MAXIMUM
,DISTCNT
--,LOWVAL
--,HIVAL
,DENSITY
,INTCOL#
,SPARE1
,SPARE2
,AVGCLN
,SPARE3
,SPARE4
,MINIMUM_ENC
,MAXIMUM_ENC
from hist_head$ ;
--//測試確實只要不包括這4個欄位,查詢不存在問題.
--//難道21c做了一些限制,一些欄位不可以查詢嗎?
Select PRIVILEGE, GRANTEE, GRANTABLE, GRANTOR, NULL COLUMN_NAME
from sys.dba_tab_privs
where table_name = 'HIST_HEAD$'
and owner='SYS'
UNION ALL
Select PRIVILEGE, GRANTEE, GRANTABLE, GRANTOR, COLUMN_NAME
from sys.dba_col_privs
where table_name = 'HIST_HEAD$'
and owner='SYS'
order by grantee;
--//沒有輸出.
SELECT o.object_name, o.object_type,
NVL(d.alt, '-/-') alt,
NVL(d.aud, '-/-') aud,
NVL(d.com, '-/-') com,
NVL(d.del, '-/-') del,
NVL(d.gra, '-/-') gra,
NVL(d.ind, '-/-') ind,
NVL(d.ins, '-/-') ins,
NVL(d.loc, '-/-') loc,
NVL(d.ren, '-/-') ren,
NVL(d.sel, '-/-') sel,
NVL(d.upd, '-/-') upd,
--NVL(d.REF, '-/-') REF,
NVL(d.exe, '-/-') exe,
NVL(d.cre, '-/-') cre,
NVL(d.rea, '-/-') rea,
NVL(d.wri, '-/-') wri,
NVL(d.fbk, '-/-') fbk
FROM sys.USER_OBJ_AUDIT_OPTS d, sys.USER_OBJECTS o
WHERE d.object_name(+) = o.object_name
and d.object_type(+) = decode(o.object_type, 'MATERIALIZED VIEW', 'TABLE', 'PACKAGE', 'PROCEDURE', 'FUNCTION', 'PROCEDURE', 'LIBRARY', 'PROCEDURE', O.OBJECT_TYPE)
and (d.aud is null or (d.aud <> chr(0) || '/' || chr(0)))
and o.object_type = 'TABLE'
and o.object_name ='HIST_HEAD$';
OBJECT_NAME OBJECT_TYPE ALT AUD COM DEL GRA IND INS LOC REN SEL UPD EXE CRE REA WRI FBK
------------------------------ ------------------------------ ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
HIST_HEAD$ TABLE -/- -/- -/- -/- -/- -/- -/- -/- -/- -/- -/- -/- -/- -/- -/- -/-
--//查到這裡,無法知道為什麼,那位知道.
SYS@book01p> analyze table hist_head$ validate structure cascade;
Table analyzed.
3.透過轉儲看看:
SYS@book01p> select rowid from hist_head$ where rownum=1;
ROWID
------------------
AAAABEAABAAAEw6AAZ
SYS@book01p> @ rowid AAAABEAABAAAEw6AAZ
OBJECT FILE BLOCK ROW ROWID_DBA DBA TEXT
------------ ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
68 1 19514 25 0x404C3A 1,19514 alter system dump datafile 1 block 19514
;
SYS@book01p> alter system dump datafile 9 block 19514;
System altered.
--//絕對檔案號是9.
SYS@book> select file#,rfile#,name from v$datafile;
FILE# RFILE# NAME
---------- ---------- --------------------------------------------------
1 1 /u01/oradata/BOOK/system01.dbf
3 3 /u01/oradata/BOOK/sysaux01.dbf
4 4 /u01/oradata/BOOK/undotbs01.dbf
5 1 /u01/oradata/BOOK/pdbseed/system01.dbf
6 4 /u01/oradata/BOOK/pdbseed/sysaux01.dbf
7 7 /u01/oradata/BOOK/users01.dbf
8 9 /u01/oradata/BOOK/pdbseed/undotbs01.dbf
9 1 /u01/oradata/BOOK/book01p/system01.dbf
10 4 /u01/oradata/BOOK/book01p/sysaux01.dbf
11 9 /u01/oradata/BOOK/book01p/undotbs01.dbf
12 12 /u01/oradata/BOOK/book01p/users01.dbf
11 rows selected.
block_row_dump:
tab 0, row 0, @0x1f66
tl: 58 fb: --H-FL-- lb: 0x2 cc: 18
col 0: [ 2] c1 05
col 1: [ 2] c1 2b
col 2: [ 2] c1 02
col 3: [ 1] 80
col 4: [ 1] 80
col 5: [ 3] c2 17 5f
col 6: [ 7] 78 7c 08 18 10 05 38
col 7: [ 3] c2 02 02
col 8: [ 1] 80
col 9: [ 1] 80
col 10: [ 2] c1 02
col 11: [ 1] 80
col 12: [ 1] 80
col 13: [ 2] c1 02
col 14: [ 2] c1 2b
col 15: [ 2] c1 02
col 16: [ 2] c1 03
col 17: [ 2] c1 03
--//看不出任何問題。總之就是不能select * 。
[20240826]奇怪ORA-01031 insufficient privileges報錯.txt
相關文章
- oracle rac dg庫報錯ORA-01031: insufficient privilegesOracle
- Oracle遠端登入報錯:ora-01031:insufficient privilegesOracle
- ORA-01031: insufficient privileges錯誤解決方法
- SYS使用者登入Oracle報錯ORA-01031: insufficient privilegesOracle
- sqlplus / as sysdba報錯ORA-01031: insufficient privileges的原因分析SQL
- 儲存過程編譯報錯:PL/SQL:ORA-01031:insufficient privileges儲存過程編譯SQL
- SYS遠端連線出錯ORA-01031:Insufficient privileges
- ora-01031:insufficient privileges解決方法
- create view receive "ORA-01031: insufficient privileges"View
- Linux oracle ORA-01031: insufficient privilegesLinuxOracle
- ORA-01031: insufficient privileges的解決方法
- SQL> conn sys/sys@vm_sigle as sysdba; 報ORA-01031: insufficient privileges錯誤SQL
- sys使用者遠端登入報ORA-01031 insufficient privileges
- ORA-01031: 資料庫恢復時的insufficient privileges錯誤QS資料庫
- linux環境下sqlplus sys/sys@ORCL as sysdba報錯 ORA-01031: insufficient privilegesLinuxSQL
- linux as 2.1 ORA-01031: insufficient privileges 解決方法Linux
- 在AIX 平臺下遇到ORA-01031: insufficient privilegesAI
- RMAN system 遠端連線 ORA-01031: insufficient privileges
- 11gR2 Restart Database SRVCTL啟動DB報ORA-01031: insufficient privilegesRESTDatabase
- sqlplus "/ as sysdba" 連不上,報ora-01031:insufficient privileges解決方法SQL
- ORA-01031: insufficient privileges重新配置sys登入密碼密碼
- Oracle的SYS使用者登入報許可權不足(ORA-01031: insufficient privileges)Oracle
- conn / as sysdba 出現ORA-01031: insufficient privileges 解決辦法
- sys使用者執行 grant授權提示ORA-01031: insufficient privileges
- oracle 10g linux 遠端登入 ORA-01031: insufficient privilegesOracle 10gLinux
- 使用SYS使用者遠端登陸報許可權不足的解決:ORA-01031: insufficient privileges
- Oracle 軟體克隆後sysdba登入提示沒有許可權ora-01031: insufficient privilegesOracle
- ORA-20000: Insufficient privileges to analyze an object in SchemaObject
- 建立資料庫時“Insufficient privileges”的解決方法DK資料庫
- ORA-0131:Insufficient privileges.(DEBUG CONNECT SESSION)Session
- MongoDB報錯Insufficient free space for journal files的解決方法MongoDB
- oracle--job執行報錯--ORA-01031Oracle
- 很奇怪的jsp錯誤,大家試試看報錯不JS
- sqlplus / as sysdba無法登入的奇怪報錯SQL
- 從ORA-01031報錯看密碼檔案故障密碼
- 奇怪的錯誤-------重新定義一下變數就不報錯了變數
- oracle很奇怪的報ora-00904錯誤的討論Oracle
- 同事在(新疆)啟動一個oracle 817報錯:ora-01031Oracle