隱藏引數查詢和dictionary view
1.查詢隱藏引數
SQL> alter session set sql_trace=true;
Session altered.
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
db_name string test
SQL> alter session set sql_trace=false;
Session altered.
檢視trace檔案
D:appdiagrdbmstesttesttrace>tkprof test_ora_5816.trc abcd.txt
TKPROF: Release 11.2.0.1.0 - Development on 星期一 8月 27 10:32:34 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
檔案中顯示show parameter的查詢語句
SELECT NAME NAME_COL_PLUS_SHOW_PARAM,DECODE(TYPE,1,'boolean',2,'string',3,
'integer',4,'file',5,'number', 6,'big integer', 'unknown') TYPE,
DISPLAY_VALUE VALUE_COL_PLUS_SHOW_PARAM
FROM
V$PARAMETER WHERE UPPER(NAME) LIKE UPPER(:NMBIND_SHOW_OBJ) ORDER BY
NAME_COL_PLUS_SHOW_PARAM,ROWNUM
看以看出show parmaeter是查詢了v$parameter,
SQL> select * from v$fixed_view_definition where view_name='V$PARAMETER';
VIEW_NAME VIEW_DEFINITION
-------------------- --------------------------------------------------------------------------------
V$PARAMETER select NUM , NAME , TYPE , VALUE , DISPLAY_VALUE, ISDEFAULT , ISSES_MODIFIABLE
, ISSYS_MODIFIABLE , ISINSTANCE_MODIFIABLE, ISMODIFIED , ISADJUSTED , ISDEPRECAT
ED, ISBASIC, DESCRIPTION, UPDATE_COMMENT, HASH from GV$PARAMETER where inst_id
= USERENV('Instance')
SQL> select * from v$fixed_view_definition where view_name='GV$PARAMETER';
VIEW_NAME VIEW_DEFINITION
-------------------- --------------------------------------------------------------------------------
GV$PARAMETER select x.inst_id,x.indx+1,ksppinm,ksppity,ksppstvl, ksppstdvl, ksppstdf, decode
(bitand(ksppiflg/256,1),1,'TRUE','FALSE'), decode(bitand(ksppiflg/65536,3),1,'I
MMEDIATE',2,'DEFERRED', 3,'IMMEDIATE','FALSE'),
decode(bitand(ksppiflg,4),4,'FALSE', decod
e(bitand(ksppiflg/65536,3), 0, 'FALSE', 'TRUE')), decode(bitand(ksppstvf,7),
1,'MODIFIED',4,'SYSTEM_MOD','FALSE'), decode(bitand(ksppstvf,2),2,'TRUE','FALSE
'), decode(bitand(ksppilrmflg/64, 1), 1, 'TRUE', 'FALSE'), decode(bitand(ksppi
lrmflg/268435456, 1), 1, 'TRUE', 'FALSE'), ksppdesc, ksppstcmnt, ksppihash fro
m x$ksppi x, x$ksppcv y where (x.indx = y.indx) and bitand(ksppiflg,268435456)
= 0 and ((translate(ksppinm,'_','#') not like '##%') and ((translate(ksppinm
,'_','#') not like '#%') or (ksppstdf = 'FALSE') or (bitand(ksppstvf,5
) > 0)))
從中,我們可以得出,主要是查詢x$ksppi,和x$ksppcv兩個表,可以直接查詢這兩個table
select a.ksppinm,b.ksppstvl,b.ksppstdvl,a.ksppdesc from x$ksppi a,x$ksppcv b where a.indx=b.indx and a.ksppinm like '%spin%'
或者:
create or replace view my_gv$parameter(INST_ID,"NUM","NAME","TYPE","VALUE","DISPLAY_VALUE",
"ISDEFAULT","ISSES_MODIFIABLE","ISSYS_MODIFIABLE","ISINSTANCE_MODIFIABLE",
"ISMODIFIED","ISADJUSTED","ISDEPRECATED","ISBASIC","DESCRIPTION",
"UPDATE_COMMENT","HASH" )
as
select x.inst_id,x.indx+1 indx,ksppinm,ksppity,ksppstvl, ksppstdvl, ksppstdf, decode(bitand(ksppiflg/256,1),1,'TRUE','FALSE'), decode(bitand(ksppiflg/65536,3),1,'IMMEDIATE',2,'DEFERRED',3,'IMMEDIATE','FALSE'), decode(bitand(ksppiflg,4),4,'FALSE',decode(bitand(ksppiflg/65536,3), 0, 'FALSE', 'TRUE')), decode(bitand(ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE'), decode(bitand(ksppstvf,2),2,'TRUE','FALSE'), decode(bitand(ksppilrmflg/64, 1), 1, 'TRUE', 'FALSE'), decode(bitand(ksppilrmflg/268435456, 1), 1, 'TRUE', 'FALSE'), ksppdesc, ksppstcmnt, ksppihash
from x$ksppi x, x$ksppcv y
where
(x.indx = y.indx) and bitand(ksppiflg,268435456) = 0 and ( (translate(ksppinm,'_','#') not like '##%')
and
( (translate(ksppinm,'_','#') like '#%') or (ksppstdf = 'FALSE') or (bitand(ksppstvf,5) > 0) ) )
CREATE or replace VIEW MY_V$PARAMETER AS
select NUM , NAME , TYPE , VALUE , DISPLAY_VALUE, ISDEFAULT , ISSES_MODIFIABLE , ISSYS_MODIFIABLE , ISINSTANCE_MODIFIABLE, ISMODIFIED , ISADJUSTED , ISDEPRECATED, ISBASIC, DESCRIPTION, UPDATE_COMMENT, HASH from my_GV$PARAMETER where inst_id = USERENV('Instance')
SQL> grant select on my_v$parameter to test;
Grant succeeded.
在test使用者下:
CREATE or replace SYNONYM V$PARMETER for sys.MY_V$PARAMETER
然後test使用者下,可以查詢隱藏引數:
SQL> show parameter spin
NAME TYPE VALUE
------------------------------------ ---------------------- ----------------
_kgx_spin_count integer 255
_spin_count integer 2000
2.查詢資料字典的順序。
synonym -->gv_$型別view --> v$型別view--> x$型別table
(1)SQL> select object_name,object_type from dba_objects where object_name='V$PARAMETER' and owner='PUBLIC';
OBJECT_NAME OBJECT_TYPE
-------------------- --------------------------------------
V$PARAMETER SYNONYM
SQL> select * from dba_synonyms where synonym_name='V$PARAMETER' AND OWNER='PUBLIC';
OWNER SYNONYM_NAME TABLE_OWNE TABLE_NAME DB_LINK
---------- ------------------ ---------- ------------------- ----------
PUBLIC V$PARAMETER SYS V_$PARAMETER
(2)SQL> select object_name,object_type from dba_objects where object_name='V_$PARAMETER';
OBJECT_NAME OBJECT_TYPE
-------------------- --------------------------------------
V_$PARAMETER VIEW
檢視dba_view中,可以得出,text是查詢v$parameter檢視
(3)SQL> select * from v$fixed_view_definition where view_name='V$PARAMETER';
VIEW_NAME VIEW_DEFINITION
-------------------- --------------------------------------------------------------------------------
V$PARAMETER select NUM , NAME , TYPE , VALUE , DISPLAY_VALUE, ISDEFAULT , ISSES_MODIFIABLE
, ISSYS_MODIFIABLE , ISINSTANCE_MODIFIABLE, ISMODIFIED , ISADJUSTED , ISDEPRECAT
ED, ISBASIC, DESCRIPTION, UPDATE_COMMENT, HASH from GV$PARAMETER where inst_id
= USERENV('Instance')
(4)SQL> select * from v$fixed_view_definition where view_name='GV$PARAMETER';
VIEW_NAME VIEW_DEFINITION
-------------------- --------------------------------------------------------------------------------
GV$PARAMETER select x.inst_id,x.indx+1,ksppinm,ksppity,ksppstvl, ksppstdvl, ksppstdf, decode
(bitand(ksppiflg/256,1),1,'TRUE','FALSE'), decode(bitand(ksppiflg/65536,3),1,'I
MMEDIATE',2,'DEFERRED', 3,'IMMEDIATE','FALSE'),
decode(bitand(ksppiflg,4),4,'FALSE', decod
e(bitand(ksppiflg/65536,3), 0, 'FALSE', 'TRUE')), decode(bitand(ksppstvf,7),
1,'MODIFIED',4,'SYSTEM_MOD','FALSE'), decode(bitand(ksppstvf,2),2,'TRUE','FALSE
'), decode(bitand(ksppilrmflg/64, 1), 1, 'TRUE', 'FALSE'), decode(bitand(ksppi
lrmflg/268435456, 1), 1, 'TRUE', 'FALSE'), ksppdesc, ksppstcmnt, ksppihash fro
m x$ksppi x, x$ksppcv y where (x.indx = y.indx) and bitand(ksppiflg,268435456)
= 0 and ((translate(ksppinm,'_','#') not like '##%') and ((translate(ksppinm
,'_','#') not like '#%') or (ksppstdf = 'FALSE') or (bitand(ksppstvf,5
) > 0)))
[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1059604/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 隱藏引數查詢sqlSQL
- 隱含引數的查詢
- Oracle引數-隱藏引數Oracle
- Oracle隱含引數的查詢Oracle
- view的隱藏和顯示View
- Oracle隱形引數查詢指令碼Oracle指令碼
- 查詢oracle中的隱形引數Oracle
- Oracle 隱藏引數使用Oracle
- oracle隱藏引數的檢視和使用Oracle
- 檢視oracle隱藏引數Oracle
- Oracle 各版本引數/隱藏引數 介紹Oracle
- 隱含引數的查詢x$ksppi,x$ksppcv
- 檢視Oracle隱藏引數的SQLOracleSQL
- 查詢資料庫隱含引數的sql語句資料庫SQL
- MySQL引數化查詢的IN 和 LIKEMySql
- Shell指令碼對ps命令隱藏引數指令碼
- 【指令碼】隱含引數及註釋資訊的查詢方法指令碼
- Laravel同時接收路由引數和查詢字串中的引數Laravel路由字串
- 獲取資料庫中所有隱藏引數資料庫
- 用隱藏引數為Windows Commander提速(轉)Windows
- ORACLE SQL調優之執行計劃與隱藏引數_complex_view_mergingOracleSQLView
- 開啟查詢慢查詢日誌引數
- 查詢hadoop引數變數Hadoop變數
- MacOS使用搜尋功能查詢隱藏檔案的方法Mac
- [20170502]11G查詢隱含引數檢視.txt
- Scala - 隱式轉換和隱式引數
- Oracle11g版本中未歸檔隱藏引數Oracle
- Oracle12c版本中未歸檔隱藏引數Oracle
- 檢視資料庫中的隱藏引數(指令碼)資料庫指令碼
- O7_DICTIONARY_ACCESSIBILITY引數
- MacOS X隱藏和顯示隱藏檔案Mac
- Mac顯示和隱藏“隱藏檔案”命令Mac
- MAC如何顯示隱藏檔案和隱藏隱藏檔案的命令Mac
- Sql Server 的引數化查詢SQLServer
- 抽象SQL引數化查詢VK抽象SQL
- 二分查詢 : 那個隱藏了 10 年的 Java BugJava
- oracle O7_DICTIONARY_ACCESSIBILITY 引數Oracle
- 如何實現引數級聯查詢