Wednesday, December 3, 2008

DBA_WAITERS


DBA_WAITERS shows all the sessions that are waiting for a lock.
Column
Datatype
NULL
Description
WAITING_SESSION
NUMBER
The waiting session
HOLDING_SESSION
NUMBER
The holding session
LOCK_TYPE
VARCHAR2(26)
The lock type
MODE_HELD
VARCHAR2(40)
The mode held
MODE_REQUESTED
VARCHAR2(40)
The mode requested
LOCK_ID1
VARCHAR2(40)
Lock ID 1
LOCK_ID2
VARCHAR2(40)
Lock ID 2
Note:
1. $ORACLE_HOME/rdbms/admin/catblock.sql The script creates these views, dba_locks and dba_blockers, along with the following views:
dba_kgllock
dba_lock (dba_locks is synonym for this)
dba_lock_internal
dba_dml_locks
dba_ddl_locks
dba_waiters
2. A number of Oracle views permits to detect locking problems.
V$SESSION_WAIT When a session is waiting on a resource, it can be found waiting on the enqueue wait event, e.g. SELECT * FROM V$SESSION_WAIT WHERE EVENT = 'enqueue';
- SID identifier of session holding the lock
- P1, P2, P3 determine the resource when event = 'enqueue'
- SECONDS_IN_WAIT gives how long the wait did occurs
V$SESSION session information and row locking information
- SID, SERIAL# identifier of the session
- LOCKWAIT address of the lock waiting, otherwise null
- ROW_WAIT_OBJ# object identified of the object we are waiting on (object_id of dba_objects)
- ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW# file_id , block_id and row location within block of the locked row
V$LOCK list of all the locks in the system
- SID identifier of session holding the lock
- TYPE, ID1 and ID2 determine the resource
- LMODE and REQUEST indicate which queue the session is waiting on, as follows:
LMODE > 0, REQUEST = 0 owner
LMODE = 0, REQUEST > 0 acquirer
LMODE > 0, REQUEST > 0 converter
- CTIME time since current mode was converted (see Note 223146.1)
- BLOCK are we blocking another lock
BLOCK = 0 non blocking
BLOCK = 1 blocking others
DBA_LOCK or DBA_LOCKS formatted view on V$LOCK (created via $ORACLE_HOME/rdbms/admin/catblock.sql)
- SESSION_ID == SID in V$LOCK
- LOCK_TYPE, LOCK_ID1, LOCK_ID2 formatted value of TYPE, ID1, ID2 from V$LOCK
- MODE_HELD and MODE_REQUESTED formatted value of LMODE and REQUEST from V$LOCK
- LAST_CONVERT == CTIME of V$LOCK
- BLOCKING_OTHERS formatted value of BLOCK from V$LOCK
V$TRANSACTION_ENQUEUE subset of V$LOCK for the blocking TX resources only (same description as for the V$LOCK view)
V$ENQUEUE_LOCK subset of V$LOCK for the system resources only and blocked TX resources only. (same description as for the V$LOCK view)
DBA_DML_LOCKS subset of the V$LOCK for the DML (TM) locks only (created via $ORACLE_HOME/rdbms/admin/catblock.sql
- same description as the DBA_LOCK view)
V$LOCKED_OBJECT same info as DBA_DML_LOCKS, but linked with the rollback and session information
- XIDUSN, XIDSLOT and XIDSQN rollback information to be linked with V$TRANSACTION
- OBJECT_ID object being locked
- SESSION_ID session id
- ORACLE_USERNAME oracle user name
- OS_USER_NAME OS user name
- PROCESS OS process id
- LOCKED_MODE lock mode
V$RESOURCE list of all the currently locked resources in the system. Each row can be associated with one or more rows in V$LOCK
- TYPE, ID1 and ID2 determine the resource
DBA_DDL_LOCKS has a row for each DDL lock that is being held, and one row for each outstanding request for a DDL lock. It is subset of DBA_LOCKS same description as the DBA_LOCK view
DBA_WAITERS view that retrieve information for each session waiting on a lock (created via $ORACLE_HOME/rdbms/admin/catblock.sql)
- WAITING_SESSION waiting session
- HOLDING_SESSION holding session
- LOCK_TYPE, LOCK_ID1, LOCK_ID2 resource locked
- MODE_HELD lock type held
- MODE_REQUESTED lock type requested
DBA_BLOCKERS view that gives the blocking sessions (created via $ORACLE_HOME/rdbms/admin/catblock.sql)
-HOLDING_SESSION holding session

Oracle data dictionary views


More Oracle DBA tips, please visit Oracle DBA Tips  

DBA_VARRAYS

DBA_VARRAYS describes all varrays in the database. Its columns are the same as those in ALL_VARRAYS.

Related Views

· ALL_VARRAYS describes the varrays accessible to the current user.

· USER_VARRAYS describes the varrays owned by the current user. This view does not display the OWNER column.

Column

Datatype

NULL

Description

OWNER

VARCHAR2(30)

Owner of the table containing the varray

PARENT_TABLE_NAME

VARCHAR2(30)

Name of the containing table

PARENT_TABLE_COLUMN

VARCHAR2(4000)

Name of the varray column or attribute

TYPE_OWNER

VARCHAR2(30)

Owner of the varray type

TYPE_NAME

VARCHAR2(30)

Name of the varray type

LOB_NAME

VARCHAR2(30)

Name of the LOB if the varray is stored in a LOB

STORAGE_SPEC

VARCHAR2(30)

Indicates whether the storage was defaulted (DEFAULT) or user-specified (USER_SPECIFIED)

RETURN_TYPE

VARCHAR2(20)

Return type of the column:

· LOCATOR

· VALUE

ELEMENT_SUBSTITUTABLE

VARCHAR2(25)

Indicates whether the varray element is substitutable (Y) or not (N)

Note:

1.

select * from dba_varrays where owner = 'SDE';

OWNER

PARENT_TABLE_NAME

PARENT_

TABLE_

COLUMN

TYPE_

OWNER

TYPE_NAME

LOB_NAME

STORAGE_

SPEC

RETURN_

TYPE

ELEMENT_

SUBSTITUTABLE

SDE

USER_ST_GEOM_INDEX_V

ST_FUNCS

SDE

ST_FUNCS_ARRAY

DEFAULT

VALUE

N

SDE

ST_GEOMETRY_INDEX

ST_FUNCS

SDE

ST_FUNCS_ARRAY

SYS_LOB0000048808C00025$$

DEFAULT

VALUE

N

2. Oracle Metalink has a note (69661.1) on how to determine type or table dependents of an object type.

The following 3 queries can be run to determine dependencies:
-------------------------------------------------------------
 
-- Find nested tables
select owner, parent_table_name, parent_table_column
from dba_nested_tables
where (table_type_owner, table_type_name) in
 (select owner, type_name
  from dba_coll_types
  where elem_type_owner = ''
  and elem_type_name = '');
 
-- Find VARRAYs
select owner, parent_table_name, parent_table_column
from dba_varrays
where (type_owner, type_name) in
 (select owner, type_name
  from dba_coll_types
  where elem_type_owner = ''
  and elem_type_name = '
 
 
-- Find object tables
select owner, table_name
from dba_object_tables
where table_type_owner = ''
 and table_type = ''
 and nested = 'NO';

Oracle data dictionary views

Oracle dynamic performance views

DBA_USTATS

DBA_USTATS describes the user-defined statistics collected on all tables and indexes in the database. Its columns are the same as those in ALL_USTATS.

Related Views

· ALL_USTATS describes the user-defined statistics collected on the tables and indexes accessible to the current user.

· USER_USTATS describes the user-defined statistics collected on the tables and indexes owned by the current user.

Column

Datatype

NULL

Description

OBJECT_OWNER

VARCHAR2(30)

Owner of the table or index for which the statistics have been collected

OBJECT_NAME

VARCHAR2(30)

Name of the table or index for which the statistics have been collected

PARTITION_NAME

VARCHAR2(30)

Partition name of a table; NULL if the table is either non-partitioned or the entry corresponds to the aggregate statistics for the table

OBJECT_TYPE

VARCHAR2(6)

Type of the object for which statistics have been collected:

· INDEX

· COLUMN

ASSOCIATION

VARCHAR2(8)

Statistics type association:

· DIRECT Direct association with the object for which the statistics have been collected

· IMPLICIT - Association for which the statistics have been collected is with the column type or index type, and the object is an instance of that column type or index type

COLUMN_NAME

VARCHAR2(30)

Column name, if OBJECT_TYPE is COLUMN, for which statistics have been collected

STATSTYPE_SCHEMA

VARCHAR2(30)

Schema of the statistics type which was used to collect the statistics

STATSTYPE_NAME

VARCHAR2(30)

Name of the statistics type which was used to collect statistics

STATISTICS

RAW(2000)

User-collected statistics for the object

Note:

1.

select * from DBA_USTATS;

OBJECT_

OWNER

OBJECT_NAME

PARTITION_

NAME

OBJECT_

TYPE

ASSOCIATION

COLUMN_

NAME

STATSTYPE_

SCHEMA

STATSTYPE_

NAME

STATISTICS

USERA

LAKE_POLY_ST

COLUMN

IMPLICIT

SHAPE

SDE

ST_DOMAIN_STATS

53484150453A30

USERA

A808_IX1

INDEX

IMPLICIT

SDE

ST_DOMAIN_STATS

413830388313A3

Oracle data dictionary views

Oracle dynamic performance views

DBA_OBJECT_SIZE

DBA_OBJECT_SIZE lists the sizes, in bytes, of various PL/SQL objects.

Related View

· USER_OBJECT_SIZE lists the size of PL/SQL objects owned by the current user.

Column

Datatype

NULL

Description

OWNER

VARCHAR2(30)

NOT NULL

Owner of the object

NAME

VARCHAR2(30)

NOT NULL

Name of the object

TYPE

VARCHAR2(12)

Type of the object: TYPE, TYPE BODY, TABLE, VIEW, SYNONYM, SEQUENCE, PROCEDURE, FUNCTION, PACKAGE, PACKAGE BODY, JAVA SOURCE, JAVA CLASS or JAVA RESOURCE

SOURCE_SIZE

NUMBER

Size of the source in bytes. Must be in memory during compilation, or dynamic recompilation.

PARSED_SIZE

NUMBER

Size of the parsed form of the object, in bytes. Must be in memory when an object is being compiled that references this object.

CODE_SIZE

NUMBER

Code size, in bytes. Must be in memory when this object is executing.

ERROR_SIZE

NUMBER

Size of error messages, in bytes. In memory during the compilation of the object when there are compilation errors.

Note:

1. Oracle Metalink (Note 1020288.6) provides a script to report size of stored objects (PL/SQL packages, functions, procedures, Java objects, sequences, types and triggers).

column num_instances heading "Num" format 99999 
column type heading "Object Type" format a12 
column source_size heading "Source" format 99,999,999 
column parsed_size heading "Parsed" format 99,999,999 
column code_size heading "Code" format 99,999,999 
column error_size heading "Errors" format 999,999 
column size_required heading "Total" format 999,999,999 
compute sum of size_required on report 
 
select count(name) num_instances 
      ,type 
      ,sum(source_size) source_size 
      ,sum(parsed_size) parsed_size 
      ,sum(code_size) code_size 
      ,sum(error_size) error_size 
      ,sum(source_size) 
      +sum(parsed_size) 
      +sum(code_size)  
      +sum(error_size) size_required 
from dba_object_size 
group by type 
order by 2
/

NUM_INSTANCES

TYPE

SOURCE_SIZE

PARSED_SIZE

CODE_SIZE

ERROR_SIZE

SIZE_REQUIRED

362

FUNCTION

252230

195189

459916

0

907335

16447

JAVA CLASS

0

0

81741773

935

81742708

298

JAVA DATA

0

0

8671612

0

8671612

792

JAVA RESOURCE

0

0

10784295

0

10784295

8

JAVA SOURCE

0

0

33522

0

33522

879

PACKAGE

5479198

5459040

2814865

0

13753103

803

PACKAGE BODY

16519276

0

19127102

4239

35650617

144

PROCEDURE

301150

127219

391309

0

819678

763

SEQUENCE

0

365802

0

0

365802

818

SYNONYM

0

147102

0

0

147102

90

TABLE

0

115466

0

0

115466

2483

TRIGGER

2212113

0

2648689

1353

4862155

1617

TYPE

843995

1267411

612502

0

2723908

149

TYPE BODY

243634

8393

881753

0

1133780

16

VIEW

0

1595

0

929

2524

Oracle data dictionary views

Oracle dynamic performance views