• 疑问,查询Oracle动态性能视图定义,建议使用v$fixed_view_definition


    SQL>select owner,object_name,object_type from dba_objects where object_name='V$SORT_USAGE';
    OWNER      OBJECT_NAME          OBJECT_TYPE
    ---------- -------------------- -------------------
    PUBLIC     V$SORT_USAGE         SYNONYM
    SQL>select * from dba_synonyms where synonym_name='V$SORT_USAGE';
    OWNER      SYNONYM_NAME    TABLE_OWNE TABLE_NAME                     DB_LINK
    ---------- --------------- ---------- ------------------------------ ----------
    PUBLIC     V$SORT_USAGE    SYS        V_$SORT_USAGE
    SQL>select owner,object_name,object_type from dba_objects where object_name='V_$SORT_USAGE';
    OWNER      OBJECT_NAME          OBJECT_TYPE
    ---------- -------------------- -------------------
    SYS        V_$SORT_USAGE        VIEW
    SQL>select dbms_metadata.get_ddl('VIEW','V_$SORT_USAGE','SYS') ddl_text from dual
    DDL_TEXT
    --------------------------------------------------------------------------------
      CREATE OR REPLACE FORCE VIEW "SYS"."V_$SORT_USAGE" ("USERNAME", "USER", "SESSI
    ON_ADDR", "SESSION_NUM", "SQLADDR", "SQLHASH", "SQL_ID", "TABLESPACE", "CONTENTS
    ", "SEGTYPE", "SEGFILE#", "SEGBLK#", "EXTENTS", "BLOCKS", "SEGRFNO#") AS
      select "USERNAME","USER","SESSION_ADDR","SESSION_NUM","SQLADDR","SQLHASH","SQL
    _ID","TABLESPACE","CONTENTS","SEGTYPE","SEGFILE#","SEGBLK#","EXTENTS","BLOCKS","
    SEGRFNO#" from v$sort_usage;
    
    SQL>select * from v$fixed_view_definition  where view_name ='V$SORT_USAGE';
    VIEW_NAME       VIEW_DEFINITION
    --------------- ---------------------------------------------
    V$SORT_USAGE    select  USERNAME , "USER" , SESSION_ADDR , SE
                    SSION_NUM , SQLADDR , SQLHASH, SQL_ID, TABLES
                    PACE , CONTENTS , SEGTYPE , SEGFILE# , SEGBLK
                    # ,EXTENTS , BLOCKS , SEGRFNO# from GV$SORT_U
                    SAGE where inst_id = USERENV('Instance')            
    SQL>select * from v$fixed_view_definition  where view_name ='GV$SORT_USAGE';
    VIEW_NAME       VIEW_DEFINITION
    --------------- ---------------------------------------------
    GV$SORT_USAGE   select x$ktsso.inst_id, username, username, k
                    tssoses, ktssosno, prev_sql_addr, prev_hash_v
                    alue, prev_sql_id, ktssotsn, decode(ktssocnt,
                     0, 'PERMANENT', 1, 'TEMPORARY'), decode(ktss
                    osegt, 1, 'SORT', 2, 'HASH', 3, 'DATA', 4, 'I
                    NDEX', 5, 'LOB_DATA', 6, 'LOB_INDEX' , 'UNDEF
                    INED'), ktssofno, ktssobno, ktssoexts, ktssob
                    lks, ktssorfno from x$ktsso, v$session where
                    ktssoses = v$session.saddr and ktssosno = v$s
                    ession.serial#
    
    SQL>select owner,object_name,object_type from dba_objects where object_name='V$SESSION';
    OWNER      OBJECT_NAME          OBJECT_TYPE
    ---------- -------------------- -------------------
    PUBLIC     V$SESSION            SYNONYM
    SQL>select * from dba_synonyms where synonym_name='V$SESSION';
    OWNER      SYNONYM_NAME    TABLE_OWNE TABLE_NAME                     DB_LINK
    ---------- --------------- ---------- ------------------------------ ----------
    PUBLIC     V$SESSION       SYS        V_$SESSION
    SQL>select owner,object_name,object_type from dba_objects where object_name='V_$SESSION';
    OWNER      OBJECT_NAME          OBJECT_TYPE
    ---------- -------------------- -------------------
    SYS        V_$SESSION           VIEW
    DDL_TEXT
    --------------------------------------------------------------------------------
    
      CREATE OR REPLACE FORCE VIEW "SYS"."V_$SESSION" ("SADDR", "SID", "SERIAL#", "A
    UDSID", "PADDR", "USER#", "USERNAME", "COMMAND", "OWNERID", "TADDR", "LOCKWAIT",
     "STATUS", "SERVER", "SCHEMA#", "SCHEMANAME", "OSUSER", "PROCESS", "MACHINE", "P
    ORT", "TERMINAL", "PROGRAM", "TYPE", "SQL_ADDRESS", "SQL_HASH_VALUE", "SQL_ID",
    "SQL_CHILD_NUMBER", "SQL_EXEC_START", "SQL_EXEC_ID", "PREV_SQL_ADDR", "PREV_HASH
    _VALUE", "PREV_SQL_ID", "PREV_CHILD_NUMBER", "PREV_EXEC_START", "PREV_EXEC_ID",
    "PLSQL_ENTRY_OBJECT_ID", "PLSQL_ENTRY_SUBPROGRAM_ID", "PLSQL_OBJECT_ID", "PLSQL_
    SUBPROGRAM_ID", "MODULE", "MODULE_HASH", "ACTION", "ACTION_HASH", "CLIENT_INFO",
     "FIXED_TABLE_SEQUENCE", "ROW_WAIT_OBJ#", "ROW_WAIT_FILE#", "ROW_WAIT_BLOCK#", "
    ROW_WAIT_ROW#", "TOP_LEVEL_CALL#", "LOGON_TIME", "LAST_CALL_ET", "PDML_ENABLED",
     "FAILOVER_TYPE", "FAILOVER_METHOD", "FAILED_OVER", "RESOURCE_CONSUMER_GROUP", "
    PDML_STATUS", "PDDL_STATUS", "PQ_STATUS", "CURRENT_QUEUE_DURATION", "CLIENT_IDEN
    TIFIER", "BLOCKING_SESSION_STATUS", "BLOCKING_INSTANCE", "BLOCKING_SESSION", "FI
    NAL_BLOCKING_SESSION_STATUS", "FINAL_BLOCKING_INSTANCE", "FINAL_BLOCKING_SESSION
    ", "SEQ#", "EVENT#", "EVENT", "P1TEXT", "P1", "P1RAW", "P2TEXT", "P2", "P2RAW",
    "P3TEXT", "P3", "P3RAW", "WAIT_CLASS_ID", "WAIT_CLASS#", "WAIT_CLASS", "WAIT_TIM
    E", "SECONDS_IN_WAIT", "STATE", "WAIT_TIME_MICRO", "TIME_REMAINING_MICRO", "TIME
    _SINCE_LAST_WAIT_MICRO", "SERVICE_NAME", "SQL_TRACE", "SQL_TRACE_WAITS", "SQL_TR
    ACE_BINDS", "SQL_TRACE_PLAN_STATS", "SESSION_EDITION_ID", "CREATOR_ADDR", "CREAT
    OR_SERIAL#", "ECID") AS    select "SADDR","SID","SERIAL#","AUDSID","PADDR","USER
    #","USERNAME","COMMAND","OWNERID","TADDR","LOCKWAIT","STATUS","SERVER","SCHEMA#"
    ,"SCHEMANAME","OSUSER","PROCESS","MACHINE","PORT","TERMINAL","PROGRAM","TYPE","S
    QL_ADDRESS","SQL_HASH_VALUE","SQL_ID","SQL_CHILD_NUMBER","SQL_EXEC_START","SQL_E
    XEC_ID","PREV_SQL_ADDR","PREV_HASH_VALUE","PREV_SQL_ID","PREV_CHILD_NUMBER","PRE
    V_EXEC_START","PREV_EXEC_ID","PLSQL_ENTRY_OBJECT_ID","PLSQL_ENTRY_SUBPROGRAM_ID"
    ,"PLSQL_OBJECT_ID","PLSQL_SUBPROGRAM_ID","MODULE","MODULE_HASH","ACTION","ACTION
    _HASH","CLIENT_INFO","FIXED_TABLE_SEQUENCE","ROW_WAIT_OBJ#","ROW_WAIT_FILE#","RO
    W_WAIT_BLOCK#","ROW_WAIT_ROW#","TOP_LEVEL_CALL#","LOGON_TIME","LAST_CALL_ET","PD
    ML_ENABLED","FAILOVER_TYPE","FAILOVER_METHOD","FAILED_OVER","RESOURCE_CONSUMER_G
    ROUP","PDML_STATUS","PDDL_STATUS","PQ_STATUS","CURRENT_QUEUE_DURATION","CLIENT_I
    DENTIFIER","BLOCKING_SESSION_STATUS","BLOCKING_INSTANCE","BLOCKING_SESSION","FIN
    AL_BLOCKING_SESSION_STATUS","FINAL_BLOCKING_INSTANCE","FINAL_BLOCKING_SESSION","
    SEQ#","EVENT#","EVENT","P1TEXT","P1","P1RAW","P2TEXT","P2","P2RAW","P3TEXT","P3"
    ,"P3RAW","WAIT_CLASS_ID","WAIT_CLASS#","WAIT_CLASS","WAIT_TIME","SECONDS_IN_WAIT
    ","STATE","WAIT_TIME_MICRO","TIME_REMAINING_MICRO","TIME_SINCE_LAST_WAIT_MICRO",
    "SERVICE_NAME","SQL_TRACE","SQL_TRACE_WAITS","SQL_TRACE_BINDS","SQL_TRACE_PLAN_S
    TATS","SESSION_EDITION_ID","CREATOR_ADDR","CREATOR_SERIAL#","ECID" from v$sessio
    n
    
    SQL>select * from v$fixed_view_definition  where view_name ='V$SESSION';
    SQL> select * from v$fixed_view_definition  where view_name ='V$SESSION';
    
    VIEW_NAME       VIEW_DEFINITION
    --------------- ---------------------------------------------
    V$SESSION       select  SADDR , SID , SERIAL# , AUDSID , PADD
                    R , USER# , USERNAME , COMMAND , OWNERID, TAD
                    DR , LOCKWAIT , STATUS , SERVER , SCHEMA# , S
                    CHEMANAME ,OSUSER , PROCESS , MACHINE , PORT
                    ,  TERMINAL , PROGRAM , TYPE , SQL_ADDRESS ,
                    SQL_HASH_VALUE, SQL_ID, SQL_CHILD_NUMBER , SQ
                    L_EXEC_START, SQL_EXEC_ID, PREV_SQL_ADDR , PR
                    EV_HASH_VALUE , PREV_SQL_ID, PREV_CHILD_NUMBE
                    R , PREV_EXEC_START , PREV_EXEC_ID , PLSQL_EN
                    TRY_OBJECT_ID, PLSQL_ENTRY_SUBPROGRAM_ID, PLS
                    QL_OBJECT_ID, PLSQL_SUBPROGRAM_ID, MODULE , M
                    ODULE_HASH , ACTION , ACTION_HASH , CLIENT_IN
                    FO , FIXED_TABLE_SEQUENCE , ROW_WAIT_OBJ# , R
                    OW_WAIT_FILE# , ROW_WAIT_BLOCK# , ROW_WAIT_RO
                    W# , TOP_LEVEL_CALL#,  LOGON_TIME ,  LAST_CAL
                    L_ET , PDML_ENABLED , FAILOVER_TYPE , FAILOVE
                    R_METHOD , FAILED_OVER, RESOURCE_CONSUMER_GRO
                    UP, PDML_STATUS, PDDL_STATUS, PQ_STATUS, CURR
                    ENT_QUEUE_DURATION, CLIENT_IDENTIFIER, BLOCKI
                    NG_SESSION_STATUS, BLOCKING_INSTANCE, BLOCKIN
                    G_SESSION, FINAL_BLOCKING_SESSION_STATUS, FIN
                    AL_BLOCKING_INSTANCE, FINAL_BLOCKING_SESSION,
                     SEQ#, EVENT#,EVENT,P1TEXT,P1,P1RAW,P2TEXT,P2
                    ,P2RAW, P3TEXT,P3,P3RAW,WAIT_CLASS_ID, WAIT_C
                    LASS#,WAIT_CLASS,WAIT_TIME, SECONDS_IN_WAIT,S
                    TATE,WAIT_TIME_MICRO,TIME_REMAINING_MICRO, TI
                    ME_SINCE_LAST_WAIT_MICRO,SERVICE_NAME, SQL_TR
                    ACE, SQL_TRACE_WAITS, SQL_TRACE_BINDS, SQL_TR
                    ACE_PLAN_STATS, SESSION_EDITION_ID, CREATOR_A
                    DDR, CREATOR_SERIAL#, ECID  from GV$SESSION w
                    here inst_id = USERENV('Instance')
    SQL> select * from v$fixed_view_definition  where view_name ='GV$SESSION';
    VIEW_NAME       VIEW_DEFINITION
    --------------- ---------------------------------------------
    GV$SESSION      select s.inst_id,s.addr,s.indx,s.ksuseser,s.k
                    suudses,s.ksusepro,s.ksuudlui,s.ksuudlna,s.ks
                    uudoct,s.ksusesow, decode(s.ksusetrn,hextoraw
                    ('00'),null,s.ksusetrn),decode(s.ksqpswat,hex
                    toraw('00'),null,s.ksqpswat),decode(bitand(s.
                    ksuseidl,11),1,'ACTIVE',0,decode(bitand(s.ksu
                    seflg,4096),0,'INACTIVE','CACHED'),2,'SNIPED'
                    ,3,'SNIPED', 'KILLED'),decode(s.ksspatyp,1,'D
                    EDICATED',2,'SHARED',3,'PSEUDO',4,'POOLED','N
                    ONE'),  s.ksuudsid,s.ksuudsna,s.ksuseunm,s.ks
                    usepid, s.ksusemnm,s.ksusemnp,s.ksusetid,s.ks
                    usepnm, decode(bitand(s.ksuseflg,19),17,'BACK
                    GROUND',1,'USER',2,'RECURSIVE','?'), s.ksuses
                    ql, s.ksusesqh, s.ksusesqi, decode(s.ksusesch
                    , 65535, to_number(null), s.ksusesch),  s.ksu
                    sesesta,  decode(s.ksuseseid, 0, to_number(nu
                    ll), s.ksuseseid),  s.ksusepsq, s.ksusepha, s
                    .ksusepsi,  decode(s.ksusepch, 65535, to_numb
                    er(null), s.ksusepch),  s.ksusepesta,  decode
                    (s.ksusepeid, 0, to_number(null), s.ksusepeid
                    ),  decode(s.ksusepeo,0,to_number(null),s.ksu
                    sepeo),  decode(s.ksusepeo,0,to_number(null),
                    s.ksusepes),  decode(s.ksusepco,0,to_number(n
                    ull),         decode(bitand(s.ksusstmbv, powe
                    r(2,11)), power(2,11), s.ksusepco,
                         to_number(null))),  decode(s.ksusepcs,0,
                    to_number(null),         decode(bitand(s.ksus
                    stmbv, power(2,11)), power(2,11), s.ksusepcs,
                                    to_number(null))),  s.ksuseap
                    p, s.ksuseaph, s.ksuseact, s.ksuseach, s.ksus
                    ecli, s.ksusefix, s.ksuseobj, s.ksusefil, s.k
                    suseblk, s.ksuseslt,  s.ksuseorafn, s.ksuselt
                    m, 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,'PREPARS
                    E','NONE'),decode(s.ksusefs, 1, 'YES', 'NO'),
                    s.ksusegrp,decode(bitand(s.ksusepxopt,4),4,'E
                    NABLED',decode(bitand(s.ksusepxopt,8),8,'FORC
                    ED','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.ksusepxo
                    pt,16),16,'DISABLED','ENABLED')),  s.ksusecqd
                    , s.ksuseclid,  decode(s.ksuseblocker,4294967
                    295,'UNKNOWN',  4294967294, 'UNKNOWN',4294967
                    293,'UNKNOWN',4294967292,'NO HOLDER',  429496
                    7291,'NOT IN WAIT','VALID'),decode(s.ksuseblo
                    cker, 4294967295,to_number(null),4294967294,t
                    o_number(null), 4294967293,to_number(null), 4
                    294967292,to_number(null),4294967291,  to_num
                    ber(null),bitand(s.ksuseblocker, 2147418112)/
                    65536),decode(s.ksuseblocker, 4294967295,to_n
                    umber(null),4294967294,to_number(null), 42949
                    67293,to_number(null), 4294967292,to_number(n
                    ull),4294967291,  to_number(null),bitand(s.ks
                    useblocker, 65535)),  decode(s.ksusefblocker,
                    4294967295,'UNKNOWN',  4294967294, 'UNKNOWN',
                    4294967293,'UNKNOWN',4294967292,'NO HOLDER',
                     4294967291,'NOT IN WAIT','VALID'),decode(s.k
                    susefblocker,4294967295,to_number(null),42949
                    67294,to_number(null), 4294967293,to_number(n
                    ull), 4294967292,to_number(null),4294967291,
                     to_number(null),bitand(s.ksusefblocker, 2147
                    418112)/65536),decode(s.ksusefblocker,4294967
                    295,to_number(null),4294967294,to_number(null
                    ), 4294967293,to_number(null), 4294967292,to_
                    number(null),4294967291,  to_number(null),bit
                    and(s.ksusefblocker, 65535)),  w.kslwtseq,w.k
                    slwtevt,e.kslednam,e.ksledp1,w.kslwtp1,w.kslw
                    tp1r, e.ksledp2,w.kslwtp2,w.kslwtp2r,e.ksledp
                    3,w.kslwtp3,w.kslwtp3r, e.ksledclassid,e.ksle
                    dclass#,e.ksledclass, decode(w.kslwtinwait,
                          0,decode(bitand(w.kslwtflags,256),
                                0,-2,                 decode(roun
                    d(w.kslwtstime/10000),
                     0,-1,                        round(w.kslwtst
                    ime/10000))),        0), decode(w.kslwtinwait
                    ,0,round((w.kslwtstime+w.kslwtltime)/1000000)
                    ,  round(w.kslwtstime/1000000)), decode(w.ksl
                    wtinwait,1,'WAITING',  decode(bitand(w.kslwtf
                    lags,256),0,'WAITED UNKNOWN TIME',   decode(r
                    ound(w.kslwtstime/10000),0,'WAITED SHORT TIME
                    ',    'WAITED KNOWN TIME'))),w.kslwtstime, de
                    code(w.kslwtinwait,0,to_number(null),  decode
                    (bitand(w.kslwtflags,64),64,0,w.kslwttrem)),
                    w.kslwtltime,s.ksusesvc, decode(bitand(s.ksus
                    eflg2,32),32,'ENABLED','DISABLED'),decode(bit
                    and(s.ksuseflg2,64),64,'TRUE','FALSE'),d
    
    SQL> l
      1* select * from v$fixed_view_definition
      
    GV$CLONEDFILE   select INST_ID, SNAPSHOTFILENAME, CLONEFILENA
                    ME, SNAPSHOTBLKREAD,  SNAPSHOTREQUEST, FILENU
                    MBER, BLOCKS_ALLOCATED  from x$ksfdsscloneinf
                    o
    
    V$CLONEDFILE    select SNAPSHOTFILENAME, CLONEFILENAME, SNAPS
                    HOTBLKREAD, SNAPSHOTREQUEST,  FILENUMBER, BLO
                    CKS_ALLOCATED from gv$clonedfile
  • 相关阅读:
    1101. Quick Sort (25)
    1100. Mars Numbers (20)
    1099. Build A Binary Search Tree (30)
    TCP四次挥手为何需要TIME_WAIT以及为何是2MSL?
    关于priority_queue运算符重载的问题
    leetcode151.翻转字符串里的单词
    华为笔试题--最长公共子串
    华为笔试题--表达式求值
    华为笔试题--字符串合并处理
    华为笔试题--删除字符串中出现次数最少的字符
  • 原文地址:https://www.cnblogs.com/lvcha001/p/12190784.html
Copyright © 2020-2023  润新知