Download presentation
Presentation is loading. Please wait.
Published byDominick Hampton Modified over 10 years ago
1
Advanced Diagnostics Revisited Julian Dyke Independent Consultant
UKOUG Conference 2014 juliandyke.com
2
WARNING Much of the content of this presentation is undocumented and unsupported by Oracle Check with Oracle support before using any of these features in a production environment
3
Agenda Trace Parameters Features and Hints Execution Plans Events
ORADEBUG ALTER Statements
4
Trace
5
Trace V$DIAG_INFO Introduced in Oracle 11.1
Session-specific view reporting various diagnostic parameters Column Name Data Type INST_ID NUMBER NAME VARCHAR2(64) VALUE VARCHAR2(512) CON_ID Current trace file can be determined using: SELECT value FROM v$diag_info WHERE name = 'Default Trace File'; VALUE /u01/app/oracle/diag/rdbms/target/TARGET/trace/TARGET_ora_5556.trc
6
Trace TRACEFILE_IDENTIFIER Parameter
Introduced in Oracle 8.1.7 Appends specified suffix to trace file name Subsequent trace is immediately written to new file Can be updated unlimited number of times For example if the current trace file name is: /u01/app/oracle/diag/rdbms/target/TARGET/trace/TARGET_ora_5556_TEST.trc If the TRACEFILE_IDENTIFIER is set to "TEST": ALTER SESSION SET tracefile_identifier = 'TEST'; Subsequent trace will be written to: /u01/app/oracle/diag/rdbms/target/TARGET/trace/TARGET_ora_5556_TEST.trc TRACEFILE_IDENTIFIER can also be set using ORADEBUG: ORADEBUG SETTRACEFILEID TEST
7
Trace DBMS_SYSTEM.KSDWRT Procedure
To write to trace files and/or alert log use: DBMS_SYSTEM.KSDWRT ( DEST NUMBER, -- 1 = Trace File, 2 = Alert Log TST VARCHAR2 -- Message ); For example: BEGIN DBMS_SYSTEM.KSDWRT (1, ‘Output to trace file’); DBMS_SYSTEM.KSDWRT (2, ‘Output to alert log’); END;
8
Trace DBMS_MONITOR - Overview
Introduced in Oracle 10.1 Package to enable/disable trace and statistics Defined in $ORACLE_HOME/rdbms/admin/dbmsmntr.sql Trace subroutines include: SESSION_TRACE_ENABLE / DISABLE DATABASE_TRACE_ENABLE / DISABLE CLIENT_ID_TRACE_ENABLE / DISABLE SERV_MOD_ACT_TRACE_ENABLE / DISABLE Statistics subroutines include: CLIENT_ID_STAT_ENABLE / DISABLE SERV_MOD_ACT_STAT_ENABLE / DISABLE Trace subroutines are equivalent to event level 8 Include wait events by default
9
Trace DBMS_MONITOR - PLAN_STAT column
In Oracle 11.1 and above the following subroutines include the PLAN_STAT column: SESSION_TRACE_ENABLE DATABASE_TRACE_ENABLE CLIENT_ID_TRACE_ENABLE SERV_MOD_ACT_TRACE_ENABLE PLAN_STAT specifies the dump frequency for row source (STAT) statistics Values can be: NEVER FIRST_EXECUTION (default) ALL_EXECUTIONS Useful when individual statement executions are affected by data cardinality / selectivity
10
Parameters
11
Parameters V$PARAMETER
V$PARAMETER includes supported parameters Column Name Data Type NUM NUMBER NAME VARCHAR2(80) TYPE VALUE VARCHAR2(4000) DISPLAY_VALUE DEFAULT_VALUE VARCHAR2(255) ISDEFAULT VARCHAR2(9) ISSES_MODIFIABLE VARCHAR2(5) ISSYS_MODIFIABLE ISPDB_MODIFIABLE Column Name Data Type IS_INSTANCE_MODIFIABLE VARCHAR2(5) ISMODIFIED VARCHAR2(10) ISADJUSTED ISDEPRECATED ISBASIC DESCRIPTION VARCHAR2(256) UPDATE_COMMENT HASH NUMBER CON_ID CON_ID - new in Oracle > Container ID ISPDB_MODIFIABLE is also new in 12.1
12
Parameters V$PARAMETER
V$PARAMETER includes supported parameters Based on X$KSPPI - includes all parameters Version Supported Unsupported Total 348 2403 2751 352 2562 2914 367 2984 3351 381 3597 3978 To set an unsupported parameter use double quotes around name e.g.: ALTER SESSION SET "_serial_direct_read" = NEVER; V$PARAMETER includes non-default values for unsupported parameters
13
Parameters Unsupported parameters
V$PARAMETER only reports non-default values for unsupported parameters To dump values for all parameters including default parameters for unsupported parameters: SELECT i.ksppinm||';'||sv.ksppstvl FROM x$ksppi i, x$ksppsv sv WHERE i.indx = sv.indx ORDER BY i.ksppinm;
14
Parameters V$PARAMETER_VALID_VALUES
V$PARAMETER_VALID_VALUES - supported parameters Based on X$KSPVLD_VALUES - all parameters Column Name Data Type NUM NUMBER NAME VARCHAR2(64) ORDINAL VALUE VARCHAR2(255) ISDEFAULT CON_ID Version Supported Unsupported Total 73 91 164 75 112 187 78 124 202
15
Parameters V$PARAMETER_VALID_VALUES
For example: SELECT value_kspvld_values AS "Value", isdefault_kspvld_values AS "Default" FROM x$kspvld_values WHERE name_kspvld_values = '_serial_direct_read' ORDER BY ordinal_kspvld_values; Value Default ALWAYS FALSE AUTO NEVER TRUE
16
Features and Hints
17
Features and Hints V$SQL_FEATURE
Based on X$QKSFM Includes features and fixes Column Name Data Type SQL_FEATURE VARCHAR2(64) DESCRIPTION PROPERTY NUMBER Fixes can be identified from DESCRIPTION column WHERE description LIKE 'Fix%' Individual fixes can be enabled and disabled. For example: ALTER SESSION SET "_fix_control"=' :off';
18
Features and Hints V$SQL_FEATURE
Version counts are: Version0 Feature Fix Total 94 654 748 98 846 944 110 885 996 115 1071 1186
19
Features and Hints V$SQL_FEATURE_HIERARCHY
V$SQL_FEATURE describes the relationships between features The root feature is QKSFM_ALL The following query prints the hierarchy in a nested format: SELECT lpad ( ' ' , level * 2 ,' ' ) || sql_feature FROM v$sql_feature_hierarchy CONNECT BY PRIOR sql_feature = parent_id START WITH parent_id = 'QKSFM_ALL'; .... QKSFM_TRANSFORMATION QKSFM_CBQT QKSFM_CVM QKSFM_DIST_PLCMT QKSFM_JOINFAC QKSFM_JPPD QKSFM_PLACE_GROUP_BY QKSFM_PULL_PRED ....
20
Features and Hints V$SQL_HINT
Based on X$QKSHT Currently no concept of unsupported hints Column Name Data Type NAME VARCHAR2(64) SQL_FEATURE CLASS INVERSE TARGET_LEVEL NUMBER PROPERTY VERSION VARCHAR2(25) VERSION_OUTLINE Version # Hints 273 277 314 332 INVERSE column Describes the opposite hint e.g.: PUSH_PRED and NO_PUSH_PRED
21
Features and Hints V$SQL_HINT
VERSION column Describes version in which hint was introduced: Version # New Hints 8.0.0 14 8.1.0 50 8.1.5 18 8.1.6 4 8.1.7 2 9.0.0 26 9.2.0 13 42 35 3 Version # New Hints 2 4 32 5 19 6 37 18
22
Execution Plans
23
Execution Plans DBMS_XPLAN - Overview
Introduced in Oracle 9.2 Enhanced in subsequent releases Defined in $ORACLE_HOME/rdbms/admin/dbmsxpln.sql Useful subroutines include DISPLAY - display a plan from a PLAN_TABLE DISPLAY_AWR - display a plan from the AWR DISPLAY_CURSOR - display a plan from the library cache DISPLAY_PLAN – returns plan as a CLOB DISPLAY_SQLSET – displays a plan from a SQL tuning set DISPLAY_SQLPLAN_BASELIN E – displays a plan from SQL baseline For example to display execution plan for statement most recently executed by the current session: SELECT * FROM TABLE (DBMS_XPLAN.DISPLAY_CURSOR);
24
Execution Plans DBMS_XPLAN - FORMAT Column
All DISPLAY subroutines include a FORMAT column which can be: BASIC Minimum information Display operation ID, name and option TYPICAL Default. Display operation ID, name and option, #rows, #bytes and optimizer cost. Includes pruning, parallel and predicate information when applicable ALL Maximum information As TYPICAL plus projection, alias and remote SQL if applicable SERIAL Same as TYPICAL except parallel information is not displayed even if statement executes in parallel
25
Execution Plans DBMS_XPLAN - FORMAT Column Options
FORMAT column options can be fine-tuned using the following keywords: ROWS - number of rows estimated by optimizer BYTES - number of bytes estimated by optimizer COST - optimizer cost information PARTITION - partition pruning information PARALLEL - parallel execution information PREDICATE - predicate section PROJECTION - projection section ALIAS - query block name / object alias REMOTE - distributed query information NOTE - note section If keyword is prefixed by a minus sign then specified information is excluded BASIC ROWS - displays basic information plus number of rows ALL -PROJECTION -NOTE displays everything except the projection and note sections
26
Execution Plans DBMS_XPLAN - Additional Statistics
For DISPLAY_CURSOR and DISPLAY_SQLSET, additional data can be output using the following keywords: IOSTATS – shows IO statistics for all executions of the cursor MEMSTATS – displays memory management statistics including execution mode of operator how much memory was used number of bytes spilled to disk ALLSTATS – both IOSTATS and MEMSTATS LAST – only report statistics for last execution of cursor IOSTATS, ALLSTATS and LAST require basic plan statistics which are collected by setting STATISTICS_LEVEL parameter to ALL specifying GATHER_PLAN_STATISTICS hint MEMSTATS requires PGA memory management to be enabled by: setting PGA_AGGREGATE_TARGET to non-zero value
27
Execution Plans Operations and Options
AWR includes some interesting (static) views that describe execution plan operations and options available in the installed database version DBA_HIST_PLAN_OPERATION_NAME Contains a list of row source operations DBA_HIST_PLAN_OPTION_NAME Contains a list of row source options DBA_HIST_TOPLEVELCALL_NAME Contains a list of top level calls Used in DBA_HIST_ACTIVE_SESS_HISTORY
28
Events
29
Event Levels Event has additional levels in recent versions Level Description Version 1 Trace includes SQL statement, response time, service time, execution statistics (#rows, #LIOs #PRs #PWs) In 10.2 and below execution plan written to trace file when associated cursor is closed. In 11.1 and above execution plan written to trace file after first execution of each cursor - plan_stat = 'first_execution' All 4 As level 1 plus bind varables 8 As level 1 plus wait times 16 As level 1 plus execution plans for every execution plan_stat = 'all_executions' 11.1 and above 32 As level 1 without any execution plans plan_stat = 'never' 64 As level 1 plus execution plans for any statement execution requiring more than 60 seconds of DB time and above
30
Event Bind Variables Event level 4 trace only captures the first bind variable in array EXECUTE dbms_monitor.session_trace_enable (binds=>TRUE); CREATE TABLE driver (key VARCHAR2(4), name VARCHAR2(30)); DECLARE TYPE driver_tab IS TABLE OF driver%ROWTYPE; d driver_tab := driver_tab (); BEGIN d.extend (6); d(1).key := 'LHAM'; d(1).name := 'Lewis Hamilton'; d(2).key := 'NROS'; d(2).name := 'Nico Rosberg'; d(3).key := 'SVET'; d(3).name := 'Sebastian Vettel'; d(4).key := 'FALO'; d(4).name := 'Fernando Alonso'; d(5).key := 'DRIC'; d(5).name := 'Daniel Ricciardo'; d(6).key := 'JBUT'; d(6).name := 'Jenson Button'; FORALL j IN INSERT INTO driver VALUES (d(j).key,d(j).name); FORALL j IN INSERT INTO driver VALUES (d(j).key,d(j).name); END;
31
Event Bind Variables Trace will only contain bind variable values for two rows: BINDS # : Bind# value="LHAM" Bind# value="Lewis Hamilton" ... BINDS # : Bind# value="FALO" Bind# value="Fernando Alonso" Note this issue has consequences for load generation / simulation tools such as HammerDB and LoadRunner which base their input on trace. Trace only includes first row of each array insert Remaining rows are not traced
32
Event 10053 Optimizer Decisions
To trace optimizer decisions use enable event 10053: Level Description Version 1 Print statistics and computations All 2 Print computations only Details are only written to trace when the statement is hard-parsed
33
Event 10053 DBMS_SQLDIAG Provides APIs to diagnose SQL statements.
Used by diagnostic modules: SQL_TESTCASE SQL_DIAGNOSTIC Defined in $ORACLE_HOME/rdbms/admin/dbmsdiag.sql Includes DUMP_TRACE procedure: Dumps trace (optimizer or compiler) trace for a specific SQL statement Does not execute SQL statement to generate trace Compiler trace is a superset of optimizer trace Includes kkf library calls Query block decisions Expressions
34
Event 10053 DBMS_SQLDIAG DUMP_TRACE procedure parameters are: Name
Description p_sql_id Child cursor SQL_ID p_child_number Child cursor number p_component "Optimizer" or "Compiler" p_file_id tracefile_identifier For example: dbms_sqldiag.dump_trace ( p_sql_id => '2y220pbrk573n', p_child_number => 0, p_component => 'Optimizer', p_file_id => 'OPTIMIZER' ); Note that P_FILE_ID sets TRACEFILE_IDENTIFIER, but does not reset it at end of call so subsequent trace file be written to the new file. Alternatively NULL can be specified (the default)
35
ORADEBUG
36
ORADEBUG Introduction
Undocumented debugging utility available as a standalone utility on Unix (oradbx) as a standalone utility on VMS (orambx) within Server Manager (svrmgr) within SQL*Plus (8.1.5 and above) Requires SYSDBA privilege Options vary for each release To list available options use: SQL> ORADEBUG HELP
37
ORADEBUG Process Specification
There are four ways of specifying a process in ORADEBUG: Using current process: SQL> ORADEBUG SETMYPID Using Oracle PID (V$PROCESS.PID) SQL> ORADEBUG SETORAPID <pid> Using operating system PID (V$PROCESS.SPID) SQL> ORADEBUG SETOSPID <spid> Using the Oracle process name: SQL> ORADEBUG SETORAPNAME <pname> For example: SQL> ORADEBUG SETORAPNAME PMON
38
ORADEBUG Useful Commands
To display the current trace file name use: SQL> ORADEBUG TRACEFILE_NAME To flush the current trace file use: SQL> ORADEBUG FLUSH To set the maximum size of the current trace file to UNLIMITED use: SQL> ORADEBUG UNLIMIT To set the TRACEFILE_IDENTIFER parameter: SQL> ORADEBUG SETTRACEFILEID <suffix> To dump the currently executing statement (SQL or PL/SQL) SQL> ORADEBUG CURRENT_SQL
39
ORADEBUG Dumps Dumps vary for each release: To list available dumps:
SQL> ORADEBUG DUMPLIST To perform an dump immediately use: SQL> ORADEBUG DUMP <dump_name> <level> [address] To perform a dump periodically use: SQL> ORADEBUG PDUMP [interval=<interval>] [ndumps=<count> <dump_name> <level> [address]
40
ORADEBUG Process Statistics
To dump process statistics use ORADEBUG PROCSTAT. For example: SQL> ORADEBUG SETORAPNAME PMON SQL> ORADEBUG PROCSTAT ----- Dump of Process Statistics User time used = 65 System time used = 30 Maximum resident set size = Integral shared text size = 0 Integral unshared data size = 0 Integral unshared stack size = 0 Page reclaims = 7480 Page faults = 7 Swaps = 0 Block input operations = 1472 Block output operations = 32 Socket messages sent = 0 Socket messages received = 0 Signals received = 0 Voluntary context switches = 2555 Involuntary context switches = 387
41
ORADEBUG Components ORADEBUG includes internal documentation for
Events SQL> ORADEBUG DOC Internal Documentation EVENT Help on events (syntax, event list, ...) COMPONENT [<comp_name>] List all components or describe <comp_name> Components are arranged in nested hierarchies Each component has a unique name Do not need to specify parent(s) to uniquely identify component Most component descriptions include the internal module name(s) e.g.: SQL_Execution SQL Execution (qer, qes, kx, qee) Parallel_Execution Parallel Execution (qerpx, qertq, kxfr, kxfx, kxfq, kxfp)
42
ORADEBUG Components Components are grouped into eight libraries:
Library Description ADVCMP Advanced Compression CLIENT Client DIAG Diagnostics GENERIC Numeric Events LIBCELL Exadata Cells ORANET Networking PLSQL PL/SQL RDBMS
43
ORADEBUG Components For example given the extract below from ORADEBUG DOC COMPONENT: Components in library RDBMS: SQL_Compiler SQL Compiler ((null)) SQL_Parser SQL Parser (qcs) SQL_Semantic SQL Semantic Analysis (kkm) SQL_Optimizer SQL Optimizer ((null)) SQL_Transform SQL Transformation (kkq, vop, nso) SQL_MVRW SQL Materialized View Rewrite ((null)) SQL_Vmerge SQL View Merging (kkqvm) SQL_Virtual SQL Virtual Column (qksvc, kkfi) SQL_APA SQL Access Path Analysis (apa) SQL_Costing SQL Cost-based Analysis (kko, kke) The following are all valid: SQL> ORADEBUG DOC RDBMS SQL> ORADEBUG DOC SQL_Compiler SQL> ORADEBUG DOC SQL_Optimizer SQL> ORADEBUG DOC SQL_Transform SQL> ORADEBUG DOC SQL_Vmerge
44
ORADEBUG Events The full event syntax is described in ORADEBUG:
SQL> ORADEBUG DOC EVENT <event_spec>::= '<event_id> [<event_scope>] [<event_filter_list>] [<event_parameters>] [<action_list>] [off]' <event_id> ::= <event_name | number>[<target_parameters>] <event_scope> ::= [<scope_name>: scope_parameters] <event_filter> ::= {<filter_name>: filter_parameters} <action> ::= <action_name>(action_parameters) <*_parameters> ::= <parameter_name> = <value>[, ]
45
ORADEBUG Events Each event specification is comprised of up to four parts: Name Scope Filter Action Not all of the above are always required Defaults apply for many permutations More information is available in: SQL> ORADEBUG DOC EVENT NAME SQL> ORADEBUG DOC EVENT SCOPE SQL> ORADEBUG DOC EVENT FILTER SQL> ORADEBUG DOC EVENT ACTION
46
ORADEBUG Events - Name Event names are optional:
Can be specified for some libraries For example for the RDBMS library: Name Description alert_text event for textual alerts trace_recursive force tracing of recursive SQL statements clientid_overwrite overwrite client_identifier in client_info sql_monitor force monitoring of SQL statements sql_trace sql trace pmon_startup startup of pmon process background_startup startup of background processes db_open_begin start of database open operation
47
ORADEBUG Events - Scope
Scope is the SQL scope for RDBMS events Defined using SQL[ ] Syntax is [SQL: sql_id <string> ] For example: [SQL: 3s1yukp05bzg6] Multiple SQL_IDs can be specified using | as a separator [SQL: 3s1yukp05bzg6 | aca4xvmz0rzup]
48
ORADEBUG Events - Filter
Filters include: Library Filter Description DIAG occurence Fire events after specified number of occurrences callstack Fire events when specified function is on stack tag Fire events when specified tag is set RDBMS process Fire events for specific process pgadep Fire when pgadep is within specified range GENERIC errarg Fire events for specific error argument Filters must be enclosed in curly brackets. For example pgadep below: SQL> ALTER SESSION SET EVENTS 'sql_trace[SQL: 32cqz71gd8wy3] {pgadep: exactdepth 0} plan_stat=all_executions,wait=true,bind=true';
49
ORADEBUG Events - Filter
pgadep is the PGA depth (dep=N) in trace file. Can take the following values: exactDepth lessThan greaterThan For example: {pgadep: exactdepth 0} For normal statement execution dep = 0 SQL statement execution For PL/SQL execution dep = 0 PL/SQL execution dep = 1 SQL statement execution
50
ORADEBUG Events - Action
Actions exist for each library (except PLSQL) For the RDBMS library most actions correspond to ORADEBUG DUMP commands from older versions including: Dump Name Description PROCESSSTATE Dump process state SYSTEMSTATE Dump system state HEAPDUMP Dump memory heap GLOBAL_AREA Dump fixed global area(s) BUFFERS Dump all buffers in buffer cache SET_TSN_P1 Set tablespace # for buffer dump BUFFER Dump all buffers for specific DBA LIBRARY_CACHE Dump the library cache CURSORDUMP Dump session cursors
51
ORADEBUG Events - SQL_TRACE
SQL_TRACE is an synonym for event and can be set using: ORADEBUG ALTER SYSTEM ALTER SESSION The ORADEBUG syntax is: SQL> ORADEBUG DOC EVENT NAME SQL_TRACE sql_trace: event for sql trace Usage sql_trace wait < false | true >, bind < false | true >, plan_stat < never | first_execution | all_executions | adaptive >, level <ub4> The default level is 1
52
ORADEBUG Events - SQL_TRACE
For example: ORADEBUG EVENT SQL_TRACE ORADEBUG EVENT SQL_TRACE BIND=TRUE ORADEBUG EVENT SQL_TRACE BIND=TRUE,WAIT=TRUE ORADEBUG EVENT SQL_TRACE OFF ORADEBUG EVENT SQL_TRACE PLAN_STAT=ALL_EXECUTIONS ORADEBUG EVENT SQL_TRACE LEVEL=4
53
ORADEBUG Events - Examples
Numeric events can be set using ORADEBUG. Default level is 1 ORADEBUG EVENT 10053 ORADEBUG EVENT LEVEL 1 ORADEBUG EVENT OFF The original syntax still works in Oracle 11g/12c ORADEBUG EVENT TRACE NAME CONTEXT FOREVER, LEVEL 1 ORADEBUG EVENT TRACE NAME CONTEXT OFF
54
ALTER Statements
55
ALTER Statements SQL_TRACE
In all versions SQL_TRACE can be enabled using ALTER SESSION/SYSTEM Examples shown for ALTER SESSION: SQL> ALTER SESSION SET SQL_TRACE=TRUE; In Oracle 11.1 and above SQL_TRACE is an event: SQL> ALTER SESSION SET EVENTS 'sql_trace wait=true'; SQL> ALTER SESSION SET EVENTS 'sql_trace bind=true'; SQL> ALTER SESSION SET EVENTS 'sql_trace bind=true, wait=true'; SQL> ALTER SESSION SET EVENTS 'sql_trace plan_stat=all_executions';
56
ALTER Statements Numeric Events
Numeric events can still be set using ALTER SESSION / ALTER SYSTEM SQL> ALTER SESSION SET EVENTS '10235'; SQL> ALTER SESSION SET EVENTS '10235 level 1'; SQL> ALTER SESSION SET EVENTS '10235 off'; The original syntax still works in Oracle 11g/12c SQL> ALTER SESSION SET EVENTS '10235 trace name context forever, level 1'; SQL> ALTER SESSION SET EVENTS '10235 trace name context off';
57
ALTER Statements SQL_TRACE - Filter
Trace can be restricted to a specific SQL ID by specifying a filter: SQL> ALTER SESSION SET EVENTS 'sql_trace [sql: sql_id=3s1yukp05bzg6] bind=true, wait=true'; Multiple SQL IDs can be specified using the | symbol as a separator SQL> ALTER SESSION SET EVENTS 'sql_trace [sql: sql_id=3s1yukp05bzg6|aca4xvmz0rzup] bind=true, wait=true';
58
ALTER Statements TRACE - Components
Trace can be restricted to a specific components e.g. SQL> ALTER SESSION SET EVENTS 'trace[rdbms.SQL_Optimizer.*]'; The library name can optionally be omitted e.g. SQL> ALTER SESSION SET EVENTS 'trace[SQL_Optimizer.*]'; Disable trace again using: SQL> ALTER SESSION SET EVENTS 'trace[SQL_Optimizer.*] off'; Individual components can also be filtered e.g.: SQL> ALTER SESSION SET EVENTS 'trace[SQL_Optimizer.*][sql:3bnxc7htmf2ad]';
59
ALTER Statements Flushing Caches
To flush the buffer cache use: ALTER SYSTEM FLUSH BUFFER_CACHE; The buffer cache must be flushed to disk before attempting to dump blocks using the ALTER SYSTEM DUMP command To flush the shared pool (library cache) use: ALTER SYSTEM FLUSH SHARED_POOL; Pinned objects will not be flushed
60
ALTER Statements Block Dumps
To dump a database block in Oracle 8.0 or above: ALTER SYSTEM DUMP DATAFILE <absolute_file_number> BLOCK <block_number>; To dump a range of database blocks: ALTER SYSTEM DUMP DATAFILE <absolute_file_number> BLOCK MIN <minimum_block_number> BLOCK MAX <maximum_block_number>; To dump a block from a datafile in a closed database: ALTER SYSTEM DUMP DATAFILE '<file_name>' BLOCK <block_number>;
61
ALTER Statements Block Dumps
In Oracle 12c ASSM bitmap blocks cannot be dumped by default Block is considered to be encrypted Work around is to set ALTER SESSION SET "_sga_clear_dump" = TRUE; X$KSPPI description for this parameter is: Allow dumping encrypted blocks in clear for debugging Acknowledgements to Jonathan Lewis and Riyaj Shamsudeen for the above
62
ALTER Statements Redo Log Dumps
To identify the current redo log use: SELECT member FROM v$logfile WHERE group# = ( SELECT group# FROM v$log WHERE status = 'CURRENT' ); To dump the contents of a redo log use: ALTER SYSTEM DUMP LOGFILE '<logfilename>'; Also works for archived log files
63
ALTER Statements Redo Log Dumps
Full syntax is: ALTER SYSTEM DUMP LOGFILE 'FileName' SCN MIN MinimumSCN SCN MAX MaximumSCN TIME MIN MinimumTime TIME MAX MaximumTime LAYER Layer OPCODE Opcode DBA MIN FileNumber . BlockNumber DBA MAX FileNumber . BlockNumber RBA MIN LogFileSequenceNumber . BlockNumber RBA MAX LogFileSequenceNumber . BlockNumber; See MOS Note for further details
64
Thank You For Your Interest
Please send any questions or comments to:
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.