>  기사  >  데이터 베이스  >  Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

WBOY
WBOY앞으로
2022-07-06 13:58:541885검색

이 기사에서는 데이터 사전, 데이터 사전 뷰 및 동적 성능 뷰와 관련된 문제를 주로 구성하는 Oracle에 대한 관련 지식을 제공합니다. 데이터 사전은 데이터 사전의 기본 테이블을 포함하여 데이터베이스의 가장 기본적인 정보를 기록합니다. 모두에게 도움이 되기를 바라면서 데이터 사전 보기를 살펴보겠습니다.

Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

추천 튜토리얼: "Oracle Video Tutorial"

1. 데이터 사전

1.1 개념

데이터 사전은 기본 데이터 사전 테이블 및 데이터 사전 뷰를 포함하여 데이터베이스의 가장 기본적인 정보를 기록합니다. 데이터 사전 기본 테이블은 $ORACLE_HOMERDBMSADMINsql.bsq

Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

    에 의해 생성됩니다. 데이터 사전의 기본 테이블은 sys 사용자에게 속하며 시스템 테이블스페이스에 저장됩니다. 사용자는 수동으로 기본 테이블을 수정할 수 없습니다.
   오라클은 데이터 사전의 기본 테이블 사용을 단순화하기 위해 데이터 사전 뷰를 제공하며, 사용자가 사용하기 편리한 데이터 사전 뷰에 대한 공용 동의어도 생성합니다. 동의어는 Catalog.sql을 통해 생성됩니다

1.2 데이터 사전 뷰

1.2.1 세 가지 유형

 USER _ 뷰 유형은 현재 로그인한 사용자가 소유한 정보를 나타냅니다.
   ALL_ 뷰 유형은 현재 로그인한 정보를 나타냅니다.
   DBA_ 뷰 유형은 데이터베이스 관리자가 볼 수 있는 정보

를 나타냅니다. 다른 하나는 동의어입니다. 데이터 사전 테이블을 기반으로 먼저 데이터 사전 뷰가 생성된 후 해당 뷰에 대해 동일한 이름의 동의어가 생성됩니다

USER_TABLES에 해당하는 데이터베이스 객체를 쿼리합니다.
select * from dba_objects d where d.OBJECT_NAME='USER_TABLES';

USER_TABLES에 해당하는 뷰:

 select * from dba_views d where d.view_name='USER_TABLES';

Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)
USER_TABLES에 해당하는 뷰의 생성문 쿼리:

SQL> SET LONG 10000;SQL>  select d.text from dba_views d where d.view_name='USER_TABLES';TEXT--------------------------------------------------------------------------------select o.name,
       decode(bitand(t.property,2151678048), 0, ts.name,
              decode(t.ts#, 0, null, ts.name)),
       decode(bitand(t.property, 1024), 0, null, co.name),
       decode((bitand(t.property, 512)+bitand(t.flags, 536870912)),
              0, null, co.name),
       decode(bitand(t.trigflag, 1073741824), 1073741824, 'UNUSABLE', 'VALID'),
       decode(bitand(t.property, 32+64), 0, mod(t.pctfree$, 100), 64, 0, null),
       decode(bitand(ts.flags, 32), 32, to_number(NULL),
          decode(bitand(t.property, 32+64), 0, t.pctused$, 64, 0, null)),
       decode(bitand(t.property, 32), 0, t.initrans, null),
       decode(bitand(t.property, 32), 0, t.maxtrans, null),
       decode(bitand(t.property, 17179869184), 17179869184,
                     ds.initial_stg * ts.blocksize,
                     s.iniexts * ts.blocksize),
       decode(bitand(t.property, 17179869184), 17179869184,
              ds.next_stg * ts.blocksize,
              s.extsize * ts.blocksize),
       decode(bitand(t.property, 17179869184), 17179869184,
              ds.minext_stg, s.minexts),
       decode(bitand(t.property, 17179869184), 17179869184,
              ds.maxext_stg, s.maxexts),
       decode(bitand(ts.flags, 3), 1, to_number(NULL),
              decode(bitand(t.property, 17179869184), 17179869184,
                            ds.pctinc_stg, s.extpct)),
       decode(bitand(ts.flags, 32), 32, to_number(NULL),
         decode(bitand(o.flags, 2), 2, 1,
                decode(bitand(t.property, 17179869184), 17179869184,
                       ds.frlins_stg, decode(s.lists, 0, 1, s.lists)))),
       decode(bitand(ts.flags, 32), 32, to_number(NULL),
         decode(bitand(o.flags, 2), 2, 1,
                decode(bitand(t.property, 17179869184), 17179869184,
                       ds.maxins_stg, decode(s.groups, 0, 1, s.groups)))),
       decode(bitand(t.property, 32+64), 0,
                decode(bitand(t.flags, 32), 0, 'YES', 'NO'), null),
       decode(bitand(t.flags,1), 0, 'Y', 1, 'N', '?'),
       t.rowcnt,
       decode(bitand(t.property, 64), 0, t.blkcnt, null),
       decode(bitand(t.property, 64), 0, t.empcnt, null),
       decode(bitand(t.property, 64), 0, t.avgspc, null),
       t.chncnt, t.avgrln, t.avgspc_flb,
       decode(bitand(t.property, 64), 0, t.flbcnt, null),
       lpad(decode(t.degree, 32767, 'DEFAULT', nvl(t.degree,1)),10),
       lpad(decode(t.instances, 32767, 'DEFAULT', nvl(t.instances,1)),10),
       lpad(decode(bitand(t.flags, 8), 8, 'Y', 'N'),5),
       decode(bitand(t.flags, 6), 0, 'ENABLED', 'DISABLED'),
       t.samplesize, t.analyzetime,
       decode(bitand(t.property, 32), 32, 'YES', 'NO'),
       decode(bitand(t.property, 64), 64, 'IOT',
               decode(bitand(t.property, 512), 512, 'IOT_OVERFLOW',
               decode(bitand(t.flags, 536870912), 536870912, 'IOT_MAPPING', null))),
       decode(bitand(o.flags, 2), 0, 'N', 2, 'Y', 'N'),
       decode(bitand(o.flags, 16), 0, 'N', 16, 'Y', 'N'),
       decode(bitand(t.property, 8192), 8192, 'YES',
              decode(bitand(t.property, 1), 0, 'NO', 'YES')),
       decode(bitand(o.flags, 2), 2, 'DEFAULT',
              decode(bitand(decode(bitand(t.property, 17179869184), 17179869184,


                            ds.bfp_stg, s.cachehint), 3),
                            1, 'KEEP', 2, 'RECYCLE', 'DEFAULT')),
       decode(bitand(o.flags, 2), 2, 'DEFAULT',
              decode(bitand(decode(bitand(t.property, 17179869184), 17179869184,


                            ds.bfp_stg, s.cachehint), 12)/4,
                            1, 'KEEP', 2, 'NONE', 'DEFAULT')),
       decode(bitand(o.flags, 2), 2, 'DEFAULT',
              decode(bitand(decode(bitand(t.property, 17179869184), 17179869184,


                            ds.bfp_stg, s.cachehint), 48)/16,
                            1, 'KEEP', 2, 'NONE', 'DEFAULT')),
       decode(bitand(t.flags, 131072), 131072, 'ENABLED', 'DISABLED'),
       decode(bitand(t.flags, 512), 0, 'NO', 'YES'),
       decode(bitand(t.flags, 256), 0, 'NO', 'YES'),
       decode(bitand(o.flags, 2), 0, NULL,
           decode(bitand(t.property, 8388608), 8388608,
                  'SYS$SESSION', 'SYS$TRANSACTION')),
       decode(bitand(t.flags, 1024), 1024, 'ENABLED', 'DISABLED'),
       decode(bitand(o.flags, 2), 2, 'NO',
           decode(bitand(t.property, 2147483648), 2147483648, 'NO',
              decode(ksppcv.ksppstvl, 'TRUE', 'YES', 'NO'))),
       decode(bitand(t.property, 1024), 0, null, cu.name),
       decode(bitand(t.flags, 8388608), 8388608, 'ENABLED', 'DISABLED'),
       case when (bitand(t.property, 32) = 32) then
         null
       when (bitand(t.property, 17179869184) = 17179869184) then
         decode(bitand(ds.flags_stg, 4), 4, 'ENABLED', 'DISABLED')
       else
         decode(bitand(s.spare1, 2048), 2048, 'ENABLED', 'DISABLED')
       end,
       case when (bitand(t.property, 32) = 32) then
         null
       when (bitand(t.property, 17179869184) = 17179869184) then
          decode(bitand(ds.flags_stg, 4), 4,
          case when bitand(ds.cmpflag_stg, 3) = 1 then 'BASIC'
               when bitand(ds.cmpflag_stg, 3) = 2 then 'OLTP'
               else decode(ds.cmplvl_stg, 1, 'QUERY LOW',
                                          2, 'QUERY HIGH',
                                          3, 'ARCHIVE LOW',
                                             'ARCHIVE HIGH') end,
               null)
       else
         decode(bitand(s.spare1, 2048), 0, null,
         case when bitand(s.spare1, 16777216) = 16777216   -- 0x1000000
                   then 'OLTP'
              when bitand(s.spare1, 100663296) = 33554432  -- 0x2000000
                   then 'QUERY LOW'
              when bitand(s.spare1, 100663296) = 67108864  -- 0x4000000
                   then 'QUERY HIGH'
              when bitand(s.spare1, 100663296) = 100663296 -- 0x2000000+0x4000000
                   then 'ARCHIVE LOW'
              when bitand(s.spare1, 134217728) = 134217728 -- 0x8000000
                   then 'ARCHIVE HIGH'
              else 'BASIC' end)
       end,
       decode(bitand(o.flags, 128), 128, 'YES', 'NO'),
       decode(bitand(t.trigflag, 2097152), 2097152, 'YES', 'NO'),
       decode(bitand(t.property, 17179869184), 17179869184, 'NO',
              decode(bitand(t.property, 32), 32, 'N/A', 'YES')),
       decode(bitand(t.property,16492674416640),2199023255552,'FORCE',
                     4398046511104,'MANUAL','DEFAULT')from sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o,
     sys.deferred_stg$ ds, sys.obj$ cx, sys.user$ cu, x$ksppcv ksppcv,
     x$ksppi ksppiwhere o.owner# = userenv('SCHEMAID')
  and o.obj# = t.obj#
  and bitand(t.property, 1) = 0
  and bitand(o.flags, 128) = 0
  and t.bobj# = co.obj# (+)
  and t.ts# = ts.ts#
  and t.file# = s.file# (+)
  and t.block# = s.block# (+)
  and t.ts# = s.ts# (+)
  and t.obj# = ds.obj# (+)
  and t.dataobj# = cx.obj# (+)
  and cx.owner# = cu.user# (+)
  and ksppi.indx = ksppcv.indx  and ksppi.ksppinm = '_dml_monitoring_enabled'

동의어 쿼리: Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

select * from dba_synonyms d where d.synonym_name='USER_TABLES'

현재 로그인 쿼리 사용자 소유 테이블

Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

(2) ALL_ 유형 ( all_tables)
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

(3) dba_ type(dba_tables)

Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

2. 동적 성능 뷰

Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

2.1 개념

스토리지 데이터베이스의 각 데이터베이스 매 순간 변경되는 정보는 주로 데이터베이스의 활동 상태 정보입니다. 메모리에 저장된 정보와 컨트롤 파일에 저장된 정보를 뷰 형태로 표시

2.2 공통 동적 성능 뷰

v$parameter

초기화 매개변수 파일의 모든 항목 값

v$process
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)현재 프로세스에 대한 정보

v$session
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)세션에 대한 정보

v$sysstat
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)현재 작업 세션에 따른 시스템 통계

v$log

Extract 제어 파일의 리두 로그 그룹에 대한 정보

v$logfile
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)인스턴스 리두 로그 그룹 파일 이름 및 해당 위치에 대한 정보

v$lock
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)현재 프로세스가 잠금 정보를 획득했으며 요청되었습니다.

v$transaction
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)데이터베이스 거래정보

v$fixed_view_definition

모든 동적 성능 뷰의 정의 정보 기록
Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)

추천 튜토리얼: "Oracle Video Tutorial"

위 내용은 Oracle 데이터 사전, 데이터 사전 보기 및 동적 성능 보기(요약 공유)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 csdn.net에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제