常用的Oracle x$ Tables

x$bh

Information on buffer headers.
Contains a record (the buffer header) for each block in the buffer cache.
This select statement lists how many blocks are Available, Free and Being Used.
<span style="color:#444444">select count(*), State from (
    select <a data-cke-saved-href="http://www.adp-gmbh.ch/ora/sql/decode.html" href="http://www.adp-gmbh.ch/ora/sql/decode.html">decode</a> (state, 
       0, 'Free',
       1, decode (lrba_seq,
          0, 'Available',
             'Being Used'),
       3, 'Being Used',
          state) State
     from x$bh )
    group by state
</span>
The meaning of state:
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 of tch: 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 also touch count.
The meaning of tim: touch time.
class represents a value designated for the use of the block.
lru_flag
set_ds maps to addr on x$kcbwds.
le_addr can be outer joined on x$le.le_addr.
flag is a bit array.
Bitif set 
0Block is dirty 
4temporary block 
9 or 10ping 
14stale 
16direct 
524288 (=0x80000)Block was read in a full table scanSee this link
 

x$kcbwbpd

Buffer pool descriptor, the base table for v$buffer_pool.
How is the buffer cache split between the default, the recycle and the keep buffer pool.

x$kcbwds

Set descriptor, see also x$kcbwbpd
The column id can be joined with v$buffer_pool.id.
The column bbwait corresponds to the buffer busy waits wait event.
Information on working set buffers
addr can be joined with x$bh.set_ds.
set_id will be between lo_setid and hi_setid in v$buffer_pool for the relevant buffer pool.

x$kccle

Controlfile logfile entry. Use
<span style="color:#444444">select max(lebsz) from x$kccle
</span>
to find out the size of a log block. The log block size is the unit for the following init params: log_checkpoint_interval_log_io_size, and max_dump_file_size.

x$kcccp

Checkpoint Progress:
The column cpodr_bno displays 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 each log switch.
k$kcccp can (together with x$kccle) be used to monitor the progress of the writing of online redo logs. The following query does this.
<span style="color:#444444">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;
</span>
bitand(le.leflg,24)=8 makes sure we get the current log group
How much Redo is written by Oracle uses 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 requested library object locks for all sessions. It is more complete than v$lock.
The column kglnaobj displays the first 80 characters of the name of the object.
<span style="color:#444444">select 
  kglnaobj, kgllkreq
from 
  x$kgllk x join <a data-cke-saved-href="http://qiuyb.itpub.net/dynamic_performance_views.html#session" href="http://qiuyb.itpub.net/dynamic_performance_views.html#session">v$session</a> s on 
    s.saddr = x.kgllkses;
</span>
kgllkreq = 0 means, the lock is held, while kgllkreq > 0 means that the lock is requested.

x$kqfco

This table has an entry for each column of the x$tables and can be joined with x$kqfta.
The column kqfcosiz indicates the size (in bytes?) of the columns.
<span style="color:#444444">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
</span>

x$kqfta

It seems that all x$table names can be retrieved with the following query.
<span style="color:#444444">select kqftanam from x$kqfta;
</span>
This table can be joined with x$kqfco which contains the columns for the tables:
<span style="color:#444444">select
  t.kqftanam "Table Name",
  c.kqfconam "Column Name"
from
  x$kqfta t,
  x$kqfco c
where
  t.indx = c.kqfcotab
</span>

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 the shared pool caused 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 the SGA. Since the size of the SGA equals the size of select sum(value) from v$sga, the following query must return 0 (at least on a four byte architecture. Don't know about 8 bytes.)
<span style="color:#444444">select 
  (select sum(value)  from <a data-cke-saved-href="http://www.adp-gmbh.ch/ora/misc/dynamic_performance_views.html#sga" href="http://www.adp-gmbh.ch/ora/misc/dynamic_performance_views.html#sga">v$sga</a>  ) -
  (select 4*count(*) from x$ksmmem) "Must be Zero!"
from 
  dual;
</span>

x$ksppcv2

Contains the value kspftctxvl for each parameter found in x$ksppi. Determine if this value is the default value with the column kspftctxdf.

x$ksppi

This table contains a record for all documented and undocumented (starting with an underscore) parameters. select ksppinm from x$ksppi to show the names of all parameters. Join indx+1 with x$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_time is selected.
The types of classes are:

BLBuffer Cache Management
CFControlfile Transaction
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 with dbms_job
JQJob queue
KKRedo log kick
LA..LPLibrary cache lock
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 cache pin
PFPassword file
PIParallel slaves
PRProcess startup
PSParallel slave synchronization
SCSystem commit number
SMSMON
SQSequence number enqueue
SRSynchronized replication
SSSort segment
STSpace management transaction
SVSequence number value
SWSuspend writes enqueue gotten when someone issues alter system suspend|resume
TATransaction recovery
ULUser defined lock
UNUser name
USUndo segment, serialization
WLRedo log being written
XAInstance attribute lock
XIInstance registration lock
XRAcquired for alter system quiesce restricted

x$ksusd

Contains a record for all statistics.

x$ktcxb

The SGA transaction table.

x$kttvs

Lists save undo for each tablespace: The column kttvstnm is the name of the tablespace that 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:
<span style="color:#444444"> select kvisval from x$kvis where kvistag = 'kcbbkl'
</span>

x$le

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

x$xssinfo

A perlscript to find x$ tables

<span style="color:#444444">#!/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";
}</span>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值