姓名:杨宝秋,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 stateThe meaning ofstate:
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.
| 0 | FREE | no valid block image |
| 1 | XCUR | a current mode block, exclusive to this instance |
| 2 | SCUR | a current mode block, shared with other instances |
| 3 | CR | a consistent read (stale) block image |
| 4 | READ | buffer is reserved for a block being read from disk |
| 5 | MREC | a block in media recovery mode |
| 6 | IREC | a block in instance (crash) recovery mode |
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.
| Bit | if set | |
| 0 | Block is dirty | |
| 4 | temporary block | |
| 9 or 10 | ping | |
| 14 | stale | |
| 16 | direct | |
| 524288 (=0x80000) | Block was read in afull table scan | Seethis link |
x$kcbwbpd
Buffer pool descriptor, the base table forv$buffer_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 column
kglnaobjdisplays 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的占有者,其它->锁的请求者。
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 whenv$enqueue_stat.cum_wait_timeis selected.
ksqstwtim: Cumulated waiting time. This column is selected whenv$enqueue_stat.cum_wait_timeis selected.
The types of classes are:
| BL | Buffer Cache Management |
| CF | ControlfileTransaction |
| CI | Cross-instance call invocation |
| CU | Bind Enqueue |
| DF | Datafile |
| DL | Direct Loader index creation |
| DM | Database mount |
| DP | ??? |
| DR | Distributed Recovery |
| DX | Distributed TX |
| FB | acquired when formatting a range of bitmap blocks far ASSM segments. id1=ts#, id2=relative dba |
| FS | File Set |
| IN | Instance number |
| IR | Instance Recovery |
| IS | Instance State |
| IV | Library cache invalidation |
| JD | Something to do withdbms_job |
| JQ | Job queue |
| KK | Redo log kick |
| LA..LP | Library cachelock |
| MD | enqueue for Change data capture materialized view log (gotten internally for DDL on a snapshot log) id1=object# of the snapshot log. |
| MR | Media recovery |
| NA..NZ | Library cachepin |
| PF | Password file |
| PI | Parallel slaves |
| PR | Process startup |
| PS | Parallel slave synchronization |
| SC | System commit number |
| SM | SMON |
| SQ | Sequencenumber enqueue |
| SR | Synchronized replication |
| SS | Sort segment |
| ST | Space management transaction |
| SV | Sequence number value |
| SW | Suspend writes enqueue gotten when someone issuesalter system suspend|resume |
| TA | Transaction recovery |
| UL | User defined lock |
| UN | User name |
| US | Undo segment, serialization |
| WL | Redo log being written |
| XA | Instance attribute lock |
| XI | Instance registration lock |
| XR | Acquired 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:

