Oracle DictionaryThis is a featured page

1 Information on Oracle Dictionary

You must be aware the information available on Oracle dictionary, because no matter how good you are, you can’t remember everything, and you must know how to find it on oracle.

1.A Types of views

USER_, are views showing information related to user
ALL_, are views showing information related to all user
DBA_, are views showing information related to all user, and sometimes has more columns than ALL_ views, But I didn’t found a dba view having more columns than a all view, in the few test I did like this.
SQL> select TABLE_NAME,count(*) from dba_tab_columns where table_name like '%_TAB_COLUMNS' GROUP BY TABLE_NAME;
TABLE_NAME COUNT(*)
------------------------------ ----------
DBA_TAB_COLUMNS 31
USER_TAB_COLUMNS 30
ALL_TAB_COLUMNS 31
The additional column is owner, user views don’t need them, because shows only user information.

1.B Finding where to find information

You want to know where is information about lob segments, because you found that when moving tables to another tablespace, you must move lob segments too, where will you search the name of the lobs?
SQL> select view_name from all_views where view_name like '%LOB%';
VIEW_NAME
------------------------------
V_$GLOBAL_TRANSACTION
V_$TEMPORARY_LOBS
V_$GLOBAL_BLOCKED_LOCKS
GV_$GLOBAL_TRANSACTION
GV_$TEMPORARY_LOBS
GV_$GLOBAL_BLOCKED_LOCKS
GLOBAL_NAME
USER_LOBS
ALL_LOBS
DBA_LOBS
1.B.i Hunting views Finding some views can be tricky, in some situations you’ll find usefull to include like 'ALL\_%TAB%' ESCAPE '\' and 'DBA\_%TAB%' ESCAPE '\';
To avoid other kind of views, if you pay attention there are some views appearing with ALL_ and not with DBA_ and vice versa.
SQL> select VIEW_name from all_views where view_name like 'ALL\_%TAB%' ESCAPE '\';
VIEW_NAME
------------------------------
ALL_TABLES
ALL_OBJECT_TABLES
ALL_ALL_TABLES
ALL_TAB_COLS
ALL_TAB_COLUMNS
ALL_NESTED_TABLE_COLS
ALL_TAB_COL_STATISTICS
ALL_TAB_HISTOGRAMS
ALL_TAB_COMMENTS
ALL_TAB_PRIVS
ALL_TAB_PRIVS_MADE
ALL_TAB_PRIVS_RECD
ALL_UPDATABLE_COLUMNS
ALL_NESTED_TABLES
ALL_UNUSED_COL_TABS
ALL_PARTIAL_DROP_TABS
ALL_TAB_MODIFICATIONS
ALL_SOURCE_TABLES
ALL_SUBSCRIBED_TABLES
ALL_PART_TABLES
ALL_TAB_PARTITIONS
ALL_TAB_SUBPARTITIONS
ALL_TAB_STATISTICS
ALL_PENDING_CONV_TABLES
ALL_SUMMARY_DETAIL_TABLES
ALL_EXTERNAL_TABLES
ALL_TAB_STATS_HISTORY
ALL_EVALUATION_CONTEXT_TABLES
ALL_QUEUE_TABLES
ALL_BASE_TABLE_MVIEWS
ALL_CAPTURE_PREPARED_DATABASE
ALL_CAPTURE_PREPARED_TABLES
ALL_APPLY_TABLE_COLUMNS
ALL_FILE_GROUP_TABLESPACES
ALL_FILE_GROUP_TABLES
ALL_STREAMS_TABLE_RULES
ALL_WM_VERSIONED_TABLES
ALL_WM_MODIFIED_TABLES
ALL_WM_TAB_TRIGGERS
ALL_WM_LOCKED_TABLES
ALL_EXPFIL_PREDTAB_ATTRIBUTES
ALL_EXPFIL_PREDTAB_PLAN
ALL_XML_TABLES
ALL_XML_TAB_COLS
44 filas seleccionadas.
SQL> select VIEW_name from all_views where view_name like 'DBA\_%TAB%' ESCAPE '\';
VIEW_NAME
------------------------------
DBA_TABLES
DBA_OBJECT_TABLES
DBA_ALL_TABLES
DBA_TAB_COLS
DBA_TAB_COLUMNS
DBA_NESTED_TABLE_COLS
DBA_TAB_COL_STATISTICS
DBA_TAB_HISTOGRAMS
DBA_TAB_COMMENTS
DBA_TAB_PRIVS
DBA_UPDATABLE_COLUMNS
DBA_NESTED_TABLES
DBA_UNUSED_COL_TABS
DBA_PARTIAL_DROP_TABS
DBA_TAB_MODIFICATIONS
DBA_SOURCE_TABLES
DBA_SUBSCRIBED_TABLES
DBA_PART_TABLES
DBA_TAB_PARTITIONS
DBA_TAB_SUBPARTITIONS
DBA_TAB_STATISTICS
DBA_PENDING_CONV_TABLES
DBA_SUMMARY_DETAIL_TABLES
DBA_ADVISOR_SQLW_TABLES
DBA_ADVISOR_SQLW_TABVOL
DBA_EXTERNAL_TABLES
DBA_TABLESPACES
DBA_TABLESPACE_GROUPS
DBA_TABLESPACE_USAGE_METRICS
DBA_TAB_STATS_HISTORY
DBA_EVALUATION_CONTEXT_TABLES
DBA_QUEUE_TABLES
DBA_BASE_TABLE_MVIEWS
DBA_CACHEABLE_NONTABLE_OBJECTS
DBA_CACHEABLE_TABLES_BASE
DBA_CACHEABLE_TABLES
DBA_CAPTURE_PREPARED_DATABASE
DBA_CAPTURE_PREPARED_TABLES
DBA_APPLY_TABLE_COLUMNS
DBA_FILE_GROUP_TABLESPACES
DBA_FILE_GROUP_TABLES
DBA_STREAMS_TABLE_RULES
DBA_STREAMS_RENAME_TABLE
DBA_HIST_DATABASE_INSTANCE
DBA_HIST_TABLESPACE_STAT
DBA_WM_VERSIONED_TABLES
DBA_XML_TABLES
DBA_XML_TAB_COLS
48 filas seleccionadas.

1.C Looking inside views

If you select the text column of the all_views view, you will have the description of the view, this helps you some times to understand some memory tables, for example for dba_lobs the query is the following
select u.name, o.name,
decode(bitand(c.property, 1), 1, ac.name, c.name), lo.name,
decode(bitand(l.property, 8), 8, ts1.name, ts.name),
io.name,
But sometimes you will find references like this
For V_$SESSION view is
select "SADDR","SID","SERIAL#","AUDSID","PADDR","USER#","USERNAME","COMMAND","OWNERID"…
from v$session
Then you want to see the content of v$session, but there are not information
SELECT * FROM ALL_VIEWS WHERE VIEW_NAME LIKE '%V$SESSION%';
So you try to find the object through the synonym, and you find a “short-circuit”
SQL> SELECT * FROM DBA_SYNONYMS WHERE SYNONYM_NAME = 'V$SESSION';
OWNER SYNONYM_NAME TABLE_OWNER
------------------------------ ------------------------------ ---------------
TABLE_NAME
------------------------------
DB_LINK
-----------------------------------------------------------------------------
PUBLIC V$SESSION SYS
V_$SESSION
Then the question is: Where I can know the source query of the fixed views
The answer is V$FIXED_VIEW_DEFINITION
SQL> SELECT VIEW_DEFINITION FROM V$FIXED_VIEW_DEFINITION WHERE VIEW_NAME ='V$SESSION';
VIEW_DEFINITION
------------------------------------------------------------------------------------------------------------------------
select SADDR , SID , SERIAL# , AUDSID , PADDR , USER# , USERNAME , COMMAND , OWNERID, TADDR , LOCKWAIT , STATUS , SERVE
R , SCHEMA# , SCHEMANAME ,OSUSER , PROCESS , MACHINE , TERMINAL , PROGRAM , TYPE , SQL_ADDRESS , SQL_HASH_VALUE, SQL_ID,
SQL_CHILD_NUMBER , PREV_SQL_ADDR , PREV_HASH_VALUE , PREV_SQL_ID, PREV_CHILD_NUMBER , MODULE , MODULE_HASH , ACTION , A
CTION_HASH , CLIENT_INFO , FIXED_TABLE_SEQUENCE , ROW_WAIT_OBJ# , ROW_WAIT_FILE# , ROW_WAIT_BLOCK# , ROW_WAIT_ROW# , LOG
ON_TIME , LAST_CALL_ET , PDML_ENABLED , FAILOVER_TYPE , FAILOVER_METHOD , FAILED_OVER, RESOURCE_CONSUMER_GROUP, PDML_STA
TUS, PDDL_STATUS, PQ_STATUS, CURRENT_QUEUE_DURATION, CLIENT_IDENTIFIER, BLOCKING_SESSION_STATUS, BLOCKING_INSTANCE,BLOCK
ING_SESSION,SEQ#, EVENT#,EVENT,P1TEXT,P1,P1RAW,P2TEXT,P2,P2RAW, P3TEXT,P3,P3RAW,WAIT_CLASS_ID, WAIT_CLASS#,WAIT_CLASS,WA
IT_TIME, SECONDS_IN_WAIT,STATE,SERVICE_NAME, SQL_TRACE, SQL_TRACE_WAITS, SQL_TRACE_BINDS from GV$SESSION where inst_id =
USERENV('Instance')
If you are not satisfied with this answer, you can go further investigating how is GV$SESSION build
SQL> SELECT VIEW_DEFINITION FROM V$FIXED_VIEW_DEFINITION WHERE VIEW_NAME ='GV$SESSION';
VIEW_DEFINITION
------------------------------------------------------------------------------------------------------------------------
select s.inst_id,s.addr,s.indx,s.ksuseser,s.ksuudses,s.ksusepro,s.ksuudlui,s.ksuudlna,s.ksuudoct,s.ksusesow, decode(s.ks
usetrn,hextoraw('00'),null,s.ksusetrn),decode(s.ksqpswat,hextoraw('00'),null,s.ksqpswat),decode(bitand(s.ksuseidl,11),1,
'ACTIVE',0,decode(bitand(s.ksuseflg,4096),0,'INACTIVE','CACHED'),2,'SNIPED',3,'SNIPED', 'KILLED'),decode(s.ksspatyp,1,'D
EDICATED',2,'SHARED',3,'PSEUDO','NONE'), s.ksuudsid,s.ksuudsna,s.ksuseunm,s.ksusepid,s.ksusemnm,s.ksusetid,s.ksusepnm,
decode(bitand(s.ksuseflg,19),17,'BACKGROUND',1,'USER',2,'RECURSIVE','?'), s.ksusesql, s.ksusesqh, s.ksusesqi, decode(s.k
susesch, 65535, to_number(null), s.ksusesch), s.ksusepsq, s.ksusepha, s.ksusepsi, decode(s.ksusepch, 65535, to_number(
null), s.ksusepch), s.ksuseapp, s.ksuseaph, s.ksuseact, s.ksuseach, s.ksusecli, s.ksusefix, s.ksuseobj, s.ksusefil, s.k
suseblk, s.ksuseslt, s.ksuseltm, s.ksusectm,decode(bitand(s.ksusepxopt, 12),0,'NO','YES'),decode(s.ksuseft, 2,'SESSION',
4,'SELECT',8,'TRANSACTIONAL','NONE'),decode(s.ksusefm,1,'BASIC',2,'PRECONNECT',4,'PREPARSE','NONE'),decode(s.ksusefs, 1
, 'YES', 'NO'),s.ksusegrp,decode(bitand(s.ksusepxopt,4),4,'ENABLED',decode(bitand(s.ksusepxopt,8),8,'FORCED','DISABLED')
),decode(bitand(s.ksusepxopt,2),2,'FORCED',decode(bitand(s.ksusepxopt,1),1,'DISABLED','ENABLED')),decode(bitand(s.ksusep
xopt,32),32,'FORCED',decode(bitand(s.ksusepxopt,16),16,'DISABLED','ENABLED')), s.ksusecqd, s.ksuseclid, decode(s.ksuseb
locker,4294967295,'UNKNOWN', 4294967294, 'UNKNOWN',4294967293,'UNKNOWN',4294967292,'NO HOLDER', 4294967291,'NOT IN WAI
T','VALID'),decode(s.ksuseblocker, 4294967295,to_number(null),4294967294,to_number(null), 4294967293,to_number(null), 42
94967292,to_number(null),4294967291, to_number(null),bitand(s.ksuseblocker, 2147418112)/65536),decode(s.ksuseblocker, 4
294967295,to_number(null),4294967294,to_number(null), 4294967293,to_number(null), 4294967292,to_number(null),4294967291,
to_number(null),bitand(s.ksuseblocker, 65535)),s.ksuseseq, s.ksuseopc,e.kslednam, e.ksledp1, s.ksusep1,s.ksusep1r,e.ks
ledp2, s.ksusep2,s.ksusep2r,e.ksledp3,s.ksusep3,s.ksusep3r,e.ksledclassid, e.ksledclass#, e.ksledclass, decode(s.ksuset
im,0,0,-1,-1,-2,-2, decode(round(s.ksusetim/10000),0,-1,round(s.ksusetim/10000))), s.ksusewtm,decode(s.ksusetim, 0, 'WAI
TING', -2, 'WAITED UNKNOWN TIME', -1, 'WAITED SHORT TIME', decode(round(s.ksusetim/10000),0,'WAITED SHORT TIME','WAIT
ED KNOWN TIME')),s.ksusesvc, decode(bitand(s.ksuseflg2,32),32,'ENABLED','DISABLED'),decode(bitand(s.ksuseflg2,64),64,'TR
UE','FALSE'),decode(bitand(s.ksuseflg2,128),128,'TRUE','FALSE')from x$ksuse s, x$ksled e where bitand(s.ksspaflg,1)!=0 a
nd bitand(s.ksuseflg,1)!=0 and s.ksuseopc=e.indx
Some dbas sometimes modifies the queries like the previous, at this level to improve performance and create their own views, to get just the information they need.
You must keep in mind this can change from release to release,
so you will have to re-analyze your “low-level” queries after you apply some important patch,
if you decided to to them.

1.D Comments

Some views contains interesting comments about views
SQL> SELECT VIEW_NAME FROM ALL_VIEWS WHERE VIEW_NAME LIKE '%COMMENT%' ORDER BY 1;
VIEW_NAME
------------------------------
ALL_COL_COMMENTS
ALL_INDEXTYPE_COMMENTS
ALL_MVIEW_COMMENTS
ALL_OPERATOR_COMMENTS
ALL_TAB_COMMENTS
DBA_COL_COMMENTS
DBA_INDEXTYPE_COMMENTS
DBA_MVIEW_COMMENTS
DBA_OPERATOR_COMMENTS
DBA_TAB_COMMENTS
KU$_COMMENT_VIEW
KU$_10_1_COMMENT_VIEW
USER_COL_COMMENTS
USER_INDEXTYPE_COMMENTS
USER_MVIEW_COMMENTS
USER_OPERATOR_COMMENTS
USER_TAB_COMMENTS
For example
select distinct table_name,column_name,comments from dba_col_comments where comments is not null
order by 2

ALL_REPCAT_TEMPLATE_PARMS USER_OVERRIDE
User override flag.
DBA_REPCAT_TEMPLATE_PARMS USER_OVERRIDE
User override flag.
REPCAT$_USER_PARM_VALUES USER_PARAMETER_ID
Internal primary key of the REPCAT$_USER_PARM_VALUES table.
DBA_APPLY_DML_HANDLERS USER_PROCEDURE
Name of the DML handler specified by the user
ALL_APPLY_DML_HANDLERS USER_PROCEDURE
Name of the DML handler specified by the user
ALL_SCHEDULER_CHAINS USER_RULE_SET
Whether the chain uses a user-specified rule set
DBA_SCHEDULER_CHAINS USER_RULE_SET
Whether the chain uses a user-specified rule set


No user avatar
juancarlosreyesp
Latest page update: made by juancarlosreyesp , Sep 30 2008, 9:59 PM EDT (about this update About This Update juancarlosreyesp Edited by juancarlosreyesp

958 words added

view changes

- complete history)
Keyword tags: None
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.