姓名:杨宝秋,OCM,ACE。近8年的TB级数据库设计、建设、管理、运行维护、调优经验,也做了7年的Hp和IBM Rs6000的系统管理员,而且是获得了BCFP认证的SAN管理员,现为中国联通黑龙江分公司数据库主管。

Oracle's x$ Tables

上一篇 / 下一篇  2008-01-30 22:58:23 / 个人分类:Oracle

常用的Oracle x$ Tables,本文章源自:http://www.adp-gmbh.ch

x$bh

Information onbuffer headers.
Contains a record (the buffer header) for each block in thebuffer cache.
This select statement lists how many blocks are Available, Free and Being Used.
select count(*), State from (
    selectdecode(state, 
       0, 'Free',
       1, decode (lrba_seq,
          0, 'Available',
             'Being Used'),
       3, 'Being Used',
          state) State
     from x$bh )
    group by state
The meaning ofstate:
0FREEno valid block image
1XCURa current mode block, exclusive to this instance
2SCURa current mode block, shared with other instances
3CRa consistent read (stale) block image
4READbuffer is reserved for a block being read from disk
5MRECa block in media recovery mode
6IRECa block in instance (crash) recovery mode
The meaning oftch: tch is the touch count. A high touch count indicates that the buffer is used often. Therefore, it will probably be at the head of the MRU list. See alsotouch count.
The meaning oftim: touch time.
classrepresents a value designated for the use of the block.
lru_flag
set_dsmaps toaddronx$kcbwds.
le_addrcan be outer joined onx$le.le_addr.
flagis a bit array.
Bitif set
0Block is dirty
4temporary block
9 or 10ping
14stale
16direct
524288 (=0x80000)Block was read in afull table scanSeethis link

x$kcbwbpd

Buffer pool descriptor, the base table forv$buffer_pool.
How is the buffer cache split between thedefault, therecycleand thekeepbuffer pool.

x$kcbwds

Set descriptor, see alsox$kcbwbpd
The columnidcan be joined withv$buffer_pool.id.
The columnbbwaitcorresponds to thebuffer busy waitswait event.
Information onworking set buffers
addrcan be joined withx$bh.set_ds.
set_idwill be between lo_setid and hi_setid inv$buffer_poolfor the relevant buffer pool.

x$kccle

Controlfile logfile entry. Use
select max(lebsz) from x$kccle
to find out the size of alog block. The log block size is the unit for the following init params:log_checkpoint_interval,_log_io_size, andmax_dump_file_size.

x$kcccp

Checkpoint Progress:
The columncpodr_bnodisplays the current redo block number. Multiplied with the OS Block Size (usually 512), it returns the amount of bytes of redo currently written to the redo logs. Hence, this number is reset at eachlog switch.
k$kcccp can (together withx$kccle) be used to monitor the progress of the writing ofonline redo logs. The following query does this.
select
  le.leseq                        "Current log sequence No",
  100*cp.cpodr_bno/le.lesiz       "Percent Full",
  cp.cpodr_bno                    "Current Block No",
  le.lesiz                        "Size of Log in Blocks"
from
  x$kcccp cp,
  x$kccle le
where
  LE.leseq =CP.cpodr_seq
  and bitand(le.leflg,24)=8;
bitand(le.leflg,24)=8 makes sure we get the current log group
How much Redo is written by Oracleuses a variation of this SQL statement to track how much redo is written by different DML Statements.

x$kgllk

This table lists all held and requestedlibrary object locksfor all sessions. It is more complete thanv$lock.
The columnkglnaobjdisplays the first 80 characters of the name of the object.
select 
  kglnaobj, kgllkreq
from 
  x$kgllk x joinv$sessions on 
    s.saddr = x.kgllkses;
kgllkreq = 0 means, the lock is held, while kgllkreq > 0 means that the lock is requested.
1、KGLLKHDL:对应于v$session_wait的p1raw列,表明library cache lock的锁地址。也对应于x$kglob的kglhdadr这一列。
2、KGLLKSNM:对应于v$session的sid
3、KGLLKUSE:对应于v$session的saddr这一列,即session的地址。
4、KGLNAOBJ:包含了在librarky cache中的对象上执行命令的语句的前80个字符。
5、KGLLKMOD:代表的锁"占用"模式,0-> 'None', 1->'Null', 2-> 'Share', 3-> 'Exclusive',其它值->'Unknown'
6、KGLLKREP:代表"请求"模式,0-> 'None', 1->'Null', 2-> 'Share', 3-> 'Exclusive',其它值->'Unknown',另一个角度说明0->lock的占有者,其它->锁的请求者。

x$kqfco

This table has an entry for each column of thex$tablesand can be joined withx$kqfta.
The columnkqfcosizindicates the size (in bytes?) of the columns.
select
  t.kqftanam "Table Name",
  c.kqfconam "Column Name",
  c.kqfcosiz "Column Size"
from
  x$kqfta t,
  x$kqfco c
where
  t.indx = c.kqfcotab

x$kqfta

It seems that allx$table namescan be retrieved with the following query.
select kqftanam from x$kqfta;
This table can be joined withx$kqfcowhich contains the columns for the tables:
select
  t.kqftanam "Table Name",
  c.kqfconam "Column Name"
from
  x$kqfta t,
  x$kqfco c
where
  t.indx = c.kqfcotab

x$ksmlru

Memory least recently used
Whenever a select is performed on x$ksmlru, its content is reset!
This table show which memory allocations in theshared poolcaused the throw out of the biggest memory chunks since it was last queried.

x$ksmmem

This 'table' seems to allow to address (that is read (write????)) every byte in theSGA. Since the size of the SGA equals the size ofselect sum(value) from v$sga, the following query must return 0 (at least on a four byte architecture. Don't know about 8 bytes.)
select 
  (select sum(value)  fromv$sga) -
  (select 4*count(*) from x$ksmmem) "Must be Zero!"
from 
  dual;

x$ksppcv2

Contains the valuekspftctxvlfor each parameter found inx$ksppi. Determine if this value is the default value with the columnkspftctxdf.

x$ksppi

This table contains a record for all documented and undocumented (starting with an underscore) parameters. selectksppinmfrom x$ksppi to show the names of all parameters. Joinindx+1withx$ksppcv2.kspftctxpn.

x$ksqst

Enqueue management statistics by type.
ksqstwat: The number of wait for the enqueue statistics class.
ksqstwtim: Cumulated waiting time. This column is selected when
v$enqueue_stat.cum_wait_timeis selected.
The types of classes are:
BLBuffer Cache Management
CFControlfileTransaction
CICross-instance call invocation
CUBind Enqueue
DFDatafile
DLDirect Loader index creation
DMDatabase mount
DP???
DRDistributed Recovery
DXDistributed TX
FBacquired when formatting a range of bitmap blocks far ASSM segments. id1=ts#, id2=relative dba
FSFile Set
INInstance number
IRInstance Recovery
ISInstance State
IVLibrary cache invalidation
JDSomething to do withdbms_job
JQJob queue
KKRedo log kick
LA..LPLibrary cachelock
MDenqueue for Change data capture materialized view log (gotten internally for DDL on a snapshot log) id1=object# of the snapshot log.
MRMedia recovery
NA..NZLibrary cachepin
PFPassword file
PIParallel slaves
PRProcess startup
PSParallel slave synchronization
SCSystem commit number
SMSMON
SQSequencenumber enqueue
SRSynchronized replication
SSSort segment
STSpace management transaction
SVSequence number value
SWSuspend writes enqueue gotten when someone issuesalter system suspend|resume
TATransaction recovery
ULUser defined lock
UNUser name
USUndo segment, serialization
WLRedo log being written
XAInstance attribute lock
XIInstance registration lock
XRAcquired foralter system quiesce restricted

x$ksusd

Contains a record for allstatistics.

x$ktcxb

TheSGAtransaction table.

x$kttvs

Listssave undofor each tablespace: The column kttvstnm is the name of thetablespacethat has saved undo. The column is null otherwise.

x$ktuxe

Kernel transaction, undo transaction entry

x$kvis

Has (among others) a row containing the db block size:
select kvisval from x$kvis where kvistag = 'kcbbkl'

x$le

Lock element: contains an entry for each PCM lock held for the buffer cache. x$le can be left outer joined tox$bhon le_addr.

x$xssinfo

A perlscript. to find x$ tables

#!/usr/bin/perl -w

use strict;

open O, ("/appl/oracle/product/9.2.0.2/bin/oracle");
open F, (">x");

my $l;
my $p = ' ' x 40;
my %x;

while (read (O,$l,10000)) {
  $l = $p.$l;

  foreach ($l =~ /(x$w{3,})/g) {
   $x{$_}++;
  }

  $p = substr ($l,-40);
}

foreach (sort keys %x) {
  print F "$_n";
}

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

我的栏目

日历

« 2008-10-12  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 7614
  • 日志数: 64
  • 图片数: 1
  • 建立时间: 2008-01-30
  • 更新时间: 2008-07-29

RSS订阅

Open Toolbar