Tuesday, December 9, 2008

DBA_TAB_STATISTICS

Thank you for visiting Spatial DBA - Oracle and ArcSDE.

Please visit Oracle DBA Tips (http://www.oracledbatips.com) for more Oracle DBA Tips.
==================================================================




DBA_TAB_STATISTICS displays optimizer statistics for all tables in the database. Its columns are the same as those in ALL_TAB_STATISTICS.

Related Views
· ALL_TAB_STATISTICS displays optimizer statistics for the tables accessible to the current user.
· USER_TAB_STATISTICS displays optimizer statistics for the tables owned by the current user. This view does not display the OWNER column.
Column
Datatype
NULL
Description
OWNER
VARCHAR2(30)
Owner of the object
TABLE_NAME
VARCHAR2(30)
Name of the table
PARTITION_NAME
VARCHAR2(30)
Name of the partition
PARTITION_POSITION
NUMBER
Position of the partition within the table
SUBPARTITION_NAME
VARCHAR2(30)
Name of the subpartition
SUBPARTITION_POSITION
NUMBER
Position of the subpartition within the partition
OBJECT_TYPE
VARCHAR2(12)
Type of the object:
· TABLE
· PARTITION
· SUBPARTITION
NUM_ROWS
NUMBER
Number of rows in the object
BLOCKS
NUMBER
Number of used blocks in the object
EMPTY_BLOCKS
NUMBER
Number of empty blocks in the object
AVG_SPACE
NUMBER
Average available free space in the object
CHAIN_CNT
NUMBER
Number of chained rows in the object
AVG_ROW_LEN
NUMBER
Average row length, including row overhead
AVG_SPACE_FREELIST_BLOCKS
NUMBER
Average freespace of all blocks on a freelist
NUM_FREELIST_BLOCKS
NUMBER
Number of blocks on the freelist
AVG_CACHED_BLOCKS
NUMBER
Average number of blocks in the buffer cache
AVG_CACHE_HIT_RATIO
NUMBER
Average cache hit ratio for the object
SAMPLE_SIZE
NUMBER
Sample size used in analyzing the table
LAST_ANALYZED
DATE
Date of the most recent time the table was analyzed
GLOBAL_STATS
VARCHAR2(3)
Indicates whether statistics were calculated without merging underlying partitions (YES) or not (NO)
USER_STATS
VARCHAR2(3)
Indicates whether statistics were entered directly by the user (YES) or not (NO)
STATTYPE_LOCKED
VARCHAR2(5)
Type of statistics lock:
· DATA
· CACHE
· ALL
STALE_STATS
VARCHAR2(3)
Indicates whether statistics for the object are stale (YES) or not (NO)
1.
select owner, table_name, object_type, num_rows, blocks,
empty_blocks, avg_space, avg_row_len, sample_size,
last_analyzed, stale_stats global_stats
from DBA_TAB_STATISTICS;
OWNER
TABLE_NAME
OBJECT_
TYPE
NUM_
ROWS
BLOCKS
EMPTY_
BLOCKS
AVG_
SPACE
AVG_
ROW_
LEN
SAMPLE_
SIZE
LAST_
ANALYZED
GLOBAL_
STATS
SDE
COLUMN_REGISTRY
TABLE
16431
93
0
0
73
16431
2008-11-05 10:56:34 PM
NO
SDE
DBTUNE
TABLE
1158
11
0
8285
67
1158
2008-02-26 10:03:14 PM
NO
SDE
GEOMETRY_COLUMNS
TABLE
928
9
0
0
92
928
2008-09-22 11:28:47 PM
NO
SDE
LAYERS
TABLE
960
13
0
0
156
960
2008-12-08 11:06:59 PM
NO
SDE
LINEAGES_MODIFIED
TABLE
2
7
0
0
12
2
2008-12-08 10:02:02 PM
NO
SDE
LOCATORS
TABLE
27
1
0
0
64
27
2006-09-23 7:16:23 AM
NO
SDE
METADATA
TABLE
6518
43
0
0
89
6518
2006-09-23 7:16:24 AM
NO
SDE
OBJECT_LOCKS
TABLE
0
7
0
0
0
0
2008-12-08 11:10:54 PM
NO
SDE
PROCESS_INFORMATION
TABLE
467
21
0
0
72
467
2008-12-08 10:03:41 PM
NO
SDE
SDE_TABLES_MODIFIED
TABLE
5
1
0
0
20
5
2008-12-08 10:02:40 PM
NO
SDE
SERVER_CONFIG
TABLE
40
7
0
0
18
40
2008-11-13 10:02:46 PM
NO
SDE
SPASTATS
TABLE
6075
373
0
0
873
6075
2008-07-07 10:05:48 PM
NO
SDE
SPASTATS_SESS
TABLE
3
1
0
0
13
3
2008-12-08 10:02:13 PM
NO
SDE
SPATIAL_REFERENCES
TABLE
31
7
0
0
185
31
2008-11-12 10:59:57 PM
NO
SDE
STATES
TABLE
29
7
504
15724
52
29
2008-12-08 11:07:28 PM
NO
SDE
TABLE_REGISTRY
TABLE
1052
11
0
0
109
1052
2008-11-24 11:02:22 PM
NO
SDE
VERSION
TABLE
1
1
0
0
113
1
2006-09-23 7:20:38 AM
NO
SDE
VERSIONS
TABLE
12
7
0
0
64
12
2008-12-08 10:02:03 PM
NO

Oracle data dictionary views

DBA_TABLESPACE_USAGE_METRICS

Thank you for visiting Spatial DBA - Oracle and ArcSDE.

Please visit Oracle DBA Tips (http://www.oracledbatips.com) for more Oracle DBA Tips.

=================================================================


DBA_TABLESPACE_USAGE_METRICS describes tablespace usage metrics for all types of tablespaces, including permanent, temporary, and undo tablespaces.

Column
Datatype
NULL
Description
TABLESPACE_NAME
VARCHAR2(30)
Tablespace name
USED_SPACE
NUMBER
Total space consumed by the tablespace
TABLESPACE_SIZE
NUMBER
Total size of the tablespace
USED_PERCENT
NUMBER
Percentage of used space, as a function of the maximum possible tablespace size
Note:
1. select * from DBA_TABLESPACE_USAGE_METRICS;
TABLESPACE_NAME
USED_SPACE
TABLESPACE_SIZE
USED_PERCENT
SDE
6204
16000
38.775
SYSAUX
303764
387072
78.4773892195767
SYSTEM
112016
256000
43.75625
TEMP
2048
2560000
0.08
UNDO
3093472
3584000
86.3133928571429
USERS
1231232
2609152
47.1889717425432

Oracle data dictionary views

Thursday, December 4, 2008

V$BH

V$BH displays the status and number of pings for every buffer in the SGA. This is a Real Application Clusters view.

Column

Datatype

Description

FILE#

NUMBER

Datafile identifier number (to find the filename, query DBA_DATA_FILES or V$DBFILE)

BLOCK#

NUMBER

Block number

CLASS#

NUMBER

Class number

STATUS

VARCHAR2(6)

Status of the buffer:

· free - Not currently in use

· xcur - Exclusive

· scur - Shared current

· cr - Consistent read

· read - Being read from disk

· mrec - In media recovery mode

· irec - In instance recovery mode

XNC

NUMBER

Number of PCM x to null lock conversions due to contention with another instance. This column is obsolete and maintained for backward compatibility.

LOCK_ELEMENT_ADDR

RAW(4 | 8)

Address of the lock element that contains the PCM lock that is covering the buffer. If more than one buffer has the same address, then these buffers are covered by the same PCM lock.

LOCK_ELEMENT_NAME

NUMBER

The address of the lock element that contains the PCM lock that is covering the buffer. If more than one buffer has the same address, then these buffers are covered by the same PCM lock.

LOCK_ELEMENT_CLASS

NUMBER

The address of the lock element that contains the PCM lock that is covering the buffer. If more than one buffer has the same address, then these buffers are covered by the same PCM lock.

FORCED_READS

NUMBER

Number of times the block had to be reread from the cache because another instance has forced it out of this instance's cache by requesting the lock on the block in exclusive mode

FORCED_WRITES

NUMBER

Number of times GCS had to write this block to cache because this instance had used the block and another instance had requested the lock on the block in a conflicting mode

DIRTY

VARCHAR2(1)

Y - block modified

TEMP

VARCHAR2(1)

Y - temporary block

PING

VARCHAR2(1)

Y - block pinged

STALE

VARCHAR2(1)

Y - block is stale

DIRECT

VARCHAR2(1)

Y - direct block

NEW

VARCHAR2(1)

Always set to N. This column is obsolete and maintained for backward compatibility.

OBJD

NUMBER

Database object number of the block that the buffer represents

TS#

NUMBER

Tablespace number of block

Note:

1. select * from V$BH WHERE FILE#=16;

FILE#

BLOCK#

CLASS#

STATUS

XNC

FORCED_

READS

FORCED_

WRITES

LOCK_

ELEMENT_

ADDR

DIRTY

TEMP

PING

STALE

DIRECT

NEW

OBJD

TS#

16

3

12

xcur

0

0

0

00

N

N

N

N

N

N

4294967295

16

16

2

13

xcur

0

0

0

00

N

N

N

N

N

N

4294967295

16

2. V$BH shows the contents of the data buffers as well as the number of blocks for each type of segment in the buffer. It is especially useful for showing the amount of table and index caching in databases with multiple data buffer pools. The following script taken from Inside the Oracle data buffer cache analyzes the contents of data buffers.

set pages 999
set lines 92
 
ttitle 'Contents of Data Buffers'
 
drop table t1;
 
create table t1 as
select
   o.owner          owner,
   o.object_name    object_name,
   o.subobject_name subobject_name,
   o.object_type    object_type,
   count(distinct file# || block#)         num_blocks
from
   dba_objects  o,
   v$bh         bh
where
   o.data_object_id  = bh.objd
and
   o.owner not in ('SYS','SYSTEM')
and
   bh.status != 'free'
group by
   o.owner,
   o.object_name,
   o.subobject_name,
   o.object_type
order by
   count(distinct file# || block#) desc
;
 
column c0 heading "Owner"                                    format a12
column c1 heading "Object|Name"                              format a30
column c2 heading "Object|Type"                              format a8
column c3 heading "Number of|Blocks in|Buffer|Cache"         format 99,999,999
column c4 heading "Percentage|of object|blocks in|Buffer"    format 999
column c5 heading "Buffer|Pool"                              format a7
column c6 heading "Block|Size"                               format 99,999
 
select
   t1.owner                                          c0,
   object_name                                       c1,
   case when object_type = 'TABLE PARTITION' then 'TAB PART'
        when object_type = 'INDEX PARTITION' then 'IDX PART'
        else object_type end c2,
   sum(num_blocks)                                     c3,
   (sum(num_blocks)/greatest(sum(blocks), .001))*100 c4,
   buffer_pool                                       c5,
   sum(bytes)/sum(blocks)                            c6
from
   t1,
   dba_segments s
where
   s.segment_name = t1.object_name
and
   s.owner = t1.owner
and
   s.segment_type = t1.object_type
and
   nvl(s.partition_name,'-') = nvl(t1.subobject_name,'-')
group by
   t1.owner,
   object_name,
   object_type,
   buffer_pool
having
   sum(num_blocks) > 10
order by
   sum(num_blocks) desc
;

Oracle data dictionary views

Oracle dynamic performance views