Академический Документы
Профессиональный Документы
Культура Документы
Diagnostics
Julian Dyke
Independent Consultant
Web Version
max_dump_file_size = <size>
_trace_files_public = TRUE
tracefile_identifier = '<identifier>'
ALTER SESSION
SET tracefile_identifier = 'test';
ss92001_<process_name>_1234.trc
# In init.ora file
event = '<event> trace name context forever, level <level>';
Alternatively use
ORADEBUG
DBMS_SYSTEM.SETEV
SET SERVEROUTPUT ON
DECLARE
err_msg VARCHAR2(120);
BEGIN
DBMS_OUTPUT.ENABLE (1000000);
FOR err_num IN 10000..10999
LOOP
err_msg := SQLERRM (-err_num);
IF err_msg NOT LIKE '%Message '||err_num||' not found%' THEN
DBMS_OUTPUT.PUT_LINE (err_msg);
END IF;
END LOOP;
END;
/
$ORACLE_HOME/rdbms/mesg/oraus.msg
event=10000
while [ $event -ne 10999 ]
do
event=`expr $event + 1`
oerr ora $event
done
SET SERVEROUTPUT ON
DECLARE
l_level NUMBER;
BEGIN
FOR l_event IN 10000..10999
LOOP
dbms_system.read_ev (l_event,l_level);
IF (l_level > 0) THEN
dbms_output.put_line ('Event '||TO_CHAR (l_event) ||
' is set at level '||TO_CHAR (l_level));
END IF;
END LOOP;
END;
/
Level Description
0 Disabled
1 Same as ALTER SESSION SET sql_trace = TRUE
4 Include bind information
8 Include event wait statistics
12 Include bind information and event wait statistics
Level Description
1 Print statistics and computations
2 Print computations only
See "A Look under the Hood of CBO : The 10053 Event"
Wolfgang Breitling - www.centrexcc.com
14
10241 Remote SQL Execution 10
© 2005 Julian Dyke
Events
Tracing Space Management
10045 Free List Management
10081 High Water Mark Changes
10225 Extent Management (Dictionary Managed)
DBMS_SESSION.SET_SQL_TRACE
(
FLAG BOOLEAN -- TRUE to enable;
-- FALSE to disable
);
$ORACLE_HOME/rdbms/admin/dbmsutil.sql
DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION
(
SI NUMBER, -- SID
SE NUMBER, -- Serial Number
SQL_TRACE BOOLEAN -- TRUE to enable;
-- FALSE to disable
);
DBMS_SYSTEM.SET_BOOL_PARAM_IN_SESSION
(
ORADEBUG
SID SUSPEND
NUMBER, -- SID
SERIAL# NUMBER, -- Serial Number
PARNAM VARCHAR2, -- Parameter Name
SET_BOOL_PARAM_IN_SESSION
BVAL BOOLEAN -- Value
);
For example
EXECUTE DBMS_SYSTEM.SET_BOOL_PARAM_IN_SESSION
(9, 27, 'hash_join_enabled', TRUE);
DBMS_SYSTEM.SET_INT_PARAM_IN_SESSION
(
ORADEBUG
SID SUSPEND
NUMBER, -- SID
SERIAL# NUMBER, -- Serial Number
PARNAM VARCHAR2, -- Parameter Name
SET_BOOL_PARAM_IN_SESSION
INTVAL INTEGER -- Value
);
For example
EXECUTE DBMS_SYSTEM.SET_INT_PARAM_IN_SESSION
(9, 27, 'sort_area_size', 131072);
Disable using same SID, serial number and event with level
0
Example
BEGIN
DBMS_SYSTEM.KSDWRT (1, ‘Output to trace file’);
DBMS_SYSTEM.KSDWRT (2, ‘Output to alert log’);
END;
/
EXECUTE DBMS_SYSTEM.KSDFLS;
To disable use
DBMS_SUPPORT.STOP_TRACE;
To disable use
DBMS_SUPPORT.STOP_TRACE_IN_SESSION
(
SI NUMBER, -- SID
SE NUMBER -- Serial Number (can be 0)
);
DBMS_SESSION.SET_IDENTIFIER
(
CLIENT_ID VARCHAR2 -- Client ID
);
DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE
(
CLIENT_ID NUMBER, -- Client ID
WAITS BOOLEAN, -- Include Waits
BINDS BOOLEAN -- Include Binds
);
SERVICE1 =
(DESCRIPTON =
(ADDRESS =
(PROTOCOL=TCP)(HOST=server1)(PORT=1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SERVICE1)
)
)
DBMS_APPLICATION_INFO.SET_MODULE
(
MODULE_NAME VARCHAR2, -- Module
ACTION_NAME VARCHAR2 -- Action
);
SQLPLUS /NOLOG
SQL> CONNECT SYS/password AS SYSDBA
ORADEBUG HELP
ORADEBUG TRACEFILE_NAME
ORADEBUG UNLIMIT
ORADEBUG FLUSH
ORADEBUG CLOSE_TRACE
ORADEBUG DUMPLIST
To perform a dump
ORADEBUG SETMYPID
ORADEBUG DUMP LIBRARY_CACHE 4
ORADEBUG SUSPEND
ORADEBUG RESUME
where level is
Level Description
1 Session
2 Process
3 System
For example
kcbnhb_
ORADEBUG FFBEGIN
ORADEBUG FFRESUMEINST
In ORADEBUG
ORADEBUG DUMP <dump> <level>
Using DBMS_SYSTEM
EXECUTE DBMS_SYSTEM.SET_EV
(sid, serial#, 65535, <level>, '<dump'>);
In ORADEBUG
ORADEBUG EVENT <error> trace name <dump> level <level>
ORADEBUG SESSION_EVENT
<error> trace name <dump> level <level>
where FORMAT is
Format Description
8 Octal
10 Decimal
16 Hexadecimal
17 Single Character
returns
Typ=2 Len=3: c2,b,2
returns
10000
SELECT
dbms_utility.make_data_block_address
(&file,&block) decimalDBA
FROM dual;
Dumps
branches
leaves
contents of leaf blocks
File Headers
ALTER SESSION SET EVENTS
'immediate trace name file_hdrs level 7';
where level is
Level Description
1 Dump library cache statistics
2 Include hash table histogram
3 Include dump of object handles
4 Include dump of object structures (heap 0)
where level is
Level Description
1 Dump row cache statistics
2 Include hash table histogram
8 Include dump of object structures
where level is
Level Description
1 Include PGA
2 Include SGA
4 Include UGA
8 Include indirect memory dumps
ORADEBUG DUMPSGA
where level is
Levels are
Levels Description
1 Buffer headers only
2 1 + block headers
3 2 + block contents
4 Buffer headers only + hash chain
5 1 + block headers + hash chain
6 2 + block contents + hash chain
8 Buffer headers only + hash chain + users/waiters
9 1 + block headers + hash chain + users/waiters
10 2 + block contents + hash chain + users/waiters
# Description
2 Process
3 Call
4 Session
6 Enqueue
24 Buffer
34 DML Locks
38 Transaction
51 Library Object
52 Library Object Pin
61 Hash Table
Amount of library cache dump output for state object dumps can be
limited using event 10065
Level Description
1 Address of library object only
2 As 1 plus library object lock details
3 As 2 plus library object handle and library object
Levels are
Level Description
0 Error stack only
1 Error stack and function call stack
2 As 1 plus the process state
3 As 2 plus the context area
Levels include
Level Description
1 Hash Table
2 Enqueue headers
3 Enqueue details
To dump the current state of all latches
ALTER SESSION SET EVENTS
'immediate trace name latches level <level>';
Levels include
Level Description
1 Latches
2 Include statistics
80 © 2005 Julian Dyke
Dumping Granules
In Oracle 9.0.1 and above
To dump the current state of all granules
ALTER SESSION SET EVENTS
'immediate trace name granulelist level <level>';
Levels include
Level Description
255 Null Granule
511 Home Granule
767 Shared Pool
1023 Large Pool
1279 Java Pool
1535 Buffer Pool
Usage:lkdebug [options]
-l [r|p] <enqueue pointer> Enqueue Object
-r <resource pointer> Resource Object
-b <gcs shadow pointer> GCS shadow Object
-p <process id> client pid
-P <process pointer> Process Object
-O <i1> <i2> <types> Oracle Format resname
-a <res/lock/proc/pres> all <res/lock/proc/pres> pointers
-a <res> [<type>] all <res> pointers by an optional type
-a convlock all converting enqueue (pointers)
-a convres all res ptr with converting enqueues
-a name list all resource names
-a hashcount list all resource hash bucket counts
-t Traffic controller info
-s summary of all enqueue types
-k GES SGA summary info
88
Instance(s) must be restarted after setting this parameter
© 2005 Julian Dyke
RAC
Tracing can be set for
GSD
GSDCTL
SRVCONFIG
SRVCTL
julian.dyke@intel.com