# DCstc.ctl:230:Collects Streams Configuration Information # $Id: DCstc.ctl,v 1.4 2013/10/30 07:18:24 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/DB/DCstc.ctl,v 1.4 2013/10/30 07:18:24 RDA Exp $ # # Change History # 20130711 MSC Identify Oracle Database 12c. =head1 NAME DB:DCstc - Collects Streams Configuration Information =head1 DESCRIPTION This module collects Streams configuration-related information (for Oracle 9i Release 2 or later). The following reports can be generated and are regrouped under C. =cut if !${I_DBC/E} return echo tput('bold'),'Processing DB.STC module ...',tput('off') # Initialization var $STC_WAIT = ${N_WAIT_ANALYZES:30} if !match($STC_WAIT,'^\d+$') var $STC_WAIT = 30 var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' toc '1:Streams Configuration' # Load the common macros run DB:DBinfo() # Obtain the database version var $ORACLE_VERSION = get_db_version() if !match($ORACLE_VERSION,'^(92|10|11|12)') {report not_applicable write 'The Streams Configuration module can only be executed on Oracle 9i \ Release 2 or later.' toc '2:[[',getFile(),'][rda_report][Not Applicable]]' return } =head2 no_privileges - Insufficient Privileges This module must be run as a SYSDBA user. =cut if !${B_SYSDBA/P} {report no_privileges write 'The Streams Configuration module requires you to connect as a SYSDBA \ user. This can be setup during the DB module setup.' toc '2:[[',getFile(),'][rda_report][Insufficient Privileges]]' return } =head2 history - History Analyses Performs history checks. (Oracle 10g Release 2 and later) =cut debug ' Inside STC module, gathering analysis results' pretoc '2:Analyses' debug ' Inside STC module, gathering history analysis results' report history var $TTL = '---+!! History Analyses for Last Day' if match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Streams Buffered Queue History ',\ '---+ Streams Buffered Subscriber History',\ '---+ Streams Capture History',\ '---+ Streams Apply History') var @HDR = ('',\ '|*Begin Interval Time*|*End Interval Time*| *Snap ID*| \ *Num Msgs*| *Spill Msgs*| *Cnum Msgs*| *Cspill Msgs*|*Queue*| \ *Queue ID*|*Startup Time*|*Instance Number*| *DB ID*|',\ '|*Begin Interval Time*|*End Interval Time*| *Snap ID*| \ *Subscriber ID*| *Num Msgs*| *Cnum Msgs*| *Total Spilled Msg*|\ *Subscriber Name*|*Subscriber Address*|*Queue*|*Startup Time*| \ *Instance Number*| *DB ID*|',\ '|*Begin Interval Time*|*End Interval Time*|*Capture Name*| \ *Lag(Sec)*| *Total Messages Captured*| \ *Total Messages Enqueued*| *Elapsed Pause Time*| \ *Elapsed Redo Wait Time*| *Elapsed Rule Time*| \ *Elapsed Enqueue Time*|*Startup Time*| *Instance Number*| \ *DB ID*|',\ '|*Begin Interval Time*|*End Interval Time*|*Apply Name*| \ *Reader Lag*| *Reader Total Messages Dequeued*| \ *Coord Lwm Lag*| *Coord Total Received*| *Coord Total Applied*| \ *Coord Total Rollbacks*| *Coord Total Wait Deps*| \ *Coord Total Wait Cmts*| *Server Total Messages Applied*| \ *Server Elapsed Dequeue Time*| *Server Elapsed Apply Time*|\ *Startup Time*| *Instance Number*| *DB ID*|') set $sql {SELECT '|' || " s.begin_interval_time || ' |' || " s.end_interval_time || ' | ' || " bq.snap_id || '| ' || " bq.num_msgs || '| ' || " bq.spill_msgs || '| ' || " bq.cnum_msgs || '| ' || " bq.cspill_msgs || '|' || " bq.queue_schema||'.'||bq.queue_name || ' | ' || " bq.queue_id || '|' || " TO_CHAR(bq.startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " bq.instance_number || '| ' || " bq.dbid || '|' " FROM dba_hist_buffered_queues bq,dba_hist_snapshot s " WHERE bq.snap_id = s.snap_id " AND s.end_interval_time >= systimestamp - 1 " ORDER BY bq.queue_schema,bq.queue_name,s.end_interval_time; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " s.begin_interval_time || ' |' || " s.end_interval_time || ' | ' || " bs.snap_id || '| ' || " bs.subscriber_id || '| ' || " bs.num_msgs || '| ' || " bs.cnum_msgs || '| ' || " bs.total_spilled_msg || '|' || " bs.subscriber_name || ' |' || " bs.subscriber_address || ' |' || " bs.queue_schema||'.'||bs.queue_name || ' |' || " TO_CHAR(bs.startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " bs.instance_number || '| ' || " bs.dbid || '|' " FROM dba_hist_buffered_subscribers bs,dba_hist_snapshot s " WHERE bs.snap_id = s.snap_id " AND s.end_interval_time >= systimestamp - 1 " ORDER BY bs.queue_schema,bs.queue_name,bs.subscriber_id,s.end_interval_time; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " s.begin_interval_time || ' |' || " s.end_interval_time || ' |' || " sc.capture_name || ' | ' || " sc.lag || '| ' || " sc.total_messages_captured || '| ' || " sc.total_messages_enqueued || '| ' || " sc.elapsed_pause_time || '| ' || " sc.elapsed_redo_wait_time || '| ' || " sc.elapsed_rule_time || '| ' || " sc.elapsed_enqueue_time || '|' || " TO_CHAR(sc.startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " sc.instance_number || '| ' || " sc.dbid || '|' " FROM dba_hist_streams_capture sc,dba_hist_snapshot s " WHERE sc.snap_id = s.snap_id " AND s.end_interval_time >= systimestamp - 1 " ORDER BY sc.capture_name,s.end_interval_time; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " s.begin_interval_time || ' |' || " s.end_interval_time || ' |' || " sa.apply_name || ' | ' || " sa.reader_lag || '| ' || " sa.reader_total_messages_dequeued || '| ' || " sa.coord_lwm_lag || '| ' || " sa.coord_total_received || '| ' || " sa.coord_total_applied || '| ' || " sa.coord_total_rollbacks || '| ' || " sa.coord_total_wait_deps || '| ' || " sa.coord_total_wait_cmts || '| ' || " sa.server_total_messages_applied || '| ' || " sa.server_elapsed_dequeue_time || '| ' || " sa.server_elapsed_apply_time || '|' || " TO_CHAR(sa.startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " sa.instance_number || '| ' || " sa.dbid || '|' " FROM dba_hist_streams_apply_sum sa,dba_hist_snapshot s " WHERE sa.snap_id = s.snap_id " AND s.end_interval_time >= systimestamp - 1 " ORDER BY sa.apply_name,s.end_interval_time; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'History Analyses',3) } =head2 rules - Rules Analyses Performs rules checks. =cut debug ' Inside STC module, gathering rules analysis results' report rules var $sql = undef var $TTL = '---+!! Rules Analyses' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Missing Rules in dba_rules',\ '---+ Extra Rules in dba_rules',\ '---+ Rule_Conditions Do Not Match between Streams and Rules',\ '---+ Source Database Name Does Not Match for Capture or \ Propagation Rules',\ '---+ Source Database Name Does Not Exist in Logminer Metadata',\ '---+ Global Rule for Capture Specified but Condition not \ Modified',\ '---+ No Rule Set Defined for Capture',\ '---+ Apply Rules with no Source Database Specified',\ '---+ Schema Rules for non Existent Schema',\ '---+ Table Rules for non Existent Object',\ '---+ Fast Evaluation Rule Set Rules for Queues',\ '---+ Constraints on Tables Configured in Streams',\ '---+ Indexes on Tables',\ '---+ Unsupported Tables in Streams',\ '---+ Capture Processes Defined on System',\ '---+ Apply Processes Defined on System',\ '---+ Propagations Defined on System',\ '---+ Streams Rules Defined on System',\ '---+ Logminer Database Map1',\ '---+ Logminer Database Map2',\ '---+ Logminer Database Map3',\ '---+ Logminer Cache Objects',\ '---+ Intcol Verification',\ '---+ Jobs in Database',\ '---+ Agents',\ '---+ Agent Privileges',\ '---+ Current Long Running Transactions') var @HDR = ('',\ '|*Rule Owner*|*Rule Name*|',\ '|*Rule Owner*|*Rule Name*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Rule Condition*|',\ '|*Streams Type*|*Streams Name*|*Rule*|',\ '|*Rule Name*|*Source Database*|',\ '|*Streams Name*|*Rule*|',\ '|*Capture Name*|',\ '|*Streams Name*|*Rule*|*Object*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Table Owner*| \ *Action Context Name*|*Action Context Value*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Object*| \ *Action Context Name*|*Action Context Value*|',\ '|*Rule Set*|*Rule Name*|*Rule Condition*|',\ '|*Object*|*Constraint Name*|*Constraint Type*|*Status*|\ *Last Change*|*Search Condition*|*Ref Constraint*|',\ '|*Object*|*Table Type*|*Index Name*|*Index Type*|\ *Funcidx Status*|',\ '|*Owner*|*Table Name*| *Property*| *Trig Flag*| *Object Flags*| \ *Table Flags*|*Reason*| *Compatible*|*Auto Filtered*|',\ '|*Queue*|*Capture Name*| *Capture#*|*Rule Set*|',\ '|*Queue*|*Apply Name*| *Apply#*|*Rule Set*|',\ '|*Source Queue*|*Destination*|*Ruleset*|',\ '|*Streams name*| *Streams Type*| *NBR*|',\ '|*Global Name*| *Logmnr UID*| *Flags*|',\ '| *Logmnr UID*| *Session#*|',\ '| *Session#*| *Client#*|*Session Name*| *DB ID*| \ *Resetlogs Change#*| *Session Attr*|*Session Attr Verbose*| \ *Start SCN*| *End SCN*| *Spill SCN*| *Resume SCN*|',\ '| *Logmnr UID*| *Count*|',\ '| *Logmnr UID*| *Obj#*| *Objv#*| *Intcol#*|',\ '| *Job*|*Log User*|*Priv User*|*Schema User*|*Last Date*|\ *Last Sec*|*This Date*|*This Sec*|*Next Date*|*Next Sec*| \ *Total Time*|*Broken*|*Interval*| *Failures*|*What*|*NLS Env*|\ *Misc Env*| *Instance*|',\ '|*Agent Name*|*HTTP Enabled*|*SMTP Enabled*|',\ '|*Agent Name*|*DB Username*|*HTTP Enabled*|*SMTP Enabled*|',\ '| *SID*|*Xid*| *Run Length*|*Terminal*|*Program*|') set $sql {SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM (SELECT rule_owner, " rule_name " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name " FROM dba_streams_global_rules) "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM (SELECT rule_owner, " rule_name " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name " FROM dba_streams_global_rules); "PROMPT ___Macro_separator(3)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM (SELECT rule_owner, " rule_name, " rule_condition, " streams_type, " streams_name " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " streams_type, " streams_name " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " streams_type, " streams_name " FROM dba_streams_global_rules) s, " dba_rules r "WHERE r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND s.rule_condition != dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_type || ' |' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM (SELECT rule_owner, " rule_name, " source_database, " streams_type, " streams_name " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name, " source_database, " streams_type, " streams_name " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name, " source_database, " streams_type, " streams_name " FROM dba_streams_global_rules) r " WHERE source_database IS NOT NULL " AND source_database != " (SELECT global_name " FROM global_name) " AND streams_type IN ('CAPTURE','PROPAGATION'); "PROMPT ___Macro_separator(5)___ "SELECT '|' || " rule_owner || '.' || rule_name || ' |' || " source_database || ' |' " FROM (SELECT rule_owner, " rule_name, " source_database " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name, " source_database " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name, " source_database " FROM dba_streams_global_rules) " WHERE source_database NOT IN " (SELECT global_name " FROM system.logmnrc_dbname_uid_map); "PROMPT ___Macro_separator(6)___ "SELECT '|' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM (SELECT rule_owner, " rule_name, " rule_condition, " streams_name, " streams_type, " table_name, " table_owner " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " streams_name, " streams_type, " schema_name table_name, " NULL " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " streams_name, " streams_type, " 'GLOBAL_RULE', " 'GLOBAL_RULE' " FROM dba_streams_global_rules) s, " dba_rules r " WHERE streams_type = 'CAPTURE' " AND table_owner = 'GLOBAL_RULE' " AND table_name = 'GLOBAL_RULE' " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND s.rule_condition = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(7)___ "SELECT '|' || " capture_name || ' |' " FROM dba_capture " WHERE rule_set_name IS NULL; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.table_owner||'.'|| s.table_name || ' |' " FROM (SELECT rule_owner, " rule_name, " rule_condition, " source_database, " table_owner, " table_name, " rule_type, " streams_type, " streams_name " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " source_database, " schema_name table_name, " NULL, " rule_type, " streams_type, " streams_name " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " source_database, " 'GLOBAL_RULE', " 'GLOBAL_RULE', " rule_type, " streams_type, " streams_name " FROM dba_streams_global_rules) s, " dba_rules r " WHERE s.streams_type = 'APPLY' " AND s.source_database IS NULL " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND s.rule_condition = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(9)___ "SELECT '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.table_owner || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM (SELECT rule_owner, " rule_name, " rule_condition, " source_database, " table_owner, " table_name, " rule_type, " streams_type, " streams_name " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " source_database, " schema_name table_name, " NULL, " rule_type, " streams_type, " streams_name " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " source_database, " 'GLOBAL_RULE', " 'GLOBAL_RULE', " rule_type, " streams_type, " streams_name " FROM dba_streams_global_rules) s, " dba_rules r, " dba_users u, " TABLE(r.rule_action_context.actx_list) ac " WHERE s.table_name IS NULL " AND u.username = s.table_owner " AND r.rule_owner = s.rule_owner " AND r.rule_name = s.rule_name " AND ac.nvn_value.accessvarchar2() IS NULL; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " s.streams_type || ' |' || " streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.table_owner||'.'|| s.table_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM (SELECT rule_owner, " rule_name, " rule_condition, " source_database, " table_owner, " table_name, " rule_type, " streams_type, " streams_name " FROM dba_streams_table_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " source_database, " schema_name table_name, " NULL, " rule_type, " streams_type, " streams_name " FROM dba_streams_schema_rules " UNION ALL " SELECT rule_owner, " rule_name, " rule_condition, " source_database, " 'GLOBAL_RULE', " 'GLOBAL_RULE', " rule_type, " streams_type, " streams_name " FROM dba_streams_global_rules) s, " dba_rules r, " dba_objects o, " TABLE(r.rule_action_context.actx_list) ac " WHERE o.object_name = s.table_name " AND o.owner = s.table_owner " AND r.rule_owner = s.rule_owner " AND r.rule_name = s.rule_name " AND ac.nvn_value.accessvarchar2() IS NULL; "PROMPT ___Macro_separator(11)___ "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner||'.'||rsr.rule_set_name || ' |' || " rsr.rule_owner||'.'||rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_set_name LIKE '%_R' " AND rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " ORDER BY rsr.rule_set_owner,rsr.rule_set_name,rsr.rule_owner,rsr.rule_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " c.owner||'.'||c.table_name || ' |' || " c.constraint_name || ' |' || " c.constraint_type || ' |' || " c.status || ' |' || " c.last_change || ' |' || " c.r_owner ||'.'|| c.r_constraint_name || ' |' " FROM dba_constraints c,dba_apply_instantiated_objects p " WHERE c.owner = p.source_object_owner " AND c.table_name = p.source_object_name " AND c.constraint_type IN ('P','U','R','C') " AND constraint_name NOT LIKE 'SYS_IOT%' " ORDER BY c.owner,c.table_name; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " table_owner || '.' || table_name || ' |' || " table_type || ' |' || " index_name || ' |' || " index_type || ' |' || " funcidx_status || ' |' " FROM dba_indexes " WHERE table_owner NOT IN ('SYS','SYSTEM','CTX','CTXSYS','XDB'); "PROMPT ___Macro_separator(14)___ "SELECT '|' || " u.name || ' |' || " o.name || ' | ' || " t.property || '| ' || " t.trigflag || '| ' || " o.flags || '| ' || " t.flags || '|' || " (CASE " WHEN ((BITAND(t.property, " 64 " + 128 " + 256 " + 512 " ) != 0 " ) OR " (BITAND(t.flags, " 268435456 " + 536870912 " ) != 0 " ) OR " (BITAND(t.property,262208) = 262208 " ) OR " (BITAND(t.property,2112) = 2112 " ) OR " (BITAND(t.property,64) != 0 AND " BITAND(t.flags,131072) != 0 " ) " ) THEN " 'IOT' " WHEN BITAND(t.property, " 1 " + 2 " + 4 " + 8 " + 16 " + 4096 " + 8192 " + 65536 " ) != 0 THEN " 'column with user-defined type' " WHEN (EXISTS " (SELECT 1 " FROM sys.col$ c " WHERE t.obj# = c.obj# " AND " ( (BITAND(c.property,32) = 32 " ) OR " (c.type# NOT IN (1,2,12,96,100,101,112,113,180,181, " 182,183,231) " AND (c.type# != 23 " OR (c.type# = 23 AND BITAND(c.property,2) = 2)) " ) OR " (c.segcol# = 0 " ) OR " (BITAND(c.property,2) = 2 " ) OR " (c.type# = 112 AND c.charsetform = 2 " ) OR " (c.type# = 112 AND c.charsetform = 1 AND " c.charsetid >= 800 " ) " ) " ) " ) THEN " 'unsupported column exists' " WHEN BITAND(t.property,1) = 1 THEN " 'object table' " WHEN BITAND(t.property,131072) = 131072 THEN " 'AQ queue table' " WHEN BITAND(t.property,4194304 + 8388608) != 0 THEN " 'temporary table' " WHEN BITAND(t.property,134217728) = 134217728 THEN " 'sub object' " WHEN BITAND(t.property,2147483648) = 2147483648 THEN " 'external table' " WHEN BITAND(t.property,33554432 + 67108864) != 0 THEN " 'materialized view' " WHEN BITAND(t.property,32768) = 32768 THEN " 'FILE column exists' " WHEN (EXISTS " (SELECT 1 " FROM sys.mlog$ ml " WHERE ml.mowner = u.name " AND ml.log = o.name " ) " ) THEN " 'materialized view log' " WHEN BITAND(t.flags,262144) = 262144 THEN " 'materalized view container table' " WHEN BITAND(t.trigflag,268435456) = 268435456 THEN " 'streams unsupported object' " WHEN BITAND(o.flags,16) = 16 THEN " 'domain index' " ELSE " NULL " END) || ' | ' || " 92 || '|' || " 'NO' || '|' " FROM sys.obj$ o,sys.user$ u,sys.tab$ t " WHERE t.obj# = o.obj# " AND o.owner# = u.user# " AND u.name NOT IN ('SYS','SYSTEM','CTXSYS') " AND BITAND(o.flags, " 2 " + 4 " + 32 " + 128 " ) = 0 " AND " ( (BITAND(t.property, " 64 " + 128 " + 256 " + 512 " ) != 0 " ) OR " (BITAND(t.flags, " 268435456 " + 536870912 " ) != 0 " ) OR " (BITAND(t.property,262208) = 262208 " ) OR " (BITAND(t.property,2112) = 2112 " ) OR " (BITAND(t.property,64) != 0 AND " BITAND(t.flags,131072) != 0 " ) OR " (BITAND(t.property, " 1 " + 2 " + 4 " + 8 " + 16 " + 4096 " + 8192 " + 65536 " ) != 0 " ) OR " (EXISTS " (SELECT 1 FROM sys.col$ c " WHERE t.obj# = c.obj# " AND " ( (BITAND(c.property,32) = 32 " ) OR " (c.type# NOT IN (1,2,12,96,112,113,180,181, " 182,183,231) " AND (c.type# != 23 " OR (c.type# = 23 AND BITAND(c.property,2) = 2)) " ) OR " (c.segcol# = 0 " ) OR " (BITAND(c.property,2) = 2 " ) OR " (c.type# = 112 AND c.charsetform = 2 " ) OR " (c.type# = 112 AND c.charsetform = 1 AND " c.charsetid >= 800 " ) " ) " ) " ) OR " (BITAND(t.property,1) = 1 " ) OR " (BITAND(t.property, " 131072 " + 4194304 " + 8388608 " + 33554432 " + 67108864 " + 134217728 " + 2147483648 " ) != 0 " ) OR " (BITAND(t.flags, " 262144 " ) = 262144 " ) OR " (BITAND(t.property,32768) = 32768 " ) OR " (BITAND(t.trigflag,268435456) = 268435456 " ) OR " (EXISTS " (SELECT 1 " FROM sys.mlog$ ml " WHERE ml.mowner = u.name " AND ml.log = o.name " ) " ) " ); "PROMPT ___Macro_separator(15)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " capture_name || ' | ' || " capture# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' " FROM sys.streams$_capture_process; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " apply_name || ' | ' || " apply# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' " FROM sys.streams$_apply_process; "PROMPT ___Macro_separator(17)___ "SELECT '|' || " source_queue_schema || '.' || source_queue || ' |' || " destination_queue_schema || '.' || destination_queue " || '@' || destination_dblink || ' |' || " ruleset_schema || '.' || ruleset || ' |' " FROM sys.streams$_propagation_process; "PROMPT ___Macro_separator(18)___ "SELECT '|' || " streams_name || ' | ' || " streams_type || '| ' || " COUNT(*) || '|' " FROM sys.streams$_rules " GROUP BY streams_name,streams_type; "PROMPT ___Macro_separator(19)___ "SELECT '|' || " global_name || ' | ' || " logmnr_uid || '| ' || " flags || '|' " FROM system.logmnrc_dbname_uid_map; "PROMPT ___Macro_separator(20)___ "SELECT '| ' || " logmnr_uid || '| ' || " session# || '|' " FROM system.logmnr_uid$; "PROMPT ___Macro_separator(21)___ "SELECT '| ' || " session# || '| ' || " client# || '|' || " session_name || ' | ' || " db_id || '| ' || " resetlogs_change# || '| ' || " session_attr || '|' || " session_attr_verbose || ' | ' || " start_scn || '| ' || " end_scn || '| ' || " spill_scn || '| ' || " resume_scn || '|' " FROM system.logmnr_session$; "PROMPT ___Macro_separator(22)___ "SELECT '| ' || " logmnr_uid || '| ' || " COUNT(*) || '|' " FROM system.logmnrc_gtlo " GROUP BY logmnr_uid; "PROMPT ___Macro_separator(23)___ "SELECT '| ' || " logmnr_uid || '| ' || " obj# || '| ' || " objv# || '| ' || " intcol# || '|' " FROM system.logmnrc_gtcs " GROUP BY logmnr_uid,obj#,objv#,intcol# " HAVING COUNT(1) > 1 " ORDER BY logmnr_uid,obj#,objv#,intcol#; "PROMPT ___Macro_separator(24)___ "SELECT '| ' || " job || '|' || " log_user || ' |' || " priv_user || ' |' || " schema_user || ' |' || " TO_CHAR(last_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " last_sec || ' |' || " TO_CHAR(this_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " this_sec || ' |' || " TO_CHAR(next_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " next_sec || ' | ' || " ROUND(total_time,1) || '|' || " broken || ' |' || " interval || ' | ' || " failures || '|' || " what || ' |' || " nls_env || ' |' || " misc_env || ' | ' || " instance || '|' " FROM dba_jobs; "PROMPT ___Macro_separator(25)___ "SELECT '|' || " agent_name || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agents; "PROMPT ___Macro_separator(26)___ "SELECT '|' || " agent_name || ' |' || " db_username || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agent_privs; "PROMPT ___Macro_separator(27)___ "SELECT '| ' || " sid || '.' || serial# || '|' || " xidusn || '.' || xidslot || '.' || xidsqn || ' | ' || " (SYSDATE - TO_DATE(start_time,'DD-Mon-YYYY HH24:MI:SS')) * 1440 || " '|' || " terminal || ' |' || " program || ' |' " FROM v$transaction t,v$session s " WHERE t.addr = s.taddr " AND (SYSDATE - TO_DATE(start_time,'DD-Mon-YYYY HH24:MI:SS')) * 1440 > 20; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Missing Rules in dba_rules',\ '---+ Extra Rules in dba_rules',\ '---+ Rule_Conditions Do Not Match between Streams and Rules',\ '---+ Source Database Name Does Not Match for Capture or \ Propagation Rules',\ '---+ Global Rule for Capture Specified but Condition not \ Modified',\ '---+ No Rule Set Defined for Capture',\ '---+ Apply Rules with no Source Database Specified',\ '---+ Schema Rules for non Existent Schema',\ '---+ Table Rules for non Existent Object',\ '---+ Fast Evaluation Rule Set Rules for Queues',\ '---+ Overlapping Rules',\ '---+ Constraints on Tables Configured in Streams',\ '---+ Indexes on Tables',\ '---+ Unsupported Tables in Streams',\ '---+ Capture Processes Defined on System',\ '---+ Apply Processes Defined on System',\ '---+ Propagations Defined on System',\ '---+ Streams Rules Defined on System',\ '---+ Logminer Database Map1',\ '---+ Logminer Database Map2',\ '---+ Logminer Database Map3',\ '---+ Logminer Cache Objects',\ '---+ Intcol Verification',\ '---+ Jobs in Database',\ '---+ Queue Memory and Flow Control Values',\ '---+ Agents',\ '---+ Agent Privileges',\ '---+ Current Long Running Transactions') var @HDR = ('',\ '|*Rule Owner*|*Rule Name*|',\ '|*Rule Owner*|*Rule Name*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Rule Condition*|',\ '|*Streams Type*|*Streams Name*|*Rule*|',\ '|*Streams Name*|*Rule*|',\ '|*Capture Name*|*Capture Type*|*Source DB*|',\ '|*Streams Name*|*Rule*|*Object*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Schema Name*|\ *Action Context Name*|*Action Context Value*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Object*|\ *Action Context Name*|*Action Context Value*|',\ '|*Rule Set*|*Rule*|*Rule Condition*|',\ '|*Streams Name*|*Streams Type*|*Rule Set Owner*|*Rule Set Name*|\ *Rule Owner*|*Rule Name*|*Streams Rule Type*|*Rule Owner*|\ *Rule Name*|*Streams Rule Type*|',\ '|*Object*|*Constraint Name*|*Constraint Type*|*Status*|\ *Last Change*|*Ref Constraint*|',\ '|*Object*|*Table Type*|*Index Name*|*Index Type*|\ *Funcidx Status*|',\ '|*Owner*|*Table Name*|*Reason*|*Auto Filtered*|',\ '|*Queue*|*Capture Name*| *Capture#*|*Rule Set*|*Rule Set2*|',\ '|*Queue*|*Apply Name*| *Apply#*|*Rule Set*|*Rule Set2*|',\ '|*Source Queue*|*Destination*|*Rule Set*|*Rule Set2*|',\ '|*Streams Name*|*Streams Type*| *Number of Rules*|',\ '|*Global Name*| *Logmnr UID*| *Flags*|',\ '| *Logmnr UID*| *Session#*|',\ '| *Session#*| *Client#*|*Session Name*| *DB ID*| \ *Resetlogs Change#*| *Session Attr*|*Session Attr Verbose*| \ *Start SCN*| *End SCN*| *Spill SCN*| *Oldest SCN*|*Resume SCN*|\ *Global DBname*| *Reset Timestamp*| *Branch SCN*|\ *Version*| *Spare1*| *Spare2*| *Spare3*| \ *Spare4*| *Spare5*|*Spare6*|*Spare7*|*Spare8*|',\ '| *Logmnr UID*| *Number of Interesting DB Objects*|',\ '| *Logmnr UID*| *Obj#*| *Objv#*| *Intcol#*|',\ '| *Job*|*Log User*|*Priv User*|*Schema User*|*Last Date*|\ *Last Sec*|*This Date*|*This Sec*|*Next Date*|*Next Sec*| \ *Total Time*|*Broken*|*Interval*| *Failures*|*What*|*NLS Env*|\ *Misc Env*| *Instance*|',\ '|*Addr*| *Indx*| *Inst ID*| *Frused Kwqbpmt*| *Flc1 kwqbpmt*| \ *Flc2 Kwqbpmt*|*Flc3 Kwqbpmt*|',\ '|*Agent Name*|*HTTP Enabled*|*SMTP Enabled*|',\ '|*Agent Name*|*DB Username*|*HTTP Enabled*|*SMTP Enabled*|',\ '| *Inst ID*| *SID*|*Xid*|*Run Length*|*Terminal*|*Program*|') set $sql {SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_streams_rules "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_streams_rules; "PROMPT ___Macro_separator(3)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_streams_rules s,dba_rules r " WHERE r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) != dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_type || ' |' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM dba_streams_rules r " WHERE source_database IS NOT NULL " AND source_database != (SELECT global_name FROM global_name) " AND streams_type IN ('CAPTURE','PROPAGATION'); "PROMPT ___Macro_separator(5)___ "SELECT '|' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM dba_streams_rules s,dba_rules r " WHERE streams_type = 'CAPTURE' " AND rule_type = 'GLOBAL' " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(6)___ "SELECT '|' || " capture_name || ' |' || " capture_type || ' |' || " source_database || ' |' " FROM dba_capture " WHERE rule_set_name IS NULL " AND negative_rule_set_name IS NULL; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.schema_name || '.' || s.object_name || ' |' " FROM dba_streams_rules s,dba_rules r " WHERE s.streams_type = 'APPLY' " AND s.source_database IS NULL " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(8)___ "SELECT '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.schema_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_streams_rules s,dba_rules r,dba_users u, " TABLE(r.rule_action_context.actx_list) ac " WHERE s.schema_name IS NULL " AND u.username = s.schema_name " AND r.rule_owner = s.rule_owner " AND r.rule_name = s.rule_name " AND ac.nvn_value.accessvarchar2() IS NULL; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " s.streams_type || ' |' || " streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.schema_name || '.' || s.object_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_streams_rules s,dba_rules r,dba_objects o, " TABLE(r.rule_action_context.actx_list) ac " WHERE o.object_name = s.object_name " AND o.owner = s.schema_name " AND r.rule_owner = s.rule_owner " AND r.rule_name = s.rule_name " AND ac.nvn_value.accessvarchar2() IS NULL; "PROMPT ___Macro_separator(10)___ "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner||'.'||rsr.rule_set_name || ' |' || " rsr.rule_owner||'.'||rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_set_name LIKE '%_R' " AND rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " ORDER BY rsr.rule_set_owner,rsr.rule_set_name,rsr.rule_owner,rsr.rule_name; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " a.streams_name || ' |' || " a.streams_type || ' |' || " a.rule_set_owner || ' |' || " a.rule_set_name || ' |' || " a.rule_owner || ' |' || " a.rule_name || ' |' || " a.streams_rule_type || ' |' || " b.rule_owner || ' |' || " b.rule_name || ' |' || " b.streams_rule_type || ' |' " FROM dba_streams_rules a,dba_streams_rules b " WHERE a.rule_set_owner = b.rule_set_owner " AND a.rule_set_name = b.rule_set_name " AND a.streams_name = b.streams_name " AND a.streams_type = b.streams_type " AND a.rule_type = b.rule_type " AND (a.subsetting_operation IS NULL OR b.subsetting_operation IS NULL) " AND (a.rule_owner != b.rule_owner OR a.rule_name != b.rule_name) " AND ((a.streams_rule_type = 'GLOBAL' " AND b.streams_rule_type IN ('SCHEMA','TABLE') " AND a.schema_name = b.schema_name) " OR (a.streams_rule_type = 'SCHEMA' " AND b.streams_rule_type = 'TABLE' " AND a.schema_name = b.schema_name) " OR (a.streams_rule_type = 'TABLE' " AND b.streams_rule_type = 'TABLE' " AND a.schema_name = b.schema_name " AND a.object_name = b.object_name " AND a.rule_name < b.rule_name) " OR (a.streams_rule_type = 'SCHEMA' " AND b.streams_rule_type = 'SCHEMA' " AND a.schema_name = b.schema_name " AND a.rule_name < b.rule_name) " OR (a.streams_rule_type = 'GLOBAL' " AND b.streams_rule_type = 'GLOBAL' " AND a.rule_name < b.rule_name)) " ORDER BY a.rule_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " c.owner||'.'||c.table_name || ' |' || " c.constraint_name || ' |' || " c.constraint_type || ' |' || " status || ' |' || " last_change || ' |' || " r_owner || '.' || r_constraint_name || ' |' " FROM dba_constraints c,dba_apply_instantiated_objects p " WHERE c.owner = p.source_object_owner " AND c.table_name = p.source_object_name " AND c.constraint_type IN ('P','U','R','C') " AND constraint_name NOT LIKE 'SYS_IOT%' " ORDER BY c.owner,c.table_name; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " table_owner || '.' || table_name || ' |' || " table_type || ' |' || " index_name || ' |' || " index_type || ' |' || " funcidx_status || ' |' " FROM dba_indexes " WHERE table_owner NOT IN ('SYS','SYSTEM','CTX','CTXSYS','XDB'); "PROMPT ___Macro_separator(14)___ "SELECT '|' || " owner || ' |' || " table_name || ' |' || " reason || ' |' || " auto_filtered || ' |' " FROM dba_streams_unsupported; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " capture_name || ' | ' || " capture# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' || " negative_ruleset_owner || '.' || negative_ruleset_name || ' |' " FROM sys.streams$_capture_process; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " apply_name || ' | ' || " apply# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' || " negative_ruleset_owner || '.' || negative_ruleset_name || ' |' " FROM sys.streams$_apply_process; "PROMPT ___Macro_separator(17)___ "SELECT '|' || " source_queue_schema || '.' || source_queue || ' |' || " destination_queue_schema || '.' || destination_queue " || '@' || destination_dblink || ' |' || " ruleset_schema || '.' || ruleset || ' |' || " negative_ruleset_schema || '.' || negative_ruleset || ' |' " FROM sys.streams$_propagation_process; "PROMPT ___Macro_separator(18)___ "SELECT '|' || " streams_name || ' | ' || " streams_type || '| ' || " COUNT(*) || '|' " FROM sys.streams$_rules " GROUP BY streams_name,streams_type; "PROMPT ___Macro_separator(19)___ "SELECT '|' || " global_name || ' | ' || " logmnr_uid || '| ' || " flags || '|' " FROM system.logmnrc_dbname_uid_map; "PROMPT ___Macro_separator(20)___ "SELECT '| ' || " logmnr_uid || '| ' || " session# || '|' " FROM system.logmnr_uid$; "PROMPT ___Macro_separator(21)___ "SELECT '| ' || " session# || '| ' || " client# || '|' || " session_name || ' | ' || " db_id || '| ' || " resetlogs_change# || '| ' || " session_attr || '|' || " session_attr_verbose || ' | ' || " start_scn || '| ' || " end_scn || '| ' || " spill_scn || '|' || " oldest_scn || '| ' || " resume_scn || '|' || " global_db_name || ' | ' || " reset_timestamp || '| ' || " branch_scn || '|' || " version || ' |' || " spare1 || '| ' || " spare2 || '| ' || " spare3 || '| ' || " spare4 || '| ' || " spare5 || '|' || " spare6 || ' |' || " spare7 || ' |' || " spare8 || ' |' " FROM system.logmnr_session$; "PROMPT ___Macro_separator(22)___ "SELECT '| ' || " logmnr_uid || '| ' || " COUNT(*) || '|' " FROM system.logmnrc_gtlo " GROUP BY logmnr_uid; "PROMPT ___Macro_separator(23)___ "SELECT '| ' || " logmnr_uid || '| ' || " obj# || '| ' || " objv# || '| ' || " intcol# || '|' " FROM system.logmnrc_gtcs " GROUP BY logmnr_uid,obj#,objv#,intcol# " HAVING COUNT(1) > 1 " ORDER BY logmnr_uid,obj#,objv#,intcol#; "PROMPT ___Macro_separator(24)___ "SELECT '| ' || " job || '|' || " log_user || ' |' || " priv_user || ' |' || " schema_user || ' |' || " TO_CHAR(last_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " last_sec || ' |' || " TO_CHAR(this_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " this_sec || ' |' || " TO_CHAR(next_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " next_sec || ' | ' || " ROUND(total_time,1) || '|' || " broken || ' |' || " interval || ' | ' || " failures || '|' || " what || ' |' || " nls_env || ' |' || " misc_env || ' | ' || " instance || '|' " FROM dba_jobs; "PROMPT ___Macro_separator(25)___ "SELECT '|' || " addr || ' | ' || " indx || '| ' || " inst_id || '| ' || " frused_kwqbpmt || '| ' || " flc1_kwqbpmt || '| ' || " flc2_kwqbpmt || '| ' || " flc3_kwqbpmt || '|' " FROM x$kwqbpmt; "PROMPT ___Macro_separator(26)___ "SELECT '|' || " agent_name || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agents; "PROMPT ___Macro_separator(27)___ "SELECT '|' || " agent_name || ' |' || " db_username || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agent_privs; "PROMPT ___Macro_separator(28)___ "SELECT '| ' || " t.inst_id || '| ' || " sid || '.' || serial# || '|' || " xidusn || '.' || xidslot || '.' || xidsqn || ' |' || " (SYSDATE - start_date) * 1440 || ' |' || " terminal || ' |' || " program || ' |' " FROM gv$transaction t,gv$session s " WHERE t.addr = s.taddr " AND (SYSDATE - start_date) * 1440 > 20; } } elsif match($ORACLE_VERSION,'102') {var @TTL = ('',\ '---+ Check for Missing Rules in dba_rules',\ '---+ Check for Extra Rules in dba_rules',\ '---+ Check for Rule_Conditions Do not Match between Streams and \ Rules',\ '---+ Check for Source Database Name Does not Match for Capture \ or Propagation Rules',\ '---+ Check for Global Rule for Capture Specified but Condition \ not Modified',\ '---+ Check for No Rule Set Defined for Capture',\ '---+ Check for Apply Rules with no Source Database Specified',\ '---+ Check for Schema Rules for non Existent Schema',\ '---+ Fast Evaluation Rule Set Rules for Queues',\ '---+ Check for Constraints on Tables Configured in Streams',\ '---+ List Indexes on Tables',\ '---+ List Unsupported Tables in Streams',\ '---+ Capture Processes Defined on system',\ '---+ Apply Processes Defined on System',\ '---+ Propagations Defined on System',\ '---+ Streams Rules Defined on System',\ '---+ Logminer Database Map1',\ '---+ Logminer Database Map2',\ '---+ Logminer Database Map3',\ '---+ Logminer Cache Objects',\ '---+ Intcol Verification',\ '---+ Jobs in Database',\ '---+ Segcol Verification',\ '---+ Queue Memory and Flow Control Values',\ '---+ DBA_QUEUE_SCHEDULES',\ '---+ Agents',\ '---+ Agent Privileges',\ '---+ Current Long Running Transactions',\ '---+ Streams Pool Advice',\ '---+ Most recent Streams alerts(max=10) occuring within last \ 10 days') var @HDR = ('',\ '|*Rule Owner*|*Rule Name*|',\ '|*Rule Owner*|*Rule Name*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Rule Condition*|',\ '|*Streams Type*|*Streams Name*|*Rule*|',\ '|*Streams Name*|*Rule*|',\ '|*Capture Name*|*Capture Type*|*Source DB*|',\ '|*Streams Name*|*Rule*|*Object*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Schema Name*|\ *Action Context Name*|*Action Context Value*|',\ '|*Rule Set*|*Rule*|*Rule Condition*|',\ '|*Object*|*Constraint Name*|*Constraint Type*|*Status*|\ *Last Change*|*Ref Constraint*|',\ '|*Object*|*Table Type*|*Index Name*|*Index Type*|\ *Funcidx Status*|',\ '|*Owner*|*Table Name*|*Reason*|*Auto Filtered*|',\ '|*Queue*|*Capture Name*| *Capture#*|*Rule Set*|*Rule Set2*|',\ '|*Queue*|*Apply Name*| *Apply#*|*Rule Set*|*Rule Set2*|',\ '|*Source Queue*|*Destination*|*Rule Set*|*Rule Set2*|',\ '|*Streams Name*| *Streams Type*| *Number of Rules*|',\ '|*Global Name*| *Logmnr UID*| *Flags*|*Src*|',\ '| *Logmnr UID*| *Session#*|',\ '| *Session#*| *Client#*|*Session Name*| *DB ID*| \ *Resetlogs Change#*| *Session Attr*|*Session Attr Verbose*| \ *Start SCN*| *End SCN*| *Spill SCN*|*Spill Time*| *Oldest SCN*| \ *Resume SCN*|*Global DBname*| *Reset Timestamp*| *Branch SCN*|\ *Version*| *Spare1*| *Spare2*| *Spare3*| \ *Spare4*| *Spare5*|*Spare6*|*Spare7*|*Spare8*|',\ '| *Logmnr UID*| *Number of Interesting DB Objects*|',\ '| *Logmnr UID*| *Obj#*| *Objv#*| *Intcol#*|',\ '| *Job*|*Log User*|*Priv User*|*Schema User*|*Last Date*|\ *Last Sec*|*This Date*|*This Sec*|*Next Date*|*Next Sec*| \ *Total Time*|*Broken*|*Interval*| *Failures*|*What*|*NLS Env*|\ *Misc Env*| *Instance*|',\ '| *Logmnr UID*| *Obj#*| *Objv#*| *Segcol#*| *Intcol#*|',\ '|*Addr*| *Indx*| *Inst ID*| *Frused Kwqbpmt*| *Flc1 kwqbpmt*| \ *Flc2 Kwqbpmt*| *Flc3 Kwqbpmt*|',\ '|*Schema*|*Qname*|*Destination*|*Start Date*|*Start Time*| \ *Propagation Window*|*Next Time*| *Latency*|*Schedule Disabled*|\ *Process Name*|*Session ID*| *Instance*|*Last Run Date*|\ *Last Run Time*|*Current Start Date*|*Current Start Time*|\ *Next Run Date*|*Next Run Time*| *Total Time*| *Total Number*| \ *Total Bytes*| *Max Number*| *Max Bytes*| *Avg Number*| \ *Avg Size*| *Avg Time*| *Failures*|*Last Error Date*|\ *Last Error Time*|*Last Error Msg*|*Message Delivery Mode*| \ *Elapsed Dequeue Time*| *Elapsed Pickle Time*|',\ '|*Agent Name*|*HTTP Enabled*|*SMTP Enabled*|',\ '|*Agent Name*|*DB Username*|*HTTP Enabled*|*SMTP Enabled*|',\ '| *Inst ID*| *SID*|*Xid*|*Run Length*|*Terminal*|*Program*|',\ '| *Streams Pool Size Factor*| *Streams Pool Size for Estimate*| \ *Estd Spill Count*| *Estd Spill Time*| *Estd Unspill Count*| \ *Estd Unspill Time*|',\ '|*Message Type*|*Creation Time*|*Reason*|*Suggested Action*|\ *Module ID*|*Object Type*|*Host ID*|*Instance*|\ *Resolution*|*Time Suggested*|') set $sql {SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_streams_rules "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_streams_rules; "PROMPT ___Macro_separator(3)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_streams_rules s,dba_rules r " WHERE r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) != dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_type || ' |' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM dba_streams_rules r " WHERE source_database IS NOT NULL " AND source_database != (SELECT global_name FROM global_name) " AND streams_type IN ('CAPTURE','PROPAGATION'); "PROMPT ___Macro_separator(5)___ "SELECT '|' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM dba_streams_rules s,dba_rules r " WHERE streams_type = 'CAPTURE' " AND rule_type = 'GLOBAL' " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(6)___ "SELECT '|' || " capture_name || ' |' || " capture_type || ' |' || " source_database || ' |' " FROM dba_capture " WHERE rule_set_name IS NULL " AND negative_rule_set_name IS NULL; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.schema_name || '.' || s.object_name || ' |' " FROM dba_streams_rules s,dba_rules r " WHERE s.streams_type = 'APPLY' " AND s.source_database IS NULL " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(8)___ "SELECT '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.schema_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_streams_rules s,dba_rules r,dba_users u, " TABLE(r.rule_action_context.actx_list) ac " WHERE s.schema_name IS NULL " AND u.username = s.schema_name " AND r.rule_owner = s.rule_owner " AND r.rule_name = s.rule_name " AND ac.nvn_value.accessvarchar2() IS NULL; "PROMPT ___Macro_separator(9)___ "SET long 4000 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner||'.'||rsr.rule_set_name || ' |' || " rsr.rule_owner||'.'||rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_set_name LIKE '%_R' " AND rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " ORDER BY rsr.rule_set_owner,rsr.rule_set_name,rsr.rule_owner,rsr.rule_name; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " c.owner||'.'||c.table_name || ' |' || " c.constraint_name || ' |' || " c.constraint_type || ' |' || " status || ' |' || " last_change || ' |' || " r_owner||'.'||r_constraint_name || ' |' " FROM dba_constraints c,dba_apply_instantiated_objects p " WHERE c.owner = p.source_object_owner " AND c.table_name = p.source_object_name " AND c.constraint_type IN ('P','U','R','C') " AND constraint_name NOT LIKE 'SYS_IOT%' " ORDER BY c.owner,c.table_name; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " table_owner || '.' || table_name || ' |' || " table_type || ' |' || " index_name || ' |' || " index_type || ' |' || " funcidx_status || ' |' " FROM dba_indexes i,dba_apply_instantiated_objects p " WHERE i.owner = p.source_object_owner " AND i.table_name = p.source_object_name " ORDER BY i.owner,i.table_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " owner || ' |' || " table_name || ' |' || " reason || ' |' || " auto_filtered || ' |' " FROM dba_streams_unsupported; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " capture_name || ' | ' || " capture# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' || " negative_ruleset_owner || '.' || negative_ruleset_name || ' |' " FROM sys.streams$_capture_process; "PROMPT ___Macro_separator(14)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " apply_name || ' | ' || " apply# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' || " negative_ruleset_owner || '.' || negative_ruleset_name || ' |' " FROM sys.streams$_apply_process; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " source_queue_schema || '.' || source_queue || ' |' || " destination_queue_schema || '.' || destination_queue " || '@' || destination_dblink || ' |' || " ruleset_schema || '.' || ruleset || ' |' || " negative_ruleset_schema || '.' || negative_ruleset || ' |' " FROM sys.streams$_propagation_process; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " streams_name || ' | ' || " streams_type || '| ' || " COUNT(*) || '|' " FROM sys.streams$_rules " GROUP BY streams_name,streams_type; "PROMPT ___Macro_separator(17)___ "SELECT '|' || " global_name || ' | ' || " logmnr_uid || '| ' || " flags || '|' || " 'MAP'|| '|' " FROM (SELECT global_name, " logmnr_uid, " flags, " 'MAP' type " FROM system.logmnrc_dbname_uid_map " UNION " SELECT s.global_db_name global_name, " u.logmnr_uid logmnr_uid, " NULL flags, " 'UID$' type " FROM system.logmnr_uid$ u,system.logmnr_session$ s " WHERE u.session# = s.session#) " ORDER BY logmnr_uid; "PROMPT ___Macro_separator(18)___ "SELECT '| ' || " logmnr_uid || '| ' || " session# || '|' " FROM system.logmnr_uid$; "PROMPT ___Macro_separator(19)___ "SELECT '| ' || " session# || '| ' || " client# || '|' || " session_name || ' | ' || " db_id || '| ' || " resetlogs_change# || '| ' || " session_attr || '|' || " session_attr_verbose || ' | ' || " start_scn || '| ' || " end_scn || '| ' || " spill_scn || '|' || " spill_time || ' | ' || " oldest_scn || '| ' || " resume_scn || '|' || " global_db_name || ' | ' || " reset_timestamp || '| ' || " branch_scn || '|' || " version || ' |' || " spare1 || '| ' || " spare2 || '| ' || " spare3 || '| ' || " spare4 || '| ' || " spare5 || '|' || " spare6 || ' |' || " spare7 || ' |' || " spare8 || ' |' " FROM system.logmnr_session$; "PROMPT ___Macro_separator(20)___ "SELECT '| ' || " logmnr_uid || '| ' || " COUNT(*) || '|' " FROM system.logmnrc_gtlo " GROUP BY logmnr_uid; "PROMPT ___Macro_separator(21)___ "SELECT '| ' || " logmnr_uid || '| ' || " obj# || '| ' || " objv# || '| ' || " intcol# || '|' " FROM system.logmnrc_gtcs " GROUP BY logmnr_uid,obj#,objv#,intcol# " HAVING COUNT(1) > 1 " ORDER BY logmnr_uid,obj#,objv#,intcol#; "PROMPT ___Macro_separator(22)___ "SELECT '| ' || " job || '|' || " log_user || ' |' || " priv_user || ' |' || " schema_user || ' |' || " TO_CHAR(last_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " last_sec || ' |' || " TO_CHAR(this_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " this_sec || ' |' || " TO_CHAR(next_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " next_sec || ' | ' || " ROUND(total_time,1) || '|' || " broken || ' |' || " interval || ' | ' || " failures || '|' || " what || ' |' || " nls_env || ' |' || " misc_env || ' | ' || " instance || '|' " FROM dba_jobs; "PROMPT ___Macro_separator(23)___ "SELECT '| ' || " a.logmnr_uid || '| ' || " a.obj# || '| ' || " a.objv# || '| ' || " a.segcol# || '| ' || " a.intcol# || '|' " FROM system.logmnrc_gtcs a " WHERE EXISTS " (SELECT logmnr_uid " FROM system.logmnrc_gtcs b " WHERE a.logmnr_uid = b.logmnr_uid " AND a.obj# = b.obj# " AND a.objv# = b.objv# " AND a.segcol# = b.segcol# " AND a.segcol# <> 0 " AND a.intcol# <> b.intcol#); "PROMPT ___Macro_separator(24)___ "SELECT '|' || " addr || ' | ' || " indx || '| ' || " inst_id || '| ' || " frused_kwqbpmt || '| ' || " flc1_kwqbpmt || '| ' || " flc2_kwqbpmt || '| ' || " flc3_kwqbpmt || '|' " FROM x$kwqbpmt; "PROMPT ___Macro_separator(25)___ "SELECT '|' || " schema || ' |' || " qname || ' |' || " destination || ' |' || " start_date || ' |' || " start_time || ' | ' || " propagation_window || '|' || " next_time || ' | ' || " latency || '|' || " schedule_disabled || ' |' || " process_name || ' |' || " session_id || ' | ' || " instance || '|' || " last_run_date || ' |' || " last_run_time || ' |' || " current_start_date || ' |' || " current_start_time || ' |' || " next_run_date || ' |' || " next_run_time || ' | ' || " total_time || '| ' || " total_number || '| ' || " total_bytes || '| ' || " max_number || '| ' || " max_bytes || '| ' || " avg_number || '| ' || " avg_size || '| ' || " avg_time || '| ' || " failures || '|' || " last_error_date || ' |' || " last_error_time || ' |' || " last_error_msg || ' |' || " message_delivery_mode || ' | ' || " elapsed_dequeue_time || '| ' || " elapsed_pickle_time || ' |' " FROM dba_queue_schedules " ORDER BY schema,qname,destination,message_delivery_mode; "PROMPT ___Macro_separator(26)___ "SELECT '|' || " agent_name || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agents; "PROMPT ___Macro_separator(27)___ "SELECT '|' || " agent_name || ' |' || " db_username || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agent_privs; "PROMPT ___Macro_separator(28)___ "SELECT '| ' || " t.inst_id || '| ' || " sid || '.' || serial# || '|' || " xidusn || '.' || xidslot || '.' || xidsqn || ' |' || " (SYSDATE - start_date) * 1440 || ' |' || " terminal || ' |' || " program || ' |' " FROM gv$transaction t,gv$session s " WHERE t.addr = s.taddr " AND (SYSDATE - start_date) * 1440 > 20; "PROMPT ___Macro_separator(29)___ "SELECT '| ' || " streams_pool_size_factor || '| ' || " streams_pool_size_for_estimate || '| ' || " estd_spill_count || '| ' || " estd_spill_time || '| ' || " estd_unspill_count || '| ' || " estd_unspill_time || '|' " FROM v$streams_pool_advice; "PROMPT ___Macro_separator(30)___ "SELECT '|' || " message_type || ' |' || " creation_time || ' |' || " reason || ' |' || " suggested_action || ' |' || " module_id || ' |' || " object_type || ' |' || " host_id || ' |' || " instance_name ||' ( '||instance_number||' )' || " resolution || ' |' || " time_suggested || ' |' " FROM dba_alert_history " WHERE message_group ='Streams' " AND creation_time >= SYSDATE - 10 and rownum < 11 " ORDER BY creation_time DESC; } } elsif match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Check for Missing Rules in dba_rules',\ '---+ Check for Extra Rules in dba_rules',\ '---+ Check for Rule_Conditions Do not Match between Streams and \ Rules',\ '---+ Check for Source Database Name Does not Match for Capture \ or Propagation Rules',\ '---+ Check for Global Rule for Capture Specified but Condition \ not Modified',\ '---+ Check for No Rule Set Defined for Capture',\ '---+ Check for Apply Rules with no Source Database Specified',\ '---+ Check for Schema Rules for non Existent Schema',\ '---+ Fast Evaluation Rule Set Rules for Queues',\ '---+ Check for Constraints on Tables Configured in Streams',\ '---+ List Indexes on Tables',\ '---+ List Unsupported Tables in Streams',\ '---+ Capture processes defined on system',\ '---+ Apply processes defined on system',\ '---+ Propagations defined on system',\ '---+ Streams rules defined on system',\ '---+ Logminer Database Map1',\ '---+ Logminer Database Map2',\ '---+ Logminer Database Map3',\ '---+ Logminer Cache Objects',\ '---+ Intcol Verification',\ '---+ Jobs in Database',\ '---+ Segcol Verification',\ '---+ Queue Memory and Flow Control Values',\ '---+ DBA_QUEUE_SCHEDULES',\ '---+ Agents',\ '---+ Agent Privileges',\ '---+ Current Long Running Transactions',\ '---+ Streams Pool Advice',\ '---+ Most recent Streams alerts(max=10) occuring within last \ 10 days',\ '---+ Logminer Statistics') var @HDR = ('',\ '|*Rule Owner*|*Rule Name*|',\ '|*Rule Owner*|*Rule Name*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Rule Condition*|',\ '|*Streams Type*|*Streams Name*|*Rule*|',\ '|*Streams Name*|*Rule*|',\ '|*Capture Name*|*Capture Type*|*Source DB*|',\ '|*Streams Name*|*Rule*|*Object*|',\ '|*Streams Type*|*Streams Name*|*Rule*|*Schema Name*|\ *Action Context Name*|*Action Context Value*|',\ '|*Rule Set*|*Rule*|*Rule Condition*|',\ '|*Object*|*Constraint Name*|*Constraint Type*|*Status*|\ *Last Change*|*Search Condition*|*Ref Constraint*|',\ '|*Object*|*Table Type*|*Index Name*|*Index Type*|\ *Funcidx Status*|',\ '|*Owner*|*Table Name*|*Reason*|*Auto Filtered*|',\ '|*Queue*|*Capture Name*| *Capture#*|*Rule Set*|*Rule Set2*|',\ '|*Queue*|*Apply Name*| *Apply#*|*Rule Set*|*Rule Set2*|',\ '|*Source Queue*|*Destination*|*Rule Set*|*Rule Set2*|',\ '|*Streams Name*|*Streams Type*| *Number of Rules*|',\ '|*Global Name*| *Logmnr UID*| *Flags*|*Src*|',\ '| *Logmnr UID*| *Session#*|',\ '| *Session#*| *Client#*|*Session Name*| *DB ID*| \ *Resetlogs Change#*| *Session Attr*|*Session Attr Verbose*| \ *Start SCN*| *End SCN*| *Spill SCN*|*Spill Time*| *Oldest SCN*| \ *Resume SCN*|*Global DBname*| *Reset Timestamp*| *Branch SCN*|\ *Version*|*Redo Compat*| *Spare1*| *Spare2*| *Spare3*| \ *Spare4*| *Spare5*|*Spare6*|*Spare7*|*Spare8*|',\ '| *Logmnr UID*| *Number of Interesting DB Objects*|',\ '| *Logmnr UID*| *Obj#*| *Objv#*| *Intcol#*|',\ '| *Job*|*Log User*|*Priv User*|*Schema User*|*Last Date*|\ *Last Sec*|*This Date*|*This Sec*|*Next Date*|*Next Sec*| \ *Total Time*|*Broken*|*Interval*| *Failures*|*What*|*NLS Env*|\ *Misc Env*| *Instance*|',\ '| *Logmnr UID*| *Obj#*| *Objv#*| *Segcol#*| *Intcol#*|',\ '|*Addr*| *Indx*| *Inst ID*| *Frused Kwqbpmt*| *Flbp kwqbpmt*| \ *Flcp Kwqbpmt*|',\ '|*Schema*|*Qname*|*Destination*|*Start Date*|*Start Time*| \ *Propagation Window*|*Next Time*| *Latency*|*Schedule Disabled*|\ *Process Name*|*Session ID*| *Instance*|*Last Run Date*|\ *Last Run Time*|*Current Start Date*|*Current Start Time*|\ *Next Run Date*|*Next Run Time*| *Total Time*| *Total Number*| \ *Total Bytes*| *Max Number*| *Max Bytes*| *Avg Number*| \ *Avg Size*| *Avg Time*| *Failures*|*Last Error Date*|\ *Last Error Time*|*Last Error Msg*|*Message Delivery Mode*| \ *Elapsed Dequeue Time*| *Elapsed Pickle Time*|*Job Name*|',\ '|*Agent Name*|*HTTP Enabled*|*SMTP Enabled*|',\ '|*Agent Name*|*DB Username*|*HTTP Enabled*|*SMTP Enabled*|',\ '| *Inst ID*| *SID*|*Xid*|*Run Length*|*Terminal*|*Program*|',\ '| *Streams Pool Size Factor*| *Streams Pool Size for Estimate*| \ *Estd Spill Count*| *Estd Spill Time*| *Estd Unspill Count*| \ *Estd Unspill Time*|',\ '|*Message Type*|*Creation Time*|*Reason*|*Suggested Action*|\ *Module ID*|*Object Type*|*Host ID*|*Instance*|\ *Resolution*|*Time Suggested*|',\ '|*Capture Name*|*Name*|*Value*|') set $sql {SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_streams_rules "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_rules "MINUS "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' " FROM dba_streams_rules; "PROMPT ___Macro_separator(3)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_streams_rules s,dba_rules r " WHERE r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) != dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_type || ' |' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM dba_streams_rules r " WHERE source_database IS NOT NULL " AND source_database != (SELECT global_name FROM global_name) " AND streams_type IN ('CAPTURE','PROPAGATION'); "PROMPT ___Macro_separator(5)___ "SELECT '|' || " streams_name || ' |' || " r.rule_owner || '.' || r.rule_name || ' |' " FROM dba_streams_rules s,dba_rules r " WHERE streams_type = 'CAPTURE' " AND rule_type = 'GLOBAL' " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(6)___ "SELECT '|' || " capture_name || ' |' || " capture_type || ' |' || " source_database || ' |' " FROM dba_capture " WHERE rule_set_name IS NULL " AND negative_rule_set_name IS NULL; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.schema_name || '.' || s.object_name || ' |' " FROM dba_streams_rules s,dba_rules r " WHERE s.streams_type = 'APPLY' " AND s.source_database IS NULL " AND r.rule_name = s.rule_name " AND r.rule_owner = s.rule_owner " AND dbms_lob.substr(s.rule_condition) = dbms_lob.substr(r.rule_condition); "PROMPT ___Macro_separator(8)___ "SELECT '|' || " s.streams_type || ' |' || " s.streams_name || ' |' || " s.rule_owner || '.' || s.rule_name || ' |' || " s.schema_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_streams_rules s,dba_rules r,dba_users u, " TABLE(r.rule_action_context.actx_list) ac " WHERE s.schema_name IS NULL " AND u.username = s.schema_name " AND r.rule_owner = s.rule_owner " AND r.rule_name = s.rule_name " AND ac.nvn_value.accessvarchar2() IS NULL; "PROMPT ___Macro_separator(9)___ "SET long 4000 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner||'.'||rsr.rule_set_name || ' |' || " rsr.rule_owner||'.'||rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_set_name LIKE '%_R' " AND rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " ORDER BY rsr.rule_set_owner,rsr.rule_set_name,rsr.rule_owner,rsr.rule_name; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " c.owner||'.'||c.table_name || ' |' || " c.constraint_name || ' |' || " c.constraint_type || ' |' || " status || ' |' || " last_change || ' |' || " r_owner||'.'||r_constraint_name || ' |' " FROM dba_constraints c,dba_apply_instantiated_objects p " WHERE c.owner = p.source_object_owner " AND c.table_name = p.source_object_name " AND c.constraint_type IN ('P','U','R','C') " AND constraint_name NOT LIKE 'SYS_IOT%' " ORDER BY c.owner,c.table_name; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " table_owner || '.' || table_name || ' |' || " table_type || ' |' || " index_name || ' |' || " index_type || ' |' || " funcidx_status || ' |' " FROM dba_indexes i,dba_apply_instantiated_objects p " WHERE i.owner = p.source_object_owner " AND i.table_name = p.source_object_name " ORDER BY i.owner,i.table_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " owner || ' |' || " table_name || ' |' || " reason || ' |' || " auto_filtered || ' |' " FROM dba_streams_unsupported; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " capture_name || ' | ' || " capture# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' || " negative_ruleset_owner || '.' || negative_ruleset_name || ' |' " FROM sys.streams$_capture_process; "PROMPT ___Macro_separator(14)___ "SELECT '|' || " queue_owner || '.' || queue_name || ' |' || " apply_name || ' | ' || " apply# || '|' || " ruleset_owner || '.' || ruleset_name || ' |' || " negative_ruleset_owner || '.' || negative_ruleset_name || ' |' " FROM sys.streams$_apply_process; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " source_queue_schema || '.' || source_queue || ' |' || " destination_queue_schema || '.' || destination_queue " || '@' || destination_dblink || ' |' || " ruleset_schema || '.' || ruleset || ' |' || " negative_ruleset_schema || '.' || negative_ruleset || ' |' " FROM sys.streams$_propagation_process; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " streams_name || ' | ' || " streams_type || '| ' || " COUNT(*) || '|' " FROM sys.streams$_rules " GROUP BY streams_name,streams_type; "PROMPT ___Macro_separator(17)___ "SELECT '|' || " global_name || ' | ' || " logmnr_uid || '| ' || " flags || '|' || " 'MAP'|| '|' " FROM (SELECT global_name, " logmnr_uid, " flags, " 'MAP' type " FROM system.logmnrc_dbname_uid_map " UNION " SELECT s.global_db_name global_name, " u.logmnr_uid logmnr_uid, " NULL flags, " 'UID$' type " FROM system.logmnr_uid$ u,system.logmnr_session$ s " WHERE u.session# = s.session#) " ORDER BY logmnr_uid; "PROMPT ___Macro_separator(18)___ "SELECT '| ' || " logmnr_uid || '| ' || " session# || '|' " FROM system.logmnr_uid$; "PROMPT ___Macro_separator(19)___ "SELECT '| ' || " session# || '| ' || " client# || '|' || " session_name || ' | ' || " db_id || '| ' || " resetlogs_change# || '| ' || " session_attr || '|' || " session_attr_verbose || ' | ' || " start_scn || '| ' || " end_scn || '| ' || " spill_scn || '|' || " spill_time || ' | ' || " oldest_scn || '| ' || " resume_scn || '|' || " global_db_name || ' | ' || " reset_timestamp || '| ' || " branch_scn || '|' || " version || ' |' || " redo_compat || ' | ' || " spare1 || '| ' || " spare2 || '| ' || " spare3 || '| ' || " spare4 || '| ' || " spare5 || '|' || " spare6 || ' |' || " spare7 || ' |' || " spare8 || ' |' " FROM system.logmnr_session$; "PROMPT ___Macro_separator(20)___ "SELECT '| ' || " logmnr_uid || '| ' || " COUNT(*) || '|' " FROM system.logmnrc_gtlo " GROUP BY logmnr_uid; "PROMPT ___Macro_separator(21)___ "SELECT '| ' || " logmnr_uid || '| ' || " obj# || '| ' || " objv# || '| ' || " intcol# || '|' " FROM system.logmnrc_gtcs " GROUP BY logmnr_uid,obj#,objv#,intcol# " HAVING COUNT(1) > 1 " ORDER BY logmnr_uid,obj#,objv#,intcol#; "PROMPT ___Macro_separator(22)___ "SELECT '| ' || " job || '|' || " log_user || ' |' || " priv_user || ' |' || " schema_user || ' |' || " TO_CHAR(last_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " last_sec || ' |' || " TO_CHAR(this_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " this_sec || ' |' || " TO_CHAR(next_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " next_sec || ' | ' || " ROUND(total_time,1) || '|' || " broken || ' |' || " interval || ' | ' || " failures || '|' || " what || ' |' || " nls_env || ' |' || " misc_env || ' | ' || " instance || '|' " FROM dba_jobs; "PROMPT ___Macro_separator(23)___ "SELECT '| ' || " a.logmnr_uid || '| ' || " a.obj# || '| ' || " a.objv# || '| ' || " a.segcol# || '| ' || " a.intcol# || '|' " FROM system.logmnrc_gtcs a " WHERE EXISTS " (SELECT logmnr_uid " FROM system.logmnrc_gtcs b " WHERE a.logmnr_uid = b.logmnr_uid " AND a.obj# = b.obj# " AND a.objv# = b.objv# " AND a.segcol# = b.segcol# " AND a.segcol# <> 0 " AND a.intcol# <> b.intcol#); "PROMPT ___Macro_separator(24)___ "SELECT '|' || " addr || ' | ' || " indx || '| ' || " inst_id || '| ' || " frused_kwqbpmt || '| ' || " flbp_kwqbpmt || '| ' || " flcp_kwqbpmt || '|' " FROM x$kwqbpmt; "PROMPT ___Macro_separator(25)___ "SELECT '|' || " schema || ' |' || " qname || ' |' || " destination || ' |' || " start_date || ' |' || " start_time || ' | ' || " propagation_window || '|' || " next_time || ' | ' || " latency || '|' || " schedule_disabled || ' |' || " process_name || ' |' || " session_id || ' | ' || " instance || '|' || " last_run_date || ' |' || " last_run_time || ' |' || " current_start_date || ' |' || " current_start_time || ' |' || " next_run_date || ' |' || " next_run_time || ' | ' || " total_time || '| ' || " total_number || '| ' || " total_bytes || '| ' || " max_number || '| ' || " max_bytes || '| ' || " avg_number || '| ' || " avg_size || '| ' || " avg_time || '| ' || " failures || '|' || " last_error_date || ' |' || " last_error_time || ' |' || " last_error_msg || ' |' || " message_delivery_mode || ' | ' || " elapsed_dequeue_time || '| ' || " elapsed_pickle_time || ' |' || " job_name || ' |' " FROM dba_queue_schedules " ORDER BY schema,qname,destination,message_delivery_mode; "PROMPT ___Macro_separator(26)___ "SELECT '|' || " agent_name || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agents; "PROMPT ___Macro_separator(27)___ "SELECT '|' || " agent_name || ' |' || " db_username || ' |' || " http_enabled || ' |' || " smtp_enabled || ' |' " FROM dba_aq_agent_privs; "PROMPT ___Macro_separator(28)___ "SELECT '| ' || " t.inst_id || '| ' || " sid || '.' || serial# || '|' || " xidusn || '.' || xidslot || '.' || xidsqn || ' |' || " (SYSDATE - start_date) * 1440 || ' |' || " terminal || ' |' || " program || ' |' " FROM gv$transaction t,gv$session s " WHERE t.addr = s.taddr " AND (SYSDATE - start_date) * 1440 > 20; "PROMPT ___Macro_separator(29)___ "SELECT '| ' || " streams_pool_size_factor || '| ' || " streams_pool_size_for_estimate || '| ' || " estd_spill_count || '| ' || " estd_spill_time || '| ' || " estd_unspill_count || '| ' || " estd_unspill_time || '|' " FROM v$streams_pool_advice; "PROMPT ___Macro_separator(30)___ "SELECT '|' || " message_type || ' |' || " creation_time || ' |' || " reason || ' |' || " suggested_action || ' |' || " module_id || ' |' || " object_type || ' |' || " host_id || ' |' || " instance_name ||' ( '||instance_number||' )' || " resolution || ' |' || " time_suggested || ' |' " FROM dba_alert_history " WHERE message_group ='Streams' " AND creation_time >= SYSDATE - 10 and rownum < 11 " ORDER BY creation_time DESC; "PROMPT ___Macro_separator(31)___ "SELECT '|' || " c.capture_name || ' |' || " name || ' |' || " value || ' |' " FROM gv$streams_capture c,gv$logmnr_stats l " WHERE c.logminer_id = l.session_id " ORDER BY capture_name,name; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Rules Analyses',3) } =head2 topology - Topology Analyses Performs topology checks. (Oracle 11g and later) =cut debug ' Inside STC module, gathering topology analysis results' report topology var $sql = undef var $TTL = '---+!! Topology Analyses' if match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Topology Databases',\ '---+ Streams Components',\ '---+ Streams Component Statistics',\ '---+ Streams Active Paths',\ '---+ Streams Path Highest Activity Process (Bottleneck)',\ '---+ Streams Path Statistics',\ '---+ Streams Message Tracking') var @HDR = ('',\ '|*Global Name*|*Last Queried*|*Version*|*Compatibility*|\ *Management Pack Access*|',\ '| *Component ID*|*Component Name*|*Component DB*|\ *Component Type*|*Component Changed Time*|',\ '| *Component ID*|*Component Name*|*Component DB*|\ *Component Type*|*Subcomponent Type*| *Session ID*| \ *Session Serial#*|*Statistic Time*|*Statistic Name*| \ *Statistic Value*|*Statistic Unit*| *Advisor Run ID*|\ *Advisor Run Time*|',\ '| *Path ID*| *Position*| *Source Component ID*|\ *Source Component DB*|*Source Component Name*|\ *Source Component Type*| *Destination Component ID*|\ *Destination Component DB*|*Destination Component Name*|\ *Destination Component Type*|',\ '| *Path ID*| *Component ID*|*Component Name*|*Component DB*|\ *Component Type*| *Top Session ID*| *Top Session Serial#*|\ *Action Name*|*Bottleneck Identified*| *Advisor Run ID*|\ *Advisor Run Time*|*Advisor Run Reason*|',\ '| *Path ID*|*Statistic Time*|*Statistic Name*| \ *Statistic Value*|*Statistic Unit*| *Advisor Run ID*|\ *Advisor Run Time*|',\ '| *Inst ID*|*Tracking Label*|*Tag*|*Component Name*|\ *Component Type*|*Action*|*Action Details*|*Timestamp*|\ *Message Creation Time*| *Message Number*|*Tracking ID*|\ *Source Database Name*|*Object Owner*|*Object Name*|\ *Xid*|*Command Type*|') set $sql {EXEC dbms_streams_advisor_adm.ANALYZE_CURRENT_PERFORMANCE; "EXEC dbms_lock.sleep(5); "EXEC dbms_streams_advisor_adm.ANALYZE_CURRENT_PERFORMANCE; "EXEC dbms_lock.sleep(5); "EXEC dbms_streams_advisor_adm.ANALYZE_CURRENT_PERFORMANCE; "PROMPT ___Macro_separator(1)___ "SELECT '|' || " global_name || ' |' || " last_queried || ' |' || " version || ' |' || " compatibility || ' |' || " management_pack_access || ' |' " FROM dba_streams_tp_database; "PROMPT ___Macro_separator(2)___ "SELECT '| ' || " component_id || '|' || " component_name || ' |' || " component_db || ' |' || " component_type || ' |' || " component_changed_time || ' |' " FROM dba_streams_tp_component " ORDER BY component_id; "PROMPT ___Macro_separator(3)___ "SELECT '| ' || " component_id || '|' || " component_name || ' |' || " component_db || ' |' || " component_type || ' |' || " sub_component_type || ' | ' || " session_id || '| ' || " session_serial# || '|' || " statistic_time || ' |' || " statistic_name || ' | ' || " statistic_value || '|' || " statistic_unit || ' | ' || " advisor_run_id || '|' || " advisor_run_time || ' |' " FROM dba_streams_tp_component_stat " ORDER BY component_id,advisor_run_id,statistic_name; "PROMPT ___Macro_separator(4)___ "SELECT '| ' || " path_id || '| ' || " position || '| ' || " source_component_id || ' - from' || '|' || " source_component_db || ' |' || " source_component_name || ' |' || " source_component_type || ' | ' || " destination_component_id || ' - to' || '|' || " destination_component_db || ' |' || " destination_component_name || ' |' || " destination_component_type || ' |' " FROM dba_streams_tp_component_link " WHERE active = 'YES' " ORDER BY path_id,position; "PROMPT ___Macro_separator(5)___ "SELECT '| ' || " path_id || '| ' || " component_id || '|' || " component_name || ' |' || " component_db || ' |' || " component_type || ' | ' || " top_session_id || '| ' || " top_session_serial# || '|' || " action_name || ' |' || " bottleneck_identified || '| ' || " advisor_run_id || '|' || " advisor_run_time || ' |' || " advisor_run_reason || ' | ' " FROM dba_streams_tp_path_bottleneck " WHERE bottleneck_identified = 'YES' " AND advisor_run_id = " (SELECT max(advisor_run_id) " FROM dba_streams_tp_path_bottleneck) " ORDER BY path_id,advisor_run_id; "PROMPT ___Macro_separator(6)___ "SELECT '| ' || " path_id || '|' || " statistic_time || ' |' || " statistic_name || ' | ' || " statistic_value || '|' || " statistic_unit || ' | ' || " advisor_run_id || '|' || " advisor_run_time || ' |' " FROM dba_streams_tp_path_stat "ORDER BY path_id,advisor_run_id,statistic_name; "PROMPT ___Macro_separator(7)___ "SELECT '| ' || " inst_id || '|' || " tracking_label || ' |' || " tag || ' |' || " component_name || ' |' || " component_type || ' |' || " action || ' |' || " action_details || ' |' || " timestamp || ' |' || " message_creation_time || ' | ' || " message_number || '|' || " tracking_id || ' |' || " source_database_name || ' |' || " object_owner || ' |' || " object_name || ' |' || " xid || ' |' || " command_type || ' |' " FROM gv$streams_message_tracking " ORDER BY tracking_label,timestamp; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Topology Analyses',3) } =head2 wait - Wait Analyses Performs wait checks. (Oracle 10g and later) =cut debug ' Inside STC module, gathering wait analysis information' report wait var $sql = undef var $TTL = '---+!! Wait Analyses' if match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Logminer Reader Processes',\ '---+ Logminer Preparer Processes',\ '---+ Logminer Builder Processes',\ '---+ Capture Processes',\ '---+ Apply Reader Processes',\ '---+ Apply Coordinator Processes',\ '---+ Apply Server Processes') var @HDR = ('',\ '|*Logminer Reader Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Logminer Preparer Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Logminer Builder Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Capture Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Apply Reader Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Apply Coordinator Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Apply Server Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|') set $sql {SELECT '|' || " c.capture_name || ' - reader' || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '|' || " 'YES' || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$logmnr_process lp, " v$streams_capture c " WHERE lp.sid = ash_capture.session_id " AND lp.serial# = ash_capture.session_serial# " AND lp.role = 'reader' and lp.session_id = c.logminer_id " ORDER BY c.capture_name || ' - reader', " ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " c.capture_name || ' - preparer' || lp.spid || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '|' || " 'YES' || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$logmnr_process lp, " v$streams_capture c " WHERE lp.sid = ash_capture.session_id " AND lp.serial# = ash_capture.session_serial# " AND lp.role = 'preparer' and lp.session_id = c.logminer_id " ORDER BY c.capture_name || ' - preparer' || lp.spid, " ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " c.capture_name || ' - builder' || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '|' || " 'YES' || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$logmnr_process lp, " v$streams_capture c " WHERE lp.sid = ash_capture.session_id " AND lp.serial# = ash_capture.session_serial# " AND lp.role = 'builder' and lp.session_id = c.logminer_id " ORDER BY c.capture_name || ' - builder', " ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " c.capture_name || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '| ' || " DECODE(ash_capture.event, " 'Streams capture: waiting for subscribers to catch up','NO', " 'Streams capture: resolve low memory condition','NO', " 'Streams capture: waiting for archive log','NO', " 'YES') || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_capture c " WHERE c.sid = ash_capture.session_id " AND c.serial# = ash_capture.session_serial# " ORDER BY capture_name,ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " a.apply_name || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '|' || " DECODE(ash.event, " 'rdbms ipc message','NO', " 'YES') || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_apply_reader a " WHERE a.sid = ash.session_id " AND a.serial# = ash.session_serial# " ORDER BY apply_name,ash.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " a.apply_name || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '|' || " 'YES' || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_apply_coordinator a " WHERE a.sid = ash.session_id " AND a.serial# = ash.session_serial# " ORDER BY apply_name,ash.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " a.apply_name || ' - ' || a.server_id || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '| ' || " 'YES' || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_apply_server a " WHERE a.sid = ash.session_id " AND a.serial# = ash.session_serial# " ORDER BY a.apply_name || ' - ' || a.server_id, " ash.event_count * 100 / ash_total.total_count; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Logminer Reader Processes',\ '---+ Logminer Preparer Processes',\ '---+ Logminer Builder Processes',\ '---+ Capture Processes',\ '---+ Propagation Sender Processes',\ '---+ Propagation Receiver Processes',\ '---+ Apply Reader Processes',\ '---+ Apply Coordinator Processes',\ '---+ Apply Server Processes') var @HDR = ('',\ '|*Logminer Reader Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Logminer Preparer Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Logminer Builder Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Capture Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Propagation Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Propagation Receiver Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Apply Reader Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Apply Coordinator Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|',\ '|*Apply Server Name*| *Event Count*| *Total Count*| \ *Percentage*|*Busy*|*Event*|') set $sql {SELECT '|' || " c.capture_name || ' - reader' || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '|' || " 'YES' || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$logmnr_process lp, " v$streams_capture c " WHERE lp.sid = ash_capture.session_id " AND lp.serial# = ash_capture.session_serial# " AND lp.role = 'reader' " AND lp.session_id = c.logminer_id " ORDER BY c.capture_name || ' - reader', " ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " c.capture_name || ' - preparer' || lp.spid || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '| ' || " 'YES' || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$logmnr_process lp, " v$streams_capture c " WHERE lp.sid = ash_capture.session_id " AND lp.serial# = ash_capture.session_serial# " AND lp.role = 'preparer' " AND lp.session_id = c.logminer_id " ORDER BY c.capture_name || ' - preparer' || lp.spid, " ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " c.capture_name || ' - builder' || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '| ' || " 'YES' || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$logmnr_process lp, " v$streams_capture c " WHERE lp.sid = ash_capture.session_id " AND lp.serial# = ash_capture.session_serial# " AND lp.role = 'builder' " AND lp.session_id = c.logminer_id " ORDER BY c.capture_name || ' - builder', " ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " c.capture_name || ' | ' || " ash_capture.event_count || '| ' || " ash_total.total_count || '| ' || " ash_capture.event_count * 100 / ash_total.total_count || '|' || " DECODE(ash_capture.event, " 'Streams capture: waiting for subscribers to catch up','NO', " 'Streams capture: resolve low memory condition','NO', " 'Streams capture: waiting for archive log','NO', " 'YES') || ' |' || " ash_capture.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash_capture, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_capture c " WHERE c.sid = ash_capture.session_id " AND c.serial# = ash_capture.session_serial# " ORDER BY capture_name,ash_capture.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " '"' || vps.queue_schema || '"."' || vps.queue_name " || '"=>' || vps.dblink || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '|' || " DECODE(ash.event, " 'SQL*Net more data to dblink','NO', " 'SQL*Net message from dblink','NO', " 'YES') || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$propagation_sender vps, " x$kwqps xps " WHERE xps.kwqpssid = ash.session_id " AND xps.kwqpsser = ash.session_serial# " AND xps.kwqpsqid = vps.queue_id " AND vps.dblink = xps.kwqpsdbn " ORDER BY ('"' || vps.queue_schema ||'"."'|| vps.queue_name || " '"=>'||vps.dblink), " ash.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " '"' || vpr.src_queue_schema || '"."' ||vpr.src_queue_name " || '@' || vpr.src_dbname|| '"=>'||global_name || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '| ' || " DECODE(ash.event, " 'Streams AQ: enqueue blocked on low memory','NO', " 'Streams AQ: enqueue blocked due to flow control','NO', " 'YES') || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$propagation_receiver vpr, " x$kwqpd xpd, " global_name " WHERE xpd.kwqpdsid = ash.session_id " AND xpd.kwqpdser = ash.session_serial# " AND xpd.kwqpdsqn = vpr.src_queue_name " AND xpd.kwqpdsqs = vpr.src_queue_schema " AND xpd.kwqpddbn = vpr.src_dbname " ORDER BY ('"' || vpr.src_queue_schema ||'"."'|| vpr.src_queue_name || " '@' || vpr.src_dbname|| '"=>'||global_name), " ash.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " a.apply_name || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '|' || " DECODE(ash.event, " 'rdbms ipc message','NO', " 'YES') || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_apply_reader a " WHERE a.sid = ash.session_id " AND a.serial# = ash.session_serial# " ORDER BY a.apply_name,ash.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " a.apply_name || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '|' || " 'YES' || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_apply_coordinator a " WHERE a.sid = ash.session_id " AND a.serial# = ash.session_serial# " ORDER BY a.apply_name,ash.event_count * 100 / ash_total.total_count; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " a.apply_name || ' - ' || a.server_id || ' | ' || " ash.event_count || '| ' || " ash_total.total_count || '| ' || " ash.event_count * 100 / ash_total.total_count || '| ' || " 'YES' || ' |' || " ash.event || ' |' " FROM (SELECT session_id, " session_serial#, " event, " COUNT(sample_time) AS event_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440 " GROUP BY session_id,session_serial#,event) ash, " (SELECT COUNT(DISTINCT sample_time) AS total_count " FROM v$active_session_history " WHERE sample_time > SYSDATE - :1 / 1440) ash_total, " v$streams_apply_server a " WHERE a.sid = ash.session_id " AND a.serial# = ash.session_serial# " ORDER BY a.apply_name || ' - ' || a.server_id, " ash.event_count * 100 / ash_total.total_count; } } if $sql {call separator(1) call writeSql(bindSql($sql,$STC_WAIT),2) call separator(0,'Wait Analyses',3) } =head2 other - Other Analyses Performs additional checks. (Oracle 10g and later) =cut debug ' Inside STC module, performing other checks' report other var $sql = undef var $TTL = '---+!! Other Analyses' if match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ init.ora Checks',\ '---+ Configuration Checks',\ '---+ Notifications ',\ '---+ Performance Checks') var @HDR = ('',\ '|* Details *|',\ '|* Details *|',\ '|* Details *|',\ '|* Details *|') set $sql {SET serverout on size 100000 "SELECT '|The parameter global_names must be set to ''TRUE''|' " FROM v$parameter " WHERE UPPER(name) = 'GLOBAL_NAMES' " AND UPPER(NVL(value,'FALSE')) != 'TRUE'; "DECLARE " mynum NUMBER; " apply_procs NUMBER; " capture_procs NUMBER; " num_downstream_cap NUMBER; " mychar v$parameter.value%TYPE; "BEGIN " SELECT NVL(TO_NUMBER(value),0) " INTO mynum " FROM v$parameter " WHERE UPPER(name) = 'JOB_QUEUE_PROCESSES'; " IF mynum < 4 " THEN " dbms_output.put_line( " '|The parameter job_queue_processes must be set to at least 4|'); " END IF; " SELECT NVL(TO_NUMBER(value),0) " INTO mynum " FROM v$parameter " WHERE UPPER(name) = 'OPEN_LINKS'; " IF mynum < 4 " THEN " dbms_output.put_line( " '|The parameter open_links must be set to at least 4|'); " END IF; " SELECT NVL(SUM(TO_NUMBER(value)+2),0) " INTO capture_procs " FROM dba_capture_parameters " WHERE parameter = 'PARALLELISM'; " SELECT NVL(SUM(TO_NUMBER(value)+2),0) " INTO apply_procs " FROM dba_apply_parameters " WHERE parameter = 'PARALLELISM'; " SELECT NVL(TO_NUMBER(value),0) " INTO mynum " FROM v$parameter " WHERE UPPER(name) = 'PARALLEL_MAX_SERVERS'; " IF mynum < capture_procs + apply_procs " THEN " dbms_output.put_line( " '|The parameter parallel_max_servers must be set to at least ' || " TO_CHAR(capture_procs + apply_procs) || " '. If you have stray Capture or Apply processes on the system, ' || " 'you can ignore this error.|'); " END IF; " SELECT COUNT(*) " INTO num_downstream_cap " FROM dba_capture " WHERE capture_type = 'DOWNSTREAM'; " IF num_downstream_cap > 0 " THEN " SELECT NVL(value,'FALSE') " INTO mychar " FROM v$parameter " WHERE UPPER(name) = 'REMOTE_ARCHIVE_ENABLE'; " END IF; " IF UPPER(mychar) = 'FALSE' " THEN " dbms_output.put_line( " '|The parameter remote_archive_enable must be set to ''TRUE''|'); " END IF; "END; "/ "PROMPT ___Macro_separator(2)___ "DECLARE " overlap_rules BOOLEAN := FALSE; " verbose BOOLEAN := TRUE; " capture_count NUMBER; " row_count NUMBER; " latency NUMBER; " current_value dba_apply_parameters.value%TYPE; " CURSOR propagation_latency IS " SELECT propagation_name, " latency " FROM dba_propagation,dba_queue_schedules " WHERE schema = source_queue_owner " AND qname = source_queue_name " AND destination = destination_dblink " AND latency >= 60; " CURSOR multiqueues IS " SELECT c.capture_name, " a.apply_name, " c.queue_owner, " c.queue_name " FROM dba_capture c,dba_apply a " WHERE c.queue_name = a.queue_name " AND c.queue_owner = a.queue_owner " AND c.capture_type != 'DOWNSTREAM'; " CURSOR nonlogged_tables IS " SELECT c.table_owner owner, " c.table_name name " FROM dba_capture_prepared_tables c " WHERE NOT EXISTS( " SELECT 'X' " FROM dba_log_groups l " WHERE c.table_owner = l.owner " AND c.table_name = l.table_name); " CURSOR overlapping_rules IS " SELECT a.streams_name sname, " a.streams_type stype, " a.rule_set_owner , " a.rule_set_name, " a.rule_owner owner1, " a.rule_name name1, " a.streams_rule_type type1, " b.rule_owner owner2, " b.rule_name name2, " b.streams_rule_type type2 " FROM dba_streams_rules a,dba_streams_rules b " WHERE a.rule_set_owner = b.rule_set_owner " AND a.rule_set_name = b.rule_set_name " AND a.streams_name = b.streams_name AND a.streams_type = b.streams_type " AND a.rule_type = b.rule_type " AND (a.subsetting_operation IS NULL OR b.subsetting_operation IS NULL) " AND (a.rule_owner != b.rule_owner OR a.rule_name != b.rule_name) " AND ((a.streams_rule_type = 'GLOBAL' " AND b.streams_rule_type IN ('SCHEMA','TABLE') " AND a.schema_name = b.schema_name) " OR (a.streams_rule_type = 'SCHEMA' AND b.streams_rule_type = 'TABLE' " AND a.schema_name = b.schema_name) " OR (a.streams_rule_type = 'TABLE' AND b.streams_rule_type = 'TABLE' " AND a.schema_name = b.schema_name AND a.object_name = b.object_name " AND a.rule_name < b.rule_name) " OR (a.streams_rule_type = 'SCHEMA' AND b.streams_rule_type = 'SCHEMA' " AND a.schema_name = b.schema_name AND a.rule_name < b.rule_name) " OR (a.streams_rule_type = 'GLOBAL' AND b.streams_rule_type = 'GLOBAL' " AND a.rule_name < b.rule_name)) " ORDER BY a.rule_name; " CURSOR spilled_apply IS " SELECT a.apply_name " FROM dba_apply_parameters p,dba_apply a,gv$buffered_queues q " WHERE a.queue_owner = q.queue_schema " AND a.queue_name = q.queue_name " AND a.apply_name = p.apply_name " AND p.parameter = 'PARALLELISM' " AND p.value > 1 " AND (q.cspill_msgs/DECODE(q.cnum_msgs,0,1,q.cnum_msgs) * 100) > 25; " CURSOR bad_source_db IS " SELECT rule_owner||'.'||rule_name rule_name, " source_database " FROM dba_streams_rules " WHERE source_database IS NOT NULL " AND source_database NOT IN " (SELECT global_name " FROM system.logmnrc_dbname_uid_map); " CURSOR qtab_too_long IS " SELECT queue_table name, " LENGTH(queue_table) len " FROM dba_queues q,dba_apply a " WHERE LENGTH(queue_table) > 19 " AND q.owner = a.queue_owner " AND q.name = a.queue_name; " CURSOR reginfo_invalid IS " SELECT comp_id, " status " FROM dba_registry " WHERE comp_id IN ('CATALOG','CATPROC') " AND status <> 'VALID'; " CURSOR version_diff IS " SELECT i.version inst_version, " r.version reg_version " FROM v$instance i,dba_registry r " WHERE r.comp_id IN ('CATALOG','CATPROC') " AND i.version <> r.version; "BEGIN " FOR rec IN propagation_latency " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: the Propagation process ''' || rec.propagation_name || " ''' has latency ' || rec.latency || ', it should be 5 or less!'); " IF verbose " THEN " dbms_output.put_line('%BR%Set the latency by calling ' || " 'dbms_aqadm.alter_schedule(queue_name,destination,latency => 5)'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN bad_source_db " LOOP " dbms_output.put_line('|ERROR: The rule ' || rec.rule_name || " ' specifies an unknown source database: ''' || rec.source_database || " '''.|'); " END LOOP; " FOR rec IN qtab_too_long " LOOP " dbms_output.put_line('|ERROR: The queue table name ''' || rec.name || " ''' has length of ' || rec.len || " ' bytes, it should be 19 bytes or less!|'); " END LOOP; " FOR rec IN reginfo_invalid " LOOP " dbms_output.put_line('|ERROR: The DBA_REGISTRY status information for ' || " 'component ''' || rec.comp_id || ''' requires attention. Status is ' || " rec.status || '. Recompile the component|'); " END LOOP; " FOR rec IN version_diff " LOOP " dbms_output.put_line('|ERROR: The ORACLE_HOME software is ''' || " rec.inst_version || ''' but the database catalog is ' || " rec.reg_version || " ' .CATPATCH must be run successfully to complete the upgrade|'); " END LOOP; " FOR rec IN multiqueues " LOOP " dbms_output.put_line('[[[' ||CHR(10) || " '|WARNING: the Capture process ''' || rec.capture_name || " ''' and Apply process ''' || rec.apply_name || '''share the same queu'); " dbms_output.put_line('e ''' || rec.queue_owner || '.' || " rec.queue_name || '''. If the Apply process is receiving changes fro'); " dbms_output.put_line( " 'm a remote site, a separate queue should be created for' || " ' the Apply process.|' || CHR(10) || ']]]'); " END LOOP; " SELECT COUNT(*) " INTO capture_count " FROM dba_capture " WHERE capture_type != 'DOWNSTREAM'; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE log_mode = 'NOARCHIVELOG'; " IF row_count > 0 AND capture_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: ARCHIVELOG mode must be enabled for this database.'); " IF verbose " THEN " dbms_output.put_line('%BR%For a Streams Capture process to function '|| " 'correctly, it must be able to read the archive logs. Refer t'); " dbms_output.put_line( " 'o the documentation to restart the database' || " ' in ARCHIVELOG format.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE SUPPLEMENTAL_LOG_DATA_MIN = 'NO'; " IF row_count > 0 AND capture_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: Minimal supplemental logging not enabled.'); " IF verbose " THEN " dbms_output.put_line('%BR%For a Streams Capture process to function ' || " 'correctly, at least minimal supplemental logging should be enabled. E'); " dbms_output.put_line('xecute ''ALTER DATABASE ADD SUPPLEMENTAL LOG ' || " 'DATA'' to fix this issue. Note you may need to specify further level'); " dbms_output.put_line('s of supplemental logging, see the ' || " 'documentation for more details.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE supplemental_log_data_pk = 'NO'; " IF row_count > 0 AND capture_count > 0 " THEN " FOR rec IN nonlogged_tables " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: No supplemental logging specified for table ''' || " rec.owner || '.' || rec.name || '''.'); " IF verbose " THEN " dbms_output.put_line('%BR%In order for Streams to work properly, it ' || " 'must have key information supplementally logged for each table who'); " dbms_output.put_line('se changes are being captured. ' || " 'This system does not have database level primary key information lo'); " dbms_output.put_line('gged, thus for each interested table manual ' || " 'logging must be specified. See the documentation for more info.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " END IF; " overlap_rules := FALSE; " FOR rec IN overlapping_rules " LOOP " overlap_rules := TRUE; " dbms_output.put_line( " '|WARNING: The rule ''' || rec.owner1 || '.' ||rec.name1 || " ''' and ''' || rec.owner2 || '.' || rec.name2 || ''' from rule set ''' || " rec.rule_set_owner || '.' || rec.rule_set_name || ''' overlap.|'); " END LOOP; " IF overlap_rules AND verbose " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|Overlapping rules are a problem especially when rule-based' || " 'transformations exist. St'); " dbms_output.put_line( " 'reams makes no guarantees of which rule in a rule set will evaluate'); " dbms_output.put_line( " 'to TRUE, thus overlapping rules will cause inconsistent behavior, an'); " dbms_output.put_line( " 'd should be avoided.|' || CHR(10) || ']]]'); " END IF; " IF verbose " THEN " SELECT COUNT(*) " INTO row_count " FROM dba_propagation " WHERE rule_set_owner IS NOT NULL " AND rule_set_name IS NOT NULL; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more propagation processes contain rule sets. I'); " dbms_output.put_line( " 'f a Propagation process will unconditionally forward all incoming me'); " dbms_output.put_line( " 'ssages to its destination queue, and no rule-based transformations a'); " dbms_output.put_line( " 're performed by the Propagation process, you should consider removin'); " dbms_output.put_line( " 'g the rule set for the Propagation process vi'); " dbms_output.put_line( " 'a dbms_propagation_adm.alter_propagation. Thi'); " dbms_output.put_line( " 's will improve Propagation performance.|' || " CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM dba_apply " WHERE rule_set_owner IS NOT NULL " AND rule_set_name IS NOT NULL; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more apply processes contain rule sets. If an Ap'); " dbms_output.put_line( " 'ply process will unconditionally apply all incoming messages and n'); " dbms_output.put_line( " 'o rule-based transformations or apply enqueues are performed by the A'); " dbms_output.put_line( " 'pply process, you should consider removing the ru'); " dbms_output.put_line( " 'le set for via dbms_apply_adm.alter_apply. Th'); " dbms_output.put_line( " 'is will improve Apply performance.|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM dba_apply_parameters " WHERE parameter = 'PARALLELISM' " AND TO_NUMBER(value) = 1; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more Apply processes have parallelism 1. If you'); " dbms_output.put_line( " 'r workload consists of many independent transactions and you notice t'); " dbms_output.put_line( " 'hat apply is the bottleneck of your system, you might consider incre'); " dbms_output.put_line( " 'asing the parallelism of the apply process to three times the numbe'); " dbms_output.put_line( " 'r of CPUs on your system with dbms_apply_adm.set_parameter. Be sur'); " dbms_output.put_line( " 'e to set supplemental logging and the ''_TXN_BUFFER_SIZE'''); " dbms_output.put_line( " 'apply parameter appropriately.|' || CHR(10) || ']]]'); " END IF; " FOR rec IN spilled_apply " LOOP " BEGIN " SELECT value " INTO current_value " FROM dba_apply_parameters " WHERE parameter = '_TXN_BUFFER_SIZE' " AND apply_name = rec.apply_name; " EXCEPTION " WHEN no_data_found THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: Apply ''' || rec.apply_name || " '''has parallelism > 1 and spilled data. Consi'); " dbms_output.put_line( " 'der reducing the ''_TXN_BUFFER_SIZE'' apply parameter to 10 to lim'); " dbms_output.put_line( " 'it the number of transactions stored in the Apply hash table, an'); " dbms_output.put_line( " 'd memory consumption. If your workload contains very large transac'); " dbms_output.put_line( " 'tions (100000 rows), consider reducing this parameter even furth'); " dbms_output.put_line( " 'er, to 2 for example. Note by reducing this parameter you are trad'); " dbms_output.put_line( " 'ing off memory usage for performance.|' || CHR(10) || ']]]'); " END; " IF current_value > 10 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: Apply ''' || rec.apply_name || " '''has parallelism > 1 and spilled data.'); " dbms_output.put_line( " 'Consider reducing the ''_TXN_BUFFER_SIZE'' apply parameter to 10 t'); " dbms_output.put_line( " 'o limit the number of transactions stored in the Apply hash tabl'); " dbms_output.put_line( " 'e, and memory consumption. If your workload contains very large tra'); " dbms_output.put_line( " 'nsactions (100000 rows), consider reducing this parameter even fur'); " dbms_output.put_line( " 'ther, to 2 for example. Note by reducing this parameter you are tra'); " dbms_output.put_line( " 'ding off memory usage for performance.|' || CHR(10) || ']]]'); " END IF; " END LOOP; " SELECT COUNT(*) " INTO row_count " FROM dba_apply a,dba_streams_rules r,dba_streams_transform_function t, " dba_apply_dml_handlers d " WHERE a.rule_set_owner = r.rule_set_owner " AND a.rule_set_name = r.rule_set_name " AND r.rule_owner = t.rule_owner " AND r.rule_name = t.rule_name " AND t.transform_function_name IS NOT NULL " AND (a.apply_name = d.apply_name OR d.apply_name IS NULL) " AND (r.schema_name = d.object_owner OR r.schema_name IS NULL) " AND (r.object_name = d.object_name OR r.object_name IS NULL) " AND r.subsetting_operation IS NULL " AND d.error_handler = 'N' " AND d.user_procedure IS NOT NULL; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more Apply processes have both DML handlers ' || " 'and transformation func'); " dbms_output.put_line( " 'tions defined. Both DML handlers and transformations involve expensi'); " dbms_output.put_line( " 've PL/SQL operations. If you notice slow Apply performance, conside'); " dbms_output.put_line( " 'r performing all PL/SQL operations in either a transformation functi'); " dbms_output.put_line( " 'on or DML handler.|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE supplemental_log_data_pk = 'YES'; " SELECT COUNT(*) " INTO capture_count " FROM dba_capture_prepared_tables; " IF row_count > 0 AND capture_count < 10 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: Database-level supplemental logging enabled but only a f'); " dbms_output.put_line( " 'ew tables prepared for capture. Database-level supplemental logging c'); " dbms_output.put_line( " 'ould write more information to the redo logs for every update statem'); " dbms_output.put_line( " 'ent in the system. If the number of tables you are interested in is s'); " dbms_output.put_line( " 'mall, you might consider specifying supplemental logging of keys an'); " dbms_output.put_line( " 'd columns on a per-table basis. See the documentation for more infor'); " dbms_output.put_line( " 'mation on per-table supplemental logging.|' || CHR(10) || ']]]'); " END IF; " END IF; "END; "/ "PROMPT ___Macro_separator(3)___ "SET serveroutput on size 50000 "DECLARE " failed BOOLEAN; " verbose BOOLEAN := TRUE; " apply_error_threshold NUMBER := 0; " registered_logs_threshold NUMBER := 1000; " registered_age_threshold NUMBER := 60; " row_count NUMBER; " days_old NUMBER; " CURSOR apply_error IS " SELECT DISTINCT apply_name " FROM dba_apply_error; " CURSOR aborted_apply IS " SELECT apply_name, " error_number, " error_message " FROM dba_apply " WHERE status='ABORTED'; " CURSOR aborted_capture IS " SELECT capture_name, " error_number, " error_message " FROM dba_capture " WHERE status = 'ABORTED'; " CURSOR aborted_prop IS " SELECT propagation_name, " last_error_date, " last_error_msg " FROM dba_propagation,dba_queue_schedules " WHERE schema = source_queue_owner " AND qname = source_queue_name " AND destination = destination_dblink " AND schedule_disabled = 'Y'; " CURSOR disabled_apply IS " SELECT apply_name " FROM dba_apply " WHERE status = 'DISABLED'; " CURSOR disabled_capture IS " SELECT capture_name " FROM dba_capture " WHERE status = 'DISABLED'; "BEGIN " FOR rec IN aborted_capture " LOOP " dbms_output.put_line('|ERROR: Capture ''' || rec.capture_name || " ''' has aborted with message ' || rec.error_message || '|'); " END LOOP; " FOR rec IN aborted_apply " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: Apply '''|| rec.apply_name || " ''' has aborted with message: ''' || rec.error_message || ''''); " IF verbose " THEN " IF rec.error_number = 26714 " THEN " dbms_output.put_line( " '%BR%This apply aborted because a nonfatal user error has occurred a'); " dbms_output.put_line( " 'nd the ''disable_on_error'' parameter is ''Y''. Resolve the e'); " dbms_output.put_line( " 'rrors and restart the apply. Setting the ''disable_on_error'' para'); " dbms_output.put_line( " 'meter to ''N'' will prevent apply from aborting on user errors in t'); " dbms_output.put_line( " 'he future. Note the errors should still be resolved though.'); " ELSIF rec.error_number = 26688 " THEN " dbms_output.put_line( " '%BR%This apply aborted because a column value in a particular chan'); " dbms_output.put_line( " 'ge record belonging to a key was not found. For more information, s'); " dbms_output.put_line( " 'earch the trace files for ''26688'' and view the relevant trace ' || " 'file.'); " END IF; " END IF; " dbms_output.put_line('|' || CHR(10)||']]]'); " END LOOP; " FOR rec IN apply_error " LOOP " SELECT COUNT(*) " INTO row_count " FROM dba_apply_error " WHERE rec.apply_name = apply_name; " IF row_count > apply_error_threshold " THEN " dbms_output.put_line('|ERROR: Apply ''' || rec.apply_name || " ''' has placed ' || row_count || " ' transactions in the error queue! Check the dba_apply_error ' || " 'view.|'); " END IF; " END LOOP; " FOR rec IN aborted_prop " LOOP " dbms_output.put_line('|ERROR: Propagation ''' || rec.propagation_name || " ''' has aborted with most recent error message: ''' || " rec.last_error_msg || '''|'); " END LOOP; " FOR rec IN disabled_capture " LOOP " dbms_output.put_line('|WARNING: Capture ''' || rec.capture_name || " ''' is disabled|'); " END LOOP; " FOR rec IN disabled_apply " LOOP " dbms_output.put_line('|WARNING: Apply ''' || rec.apply_name || " ''' is disabled|'); " END LOOP; " BEGIN " failed := FALSE; " SELECT COUNT(*) " INTO row_count " FROM dba_registered_archived_log r " WHERE NOT EXISTS( " SELECT file_name " FROM dba_logmnr_purged_log p " WHERE r.name = p.file_name); " SELECT (SYSDATE - min(r.modified_time)) " INTO days_old " FROM dba_registered_archived_log r " WHERE NOT EXISTS( " SELECT file_name " FROM dba_logmnr_purged_log p " WHERE r.name = p.file_name); " IF row_count > registered_logs_threshold " THEN " failed := TRUE; " dbms_output.put_line('|WARNING: ' || row_count || " ' archived logs registered.|'); " END IF; " IF days_old > registered_age_threshold " THEN " failed := TRUE; " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The oldest archived log is ' || ROUND(days_old) || " ' days old!'); " END IF; " IF failed " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|A restarting Capture process must mine through each registered arch'); " dbms_output.put_line( " 'ive log. To speedup Capture restart, reduce the amount of disk spac'); " dbms_output.put_line( " 'e taken by the archived logs, and reduce Capture metadata, conside'); " dbms_output.put_line( " 'r moving the first_scn parameter to a higher value (See the Document'); " dbms_output.put_line( " 'ation for more information). Note that once the first scn is increas'); " dbms_output.put_line( " 'ed, Capture will no longer be able to mine before this new scn valu'); " dbms_output.put_line( " 'e. Successive moves of the first_scn will remove unneeded registere'); " dbms_output.put_line( " 'd archive logs only if the files have been removed from ' || " ' disk|' || CHR(10) || ']]]'); " END IF; " END; "END; "/ "PROMPT ___Macro_separator(4)___ "DECLARE " complex_rules BOOLEAN := FALSE; " verbose BOOLEAN := TRUE; " capture_latency_threshold NUMBER := 300; " applyrdr_latency_threshold NUMBER := 600; " applylwm_latency_threshold NUMBER := 1200; " unconsumed_msgs_threshold NUMBER := 300000; " spill_ratio_threshold NUMBER := 25; " spill_startup_threshold NUMBER := 3600; " logminer_spill_threshold NUMBER := 30000000; " CURSOR capture_latency (threshold NUMBER) IS " SELECT capture_name, " 86400*(available_message_create_time - capture_message_create_time) " latency " FROM gv$streams_capture " WHERE 86400*(available_message_create_time - capture_message_create_time) " > threshold; " CURSOR apply_reader_latency (threshold NUMBER) IS " SELECT apply_name, " 86400*(dequeue_time - dequeued_message_create_time) latency " FROM gv$streams_apply_reader " WHERE 86400 *(dequeue_time - dequeued_message_create_time) > threshold; " CURSOR apply_lwm_latency (threshold NUMBER) IS " SELECT r.apply_name, " 86400*(r.dequeue_time - c.lwm_message_create_time) latency " FROM gv$streams_apply_reader r,gv$streams_apply_coordinator c " WHERE r.apply# = c.apply# " AND r.apply_name = c.apply_name " AND 86400*(r.dequeue_time - c.lwm_message_create_time) > threshold; " CURSOR queue_stats IS " SELECT queue_schema, " queue_name, " num_msgs, " spill_msgs, " cnum_msgs, " cspill_msgs, " (cspill_msgs / DECODE(cnum_msgs,0,1,cnum_msgs) * 100) spill_ratio, " 86400 * (SYSDATE - startup_time) alive " FROM gv$buffered_queues; " CURSOR logminer_spill_time(threshold NUMBER) IS " SELECT c.capture_name, " l.name, " l.value " FROM gv$streams_capture c,gv$logmnr_stats l " WHERE c.logminer_id = l.session_id " AND name = 'microsecs spent in pageout' " AND value > threshold; " CURSOR complex_rule_sets_cap IS " SELECT capture_name, " owner, " name " FROM gv$rule_set r,dba_capture c " WHERE c.rule_set_owner = r.owner " AND c.rule_set_name = r.name " AND r.sql_executions > 0; " CURSOR complex_rule_sets_prop IS " SELECT propagation_name, " owner, " name " FROM gv$rule_set r,dba_propagation p " WHERE p.rule_set_owner = r.owner " AND p.rule_set_name = r.name " AND r.sql_executions > 0; " CURSOR complex_rule_sets_apply IS " SELECT apply_name, " owner, " name " FROM gv$rule_set r,dba_apply a " WHERE a.rule_set_owner = r.owner " AND a.rule_set_name = r.name " AND r.sql_executions > 0; "BEGIN " FOR rec IN capture_latency(capture_latency_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The latency of the Capture process ''' || rec.capture_name || " ''' is ' || TO_CHAR(rec.latency,'99999999') || ' seconds!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%This measurement shows how far behind the Capture process is in p'); " dbms_output.put_line( " 'rocessing the redo log. This may be due to slowdown in any of the co'); " dbms_output.put_line( " 'mmon Streams components: Capture, Propagation, and/or Apply. If thi'); " dbms_output.put_line( " 's latency is chronic and not due to errors, consider the above sugge'); " dbms_output.put_line( " 'stions for improving Capture, Propagation, and ' || " 'Apply performance.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN apply_reader_latency(applyrdr_latency_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The latency of the reader process for Apply ''' || " rec.apply_name || ''' is ' || TO_CHAR(rec.latency,'99999999') || " ' seconds!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%This measurement shows how far behind the Apply reader is from w'); " dbms_output.put_line( " 'hen the message was created, which in the normal case is by a Captur'); " dbms_output.put_line( " 'e process. In other words, the time between message creation and mes'); " dbms_output.put_line( " 'sage dequeue by the Apply reader is too large. If this latency is ch'); " dbms_output.put_line( " 'ronic and not due to errors, consider the above suggestions for impr'); " dbms_output.put_line( " 'oving Capture and Propagation performance.|'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN apply_lwm_latency(applylwm_latency_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The latency of the coordinator process for Apply ''' || " rec.apply_name || ''' is ' || TO_CHAR(rec.latency,'99999999') || " ' seconds!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%This measurement shows how far behind the low-watermark of the A'); " dbms_output.put_line( " 'pply process is from when the message was first created, which in t'); " dbms_output.put_line( " 'he normal case is by a Capture process. The low-watermark is the mo'); " dbms_output.put_line( " 'st recent transaction (in terms of SCN) that has been successfully a'); " dbms_output.put_line( " 'pplied, for which all previous transactions have also been appli'); " dbms_output.put_line( " 'ed. A high latency can be due to long-running tranactions, many depen'); " dbms_output.put_line( " 'dent transactions, or slow Capture, Propagation, or Apply processes.|'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN queue_stats " LOOP " IF rec.num_msgs > unconsumed_msgs_threshold " THEN " dbms_output.put_line('|WARNING: There are ' || rec.num_msgs || " 'unconsumed messages in queue ''' || rec.queue_schema || '.' || " rec.queue_name || '''!|'); " END IF; " IF rec.spill_ratio > spill_ratio_threshold AND " rec.alive > spill_startup_threshold " THEN " dbms_output.put_line('[[[' || CHR(10) || " ' WARNING: There queue ''' || rec.queue_schema || " '.' || rec.queue_name || ''' has spilled' || " ROUND(rec.spill_ratio) || '% of its messages!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%Since the queue has been started, some large ratio of messages h'); " dbms_output.put_line( " 'ave been spilled to disk. If no errors have occurred which might ha'); " dbms_output.put_line( " 've caused the spills in the past (such as an aborted Apply or Propa'); " dbms_output.put_line( " 'gation process), and if you do not have long running transaction'); " dbms_output.put_line( " 's in your workload, consider increasing the size of the Streams Poo'); " dbms_output.put_line( " 'l or increasing Apply parallelism.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END IF; " END LOOP; " FOR rec IN logminer_spill_time(logminer_spill_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: Excessive spill time for Capture process ''' || " rec.capture_name || '''!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%Spill time implies that the Logminer component used by Capture d'); " dbms_output.put_line( " 'oes not have enough memory allocated to it. This condition occurs wh'); " dbms_output.put_line( " 'en the system workload contains many DDLs and/or LOB transactions. C'); " dbms_output.put_line( " 'onsider increasing the size of memory allocated to the Capture proce'); " dbms_output.put_line( " 'ss by increasing the ''_SGA_SIZE'' Capture parameter.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN complex_rule_sets_cap " LOOP " complex_rules := TRUE; " dbms_output.put_line( " '|WARNING: Complex rules exist for Capture process''' || " rec.capture_name || ' and rule set ''' || rec.owner || '.' || " rec.name ||'''!|'); " END LOOP; " FOR rec IN complex_rule_sets_prop " LOOP " complex_rules := TRUE; " dbms_output.put_line( " '|WARNING: Complex rules exist for Propagation process ''' || " rec.propagation_name || ' and rule set ''' || rec.owner || '.' || " rec.name || '''!|'); " END LOOP; " FOR rec IN complex_rule_sets_apply " LOOP " complex_rules := TRUE; " dbms_output.put_line( " '|WARNING: Complex rules exist for Apply process ''' || " rec.apply_name || ' and rule set''' || rec.owner || '.' || " rec.name || '''!|'); " END LOOP; " IF verbose AND complex_rules " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|Complex rules require SQL evaluations per message by a Streams proc'); " dbms_output.put_line( " 'ess. This slows down performance and should be avoided if possibl'); " dbms_output.put_line( " 'e. Examine the rules in the rule set (for example by looking at DBA_'); " dbms_output.put_line( " 'RULE_SET_RULES and DBA_RULES) and avoid uses of the ''like'' operato'); " dbms_output.put_line( " 'r and function/procedure calls in rule conditions unless absolutel'); " dbms_output.put_line( " 'y necessary.|' || CHR(10) || ']]]'); " END IF; "END; "/ } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ SYS Checks',\ '---+ init.ora Checks',\ '---+ Configuration Checks',\ '---+ Notifications ',\ '---+ Performance Checks') var @HDR = ('',\ '|*Details*|',\ '|*Details*|',\ '|*Details*|',\ '|*Details*|',\ '|*Details*|') set $sql {SET serverout on size 100000 "DECLARE " failed BOOLEAN; " verbose BOOLEAN := TRUE; " streams_pool_usage_threshold NUMBER := 95; " row_count NUMBER; " days_old NUMBER; " streams_pool_usage NUMBER; " streams_pool_size v$parameter.value%TYPE; " CURSOR unrecovered_queue IS " SELECT queue_schema, " queue_name " FROM x$buffered_queues " WHERE flags = 1; "BEGIN " BEGIN " SELECT frused_kwqbpmt " INTO streams_pool_usage " FROM x$kwqbpmt; " SELECT value " INTO streams_pool_size " FROM v$parameter " WHERE name = 'streams_pool_size'; " IF streams_pool_usage > streams_pool_usage_threshold " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|Streams pool usage for this instance is ' || streams_pool_usage || " '% of ' || streams_pool_size || ' bytes! '); " dbms_output.put_line( " 'If this system is processing a typical workload, and no other '|| " 'errors exist, consider increasing the streams pool size.|' || " CHR(10) || ']]]'); " END IF; " EXCEPTION " WHEN OTHERS THEN " NULL; " END; " FOR rec IN unrecovered_queue " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: Queue ''' || rec.queue_schema || '.' || rec.queue_name || " ' has not been recovered normally ' ); " dbms_output.put_line( " '%BR%Force recovery by altering the queue ownership to another instan'); " dbms_output.put_line( " 'ce. Use the DBMS_AQADM.ALTER_QUEUE_TABLE procedure to specify a diff'); " dbms_output.put_line( " 'erent instance.|' || CHR(10) || ']]]'); " END LOOP; "END; "/ "PROMPT ___Macro_separator(2)___ "SELECT '|The parameter global_names must be set to ''TRUE''|' " FROM v$parameter " WHERE UPPER(name) = 'GLOBAL_NAMES' " AND UPPER(NVL(value,'FALSE')) != 'TRUE'; "DECLARE " mynum NUMBER; " apply_procs NUMBER; " capture_procs NUMBER; " num_downstream_cap NUMBER; " mychar v$parameter.value%TYPE; "BEGIN " SELECT NVL(TO_NUMBER(value),0) " INTO mynum " FROM v$parameter " WHERE UPPER(name) = 'JOB_QUEUE_PROCESSES'; " IF mynum < 4 " THEN " dbms_output.put_line( " '|The parameter job_queue_processes must be set to at least 4|'); " END IF; " SELECT NVL(TO_NUMBER(value),0) " INTO mynum " FROM v$parameter " WHERE UPPER(name) = 'OPEN_LINKS'; " IF mynum < 4 " THEN " dbms_output.put_line( " '|The parameter open_links must be set to at least 4 |'); " END IF; " SELECT NVL(SUM(TO_NUMBER(value)+2),0) " INTO capture_procs " FROM dba_capture_parameters " WHERE parameter = 'PARALLELISM'; " SELECT NVL(SUM(TO_NUMBER(value)+2),0) " INTO apply_procs " FROM dba_apply_parameters " WHERE parameter = 'PARALLELISM'; " SELECT NVL(TO_NUMBER(value),0) " INTO mynum " FROM v$parameter " WHERE UPPER(name) = 'PARALLEL_MAX_SERVERS'; " IF mynum < capture_procs + apply_procs " THEN " dbms_output.put_line( " '|The parameter parallel_max_servers must be set to at least ' || " TO_CHAR(capture_procs + apply_procs) || " '. If you have stray Capture or Apply processes on the system, ' || " 'you can ignore this error.|'); " END IF; " SELECT COUNT(*) " INTO num_downstream_cap " FROM dba_capture " WHERE capture_type = 'DOWNSTREAM'; " IF num_downstream_cap > 0 " THEN " SELECT NVL(value,'FALSE') " INTO mychar " FROM v$parameter " WHERE UPPER(name) = 'REMOTE_ARCHIVE_ENABLE'; " END IF; " IF UPPER(mychar) = 'FALSE' " THEN " dbms_output.put_line( " '|The parameter remote_archive_enable must be set to ''TRUE''|'); " END IF; "END; "/ "PROMPT ___Macro_separator(3)___ "DECLARE " overlap_rules BOOLEAN := FALSE; " verbose BOOLEAN := TRUE; " row_count NUMBER; " capture_count NUMBER; " latency NUMBER; " current_value dba_apply_parameters.value%TYPE; " CURSOR propagation_latency IS " SELECT propagation_name, " latency " FROM dba_propagation,dba_queue_schedules " WHERE schema = source_queue_owner " AND qname = source_queue_name " AND destination = destination_dblink " AND latency >= 60; " CURSOR multiqueues IS " SELECT c.capture_name, " a.apply_name, " c.queue_owner, " c.queue_name " FROM dba_capture c,dba_apply a " WHERE c.queue_name = a.queue_name " AND c.queue_owner = a.queue_owner " AND c.capture_type != 'DOWNSTREAM'; " CURSOR nonlogged_tables IS " SELECT table_owner owner, " table_name name " FROM dba_capture_prepared_tables t " WHERE supplemental_log_data_pk = 'NO' " AND supplemental_log_data_fk = 'NO' " AND supplemental_log_data_ui = 'NO' " AND supplemental_log_data_all='NO' " AND NOT EXISTS( " SELECT 'X' " FROM dba_log_groups l " WHERE t.table_owner = l.owner " AND t.table_name = l.table_name " UNION " SELECT 'x' " FROM dba_capture_prepared_schemas s " WHERE s.schema_name = t.table_owner " UNION " SELECT 'x' " FROM dba_capture_prepared_database); " CURSOR overlapping_rules IS " SELECT a.streams_name sname, " a.streams_type stype, " a.rule_set_owner, " a.rule_set_name, " a.rule_owner owner1, " a.rule_name name1, " a.streams_rule_type type1, " b.rule_owner owner2, " b.rule_name name2, " b.streams_rule_type type2 " FROM dba_streams_rules a,dba_streams_rules b " WHERE a.rule_set_owner = b.rule_set_owner " AND a.rule_set_name = b.rule_set_name " AND a.streams_name = b.streams_name AND a.streams_type = b.streams_type " AND a.rule_type = b.rule_type " AND (a.subsetting_operation IS NULL OR b.subsetting_operation IS NULL) " AND (a.rule_owner != b.rule_owner OR a.rule_name != b.rule_name) " AND ((a.streams_rule_type = 'GLOBAL' AND b.streams_rule_type IN " ('SCHEMA','TABLE') AND a.schema_name = b.schema_name) " OR (a.streams_rule_type = 'SCHEMA' AND b.streams_rule_type = 'TABLE' " AND a.schema_name = b.schema_name) " OR (a.streams_rule_type = 'TABLE' AND b.streams_rule_type = 'TABLE' " AND a.schema_name = b.schema_name AND a.object_name = b.object_name " AND a.rule_name < b.rule_name) " OR (a.streams_rule_type = 'SCHEMA' AND b.streams_rule_type = 'SCHEMA' " AND a.schema_name = b.schema_name AND a.rule_name < b.rule_name) " OR (a.streams_rule_type = 'GLOBAL' AND b.streams_rule_type = 'GLOBAL' " AND a.rule_name < b.rule_name)) " ORDER BY a.rule_name; " CURSOR spilled_apply IS " SELECT a.apply_name " FROM dba_apply_parameters p,dba_apply a,gv$buffered_queues q " WHERE a.queue_owner = q.queue_schema " AND a.queue_name = q.queue_name " AND a.apply_name = p.apply_name " AND p.parameter = 'PARALLELISM' " AND p.value > 1 " AND (q.cspill_msgs/DECODE(q.cnum_msgs,0,1,q.cnum_msgs) * 100) > 25; " CURSOR bad_source_db IS " SELECT rule_owner || '.' || rule_name rule_name, " source_database " FROM dba_streams_rules " WHERE source_database NOT IN " (SELECT global_name " FROM system.logmnrc_dbname_uid_map); " CURSOR qtab_too_long IS " SELECT queue_table name, " LENGTH(queue_table) len " FROM dba_queues q,dba_apply a " WHERE LENGTH(queue_table) > 24 " AND q.owner = a.queue_owner " AND q.name = a.queue_name; " CURSOR reginfo_invalid IS " SELECT comp_id, " status " FROM dba_registry " WHERE comp_id IN ('CATALOG','CATPROC') " AND status <> 'VALID'; " CURSOR version_diff IS " SELECT i.version inst_version, " r.version reg_version " FROM v$instance i,dba_registry r " WHERE r.comp_id IN ('CATALOG','CATPROC') " AND i.version <> r.version; "BEGIN " FOR rec IN propagation_latency " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The Propagation process ''' || rec.propagation_name || " ''' has latency ' || rec.latency || '. It should be 5 or less!'); " IF verbose " THEN " dbms_output.put_line('%BR%Set the latency by calling ' || " 'dbms_aqadm.alter_schedule(queue_name,destination,latency => 5)'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN bad_source_db " LOOP " dbms_output.put_line( " '|ERROR: The rule ' || rec.rule_name || " ' specifies an unknown source database: ''' || rec.source_database || " '''.|'); " END LOOP; " FOR rec IN qtab_too_long " LOOP " dbms_output.put_line( " '|ERROR: The queue table name ''' || rec.name || ''' has length of ' || " rec.len || ' bytes. It should be 24 bytes or less!'); " END LOOP; " FOR rec IN reginfo_invalid " LOOP " dbms_output.put_line( " '|ERROR: The DBA_REGISTRY status information for component ''' || " rec.comp_id || ''' requires attention. Status is ' || rec.status || " '. Recompile the component|'); " END LOOP; " FOR rec IN version_diff " LOOP " dbms_output.put_line( " '|ERROR: The ORACLE_HOME software is ''' || rec.inst_version || " ''' but the database catalog is ' || rec.reg_version || " ' .CATPATCH must be run successfully to complete the upgrade|'); " END LOOP; " FOR rec IN multiqueues " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The Capture process ''' || rec.capture_name || " ''' and Apply process ''' || rec.apply_name || ''' sha '); " dbms_output.put_line( " 're the same queue ''' || rec.queue_owner || '.' || " rec.queue_name || '''. If the Apply process is receiving changes fro'); " dbms_output.put_line( " 'm a remote site, a separate queue should be created for the ' || " 'Apply process.|' || CHR(10) || ']]]'); " END LOOP; " SELECT COUNT(*) " INTO capture_count " FROM dba_capture " WHERE capture_type != 'DOWNSTREAM'; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE log_mode = 'NOARCHIVELOG'; " IF row_count > 0 AND capture_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: ARCHIVELOG mode must be enabled for this database.'); " IF verbose " THEN " dbms_output.put_line( " '%BR%For a Streams Capture process to function correctly, it must be a'); " dbms_output.put_line( " 'ble to read the archive logs. Refer to the documentation to re'); " dbms_output.put_line( " 'start the database in ARCHIVELOG format.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE supplemental_log_data_min = 'NO'; " IF row_count > 0 AND capture_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: Minimal supplemental logging not enabled.'); " IF verbose " THEN " dbms_output.put_line( " '%BR%For a Streams Capture process to function correctly, at least mi'); " dbms_output.put_line( " 'nimal supplemental logging should be enabled. '); " dbms_output.put_line( " 'Execute ''ALTER DATABASE ADD SUPPLEMENTAL LOG DATA'' to fix this iss'); " dbms_output.put_line( " 'ue. Note you may need to specify further levels of supplemental log'); " dbms_output.put_line( " 'ging, see the documentation for more details.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE SUPPLEMENTAL_LOG_DATA_PK = 'NO'; " IF row_count > 0 AND capture_count > 0 " THEN " FOR rec IN nonlogged_tables " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: No supplemental logging specified for table''' || rec.owner || " '.' || rec.name || '''.'); " IF verbose " THEN " dbms_output.put_line( " '%BR%In order for Streams to work properly, it must have key informa'); " dbms_output.put_line( " 'tion supplementally logged for each table whose changes are being c'); " dbms_output.put_line( " 'aptured. This system does not have database level primary key infor'); " dbms_output.put_line( " 'mation logged, thus for each interested table manual logging mus'); " dbms_output.put_line( " 't be specified. See the documentation for more info.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " END IF; " FOR rec IN overlapping_rules " LOOP " overlap_rules := TRUE; " dbms_output.put_line( " '| WARNING: The rule ''' || rec.owner1 || '.' || rec.name1 || " ''' and ''' || rec.owner2 || '.' || rec.name2 || ''' from rule set ''' || " rec.rule_set_owner || '.' || rec.rule_set_name || ''' overlap.|'); " END LOOP; " IF overlap_rules AND verbose " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|Overlapping rules are a problem especially when rule-based transform'); " dbms_output.put_line( " 'ations exist. Streams makes no guarantees of which rule in a rule se'); " dbms_output.put_line( " 't will evaluate to TRUE, thus overlapping rules will cause inconsist'); " dbms_output.put_line( " 'ent behavior, and should be avoided.|' || " CHR(10) || ']]]'); " END IF; " IF verbose " THEN " SELECT COUNT(*) " INTO row_count " FROM dba_propagation " WHERE rule_set_owner IS NOT NULL " AND rule_set_name IS NOT NULL; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more propagation processes contain rule sets. I'); " dbms_output.put_line( " 'f a Propagation process will unconditionally forward all incoming me'); " dbms_output.put_line( " 'ssages to its destination queue, and no rule-based transformations a'); " dbms_output.put_line( " 're performed by the Propagation process, you should consider removin'); " dbms_output.put_line( " 'g the rule set for the Propagation process via dbms_propagation_a'); " dbms_output.put_line( " 'dm.alter_propagation. This will improve Propogation performanc'); " dbms_output.put_line( " 'e.|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM dba_apply " WHERE rule_set_owner IS NOT NULL " AND rule_set_name IS NOT NULL; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more apply processes contain rule sets. If an Ap'); " dbms_output.put_line( " 'ply process will unconditionally apply all incoming messages and no r'); " dbms_output.put_line( " 'ule-based transformations or apply enqueues are performed by the App'); " dbms_output.put_line( " 'ly process, you should consider removing the rule set via dbms_apply'); " dbms_output.put_line( " '_adm.alter_apply. This will improve Apply peformanc'); " dbms_output.put_line( " 'e.|' || CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM dba_apply_parameters " WHERE parameter='PARALLELISM' " AND TO_NUMBER(value) = 1; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more Apply processes have parallelism 1. If yo'); " dbms_output.put_line( " 'ur workload consists of many independent transactions and you notic'); " dbms_output.put_line( " 'e that apply is the bottleneck of your system, you might consider in'); " dbms_output.put_line( " 'creasing the parallelism of the apply process to a multiple of 4 vi'); " dbms_output.put_line( " 'a dbms_apply_adm.set_parameter.|' || CHR(10) || ']]]'); " END IF; " FOR rec IN spilled_apply " LOOP " BEGIN " SELECT value " INTO current_value " FROM dba_apply_parameters " WHERE parameter = '_TXN_BUFFER_SIZE' " AND apply_name = rec.apply_name; " EXCEPTION " WHEN no_data_found THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: Apply ''' || rec.apply_name || " ''' has parallelism > 1 and spilled data.'); " dbms_output.put_line( " '%BR%Consider reducing the ''_TXN_BUFFER_SIZE'' apply parameter to 1'); " dbms_output.put_line( " '0*parallelism to limit the number of transactions stored in the Ap'); " dbms_output.put_line( " 'ply hash table, and memory consumption. If your workload contains v'); " dbms_output.put_line( " 'ery large transactions > (100000 rows), consider reducing this par'); " dbms_output.put_line( " 'ameter even further, to 2*parallelism for example. Note by reducin'); " dbms_output.put_line( " 'g this parameter you are trading off memory usage for performanc'); " dbms_output.put_line( " 'e.|' || CHR(10) || ']]]'); " END; " IF current_value > 10 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: Apply ''' || rec.apply_name || " ''' has parallelism > 1 and spilled data.'); " dbms_output.put_line( " '%BR%If the transaction workload is mainly medium size transcations t'); " dbms_output.put_line( " '(housands of row changes per transaction), consider reducing t'); " dbms_output.put_line( " 'he ''_TXN_BUFFER_SIZE''apply parameter to 10+parallelism to limit t'); " dbms_output.put_line( " 'he number of transactions stored in the Apply hash table, and memo'); " dbms_output.put_line( " 'ry consumption.%BR%If your workload contains very large transaction'); " dbms_output.put_line( " 's (>100000 rows), consider reducing this parameter even further, t'); " dbms_output.put_line( " 'o transactions 2+parallelism for example. Note by reducing this par'); " dbms_output.put_line( " 'ameter you are trading off memory usage for performance.|' || " CHR(10) || ']]]'); " END IF; " END LOOP; " SELECT COUNT(*) " INTO row_count " FROM dba_apply a,dba_streams_rules r,dba_streams_transform_function t, " dba_apply_dml_handlers d " WHERE a.rule_set_owner = r.rule_set_owner " AND a.rule_set_name = r.rule_set_name " AND r.rule_owner = t.rule_owner " AND r.rule_name = t.rule_name " AND t.transform_function_name IS NOT NULL " AND (a.apply_name = d.apply_name OR d.apply_name IS NULL) " AND (r.schema_name = d.object_owner OR r.schema_name IS NULL) " AND (r.object_name = d.object_name OR r.object_name IS NULL) " AND r.subsetting_operation IS NULL " AND d.error_handler = 'N' " AND d.user_procedure IS NOT NULL; " IF row_count > 0 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: One or more Apply processes have both DML handlers and t'); " dbms_output.put_line( " 'ransformation functions defined. Both DML handlers and transformatio'); " dbms_output.put_line( " 'ns involve expensive PL/SQL operations. If you notice slow Apply per'); " dbms_output.put_line( " 'formance, consider performing all PL/SQL operations in either a tran'); " dbms_output.put_line( " 'sformation function or DML handler.|' || " CHR(10) || ']]]'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM v$database " WHERE supplemental_log_data_pk = 'YES'; " SELECT COUNT(*) " INTO capture_count " FROM dba_capture_prepared_tables; " IF row_count > 0 AND capture_count < 10 " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|SUGGESTION: Database-level supplemental logging enabled but only a f'); " dbms_output.put_line( " 'ew tables prepared for capture. Database-level supplemental logging c'); " dbms_output.put_line( " 'ould write more information to the redo logs for every update statem'); " dbms_output.put_line( " 'ent in the system. If the number of tables you are interested in is s'); " dbms_output.put_line( " 'mall, you might consider specifying supplemental logging of keys an'); " dbms_output.put_line( " 'd columns on a per-table basis. See the documentation for more infor'); " dbms_output.put_line( " 'mation on per-table supplemental logging.|' || " CHR(10) || ']]]'); " END IF; " END IF; "END; "/ "PROMPT ___Macro_separator(4)___ "SET serveroutput on size 50000 "DECLARE " failed BOOLEAN; " verbose BOOLEAN := TRUE; " apply_error_threshold NUMBER := 0; " streams_pool_usage_threshold NUMBER := 95; " registered_logs_threshold NUMBER := 1000; " registered_age_threshold NUMBER := 60; " row_count NUMBER; " days_old NUMBER; " streams_pool_usage NUMBER; " CURSOR apply_error IS " SELECT DISTINCT apply_name " FROM dba_apply_error; " CURSOR aborted_apply IS " SELECT apply_name, " error_number, " error_message " FROM dba_apply " WHERE status='ABORTED'; " CURSOR aborted_capture IS " SELECT capture_name, " error_number, " error_message " FROM dba_capture " WHERE status = 'ABORTED'; " CURSOR aborted_prop IS " SELECT propagation_name, " last_error_date, " last_error_msg " FROM dba_propagation,dba_queue_schedules " WHERE schema = source_queue_owner " AND qname = source_queue_name " AND destination = destination_dblink " AND schedule_disabled = 'Y'; " CURSOR disabled_apply IS " SELECT apply_name " FROM dba_apply " WHERE status = 'DISABLED'; " CURSOR disabled_capture IS " SELECT capture_name " FROM dba_capture " WHERE status = 'DISABLED'; "BEGIN " FOR rec IN aborted_capture " LOOP " dbms_output.put_line( " '|ERROR: Capture ''' || rec.capture_name || " ''' has aborted with message: ''' || rec.error_message || '''|'); " END LOOP; " FOR rec IN aborted_apply " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|ERROR: Apply ''' || rec.apply_name || " '''has aborted with message: ''' || rec.error_message || ''''); " IF verbose " THEN " IF rec.error_number = 26714 " THEN " dbms_output.put_line( " '%BR%This apply aborted because a nonfatal user error has occurre'); " dbms_output.put_line( " 'd and the ''disable_on_error'' parameter is ''Y''. Resolv'); " dbms_output.put_line( " 'e the errors and restart the apply. Setting the ''disable_on_err'); " dbms_output.put_line( " 'or'' parameter to ''N'' will prevent apply from aborting on user er'); " dbms_output.put_line( " 'rors in the future. Note the errors should still be resolved though.'); " ELSIF rec.error_number = 26688 " THEN " dbms_output.put_line( " '%BR%This apply aborted because a column value in a particular chang'); " dbms_output.put_line( " 'e record belonging to a key was not found. For more informatio'); " dbms_output.put_line( " 'n, search the trace files for ''26688'' and view the relevent trac'); " dbms_output.put_line( " 'e file.'); " END IF; " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN apply_error " LOOP " SELECT COUNT(*) " INTO row_count " FROM dba_apply_error " WHERE rec.apply_name = apply_name; " IF row_count > apply_error_threshold " THEN " dbms_output.put_line( " '|ERROR: Apply ''' || rec.apply_name || ''' has placed ' || " row_count || ' transactions in the error queue! ' || " 'Check the dba_apply_error view.|'); " END IF; " END LOOP; " FOR rec IN aborted_prop " LOOP " dbms_output.put_line( " '|ERROR: Propagation ''' || rec.propagation_name || " ''' has aborted with most recent error message:''' || " rec.last_error_msg || '''|'); " END LOOP; " FOR rec IN disabled_capture " LOOP " dbms_output.put_line( " '|WARNING: Capture ''' || rec.capture_name || ''' is disabled|'); " END LOOP; " FOR rec IN disabled_apply " LOOP " dbms_output.put_line( " '|WARNING: Apply ''' || rec.apply_name || ''' is disabled|'); " END LOOP; " BEGIN " failed := FALSE; " SELECT COUNT(*) " INTO row_count " FROM dba_registered_archived_log " WHERE purgeable = 'NO'; " SELECT (SYSDATE - min(modified_time)) " INTO days_old " FROM dba_registered_archived_log " WHERE purgeable = 'NO'; " IF row_count > registered_logs_threshold " THEN " failed := TRUE; " dbms_output.put_line( " '|WARNING: ' || row_count || ' archived logs registered.|'); " END IF; " IF days_old > registered_age_threshold " THEN " failed := TRUE; " dbms_output.put_line( " '|WARNING: The oldest archived log is ' || ROUND(days_old) || " ' days old!|'); " END IF; " SELECT COUNT(*) " INTO row_count " FROM dba_registered_archived_log " WHERE purgeable = 'YES'; " IF row_count > registered_logs_threshold/2 " THEN " dbms_output.put_line('[[[' || CHR(10) || " 'WARNING: There are ' || row_count || " ' archived logs ready to be purged from disk.'); " dbms_output.put_line( " '%BR%Use the following select to identify unneeded logfiles:%BR%'); " dbms_output.put_line( " '``SELECT name``%BR%' || " '`` FROM dba_registered_archived_log``%BR%' || " '`` WHERE purgeable = ''YES''``' || CHR(10) || ']]]'); " END IF; " IF failed " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|A restarting Capture process must mine through each registered' || " 'archive log.'); " dbms_output.put_line( " '%BR%To speedup Capture restart, reduce the amount of disk space take'); " dbms_output.put_line( " 'n by the archived logs, and reduce Capture metadata, consider movin'); " dbms_output.put_line( " 'g the automatically by altering the checkpoint_retention_time captur'); " dbms_output.put_line( " 'e parameter to a lower value (See the Documentation for more informa'); " dbms_output.put_line( " 'tion). Note that once the first scn is increased, Capture will no lo'); " dbms_output.put_line( " 'nger be able to mine before this new scn value. Successive moves o'); " dbms_output.put_line( " 'f the first_scn will remove unneeded registered archive logs only i'); " dbms_output.put_line( " 'f the files have been removed from disk|' || " CHR(10) || ']]]'); " END IF; " END; "END; "/ "PROMPT ___Macro_separator(5)___ "DECLARE " complex_rules BOOLEAN := FALSE; " verbose BOOLEAN := TRUE; " capture_latency_threshold NUMBER := 300; " applyrdr_latency_threshold NUMBER := 600; " applylwm_latency_threshold NUMBER := 1200; " unconsumed_msgs_threshold NUMBER := 300000; " spill_ratio_threshold NUMBER := 25; " spill_startup_threshold NUMBER := 3600; " logminer_spill_threshold NUMBER := 30000000; " CURSOR capture_latency(threshold NUMBER) IS " SELECT capture_name, " 86400 *(available_message_create_time - capture_message_create_time) " latency " FROM gv$streams_capture " WHERE 86400 *(available_message_create_time - capture_message_create_time) " > threshold; " CURSOR apply_reader_latency(threshold NUMBER) IS " SELECT apply_name, " 86400 *(dequeue_time - dequeued_message_create_time) latency " FROM gv$streams_apply_reader " WHERE 86400 *(dequeue_time - dequeued_message_create_time) > threshold; " CURSOR apply_lwm_latency(threshold NUMBER) IS " SELECT r.apply_name, " 86400 *(r.dequeue_time - c.lwm_message_create_time) latency " FROM gv$streams_apply_reader r,gv$streams_apply_coordinator c " WHERE r.apply# = c.apply# " AND r.apply_name = c.apply_name " AND 86400 *(r.dequeue_time - c.lwm_message_create_time) > threshold; " CURSOR queue_stats IS " SELECT queue_schema, " queue_name, " num_msgs, " spill_msgs, " cnum_msgs, " cspill_msgs, " (cspill_msgs/DECODE(cnum_msgs,0,1,cnum_msgs) * 100) spill_ratio, " 86400 *(SYSDATE - startup_time) alive " FROM gv$buffered_queues; " CURSOR logminer_spill_time (threshold NUMBER) IS " SELECT c.capture_name, " l.name, " l.value " FROM gv$streams_capture c,gv$logmnr_stats l " WHERE c.logminer_id = l.session_id " AND name = 'microsecs spent in pageout' " AND value > threshold; " CURSOR complex_rule_sets_cap IS " SELECT capture_name, " owner, " name " FROM gv$rule_set r,dba_capture c " WHERE c.rule_set_owner = r.owner " AND c.rule_set_name = r.name " AND r.sql_executions > 0; " CURSOR complex_rule_sets_prop IS " SELECT propagation_name, " owner, " name " FROM gv$rule_set r,dba_propagation p " WHERE p.rule_set_owner = r.owner " AND p.rule_set_name = r.name " AND r.sql_executions > 0; " CURSOR complex_rule_sets_apply IS " SELECT apply_name, " owner, " name " FROM gv$rule_set r,dba_apply a " WHERE a.rule_set_owner = r.owner " AND a.rule_set_name = r.name " AND r.sql_executions > 0; "BEGIN " FOR rec IN capture_latency(capture_latency_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The latency of the Capture process ''' || rec.capture_name || " ''' is ' || TO_CHAR(rec.latency,'99999999') || ' seconds!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%This measurement shows how far behind the Capture process is i'); " dbms_output.put_line( " 'n processing the redo log. This may be due to slowdown in any of th'); " dbms_output.put_line( " 'e common Streams components: Capture, Propagation, and/or Apply. If t'); " dbms_output.put_line( " 'his latency is chronic and not due to errors, consider the above sug'); " dbms_output.put_line( " 'gestions for improving Capture, Propagation, and Apply performance'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN apply_reader_latency(applyrdr_latency_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The latency of the reader process for Apply ''' || " rec.apply_name || ''' is ' || TO_CHAR(rec.latency,'99999999') || " ' seconds!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%This measurement shows how far behind the Apply reader is from w'); " dbms_output.put_line( " 'hen the message was created, which in the normal case is by a Captur'); " dbms_output.put_line( " 'e process. In other words, the time between message creation and me'); " dbms_output.put_line( " 'ssage dequeue by the Apply reader is too large. If this latency is c'); " dbms_output.put_line( " 'hronic and not due to errors, consider the above suggestions for imp'); " dbms_output.put_line( " 'roving Capture and Propagation performance'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN apply_lwm_latency(applylwm_latency_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " ' WARNING: The latency of the coordinator process for Apply ''' || " rec.apply_name || ''' is ' || TO_CHAR(rec.latency,'99999999') || " ' seconds!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%This measurement shows how far behind the low-watermark of the A'); " dbms_output.put_line( " 'pply process is from when the message was first created, which in th'); " dbms_output.put_line( " 'e normal case is by a Capture process. The low-watermark is the mos'); " dbms_output.put_line( " 't recent transaction (in terms of SCN) that has been successfully ap'); " dbms_output.put_line( " 'plied, for which all previous transactions have also been appli'); " dbms_output.put_line( " 'ed. A high latency can be due to long-running transactions, many dep'); " dbms_output.put_line( " 'endent transactions, or slow Capture, Propagation, or Apply ' || " 'processes.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN queue_stats " LOOP " IF rec.num_msgs > unconsumed_msgs_threshold " THEN " dbms_output.put_line('|WARNING: There are ' || rec.num_msgs || " ' unconsumed messages in queue ''' || " rec.queue_schema || '.' || rec.queue_name || " '''!|'); " END IF; " IF rec.spill_ratio > spill_ratio_threshold " AND rec.alive > spill_startup_threshold " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: The queue ''' || rec.queue_schema || '.' || rec.queue_name || " ''' has spilled ' || ROUND(rec.spill_ratio) || '% of its messages!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%Since the queue has been started, some large ratio of message'); " dbms_output.put_line( " 's have been spilled to disk. If no errors have occurred which migh'); " dbms_output.put_line( " 't have caused the spills in the past (such as an aborted Apply or P'); " dbms_output.put_line( " 'ropagation process), and if you do not have long running tranaction'); " dbms_output.put_line( " 's in your workload, consider increasing the size of the Streams Po'); " dbms_output.put_line( " 'ol or increasing Apply parallelism.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END IF; " END LOOP; " FOR rec IN logminer_spill_time(logminer_spill_threshold) " LOOP " dbms_output.put_line('[[[' || CHR(10) || " '|WARNING: Excessive spill time for Capture process ''' || " rec.capture_name || '''!'); " IF verbose " THEN " dbms_output.put_line( " '%BR%Spill time implies that the Logminer component used by Capture d'); " dbms_output.put_line( " 'oes not have enough memory allocated to it. This condition occurs wh'); " dbms_output.put_line( " 'en the system workload contains many DDLs and/or LOB transactions. C'); " dbms_output.put_line( " 'onsider increasing the size of memory allocated to the Capture proce'); " dbms_output.put_line( " 'ss by increasing the ''_SGA_SIZE'' Capture parameter.'); " END IF; " dbms_output.put_line('|' || CHR(10) || ']]]'); " END LOOP; " FOR rec IN complex_rule_sets_cap " LOOP " complex_rules := TRUE; " dbms_output.put_line( " '|WARNING: Complex rules exist for Capture process ''' || " rec.capture_name || ' and rule set ''' || rec.owner || '.' || " rec.name || '''!|'); " END LOOP; " FOR rec IN complex_rule_sets_prop " LOOP " complex_rules := TRUE; " dbms_output.put_line( " '|WARNING: Complex rules exist for Propagation process ''' || " rec.propagation_name || ' and rule set ''' || rec.owner || '.' || " rec.name || '''!|'); " END LOOP; " FOR rec IN complex_rule_sets_apply " LOOP " complex_rules := TRUE; " dbms_output.put_line( " '|WARNING: Complex rules exist for Apply process''' || rec.apply_name || " ' and rule set ''' || rec.owner || '.' || rec.name || '''!'); " END LOOP; " IF verbose AND complex_rules " THEN " dbms_output.put_line('[[[' || CHR(10) || " '|Complex rules require SQL evaluations per message by a Streams proce'); " dbms_output.put_line( " 'ss. This slows down performance and should be avoided if possible. Ex'); " dbms_output.put_line( " 'amine the rules in the rule set (for example by looking at DBA_RULE_'); " dbms_output.put_line( " 'SET_RULES and DBA_RULES) and avoid uses of the ''like'' of th'); " dbms_output.put_line( " 'e ''like'' operator and function/procedure calls in rule conditions u'); " dbms_output.put_line( " 'nless absolutely necessary.|' || CHR(10) || ']]]'); " END IF; "END; "/ } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Other Analyses',3) } =head2 apply_set - Apply Settings Collects information about Apply Settings. =cut debug ' Inside STC module, gathering settings information' pretoc '2:Settings' debug ' Inside STC module, gathering apply settings information' report apply_set var $TTL = '---+!! Apply Settings' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Apply Information',\ '---+ Apply Process Parameters',\ '---+ Streams Apply Rules configured with \ DBMS_STREAMS_ADM Package',\ '---+ Streams Table Subsetting Rules',\ '---+ Apply Rules by Ruleset',\ '---+ Apply Rule Transformation by Ruleset',\ '---+ Apply Handlers',\ '---+ Apply Dml Handlers',\ '---+ Dml Handler Status',\ '---+ Rule Transformation Status',\ '---+ Update Conflict Resolution Columns',\ '---+ Key Columns set for apply') var @HDR = ('',\ '|*Apply Name*|*Queue*|*Apply Captured*|*Status*|*Apply User*|\ *Apply Tag*|*Rule Set*|*Apply Database Link*|',\ '|*Apply Name*|*Parameter*|*Value*|*Set By User*|',\ '|*Name*|*Object*|*Source Database*|*Type*|*Include Tagged Lcr*|\ *Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Name*|*Action Context Name*|\ *Action Context Value*|',\ '|*Apply Name*|*Msg Handler*|*DDL Handler*|',\ '|*Object*|*Operation*|*User Procedure*|*Typ*|*DB Link*|',\ '|*User Procedure*|*Status*|*Type*|*Created*|*Last DDL Time*|',\ '|*Action Context Value*|*Status*|*Type*|*Created*|\ *Last DDL Time*|',\ '|*Object*|*Method Name*|*Resolution Column*|*Column Name*|',\ '|*Object Owner*|*Object*|*Column*|*DB Link*|') set $sql {SELECT '|' || " apply_name || ' |' || " queue_owner || '.' || queue_name || ' |' || " DECODE(apply_captured,'YES','Captured','NO','User-Enqueued') || ' |' || " status || ' |' || " apply_user || ' |' || " apply_tag || ' |' || " rule_set_owner || '.' || rule_set_name || ' |' || " apply_database_link || ' |' " FROM dba_apply; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " apply_name || ' |' || " parameter || ' |' || " value || ' |' || " set_by_user || ' |' " FROM dba_apply_parameters " ORDER BY apply_name,parameter; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " name || '|' || " object || '|' || " source_database || '|' || " type || '|' || " include_tagged_lcr || '|' || " rule || '|' " FROM (SELECT streams_name name, " table_owner || '.' || table_name object, " source_database, " rule_type || ' TABLE RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_table_rules " WHERE streams_type = 'APPLY' " UNION " SELECT streams_name name, " schema_name object, " source_database, " rule_type || ' SCHEMA RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_schema_rules " WHERE streams_type = 'APPLY' " UNION " SELECT streams_name name, " ' ' object, " source_database, " rule_type || ' GLOBAL RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_GLOBAL_rules " WHERE streams_type = 'APPLY') " ORDER BY name,object; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_name || ' |' || " table_owner || '.' || table_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_table_rules " WHERE streams_type = 'APPLY' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(5)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_rule_set_rules rsr,dba_rules r, " TABLE(r.rule_action_context.actx_list) ac " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " apply_name || ' |' || " message_handler || ' |' || " ddl_handler || ' |' " FROM dba_apply " WHERE message_handler IS NOT NULL OR ddl_handler IS NOT NULL; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " object_owner || '.' || object_name || ' |' || " SUBSTR(operation_name,1,1) || ' |' || " user_procedure || ' |' || " DECODE(error_handler,'Y','Error','N','DML','UNKNOWN') || ' |' || " apply_database_link || ' |' " FROM dba_apply_dml_handlers; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " h.user_procedure || ' |' || " o.status || ' |' || " o.object_type || ' |' || " o.created || ' |' || " o.last_ddl_time || ' |' " FROM dba_objects o,dba_apply_dml_handlers h " WHERE o.owner = SUBSTR(h.user_procedure,1, " INSTR(h.user_procedure,'.',1,1) - 1) " AND o.object_name = SUBSTR(h.user_procedure, " INSTR(h.user_procedure,'.',-1,1) + 1); "PROMPT ___Macro_separator(10)___ "SELECT '|' || " ac.nvn_value.accessvarchar2() || ' |' || " o.status || ' |' || " o.object_type || ' |' || " o.created || ' |' || " o.last_ddl_time || ' |' " FROM dba_objects o,dba_rules r,TABLE(r.rule_action_context.actx_list) ac " WHERE o.owner = UPPER(SUBSTR(ac.nvn_value.accessvarchar2(),1, " INSTR(ac.nvn_value.accessvarchar2(),'.',1,1) - 1)) " AND o.object_name = UPPER(SUBSTR(ac.nvn_value.accessvarchar2(), " INSTR(ac.nvn_value.accessvarchar2(),'.',-1,1) + 1)); "PROMPT ___Macro_separator(11)___ "SELECT '|' || " object_owner || '.' || object_name || ' |' || " method_name || ' |' || " resolution_column || ' |' || " column_name || ' |' " FROM dba_apply_conflict_columns " ORDER BY object_owner,object_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " object_owner || ' |' || " object_name || ' |' || " column_name || ' |' || " apply_database_link || ' |' " FROM dba_apply_key_columns; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Apply Information',\ '---+ Apply Process Information',\ '---+ Apply Process Handlers',\ '---+ Apply Process Parameters',\ '---+ Streams Apply Rules Configured with DBMS_STREAMS_ADM \ Package',\ '---+ Streams Table Subsetting Rules',\ '---+ Apply Rules by RuleSet',\ '---+ Apply Rules in Negative RuleSet',\ '---+ Apply Rule Transformations by Rule Set',\ '---+ Apply Handlers',\ '---+ Apply Dml Handlers',\ '---+ DML Handler Status',\ '---+ Rule Transformation Status',\ '---+ Update Conflict Resolution Columns',\ '---+ Key Columns Set for Apply') var @HDR = ('',\ '|*Apply Name*|*Queue*|*Apply Captured*|*Status*|*Apply User*|\ *Apply Tag*|*RSN*|*RSN2*|*Apply Database Link*|',\ '|*Apply Name*| *Max Applied Msg No*|*Status*|\ *Status Change Time*| *Error No*|*Error Msg*|',\ '|*Apply Name*|*DDL Handler*|*Message Handler*|\ *Precommit Handler*|',\ '|*Apply Name*|*Parameter*|*Value*|*Set By User*|',\ '|*Name*|*Object*|*Rule Set Type*|*Source DB*|*Type*|\ *Include Tagged Lcr*|*Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Apply Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Name*|*Action Context Name*|\ *Action Context Value*|',\ '|*Apply Name*|*Msg Handler*|*DDL Handler*|',\ '|*Object*|*Operation Name*|*User Procedure*|*Typ*|*DB Link*|\ *Apply Name*|',\ '|*Object*|*Status*|*Object Type*|*Created*|*Last DDL Time*|',\ '|*Action Context Value*|*Status*|*Object Type*|*Created*|\ *Last DDL Time*|',\ '|*Object*|*Method Name*|*Resolution Column*|*Column Name*|',\ '|*Object Owner*|*Object*|*Column*|*DB Link*|') set $sql {SELECT '|' || " apply_name || ' |' || " queue_owner || '.' || queue_name || ' |' || " DECODE(apply_captured,'YES','Captured','NO','User-Enqueued') || ' |' || " status || ' |' || " apply_user || ' |' || " apply_tag || ' |' || " rule_set_owner || '.' || rule_set_name || ' |' || " negative_rule_set_owner || '.' || negative_rule_set_name || ' |' || " apply_database_link || ' |' " FROM dba_apply; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " apply_name || ' | ' || " max_applied_message_number || '|' || " status || ' |' || " TO_CHAR(status_change_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " error_number || '|' || " error_message || ' |' " FROM dba_apply; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " apply_name || ' |' || " ddl_handler || ' |' || " message_handler || ' |' || " precommit_handler || ' |' " FROM dba_apply; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " apply_name || ' |' || " parameter || ' |' || " value || ' |' || " set_by_user || ' |' " FROM dba_apply_parameters; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_set_type || ' |' || " source_database || ' |' || " streams_rule_type || ' ' || rule_type || ' |' || " include_tagged_lcr || ' |' || " rule_owner||'.'||rule_name || ' |' " FROM dba_streams_rules " WHERE streams_type = 'APPLY' " ORDER BY streams_name,object_name,source_database,rule_set_type,rule_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_rules " WHERE streams_type = 'APPLY' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(7)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(8)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " c.apply_name || ' |' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r,dba_apply c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.negative_rule_set_owner " AND rsr.rule_set_name = c.negative_rule_set_name " AND rsr.rule_set_name IN " (SELECT negative_rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_rule_set_rules rsr,dba_rules r, " TABLE(r.rule_action_context.actx_list) ac " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " apply_name || ' |' || " message_handler || ' |' || " ddl_handler || ' |' " FROM dba_apply " WHERE message_handler IS NOT NULL OR ddl_handler IS NOT NULL; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " object_owner || '.' || object_name || ' |' || " operation_name || ' |' || " user_procedure || ' |' || " DECODE(error_handler,'Y','Error','N','DML','UNKNOWN') || ' |' || " apply_database_link || ' |' || " apply_name || ' |' " FROM dba_apply_dml_handlers; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " o.owner || '.' || o.object_name || ' |' || " o.status || ' |' || " o.object_type || ' |' || " o.created || ' |' || " o.last_ddl_time || ' |' " FROM dba_objects o, " (SELECT DISTINCT user_procedure " FROM dba_apply_dml_handlers " WHERE user_procedure IS NOT NULL) h " WHERE o.owner = REPLACE(SUBSTR(h.user_procedure,1, " INSTR(h.user_procedure,'.',1,1) - 1),'"',NULL) " AND o.object_name = REPLACE(SUBSTR(h.user_procedure, " INSTR(h.user_procedure,'.',-1,1) + 1),'"',NULL); "PROMPT ___Macro_separator(13)___ "SELECT '|' || " ac.owner || '.' || ac.object_name || ' |' || " o.status || ' |' || " o.object_type || ' |' || " o.created || ' |' || " o.last_ddl_time || ' |' " FROM dba_objects o, " (SELECT DISTINCT REPLACE(SUBSTR(transform_function_name,1, " INSTR(transform_function_name,'.',1,1)-1),'"') owner, " REPLACE(SUBSTR(transform_function_name, " INSTR(transform_function_name,'.',-1,1) + 1),'"') object_name " FROM dba_streams_transform_function ) ac " WHERE o.owner = ac.owner " AND o.object_name = ac.object_name; "PROMPT ___Macro_separator(14)___ "SELECT '|' || " object_owner || '.' || object_name || ' |' || " method_name || ' |' || " resolution_column || ' |' || " column_name || ' |' " FROM dba_apply_conflict_columns " ORDER BY object_owner,object_name; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " object_owner || ' |' || " object_name || ' |' || " column_name || ' |' || " apply_database_link || ' |' " FROM dba_apply_key_columns; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Apply Information',\ '---+ Apply Process Information',\ '---+ Apply Process Handlers',\ '---+ Apply Process Parameters',\ '---+ Streams Apply Rules Configured',\ '---+ Streams Table Subsetting Rules',\ '---+ Apply Rules by RuleSet',\ '---+ Apply Rules in Negative RuleSet',\ '---+ Apply Rule Transformations by Rule Set',\ '---+ Apply Handlers',\ '---+ Apply Dml Handlers',\ '---+ DML Handler Status',\ '---+ Rule Transformation Status',\ '---+ Apply Enqueue Directives',\ '---+ Apply Execute Directives',\ '---+ Conflict Detection Control',\ '---+ Update Conflict Resolution Columns',\ '---+ Key Columns Set for Apply',\ '---+ Object Dependencies Set for Apply',\ '---+ Value Dependencies Set for Apply') var @HDR = ('',\ '|*Apply Name*|*Queue*|*Apply Captured*|*Status*|*Apply User*|\ *Apply Tag*|*RSN*|*RSN2*|*Apply Database Link*|',\ '|*Apply Name*| *Max Applied Msg No*|*Status*|\ *Status Change Time*| *Error No*|*Error Msg*|',\ '|*Apply Name*|*DDL Handler*|*Message Handler*|\ *Precommit Handler*|',\ '|*Apply Name*|*Parameter*|*Value*|*Set By User*|',\ '|*Name*|*Object*|*Rule Set Type*|*Source DB*|*Type*|\ *Include Tagged Lcr*|*Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Apply Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Owner*|*Rule Name*|*Transform Type*|\ *From Schema Name*|*To Schema Name*|*From Table Name*|\ *To Table Name*|*Schema Name*|*Table Name*|*From Column Name*|\ *To Column Name*|*Column Name*|*Column Value*|*Column Type*|\ *Column Function*|*Value Type*|*User Function Name*|\ *Subsetting Operation*|*Dml Condition*|*Declarative Type*| \ *Precedence*| *Step Number*|',\ '|*Apply Name*|*Msg Handler*|*DDL Handler*|',\ '|*Object*|*Operation Name*|*User Procedure*|*Apply Name*|*Typ*|\ *Lob Assemble*|*Apply DB Link*|',\ '|*Object*|*Status*|*Object Type*|*Created*|*Last DDL Time*|',\ '|*Action Context Value*|*Status*|*Object Type*|*Created*|\ *Last DDL Time*|',\ '|*Rule Owner*|*Rule Name*|*Destination Queue Name*|',\ '|*Rule Owner*|*Rule Name*|*Execute Event*|',\ '|*Object Owner*|*Object Name*|*Column Name*|\ *Compare Old on Delete*|*Compare Old on Update*|\ *Apply Database Link*|',\ '|*Object*|*Method Name*|*Resolution Column*|*Column Name*|\ *Apply Database Link*|',\ '|*Object Owner*|*Object*|*Column*|*Apply DB Link*|',\ '|*Object Owner*|*Object Name*|*Parent Object Owner*|\ *Parent Object Name*|',\ '|*Dependency Name*|Object Owner*|*Object Name*|*Column Name*|\ *Column Position*|') set $sql {SELECT '|' || " apply_name || ' |' || " queue_owner || '.' || queue_name || ' |' || " DECODE(apply_captured,'YES','Captured','NO','User-Enqueued') || ' |' || " status || ' |' || " apply_user || ' |' || " apply_tag || ' |' || " rule_set_owner || '.' || rule_set_name || ' |' || " negative_rule_set_owner || '.' || negative_rule_set_name || ' |' || " apply_database_link || ' |' " FROM dba_apply; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " apply_name || ' | ' || " max_applied_message_number || '|' || " status || ' |' || " TO_CHAR(status_change_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " error_number || '|' || " error_message || ' |' " FROM dba_apply; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " apply_name || ' |' || " ddl_handler || ' |' || " message_handler || ' |' || " precommit_handler || ' |' " FROM dba_apply; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " apply_name || ' |' || " parameter || ' |' || " value || ' |' || " set_by_user || ' |' " FROM dba_apply_parameters; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_set_type || ' |' || " source_database || ' |' || " streams_rule_type || ' ' || rule_type || ' |' || " include_tagged_lcr || ' |' || " rule_owner||'.'||rule_name || ' |' " FROM dba_streams_rules " WHERE streams_type = 'APPLY' " ORDER BY streams_name,object_name,source_database,rule_set_type, " rule_owner||'.'||rule_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_rules " WHERE streams_type = 'APPLY' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(7)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(8)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " c.apply_name || ' |' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r,dba_apply c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.negative_rule_set_owner " AND rsr.rule_set_name = c.negative_rule_set_name " AND rsr.rule_set_name IN " (SELECT negative_rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " r.rule_owner || '|' || " r.rule_name || ' |' || " r.transform_type || ' |' || " r.from_schema_name || ' |' || " r.to_schema_name || ' |' || " r.from_table_name || ' |' || " r.to_table_name || ' |' || " r.schema_name || ' |' || " r.table_name || ' |' || " r.from_column_name || ' |' || " r.to_column_name || ' |' || " r.column_name || ' |' || " r.column_type || ' |' || " r.column_function || ' |' || " r.value_type || ' |' || " r.user_function_name || ' |' || " r.subsetting_operation || ' |' || " r.dml_condition || ' |' || " r.declarative_type || ' | ' || " r.precedence || '| ' || " r.step_number || ' |' " FROM dba_rule_set_rules rsr,dba_streams_transformations r " WHERE r.rule_name = rsr.rule_name " AND r.rule_owner = rsr.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_apply) " ORDER BY rsr.rule_set_owner, " rsr.rule_set_name, " r.rule_owner, " r.rule_name,transform_type DESC, " step_number, " precedence; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " apply_name || ' |' || " message_handler || ' |' || " ddl_handler || ' |' " FROM dba_apply " WHERE message_handler IS NOT NULL OR ddl_handler IS NOT NULL; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " object_owner || '.' || object_name || ' |' || " operation_name || ' |' || " user_procedure || ' |' || " apply_name || ' |' || " DECODE(error_handler,'Y','Error','N','DML','UNKNOWN') || ' |' || " DECODE(assemble_lobs,'Y','Yes','N','No','UNKNOWN') || '|' || " apply_database_link || ' |' " FROM dba_apply_dml_handlers " ORDER BY object_owner,object_name,apply_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " o.owner || '.' || o.object_name || ' |' || " o.status || ' |' || " o.object_type || ' |' || " o.created || ' |' || " o.last_ddl_time || ' |' " FROM dba_objects o, " (SELECT DISTINCT user_procedure " FROM dba_apply_dml_handlers " WHERE user_procedure IS NOT NULL) h " WHERE o.owner = REPLACE(SUBSTR(h.user_procedure,1, " INSTR(h.user_procedure,'.',1,1) - 1),'"',NULL) " AND o.object_name = REPLACE(SUBSTR(h.user_procedure, " INSTR(h.user_procedure,'.',-1,1) + 1),'"',NULL); "PROMPT ___Macro_separator(13)___ "SELECT '|' || " ac.owner || '.' || ac.object_name || ' |' || " o.status || ' |' || " o.object_type || ' |' || " o.created || ' |' || " o.last_ddl_time || ' |' " FROM dba_objects o, " (SELECT DISTINCT REPLACE(SUBSTR(transform_function_name,1, " INSTR(transform_function_name,'.',1,1)-1),'"') owner, " REPLACE(SUBSTR(transform_function_name, " INSTR(transform_function_name,'.',-1,1) + 1),'"') object_name " FROM dba_streams_transform_function ) ac " WHERE o.owner = ac.owner " AND o.object_name = ac.object_name; "PROMPT ___Macro_separator(14)___ "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' || " destination_queue_name || ' |' " FROM dba_apply_enqueue; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " rule_owner || ' |' || " rule_name || ' |' || " execute_event || ' |' " FROM dba_apply_execute; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " object_owner || ' |' || " object_name || ' |' || " column_name || ' |' || " compare_old_on_delete || ' |' || " compare_old_on_update || ' |' || " apply_database_link || ' |' " FROM dba_apply_table_columns; "PROMPT ___Macro_separator(17)___ "SELECT '|' || " object_owner || '.' || object_name || ' |' || " method_name || ' |' || " resolution_column || ' |' || " column_name || ' |' || " apply_database_link || ' |' " FROM dba_apply_conflict_columns " ORDER BY object_owner,object_name; "PROMPT ___Macro_separator(18)___ "SELECT '|' || " object_owner || ' |' || " object_name || ' |' || " column_name || ' |' || " apply_database_link || ' |' " FROM dba_apply_key_columns; "PROMPT ___Macro_separator(19)___ "SELECT '|' || " object_owner || ' |' || " object_name || ' |' || " parent_object_owner || ' |' || " parent_object_name || ' |' " FROM dba_apply_object_dependencies; "PROMPT ___Macro_separator(20)___ "SELECT '|' || " dependency_name || ' |' || " object_owner || ' |' || " object_name || ' |' || " column_name || ' |' || " column_position || ' |' " FROM dba_apply_value_dependencies; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Apply Settings',3) } =head2 capture_set - Capture Settings Collects information about Capture Settings. =cut debug ' Inside STC module, gathering capture settings information' report capture_set var $TTL = '---+!! Capture Settings' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Capture Processes in Database',\ '---+ Capture Process Parameters',\ '---+ Streams Capture Rules configured with \ DBMS_STREAMS_ADM PACKAGE',\ '---+ Streams Table Subsetting Rules',\ '---+ Capture Rules by Rule Set',\ '---+ Capture Rule Transformations by Rule Set',\ '---+ Tables Prepared for Capture',\ '---+ Schemas Prepared for Capture',\ '---+ Database Prepared for Capture',\ '---+ Tables with Supplemental Logging') var @HDR = ('',\ '|*Capture Name*|*Queue*|*Rule Set Name*|*Status*|\ *Start SCN*| *Captured SCN*|*Applied SCN*|',\ '|*Capture Name*|*Parameter*|*Value*|*Set By User*|',\ '|*Name*|*Object*|*Source Database*|*Type*|*Tagged Lcr*|*Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsettng Operation*|',\ '|*Capture Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Name*|*Action Context Name*|\ *Action Context Value*|',\ '|*Table Owner*|*Table Name*| *SCN*|*Timestamp*|',\ '|*Schema Name*|*Timestamp*|',\ '|*Timestamp*|',\ '|*Owner*|*Table Name*|') set $sql {SELECT '|' || " capture_name || ' |' || " queue_owner||'.'||queue_name || ' |' || " rule_set_owner||'.'||rule_set_name || ' |' || " status || ' | ' || " start_scn || '| ' || " captured_scn || '| ' || " applied_scn || '|' " FROM dba_capture; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " capture_name || ' |' || " parameter || ' |' || " value || ' |' || " set_by_user || ' |' " FROM dba_capture_parameters; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " name || '|' || " object || '|' || " source_database || '|' || " type || '|' || " include_tagged_lcr || '|' || " rule || '|' " FROM (SELECT streams_name name, " table_owner || '.' || table_name object, " source_database, " rule_type || ' TABLE RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rulE " FROM dba_streams_table_rules " WHERE streams_type = 'CAPTURE' " UNION " SELECT streams_name name, " schema_name object, " source_database, " rule_type || ' SCHEMA RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_schema_rules " WHERE streams_type = 'CAPTURE' " UNION " SELECT streams_name name, " ' ' object, " source_database, " rule_type || ' GLOBAL RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_global_rules " WHERE streams_type = 'CAPTURE') " ORDER BY name,object; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_name || ' |' || " table_owner ||'.' || table_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_table_rules " WHERE streams_type = 'CAPTURE' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(5)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " c.capture_name || ' |' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r,dba_capture c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.rule_set_owner " AND rsr.rule_set_name = c.rule_set_name " AND rsr.rule_set_name IN " (SELECT rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_rule_set_rules rsr,dba_rules r, " TABLE(r.rule_action_context.actx_list) ac "WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " table_owner || ' |' || " table_name || ' | ' || " scn || '|' || " timestamp || ' |' " FROM dba_capture_prepared_tables; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " schema_name || ' | ' || " timestamp || ' |' " FROM dba_capture_prepared_schemas; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " timestamp || ' |' " FROM dba_capture_prepared_database; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " owner || ' |' || " table_name || ' |' " FROM dba_log_groups; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Capture Processes in Database',\ '---+ Capture Process Source Information',\ '---+ Capture Process Parameters',\ '---+ Streams Capture Rules-DBMS_STREAMS_ADM Package',\ '---+ Streams Table Subsetting Rules',\ '---+ Capture Rules by Rule Set',\ '---+ Capture Rules in Negative Rule Set',\ '---+ Capture Rule Transformations by Rule Set',\ '---+ Registered Log Files for Capture',\ '---+ Capture Extra Attributes',\ '---+ Tables Prepared for Capture',\ '---+ Schemas Prepared for Capture',\ '---+ Database Prepared for Capture',\ '---+ Tables With Supplemental Logging',\ '---+ Table Level Supplemental Log Groups Enabled for Capture',\ '---+ Supplementally Logged Columns',\ '---+ Messaging Clients in Database',\ '---+ Messaging Client Notifications') var @HDR = ('',\ '|*Capture Name*|*Queue*|*Capture Type*|*Status*|*RSN*|*RSN2*|\ *Version*|*Logfile Assgn*|*Error No*|*Status Change Time*|\ *Error Msg*|',\ '|*Capture Name*|*Capture Type*|*Source DB*| *First SCN*| \ *Start SCN*| *Captured SCN*| *Applied SCN*| \ *Required Checkpoint SCN*| *Max Checkpoint SCN*| \ *Source DB ID*| *Source Resetlogs SCN*| \ *Source Resetlogs Time*| *Logminer ID*|',\ '|*Capture Name*|*Parameter*|*Value*|*Set By User*|',\ '|*Name*|*Object*|*Rule Set Type*|*Source DB*|*Type*|\ *Include Tagged Lcr*|*Rule*|',\ '|*Streams Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Capture Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Capture Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Name*|*Action Context Name*|\ *Action Context Value*|',\ '|*Consumer Name*|*Source DB*|*Seq*|*Name*|*First SCN*|\ *First Time*|*Modified Time*|*Dictionary Begin*|\ *Dictionary End*|',\ '|*Capture Name*|*Attribute Name*|*Include*|',\ '|*Table Owner*|*Table Name*| *SCN*|*Timestamp*|',\ '|*Schema Name*|*Timestamp*|',\ '|*Timestamp*|',\ '|*Owner*|*Table Name*|',\ '|*Object*|*Log Group Name*|*Always*|',\ '|*Object*|*Log Group Name*|*Column Name*| *Position*|',\ '|*Streams Name*|*Queue Owner*|*Queue Name*|*Rule Set Name*|\ *Negative Rule Set*|',\ '|*Streams Name*|*Queue Owner*|*Queue Name*|*Notification Type*|\ *Notification Action*|') set $sql {SELECT '|' || " capture_name || ' |' || " queue_owner || '.' || queue_name || ' |' || " capture_type || ' |' || " status || ' |' || " rule_set_owner || '.' || rule_set_name || ' |' || " negative_rule_set_owner || '.' || negative_rule_set_name || ' |' || " version || ' |' || " logfile_assignment || ' | ' || " error_number || '|' || " TO_CHAR(status_change_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " error_message || ' |' " FROM dba_capture; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " capture_name || ' |' || " capture_type || ' |' || " source_database || ' | ' || " first_scn || '| ' || " start_scn || '| ' || " captured_scn || '| ' || " applied_scn || '| ' || " required_checkpoint_scn || '| ' || " max_checkpoint_scn || '| ' || " source_dbid || '| ' || " source_resetlogs_scn || '| ' || " source_resetlogs_time || '| ' || " logminer_id || '|' " FROM dba_capture; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " capture_name || ' |' || " parameter || ' |' || " value || ' |' || " set_by_user || ' |' " FROM dba_capture_parameters " ORDER BY capture_name,parameter; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_set_type || ' |' || " source_database || ' |' || " streams_rule_type || ' ' || rule_type || ' |' || " include_tagged_lcr || ' |' || " rule_owner || '.' || rule_name || ' |' " FROM dba_streams_rules " WHERE streams_type = 'CAPTURE' " ORDER BY streams_name,object_name,source_database,rule_set_type,rule_name; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_rules " WHERE streams_type = 'CAPTURE' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(6)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " c.capture_name || ' |' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r,dba_capture c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.rule_set_owner " AND rsr.rule_set_name = c.rule_set_name " AND rsr.rule_set_name IN ( " SELECT rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(7)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " c.capture_name || ' |' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r,dba_capture c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.negative_rule_set_owner " AND rsr.rule_set_name = c.negative_rule_set_name " AND rsr.rule_set_name IN " (SELECT negative_rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_rule_set_rules rsr,dba_rules r, " TABLE(r.rule_action_context.actx_list) ac " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " r.consumer_name || ' |' || " r.source_database || ' | ' || " r.sequence# || '|' || " r.name || ' | ' || " r.first_scn || '|' || " TO_CHAR(r.first_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(r.modified_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " r.dictionary_begin || ' |' || " r.dictionary_end || ' |' " FROM dba_registered_archived_log r,dba_capture c " WHERE r.consumer_name = c.capture_name " ORDER BY r.source_database,r.consumer_name,r.first_scn; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " capture_name || ' |' || " attribute_name || ' |' || " include || ' |' " FROM dba_capture_extra_attributes " ORDER BY capture_name; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " table_owner || ' |' || " table_name || ' | ' || " scn || '|' || " timestamp || ' |' " FROM dba_capture_prepared_tables " ORDER BY table_owner,table_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " schema_name || ' |' || " timestamp || ' |' " FROM dba_capture_prepared_schemas " ORDER BY schema_name; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " timestamp || ' |' " FROM dba_capture_prepared_database; "PROMPT ___Macro_separator(14)___ "SELECT DISTINCT '|' || " owner || ' |' || " table_name || ' |' " FROM dba_log_groups; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " owner || '.' || table_name || ' |' || " log_group_name || ' |' || " DECODE(always,'ALWAYS','Unconditional',NULL,'Conditional') || ' |' " FROM dba_log_groups; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " owner || '.' || table_name || ' |' || " log_group_name || ' |' || " column_name || ' | ' || " position || '|' " FROM dba_log_group_columns; "PROMPT ___Macro_separator(17)___ "SELECT '|' || " streams_name || ' |' || " queue_owner || ' |' || " queue_name || ' |' || " rule_set_name || ' |' || " negative_rule_set_name || ' |' " FROM dba_streams_message_consumers " ORDER BY queue_owner,queue_name,streams_name; "PROMPT ___Macro_separator(18)___ "SELECT '|' || " streams_name || ' |' || " queue_owner || ' |' || " queue_name || ' |' || " notification_type || ' |' || " notification_action || ' |' " FROM dba_streams_message_consumers " WHERE notification_type IS NOT NULL " ORDER BY queue_owner,queue_name,streams_name; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Capture Processes in Database',\ '---+ Capture Process Source Information',\ '---+ Capture Process Parameters',\ '---+ Streams Capture Rules-DBMS_STREAMS_ADM Package',\ '---+ Streams Table Subsetting Rules',\ '---+ Capture Rules by Rule Set',\ '---+ Capture Rules in Negative Rule Set',\ '---+ Capture Rule Transformations by Rule Set',\ '---+ Registered Log Files for Capture',\ '---+ Capture Extra Attributes',\ '---+ Tables Prepared for Capture',\ '---+ Schemas Prepared for Capture',\ '---+ Database Prepared for Capture',\ '---+ Tables With Supplemental Logging',\ '---+ Table Level Supplemental Log Groups Enabled for Capture',\ '---+ Supplementally Logged Columns',\ '---+ Messaging Clients in Database',\ '---+ Messaging Client Notifications') var @HDR = ('',\ '|*Capture Name*|*Queue*|*Capture Type*|*Status*|*RSN*|\ *RSN2*| *Checkpoint Retention Time*|*Version*|\ *Logfile Assgn*|*Error No*|*Status Change Time*|\ *Error Msg*|',\ '|*Capture Name*|*Capture Type*|*Source DB*| \ *First SCN*| *Start SCN*| *Captured SCN*| *Applied SCN*| \ *Last Enqueued SCN*| *Required Checkpoint SCN*| \ *Max Checkpoint SCN*| *Source DB ID*| *Source Resetlogs SCN*| \ *Source Resetlogs Time*| *Logminer ID*|',\ '|*Capture Name*|*Parameter*|*Value*|*Set By User*|',\ '|*Name*|*Object*|*Rule Set Type*|*Source DB*|*Type*|\ *Include Tagged Lcr*|*Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Capture Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Capture Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Owner*|*Rule Name*|*Transform Type*|\ *From Schema Name*|*To Schema Name*|*From Table Name*|\ *To Table Name*|*Schema Name*|*Table Name*|*From Column Name*|\ *To Column Name*|*Column Name*|*Column Value*|*Column Type*|\ *Column Function*|*Value Type*|*User Function Name*|\ *Subsetting Operation*|*Dml Condition*|*Declarative Type*| \ *Precedence*| *Step Number*|',\ '|*Consumer Name*|*Source DB*|*Seq*|*Name*|*First SCN*|\ *First Time*|*Next SCN*|*Next Time*|*Modified Time*|\ *Dictionary Begin*|*Dictionary End*|*Purgeable*|',\ '|*Capture Name*|*Attribute Name*|*Include*|',\ '|*Table Owner*|*Table Name*| *SCN*|*Timestamp*|\ *Supplemental Log Data PK*|*Supplemental Log Data UI*|\ *Supplemental Log Data FK*|*Supplemental Log Data All*|',\ '|*Schema Name*|*Timestamp*|*Supplemental Log Data PK*|\ *Supplemental Log Data UI*|*Supplemental Log Data FK*|\ *Supplemental Log Data All*|',\ '|*Timestamp*|*Supplemental Log Data PK*|\ *Supplemental Log Data UI*|*Supplemental Log Data FK*|\ *Supplemental Log Data All*|',\ '|*Owner*|*Table Name*|',\ '|*Object*|*Log Group Name*|*Log Group Type*|*Always*|\ *Generated*|',\ '|*Object*|*Log Group Name*|*Column Name*| *Position*|\ *Logging Property*|',\ '|*Streams Name*|*Queue Owner*|*Queue Name*|*Rule Set Name*|\ *Negative Rule Set Name*|',\ '|*Streams Name*|*Queue Owner*|*Queue Name*|*Notification Type*|\ *Notification Action*|') set $sql {SELECT '|' || " capture_name || ' |' || " queue_owner || '.' || queue_name || ' |' || " capture_type || ' |' || " status || ' |' || " rule_set_owner || '.' || rule_set_name || ' |' || " negative_rule_set_owner || '.' || negative_rule_set_name || ' | ' || " checkpoint_retention_time || '|' || " version || ' |' || " logfile_assignment || ' | ' || " error_number || '|' || " TO_CHAR(status_change_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " error_message || ' |' " FROM dba_capture; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " capture_name || ' |' || " capture_type || ' |' || " source_database || ' | ' || " first_scn || '| ' || " start_scn || '| ' || " captured_scn || '| ' || " applied_scn || '| ' || " last_enqueued_scn || '| ' || " required_checkpoint_scn || '| ' || " max_checkpoint_scn || '| ' || " source_dbid || '| ' || " source_resetlogs_scn || '| ' || " source_resetlogs_time || '| ' || " logminer_id || '|' " FROM dba_capture; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " capture_name || ' |' || " parameter || ' |' || " value || ' |' || " set_by_user || ' |' " FROM dba_capture_parameters " ORDER BY capture_name,parameter; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_set_type || ' |' || " source_database || ' |' || " streams_rule_type || ' ' || rule_type || ' |' || " include_tagged_lcr || ' |' || " rule_owner || '.' || rule_name || ' |' " FROM dba_streams_rules " WHERE streams_type = 'CAPTURE' " ORDER BY streams_name, " object_name, " source_database, " rule_set_type, " rule_owner||'.'||rule_name; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_rules " WHERE streams_type = 'CAPTURE' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(6)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " c.capture_name || ' |' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r,dba_capture c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.rule_set_owner " AND rsr.rule_set_name = c.rule_set_name " AND rsr.rule_set_name IN " (SELECT rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(7)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " c.capture_name || ' |' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r,dba_capture c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.negative_rule_set_owner " AND rsr.rule_set_name = c.negative_rule_set_name " AND rsr.rule_set_name IN " (SELECT negative_rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " r.rule_owner || '|' || " r.rule_name || ' |' || " transform_type || ' |' || " from_schema_name || ' |' || " to_schema_name || ' |' || " from_table_name || ' |' || " to_table_name || ' |' || " schema_name || ' |' || " table_name || ' |' || " from_column_name || ' |' || " to_column_name || ' |' || " column_name || ' |' || " column_type || ' |' || " column_function || ' |' || " value_type || ' |' || " user_function_name || ' |' || " subsetting_operation || ' |' || " dml_condition || ' |' || " declarative_type || ' | ' || " precedence || '| ' || " step_number || ' |' " FROM dba_rule_set_rules rsr,dba_streams_transformations r " WHERE r.rule_name = rsr.rule_name " AND r.rule_owner = rsr.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_capture) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name,r.rule_owner, " r.rule_name,transform_type DESC,step_number,precedence; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " r.consumer_name || ' |' || " r.source_database || ' | ' || " r.sequence# || '|' || " r.name || ' | ' || " r.first_scn || '|' || " TO_CHAR(r.first_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " r.next_scn || '|' || " TO_CHAR(r.next_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(r.modified_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " r.dictionary_begin || ' |' || " r.dictionary_end || ' |' || " r.purgeable || '|' " FROM dba_registered_archived_log r,dba_capture c " WHERE r.consumer_name = c.capture_name " ORDER BY r.source_database,r.consumer_name,r.first_scn; "PROMPT ___Macro_separator(10)___ "SELECT '|' || " capture_name || ' |' || " attribute_name || ' |' || " include || ' |' " FROM dba_capture_extra_attributes " ORDER BY capture_name; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " table_owner || ' |' || " table_name || ' | ' || " scn || '|' || " timestamp || ' |' || " supplemental_log_data_pk || ' |' || " supplemental_log_data_ui || ' |' || " supplemental_log_data_fk || ' |' || " supplemental_log_data_all || ' |' " FROM dba_capture_prepared_tables " ORDER BY table_owner,table_name; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " schema_name || ' |' || " timestamp || ' |' || " supplemental_log_data_pk || ' |' || " supplemental_log_data_ui || ' |' || " supplemental_log_data_fk || ' |' || " supplemental_log_data_all || ' |' " FROM dba_capture_prepared_schemas " ORDER BY schema_name; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " timestamp || ' |' || " supplemental_log_data_pk || ' |' || " supplemental_log_data_ui || ' |' || " supplemental_log_data_fk || ' |' || " supplemental_log_data_all || ' |' " FROM dba_capture_prepared_database; "PROMPT ___Macro_separator(14)___ "SELECT DISTINCT '|' || " owner || ' |' || " table_name || ' |' " FROM dba_log_groups; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " owner || '.' || table_name || ' |' || " log_group_name || ' |' || " log_group_type || ' |' || " DECODE(always,'ALWAYS','Unconditional','CONDITIONAL','Conditional', " NULL,'CONDITIONAL') || ' |' || " generated || ' |' " FROM dba_log_groups; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " owner || '.' || table_name || ' |' || " log_group_name || ' |' || " column_name || ' | ' || " position || '|' || " logging_property || '|' " FROM dba_log_group_columns; "PROMPT ___Macro_separator(17)___ "SELECT '|' || " streams_name || ' |' || " queue_owner || ' |' || " queue_name || ' |' || " rule_set_name || ' |' || " negative_rule_set_name || ' |' " FROM dba_streams_message_consumers " ORDER BY queue_owner,queue_name,streams_name; "PROMPT ___Macro_separator(18)___ "SELECT '|' || " streams_name || ' |' || " queue_owner || ' |' || " queue_name || ' |' || " notification_type || ' |' || " notification_action || ' |' " FROM dba_streams_message_consumers " WHERE notification_type IS NOT NULL " ORDER BY queue_owner,queue_name,streams_name; } } elsif match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Sync Capture Processes') var @HDR = ('',\ '|*Capture Name*|*Queue Name*|*Queue Owner*|*Rule Set Name*\ *Rule Set Owner*|*Capture User*|') append $sql {SELECT '|' || " capture_name || ' |' || " queue_name || ' |' || " queue_owner || ' |' || " rule_set_name || ' |' || " rule_set_owner || ' |' || " capture_user || ' |' " FROM dba_sync_capture " ORDER BY capture_name; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Capture Settings',3) } =head2 db - Database Settings Collects information about Database Settings. =cut debug ' Inside STC module, gathering database settings information' report db var $TTL = '---+!! Database Settings' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Database Information',\ '---+ Instance Information',\ '---+ Registry Information',\ '---+ NLS Database Parameters',\ '---+ Global Name',\ '---+ Key Init.ora Parameters') var @HDR = ('',\ '| *DB ID*|*DB Name*|*Created*|*Min Log*|*Pk Log*|*UI Log*|\ *Force Log*|*Resetlogs Time*|*Log Mode*| *Archive Change#*|\ *Open Mode*|*Database Role*| *Archivelog Change#*|',\ '| *Instance*|*Name*|*Host*|*Version*|\ *Startup Time*|*Status*|*Parallel*|*Archiver*|\ *Logins*|*Instance Role*|*Shutdown*|*Active State*|',\ '|*Comp id*|*Component*|*Version*|*Status*|*Modified*|*Schema*|',\ '|*Parameter*|*Value*|',\ '|*Global Name*|',\ '|*Name*|*Value*|*Description*|') set $sql {SELECT '| ' || " dbid || '|' || " name || ' |' || " created || ' |' || " supplemental_log_data_min || ' |' || " supplemental_log_data_pk || ' |' || " supplemental_log_data_ui || ' |' || " force_logging || ' |' || " TO_CHAR(resetlogs_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " log_mode || ' | ' || " archive_change# || '|' || " open_mode || ' |' || " database_role || ' | ' || " archivelog_change# || '|' " FROM v$database; "PROMPT ___Macro_separator(2)___ "SELECT '| ' || " instance_number || '|' || " instance_name || ' |' || " host_name || ' |' || " version || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " status || ' |' || " parallel || ' |' || " archiver || ' |' || " logins || ' |' || " instance_role || ' |' || " shutdown_pending || ' |' || " active_state || ' |' " FROM gv$instance; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " comp_id || ' |' || " comp_name || ' |' || " version || ' |' || " status || ' |' || " modified || ' |' || " schema || ' |' " FROM dba_registry; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " parameter || ' |' || " value || ' |' " FROM nls_database_parameters; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " global_name || ' |' " FROM global_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " name || ' |' || " value || ' |' || " description || ' |' " FROM v$parameter " WHERE LOWER(name) IN ('aq_tm_processes','archive_lag_target','compatible', " 'global_names','job_queue_processes', " 'log_parallelism','logmnr_max_persistent_sessions', " 'parallel_max_servers','processes','sessions', " 'sga_max_size','shared_pool_size', " 'transaction_auditing','_first_spare_parameter', " '_kghdsidx_count'); } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Database Information',\ '---+ Instance Information',\ '---+ Current Database Incarnation',\ '---+ Registry Information',\ '---+ NLS Database Parameters',\ '---+ Global Name',\ '---+ Key Init.ora Parameters') var @HDR = ('',\ '| *DB ID*|*DB Name*|*Created*|*Min Log*|*PK Log*|*UI Log*|\ *FK Log*|*All Log*|*Force Log*|*Resetlogs Time*|*Log Mode*| \ *Archive Change#*|*Open Mode*|*Database Role*| \ *Archivelog Change#*|*Current SCN*|*Platform ID*|\ *Platform Name*|',\ '| *Instance*|*Name*|*Host*|*Version*|*Startup Time*|*Status*|\ *Parallel*|*Archiver*|*Logins*|*Instance Role*|*Shutdown*|\ *Active State*|',\ '| *Incarnation#*| *Resetlogs Change#*|*Resetlogs Time*| \ *Prior Resetlogs Change#*|*Prior Resetlogs Time*|*Status*| \ *Resetlogs ID*| *Prior Incarnation#*|',\ '|*Comp id*|*Component*|*Version*|*Status*|*Modified*|*Schema*|',\ '|*Parameter*|*Value*|',\ '|*Global Name*|',\ '|*Name*|*Value*|*Description*|') set $sql {SELECT '| ' || " dbid || '|' || " name || ' |' || " created || ' |' || " supplemental_log_data_min || ' |' || " supplemental_log_data_pk || ' |' || " supplemental_log_data_ui || ' |' || " supplemental_log_data_fk || ' |' || " supplemental_log_data_all || ' |' || " force_logging || ' |' || " TO_CHAR(resetlogs_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " log_mode || ' | ' || " archive_change# || '|' || " open_mode || ' |' || " database_role || ' | ' || " archivelog_change# || '|' || " current_scn || ' | ' || " platform_id || '|' || " platform_name || ' |' " FROM v$database; "PROMPT ___Macro_separator(2)___ "SELECT '| ' || " instance_number || '|' || " instance_name || ' |' || " host_name || ' |' || " version || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " status || ' |' || " parallel || ' |' || " archiver || ' |' || " logins || ' |' || " instance_role || ' |' || " shutdown_pending || ' |' || " active_state || ' |' " FROM gv$instance; "PROMPT ___Macro_separator(3)___ "SELECT '| ' || " incarnation# || '| ' || " resetlogs_change# || '|' || " resetlogs_time || ' | ' || " prior_resetlogs_change# || '|' || " prior_resetlogs_time || ' |' || " status || ' | ' || " resetlogs_id || '| ' || " prior_incarnation# || '|' " FROM v$database_incarnation " WHERE status = 'CURRENT'; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " comp_id || ' |' || " comp_name || ' |' || " version || ' |' || " status || ' |' || " modified || ' |' || " schema || ' |' " FROM dba_registry; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " parameter || ' |' || " value || ' |' " FROM nls_database_parameters; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " global_name || ' |' " FROM global_name; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " name || ' |' || " value || ' |' || " description || ' |' " FROM v$parameter " WHERE LOWER(name) IN ('aq_tm_processes','archive_lag_target','compatible', " 'global_names','job_queue_processes', " 'log_parallelism','logmnr_max_persistent_sessions', " 'parallel_max_servers','processes', " 'sessions','shared_pool_size', " 'sga_max_size','streams_pool_size','_kghdsidx_count'); } } elsif match($ORACLE_VERSION,'102') {var @TTL = ('',\ '---+ Database Information',\ '---+ Instance Information',\ '---+ Current Database Incarnation',\ '---+ Registry Information',\ '---+ NLS Database Parameters',\ '---+ Global Name',\ '---+ Key Init.ora Parameters') var @HDR = ('',\ '| *DB ID*|*DB Name*|*Created*|*Min Log*|*PK Log*|*UI Log*|\ *FK Log*|*All Log*|*Force Log*|*Resetlogs Time*|*Log Mode*| \ *Archive Change#*|*Open Mode*|*Database Role*| \ *Archivelog Change#*|*Current SCN*| *Platform ID*| \ *Platform Name*|',\ '| *Instance*|*Name*|*Host*|*Version*|*Startup Time*|*Status*|\ *Parallel*|*Archiver*|*Logins*|*Shutdown Pending*|\ *Instance Role*|*Active State*|',\ '| *Incarnation#*| *Resetlogs ID*| *Resetlogs Change#*|',\ '|*Comp id*|*Component*|*Version*|*Status*|*Modified*|*Schema*|',\ '|*Parameter*|*Value*|',\ '|*Global Name*|',\ '|*Name*|*Value*|*Description*|') set $sql {SELECT '| ' || " dbid || '|' || " name || ' |' || " created || ' |' || " supplemental_log_data_min || ' |' || " supplemental_log_data_pk || ' |' || " supplemental_log_data_ui || ' |' || " supplemental_log_data_fk || ' |' || " supplemental_log_data_all || ' |' || " force_logging || ' |' || " TO_CHAR(resetlogs_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " log_mode || ' | ' || " archive_change# || '|' || " open_mode || ' |' || " database_role || ' | ' || " archivelog_change# || '|' || " current_scn || ' | ' || " platform_id || '|' || " platform_name || ' |' " FROM v$database; "PROMPT ___Macro_separator(2)___ "SELECT '| ' || " instance_number || '|' || " instance_name || ' |' || " host_name || ' |' || " version || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " status || ' |' || " parallel || ' |' || " archiver || ' |' || " logins || ' |' || " shutdown_pending || ' |' || " instance_role || ' |' || " active_state || ' |' " FROM gv$instance; "PROMPT ___Macro_separator(3)___ "SELECT '| ' || " incarnation# || '| ' || " resetlogs_id || '| ' || " resetlogs_change# || '|' " FROM v$database_incarnation " WHERE status = 'CURRENT'; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " comp_id || ' |' || " comp_name || ' |' || " version || ' |' || " status || ' |' || " modified || ' |' || " schema || ' |' " FROM dba_registry; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " parameter || ' |' || " value || ' |' " FROM nls_database_parameters; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " global_name || ' |' " FROM global_name; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " name || ' |' || " value || ' |' || " description || ' |' " FROM v$parameter " WHERE LOWER(name) IN ('aq_tm_processes','archive_lag_target','compatible', " 'global_names','job_queue_processes', " 'log_parallelism','logmnr_max_persistent_sessions', " 'parallel_max_servers','processes','sga_target', " 'sessions','shared_pool_size','_job_queue_interval', " 'sga_max_size','streams_pool_size','_kghdsidx_count'); } } elsif match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Database Information',\ '---+ Instance Information',\ '---+ Current Database Incarnation',\ '---+ Registry Information',\ '---+ NLS Database Parameters',\ '---+ Global Name',\ '---+ Key Init.ora Parameters') var @HDR = ('',\ '| *DB ID*|*DB Name*|*Created*|*Min Log*|*PK Log*|*UI Log*|\ *FK Log*|*All Log*|*Force Log*|*Resetlogs Time*|*Log Mode*| \ *Archive Change#*|*Open Mode*|*Database Role*| \ *Archivelog Change#*|*Current SCN*| \ *Min Required Capture Change#*|*Platform ID*|*Platform Name*|',\ '| *Instance*|*Name*|*Host*|*Version*|*Startup Time*|*Status*|\ *Parallel*|*Archiver*|*Logins*|*Shutdown Pending*|\ *Instance Role*|*Active State*|',\ '| *Incarnation#*| *Resetlogs ID*| *Resetlogs Change#*|',\ '|*Comp id*|*Component*|*Version*|*Status*|*Modified*|*Schema*|',\ '|*Parameter*|*Value*|',\ '|*Global Name*|',\ '|*Name*|*Value*|*Description*|') set $sql {SELECT '| ' || " dbid || '|' || " name || ' |' || " created || ' |' || " supplemental_log_data_min || ' |' || " supplemental_log_data_pk || ' |' || " supplemental_log_data_ui || ' |' || " supplemental_log_data_fk || ' |' || " supplemental_log_data_all || ' |' || " force_logging || ' |' || " TO_CHAR(resetlogs_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " log_mode || ' | ' || " archive_change# || '|' || " open_mode || ' |' || " database_role || ' | ' || " archivelog_change# || '|' || " current_scn || ' | ' || " min_required_capture_change# || '| ' || " platform_id || '|' || " platform_name || ' |' " FROM v$database; "PROMPT ___Macro_separator(2)___ "SELECT '| ' || " instance_number || '|' || " instance_name || ' |' || " host_name || ' |' || " version || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " status || ' |' || " parallel || ' |' || " archiver || ' |' || " logins || ' |' || " shutdown_pending || ' |' || " instance_role || ' |' || " active_state || ' |' " FROM gv$instance; "PROMPT ___Macro_separator(3)___ "SELECT '| ' || " incarnation# || '| ' || " resetlogs_id || '| ' || " resetlogs_change# || '|' " FROM v$database_incarnation " WHERE status = 'CURRENT'; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " comp_id || ' |' || " comp_name || ' |' || " version || ' |' || " status || ' |' || " modified || ' |' || " schema || ' |' " FROM dba_registry; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " parameter || ' |' || " value || ' |' " FROM nls_database_parameters; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " global_name || ' |' " FROM global_name; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " name || ' |' || " value || ' |' || " description || ' |' " FROM v$parameter " WHERE LOWER(name) IN ('aq_tm_processes','archive_lag_target','compatible', " 'global_names','job_queue_processes', " 'log_parallelism','logmnr_max_persistent_sessions', " 'parallel_max_servers','processes','sga_target', " 'sessions','shared_pool_size','_job_queue_interval', " 'sga_max_size','streams_pool_size','_kghdsidx_count'); } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Database Settings',3) } =head2 prpgt_set - Propagation Settings Collects information about Propagation Settings. =cut debug ' Inside STC module, gathering propagation settings information' report prpgt_set var $TTL = '---+!! Propagation Settings' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Propagations Jobs in Database',\ '---+ Propagation Rule Sets in Database',\ '---+ Streams Propagation Rules Configured with DBMS_STREAMS_ADM \ Package',\ '---+ Streams Table Subsetting Rules',\ '---+ Propagation Rules by Ruleset',\ '---+ Propagation Rule Transformations by Ruleset') var @HDR = ('',\ '|*Propagation Name*|*Source Queue*|*Destination Queue*|',\ '|*Propagation Name*|*Rule Set Owner*|*Rule Set Name*|',\ '|*Propagation Name*|*Object*|*Source Database*|*Type*|\ *Include Tagged Lcr*|*Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Name*| *Action Context Name*|\ *Action Context Value*|') set $sql {SELECT '|' || " p.propagation_name || ' |' || " p.source_queue_owner || '.' || p.source_queue_name " || '@' || g.global_name || ' |' || " p.destination_queue_owner || '.' || p.destination_queue_name " || '@' || p.destination_dblink || ' |' " FROM dba_propagation p,global_name g; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " propagation_name || ' |' || " rule_set_owner || ' |' || " rule_set_name || ' |' " FROM dba_propagation; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " propname || '|' || " object || '|' || " source_database || '|' || " type || '|' || " include_tagged_lcr || '|' || " rule || '|' " FROM (SELECT streams_name propname, " table_owner || '.' || table_name object, " source_database, " rule_type || ' TABLE RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_table_rules " WHERE streams_type = 'PROPAGATION' " UNION " SELECT streams_name propname, " schema_name object, " source_database, " rule_type || ' SCHEMA RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_schema_rules " WHERE streams_type = 'PROPAGATION' " UNION " SELECT streams_name propname, " ' ' object, " source_database, " rule_type || ' GLOBAL RULE' type, " include_tagged_lcr, " rule_owner || '.' || rule_name rule " FROM dba_streams_global_rules " WHERE streams_type = 'PROPAGATION') " ORDER BY propname,object; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_name || ' |' || " table_owner || '.' || table_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_table_rules " WHERE streams_type = 'PROPAGATION' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(5)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_rule_set_rules rsr,dba_rules r, " TABLE(r.rule_action_context.actx_list) ac " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Propagations Jobs in Database',\ '---+ Propagation Rule Sets in Database',\ '---+ Streams Propagation Rules Configured with DBMS_STREAMS_ADM \ Package',\ '---+ Streams Table Subsetting Rules',\ '---+ Propagation Rules by Ruleset',\ '---+ Propagation Rules in Negative Rule Set',\ '---+ Propagation Rule Transformations by Ruleset') var @HDR = ('',\ '|*Propagation Name*|*Source Queue*|*Destination Queue*|',\ '|*Propagation Name*|*Rule Set Owner*|*Rule Set Name*|',\ '|*Propagation Name*|*Object*|*Source Database*|*Type*|\ *Include Tagged Lcr*|*Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Propagation Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Name*| *Action Context Name*|\ *Action Context Value*|') set $sql {SELECT '|' || " p.propagation_name || ' |' || " p.source_queue_owner || '.' || p.source_queue_name " || '@' || g.global_name || ' |' || " p.destination_queue_owner || '.' || p.destination_queue_name " || '@' || p.destination_dblink || ' |' " FROM dba_propagation p,global_name g; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " propagation_name || ' |' || " rule_set_owner || '.' || rule_set_name || ' |' || " negative_rule_set_owner || '.' || negative_rule_set_name || ' |' " FROM dba_propagation; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_set_type || ' |' || " source_database || ' |' || " streams_rule_type || ' ' || rule_type || ' |' || " include_tagged_lcr || ' |' || " rule_owner || '.' || rule_name || ' |' " FROM dba_streams_rules " WHERE streams_type = 'PROPAGATION' " ORDER BY streams_name,object_name,source_database,rule_set_type,rule_name; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_rules " WHERE streams_type = 'PROPAGATION' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(5)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " c.propagation_name || ' |' || " rsr.rule_set_owner||'.'||rsr.rule_set_name || ' |' || " rsr.rule_owner||'.'||rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r ,dba_propagation c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.negative_rule_set_owner " AND rsr.rule_set_name=c.negative_rule_set_name " AND rsr.rule_set_name IN " (SELECT negative_rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " ac.nvn_name || ' |' || " ac.nvn_value.accessvarchar2() || ' |' " FROM dba_rule_set_rules rsr,dba_rules r, " TABLE(r.rule_action_context.actx_list) ac " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Propagations Jobs in Database',\ '---+ Propagation Rule Sets in Database',\ '---+ Streams Propagation Rules Configured',\ '---+ Streams Table Subsetting Rules',\ '---+ Propagation Rules by Ruleset',\ '---+ Propagation Rules in Negative Rule Set',\ '---+ Propagation Rule Transformations by Ruleset') var @HDR = ('',\ '|*Propagation Name*|*Source Queue*|*Destination Queue*|\ *Queue to Queue*|*Status*|*Error Date*|*Error Message*|',\ '|*Propagation Name*|*Positive*|*Negative*|',\ '|*Name*|*Object*|*Rule Set Type*|*Source Database*|*Type*|\ *Include Tagged Lcr*|*Rule*|',\ '|*Name*|*Object*|*Type*|*Rule*|*Dml Condition*|\ *Subsetting Operation*|',\ '|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Propagation Name*|*Rule Set*|*Rule Name*|*Condition*|',\ '|*Rule Set*|*Rule Name*| *Action Context Name*|\ *Action Context Value*|') set $sql {SELECT '|' || " p.propagation_name || ' |' || " p.source_queue_owner || '.' || p.source_queue_name " || '@' || g.global_name || ' |' || " p.destination_queue_owner || '.' || p.destination_queue_name " || '@' || p.destination_dblink || ' |' || " p.queue_to_queue || ' |' || " p.status || ' |' || " p.error_date || ' |' || " p.error_message || ' |' " FROM dba_propagation p,global_name g; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " propagation_name || ' |' || " rule_set_owner || '.' || rule_set_name || ' |' || " negative_rule_set_owner || '.' || negative_rule_set_name || ' |' " FROM dba_propagation; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_set_type || ' |' || " source_database || ' |' || " streams_rule_type || ' ' || rule_type || ' |' || " include_tagged_lcr || ' |' || " rule_owner || '.' || rule_name || ' |' " FROM dba_streams_rules " WHERE streams_type = 'PROPAGATION' " ORDER BY streams_name,schema_name||'.'||object_name,source_database, " rule_set_type,rule_owner||'.'||rule_name; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " streams_name || ' |' || " schema_name || '.' || object_name || ' |' || " rule_type || ' TABLE RULE' || ' |' || " rule_owner || '.' || rule_name || ' |' || " dml_condition || ' |' || " subsetting_operation || ' |' " FROM dba_streams_rules " WHERE streams_type = 'PROPAGATION' " AND (dml_condition IS NOT NULL OR subsetting_operation IS NOT NULL); "PROMPT ___Macro_separator(5)___ "SET long 65536 "SELECT '[[[' || CHR(10) || '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " rsr.rule_owner || '.' || rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " c.propagation_name || ' |' || " rsr.rule_set_owner||'.'||rsr.rule_set_name || ' |' || " rsr.rule_owner||'.'||rsr.rule_name || ' |' || " REPLACE(REPLACE(REPLACE(LTRIM(r.rule_condition), " '|','|'), " '<','<'), " '>','>') || '|' || " CHR(10) || ']]]' " FROM dba_rule_set_rules rsr,dba_rules r ,dba_propagation c " WHERE rsr.rule_name = r.rule_name " AND rsr.rule_owner = r.rule_owner " AND rsr.rule_set_owner = c.negative_rule_set_owner " AND rsr.rule_set_name=c.negative_rule_set_name " AND rsr.rule_set_name IN " (SELECT negative_rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " rsr.rule_set_owner || '.' || rsr.rule_set_name || ' |' || " r.rule_owner || '|' || " r.rule_name || ' |' || " transform_type || ' |' || " from_schema_name || ' |' || " to_schema_name || ' |' || " from_table_name || ' |' || " to_table_name || ' |' || " schema_name || ' |' || " table_name || ' |' || " from_column_name || ' |' || " to_column_name || ' |' || " column_name || ' |' || " column_type || ' |' || " column_function || ' |' || " value_type || ' |' || " user_function_name || ' |' || " subsetting_operation || ' |' || " dml_condition || ' |' || " declarative_type || ' | ' || " precedence || '| ' || " step_number || ' |' " FROM dba_rule_set_rules rsr,dba_streams_transformations r " WHERE r.rule_name = rsr.rule_name " AND r.rule_owner = rsr.rule_owner " AND rule_set_name IN " (SELECT rule_set_name " FROM dba_propagation) " ORDER BY rsr.rule_set_owner,rsr.rule_set_name,r.rule_owner, " r.rule_name,transform_type DESC,step_number,precedence; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Propagation Settings',3) } =head2 queue_set - Queue Settings Collects information about Queue Settings. =cut debug ' Inside STC module, gathering queue settings information' report queue_set var $TTL = '---+!! Queue Settings' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Streams Queues in Database',\ '---+ Minimum Archive Log Necessary to Restart Capture') var @HDR = ('',\ '|*Owner*|*Name*|*Queue Table*| *Owner Instance*|\ *Enqueue Enabled*|*Dequeue Enabled*|*User Comment*|') set $sql {SET serveroutput on size 1000000 "SELECT '|' || " q.owner || ' |' || " q.name || ' |' || " t.queue_table || ' | ' || " t.owner_instance || '|' || " q.enqueue_enabled || ' |' || " q.dequeue_enabled || ' |' || " q.user_comment || ' |' " FROM dba_queues q,dba_queue_tables t " WHERE t.object_type = 'SYS.ANYDATA' " AND q.queue_table = t.queue_table " AND q.owner = t.owner; "PROMPT ___Macro_separator(2)___ "DECLARE " hScn NUMBER := 0; " lScn NUMBER := 0; " sScn NUMBER; " aScn NUMBER; " alog v$archived_log.name%TYPE; "BEGIN " SELECT MIN(start_scn), " MIN(applied_scn) " INTO sScn,aScn FROM dba_capture; " FOR cr IN " (SELECT DISTINCT(a.ckpt_scn) " FROM system.logmnr_restart_ckpt$ a " WHERE a.ckpt_scn <= aScn and a.valid = 1 " AND EXISTS " (SELECT 'X' " FROM system.logmnr_log$ l " WHERE a.ckpt_scn BETWEEN l.first_change# AND l.next_change#) " ORDER BY a.ckpt_scn DESC) " LOOP " IF (hScn = 0) " THEN " hScn := cr.ckpt_scn; " ELSE " lScn := cr.ckpt_scn; " EXIT; " END IF; " END LOOP; " IF lScn = 0 " THEN " lScn := sScn; " END IF; " SELECT MIN(name) " INTO alog " FROM v$archived_log " WHERE lScn BETWEEN first_change# AND next_change#; " dbms_output.put_line('Capture will restart from SCN ' || lScn || " ' in log ' || alog); "END; "/ } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Streams Queues in Database',\ '---+ Minimum Archive Log Necessary to Restart Capture') var @HDR = ('',\ '|*Owner*|*Name*|*Queue Table*|*Enqueue Enabled*|\ *Dequeue Enabled*| *Primary Instance*| *Secondary Instance*| \ *Owner Instance*|*User Comment*|') set $sql {SET serveroutput on size 1000000 "SELECT '|' || " q.owner || ' |' || " q.name || ' |' || " t.queue_table || ' |' || " q.enqueue_enabled || ' |' || " q.dequeue_enabled || ' | ' || " t.primary_instance || '| ' || " t.secondary_instance || '| ' || " t.owner_instance || '|' || " q.user_comment || ' |' " FROM dba_queues q,dba_queue_tables t " WHERE t.object_type = 'SYS.ANYDATA' " AND q.queue_table = t.queue_table " AND q.owner = t.owner; "PROMPT ___Macro_separator(2)___ "DECLARE " hScn NUMBER := 0; " lScn NUMBER := 0; " sScn NUMBER; " aScn NUMBER; "BEGIN " SELECT MIN(start_scn), " MIN(applied_scn) " INTO sScn,aScn FROM dba_capture; " FOR cr IN " (SELECT DISTINCT(a.ckpt_scn) " FROM system.logmnr_restart_ckpt$ a " WHERE a.ckpt_scn <= aScn and a.valid = 1 " AND EXISTS " (SELECT 'X' " FROM system.logmnr_log$ l " WHERE a.ckpt_scn BETWEEN l.first_change# AND l.next_change#) " ORDER BY a.ckpt_scn DESC) " LOOP " IF (hScn = 0) " THEN " hScn := cr.ckpt_scn; " ELSE " lScn := cr.ckpt_scn; " EXIT; " END IF; " END LOOP; " IF lScn = 0 " THEN " lScn := sScn; " END IF; " IF lScn IS NOT NULL " THEN " dbms_output.put_line('Capture will restart from SCN ' || lScn || " ' in the following file:'); " FOR cr IN (SELECT name, " first_time " FROM dba_registered_archived_log " WHERE lscn BETWEEN first_scn AND next_scn " ORDER BY thread#) " LOOP " dbms_output.put_line(' * ' || cr.name || ' (' || cr.first_time || ')'); " END LOOP; " END IF; "END; "/ } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Streams Queues in Database',\ '---+ Queue Subscribers',\ '---+ Minimum Archive Log Necessary to Restart Capture') var @HDR = ('',\ '|*Owner*|*Name*|*Queue Table*|*Enqueue Enabled*|\ *Dequeue Enabled*| *Primary Instance*| *Secondary Instance*| \ *Owner Instance*|*Network Name*|*User Comment*|',\ '|*Name*|*Queue Table*|*Subscriber*|*Delivery Mode*|\ *Queue to Queue*| *Protocol*|') set $sql {SET serveroutput on size 1000000 "SELECT '|' || " q.owner || ' |' || " q.name || ' |' || " t.queue_table || ' |' || " TRIM(q.enqueue_enabled) || ' |' || " TRIM(q.dequeue_enabled) || ' | ' || " t.primary_instance || '| ' || " t.secondary_instance || '| ' || " t.owner_instance || '|' || " q.network_name || ' |' || " q.user_comment || ' |' " FROM dba_queues q,dba_queue_tables t " WHERE t.object_type = 'SYS.ANYDATA' " AND q.queue_table = t.queue_table " AND q.owner = t.owner; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " qs.owner||'.'||qs.queue_name || ' |' || " qs.queue_table || ' |' || " NVL2(qs.consumer_name,'CONSUMER: ','ADDRESS : ') || " NVL(qs.consumer_name,qs.address) || '|' || " qs.delivery_mode || ' |' || " qs.queue_to_queue || ' | ' || " qs.protocol || '|' " FROM dba_queue_subscribers qs,dba_queue_tables qt "WHERE qt.object_type = 'SYS.ANYDATA' " AND qs.queue_table = qt.queue_table " AND qs.owner = qt.owner "ORDER BY qs.owner,qs.queue_name; "PROMPT ___Macro_separator(3)___ "DECLARE " hScn NUMBER := 0; " lScn NUMBER := 0; " sScn NUMBER; " aScn NUMBER; "BEGIN " SELECT MIN(start_scn), " MIN(applied_scn) " INTO sScn,aScn " FROM dba_capture; " FOR cr IN " (SELECT DISTINCT(a.ckpt_scn) " FROM system.logmnr_restart_ckpt$ a " WHERE a.ckpt_scn <= aScn AND a.valid = 1 " AND EXISTS " (SELECT 'X' " FROM system.logmnr_log$ l " WHERE a.ckpt_scn BETWEEN l.first_change# AND l.next_change#) " ORDER BY a.ckpt_scn DESC) " LOOP " IF (hScn = 0) " THEN " hScn := cr.ckpt_scn; " ELSE " lScn := cr.ckpt_scn; " EXIT; " END IF; " END LOOP; " IF lScn = 0 " THEN " lScn := sScn; " END IF; " IF lScn IS NOT NULL " THEN " dbms_output.put_line('Capture will restart from SCN ' || lScn || " ' in the following file:'); " FOR cr IN (SELECT name, " first_time " FROM dba_registered_archived_log " WHERE lscn BETWEEN first_scn AND next_scn " ORDER BY thread#) " LOOP " dbms_output.put_line(' * ' || cr.name || ' (' || cr.first_time || ')'); " END LOOP; " END IF; "END; "/ } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Queue Settings',3) } =head2 apply_stat - Apply Statistics Collects information about Apply Statistics. =cut debug ' Inside STC module, gathering statistics information' pretoc '2:Statistics' debug ' Inside STC module, gathering apply statistics information' report apply_stat var $TTL = '---+!! Apply Statistics' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Apply Reader Statistics 1',\ '---+ Apply Reader Statistics 2',\ '---+ Apply Coordinator Statistics 1',\ '---+ Apply Coordinator Statistics 2',\ '---+ Apply Server Statistics 1',\ '---+ Apply Server Statistics 2',\ '---+ Apply Progress') var @HDR = ('',\ '|*Apply Name*|*Apply Captured*|*Process Name*|*State*| \ *Total Messages Dequeued*| *Sga Used*|',\ '|*Apply Name*| *Latency*|*Creation*|*Last Dequeue*| \ *Dequeued Msg No*|',\ '|*Apply Name*|*Process*|*State*| *Recieved*| *Assigned*| \ *Applied*| *Errors*| *Wait Deps*| *Wait Commits*|',\ '|*Apply Name*|*Lwm Msg Ts*| *Lwm Msg Nbr*|*Lwm Updated*|\ *Hwm Msg Ts*| *Hwm Msg Nbr*|*Hwm Updated*|',\ '|*Apply Name*|*Process Name*|*Server*|*State*| *Assigned*| \ *Applied*| *Applied Msg No*|*Created*| *Msg Seq*|',\ '|*Apply Name*| *Server*| *Current Txn*| *Commit SCN*| \ *Dependent Txn*| *Dep Commit SCN*|',\ '|*Apply Name*| *Applied Msg No*| *Oldest Msg No*|\ *Apply Time*|*Applied Msg Create Time*|') set $sql {SELECT '|' || " ap.apply_name || ' |' || " DECODE(ap.apply_captured,'YES','Captured LCRS', " 'NO','User-Enqueued', " 'UNKNOWN') || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " r.state || ' | ' || " r.total_messages_dequeued || '| ' || " r.sga_used || '|' " FROM v$streams_apply_reader r,v$session s,dba_apply ap " WHERE r.sid = s.sid " AND r.serial# = s.serial# " AND r.apply_name = ap.apply_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " apply_name || ' | ' || " (dequeue_time-dequeued_message_create_time) * 86400 || '|' || " TO_CHAR(dequeued_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(dequeue_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " dequeued_message_number || '|' " FROM v$streams_apply_reader; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " c.state || ' | ' || " c.total_received || '| ' || " c.total_assigned || '| ' || " c.total_applied || '| ' || " c.total_errors || '| ' || " c.total_wait_deps || '| ' || " c.total_wait_commits || '|' " FROM gv$streams_apply_coordinator c,gv$session s,dba_apply ap " WHERE c.sid = s.sid " AND c.serial# = s.serial# " AND c.apply_name = ap.apply_name; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " apply_name || ' |' || " TO_CHAR(lwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " lwm_message_number || '|' || " TO_CHAR(lwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(hwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " hwm_message_number || '|' || " TO_CHAR(hwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM gv$streams_apply_coordinator; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' | ' || " a.server_id || '|' || " a.state || ' | ' || " a.total_assigned || '| ' || " a.total_messages_applied || '| ' || " a.applied_message_number || '|' || " TO_CHAR(a.applied_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " a.message_sequence || '|' " FROM gv$streams_apply_server a,gv$session s,dba_apply ap " WHERE a.sid = s.sid " AND a.serial# = s.serial# " AND a.apply_name = ap.apply_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " apply_name || ' | ' || " server_id || '|' || " xidusn || '.' || xidslt || '.' || xidsqn || ' | ' || " commitscn || '|' || " dep_xidusn || '.' || dep_xidslt || '.' || dep_xidsqn || ' | ' || " dep_commitscn || '|' " FROM gv$streams_apply_server " ORDER BY apply_name,server_id; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " apply_name || ' | ' || " applied_message_number || '| ' || " oldest_message_number || '|' || " TO_CHAR(apply_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(applied_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM dba_apply_progress; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Apply Reader Statistics 1',\ '---+ Apply Reader Statistics 2',\ '---+ Apply Reader Statistics 3',\ '---+ Apply Coordinator Statistics 1',\ '---+ Apply Coordinator Statistics 2',\ '---+ Apply Coordinator Statistics 3',\ '---+ Apply Server Statistics 1',\ '---+ Apply Server Statistics 2',\ '---+ Apply Server Statistics 3',\ '---+ Apply Server Statistics 4',\ '---+ Apply Server Statistics 5',\ '---+ Apply Progress') var @HDR = ('',\ '|*Apply Name*|*Apply Captured*|*Process Name*|*State*| \ *Total Messages Dequeued*| *Sga Used*| *Oldest SCN Num*|',\ '|*Apply Name*| *Latency*|*Creation*| *Last Dequeue*| \ *Dequeued Msg No*| *Last Browse No*|',\ '|*Apply Name*| *Total Messages Dequeued*| \ *Elapsed Schedule Time*|',\ '|*Apply Name*|*Process*|*State*| *Recieved*| *Assigned*| \ *Applied*| *Errors*| *Total Ignored*| *Total Rollbacks*| \ *Wait Deps*| *Wait Commits*|',\ '|*Apply Name*|*Lwm Msg Ts*| *Lwm Msg Nbr*|*Lwm Updated*|\ *Hwm Msg Ts*| *Hwm Msg Nbr*|*Hwm Updated*|',\ '|*Apply Name*| *Total Received*| *Total Assigned*| \ *Total Applied*|*Startup Time*| *Elapsed Schedule Time*|',\ '|*Apply Name*|*Process Name*| *Server*|*State*| *Assigned*| \ *Msg Applied*| *Applied Msg No*|*Applied Msg Create Time*| \ *Msg Seq*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Sql Text*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Event*| \ *Seconds In Wait*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Event*| *Total Waits*| \ *Total Timeouts*| *Time Waited*| *Average Wait*| *Max Wait*|',\ '|*Apply Name*| *Server ID*|*Current Txn*| *Commitscn*|\ *Dependent Txn*| *Dep Commitscn*|',\ '|*Apply Name*|*Source DB*| *Applied Msg No*| *Oldest Msg No*|\ *Apply Time*|*Applied Msg Create Time*|') set $sql {SELECT '|' || " ap.apply_name || ' |' || " DECODE(ap.apply_captured,'YES','Captured LCRS', " 'NO','User-Enqueued', " 'UNKNOWN') || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " r.state || ' | ' || " r.total_messages_dequeued || '| ' || " r.sga_used || '| ' || " oldest_scn_num || '|' " FROM gv$streams_apply_reader r,gv$session s,dba_apply ap " WHERE r.sid = s.sid " AND r.serial# = s.serial# " AND r.apply_name = ap.apply_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " apply_name || ' | ' || " (dequeue_time - dequeued_message_create_time) * 86400 || '|' || " TO_CHAR(dequeued_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(dequeue_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " dequeued_message_number || '| ' || " last_browse_num || '|' " FROM gv$streams_apply_reader; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " apply_name || ' | ' || " total_messages_dequeued || '| ' || " elapsed_schedule_time || '|' " FROM gv$STREAMS_APPLY_READER; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " c.state || ' | ' || " c.total_received || '| ' || " c.total_assigned || '| ' || " c.total_applied || '| ' || " c.total_errors || '| ' || " c.total_ignored || '| ' || " c.total_rollbacks || '| ' || " c.total_wait_deps || '| ' || " c.total_wait_commits || '|' " FROM gv$streams_apply_coordinator c,gv$session s,dba_apply ap " WHERE c.sid = s.sid " AND c.serial# = s.serial# " AND c.apply_name = ap.apply_name; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " apply_name || ' |' || " TO_CHAR(lwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " lwm_message_number || '|' || " TO_CHAR(lwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(hwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " hwm_message_number || '|' || " TO_CHAR(hwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM gv$streams_apply_coordinator; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " apply_name || ' | ' || " total_received || '| ' || " total_assigned || '| ' || " total_applied || '|' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " elapsed_schedule_time || '|' " FROM gv$streams_apply_coordinator; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' | ' || " a.server_id || '|' || " a.state || ' | ' || " a.total_assigned || '| ' || " a.total_messages_applied || '| ' || " a.applied_message_number || '| ' || " TO_CHAR(a.applied_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " a.message_sequence || '|' " FROM gv$streams_apply_server a,gv$session s,dba_apply ap " WHERE a.sid = s.sid " AND a.serial# = s.serial# " AND a.apply_name = ap.apply_name; "PROMPT ___Macro_separator(8)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " q.sql_text || ' |' " FROM gv$streams_apply_server a,gv$sqltext q,gv$session s " WHERE a.sid = s.sid " AND s.sql_hash_value = q.hash_value " AND s.sql_address = q.address " AND s.sql_id = q.sql_id " ORDER BY a.apply_name,a.server_id,q.piece; "PROMPT ___Macro_separator(9)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " w.event || ' | ' || " w.seconds_in_wait || '|' " FROM gv$streams_apply_server a,gv$session_wait w " WHERE a.sid = w.sid " ORDER BY a.apply_name,a.server_id; "PROMPT ___Macro_separator(10)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '|' " FROM gv$streams_apply_server a,gv$session_event e " WHERE a.sid = e.sid " ORDER BY a.apply_name,a.server_id; "PROMPT ___Macro_separator(11)___ "SELECT '|' || " apply_name || ' | ' || " server_id || '|' || " xidusn || '.' || xidslt || '.' || xidsqn || ' | ' || " commitscn || '|' || " dep_xidusn || '.' || dep_xidslt || '.' || dep_xidsqn || ' | ' || " dep_commitscn || '|' " FROM gv$streams_apply_server " ORDER BY apply_name,server_id; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " apply_name || ' |' || " source_database || ' | ' || " applied_message_number || '| ' || " oldest_message_number || '|' || " TO_CHAR(apply_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(applied_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || '|' " FROM dba_apply_progress; } } elsif match($ORACLE_VERSION,'102') {var @TTL = ('',\ '---+ Apply Reader Statistics 1',\ '---+ Apply Reader Statistics 2',\ '---+ Apply Reader Statistics 3',\ '---+ Apply Spilled Transactions',\ '---+ Apply Coordinator Statistics 1',\ '---+ Apply Coordinator Statistics 2',\ '---+ Apply Coordinator Statistics 3',\ '---+ Apply Server Statistics 1',\ '---+ Apply Server Statistics 2',\ '---+ Apply Server Statistics 3',\ '---+ Apply Server Statistics 4',\ '---+ Apply Server Statistics 5',\ '---+ ** Count **',\ '---+ ** Detail **',\ '---+ Apply Progress') var @HDR = ('',\ '|*Apply Name*|*Apply Captured*|*Process Name*|*State*| \ *Total Messages Dequeued*| *Total Messages Spilled*| \ *Sga Used*| *Oldest SCN Num*| *Oldest Transaction ID*|',\ '|*Apply Name*| *Latency*|*Creation*| *Last Dequeue*| \ *Dequeued Msg No*| *Last Browse No*|',\ '|*Apply Name*| *Total Messages Dequeued*| \ *Total Messages Spilled*| *Elapsed Dequeue Time*| \ *Elapsed Schedule Time*|',\ '|*Apply Name*| *Txn ID*| *First SCN*|*First Msg Create Time*| \ *Message Count*|*Spill Creation Time*|',\ '|*Apply Name*|*Process*|*State*| *Recieved*| *Assigned*| \ *Applied*| *Errors*| *Total Ignored*| *Total Rollbacks*| \ *Wait Deps*| *Wait Commits*|',\ '|*Apply Name*|*Lwm Msg Ts*| *Lwm Msg Nbr*|*Lwm Updated*|\ *Hwm Msg Ts*| *Hwm Msg Nbr*|*Hwm Updated*|',\ '|*Apply Name*| *Total Received*| *Total Assigned*| \ *Total Applied*|*Startup Time*| *Elapsed Schedule Time*| \ *Elapsed Idle Time*|',\ '|*Apply Name*|*Process Name*| *Server*|*State*| *Assigned*| \ *Msg Applied*| *Applied Msg No*|*Applied Msg Create Time*| \ *Msg Seq*| *Elapsed Dequeue Time*| *Elapsed Apply Time*|\ *Apply Time*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Sql Text*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Event*| \ *Seconds In Wait*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Event*| *Total Waits*| \ *Total Timeouts*| *Time Waited*| *Average Wait*| *Max Wait*|',\ '|*Apply Name*| *Server ID*|*Current Txn*| *Commitscn*|\ *Dependent Txn*| *Dep Commitscn*|',\ '|*Streams Name*| *Open Transactions*| *Total LCRs*|',\ '| *Inst ID*|*Streams Name*|*Streams Type*| *Xidusn*| *Xidslt*| \ *Xidsqn*| *Cumulative Message Count*| *Total Message Count*|\ *First Message Time*| *First Message Number*|\ *Last Message Time*| *Last Message Number*|',\ '|*Apply Name*|*Source DB*| *Applied Msg No*| *Oldest Msg No*|\ *Apply Time*|*Applied Msg Create Time*|*Oldest Transaction ID*|') set $sql {SELECT '|' || " ap.apply_name || ' |' || " DECODE(ap.apply_captured,'YES','Captured LCRS', " 'NO','User-Enqueued', " 'UNKNOWN') || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " r.state || ' | ' || " r.total_messages_dequeued || '| ' || " r.total_messages_spilled || '| ' || " r.sga_used || '| ' || " oldest_scn_num || '| ' || " oldest_xidusn ||'.'|| oldest_xidslt ||'.'|| oldest_xidsqn || '|' " FROM gv$streams_apply_reader r,gv$session s,dba_apply ap " WHERE r.sid = s.sid " AND r.serial# = s.serial# " AND r.apply_name = ap.apply_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " apply_name || ' | ' || " (dequeue_time - dequeued_message_create_time) * 86400 || '|' || " TO_CHAR(dequeued_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(dequeue_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " dequeued_message_number || '| ' || " last_browse_num || '|' " FROM gv$streams_apply_reader; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " apply_name || ' | ' || " total_messages_dequeued || '| ' || " total_messages_spilled || '| ' || " elapsed_schedule_time || '| ' || " elapsed_spill_time || '| ' " FROM gv$STREAMS_APPLY_READER; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " apply_name || ' | ' || " xidusn ||'.'|| xidslt ||'.'|| xidsqn || '| ' || " first_scn || '|' || " first_message_create_time || ' | ' || " message_count || '|' || " spill_creation_time || ' |' " FROM dba_apply_SPILL_TXN; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " c.state || ' | ' || " c.total_received || '| ' || " c.total_assigned || '| ' || " c.total_applied || '| ' || " c.total_errors || '| ' || " c.total_ignored || '| ' || " c.total_rollbacks || '| ' || " c.total_wait_deps || '| ' || " c.total_wait_commits || '|' " FROM gv$streams_apply_coordinator c,gv$session s,dba_apply ap " WHERE c.sid = s.sid " AND c.serial# = s.serial# " AND c.apply_name = ap.apply_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " apply_name || ' |' || " TO_CHAR(lwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " lwm_message_number || '|' || " TO_CHAR(lwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(hwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " hwm_message_number || '|' || " TO_CHAR(hwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM gv$streams_apply_coordinator; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " apply_name || ' | ' || " total_received || '| ' || " total_assigned || '| ' || " total_applied || '|' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " elapsed_schedule_time || '| ' || " elapsed_idle_time || '|' " FROM gv$streams_apply_coordinator; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' | ' || " a.server_id || '|' || " a.state || ' | ' || " a.total_assigned || '| ' || " a.total_messages_applied || '| ' || " a.applied_message_number || '|' || " TO_CHAR(a.applied_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " a.message_sequence || '| ' || " a.elapsed_dequeue_time || '| ' || " a.elapsed_apply_time || '|' || " a.apply_time || ' |' " FROM gv$streams_apply_server a,gv$session s,dba_apply ap " WHERE a.sid = s.sid " AND a.serial# = s.serial# " AND a.apply_name = ap.apply_name " ORDER BY a.apply_name,a.server_id; "PROMPT ___Macro_separator(9)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " q.sql_text || ' |' " FROM gv$streams_apply_server a,gv$sqltext q,gv$session s " WHERE a.sid = s.sid " AND s.sql_hash_value = q.hash_value " AND s.sql_address = q.address " AND s.sql_id = q.sql_id " ORDER BY a.apply_name,a.server_id,q.piece; "PROMPT ___Macro_separator(10)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " w.event || ' | ' || " w.seconds_in_wait || '|' " FROM gv$streams_apply_server a,gv$session_wait w " WHERE a.sid = w.sid " ORDER BY a.apply_name,a.server_id; "PROMPT ___Macro_separator(11)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '|' " FROM gv$streams_apply_server a,gv$session_event e " WHERE a.sid = e.sid " ORDER BY a.apply_name,a.server_id,e.time_waited DESC; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " apply_name || ' | ' || " server_id || '|' || " xidusn || '.' || xidslt || '.' || xidsqn || ' | ' || " commitscn || '|' || " dep_xidusn || '.' || dep_xidslt || '.' || dep_xidsqn || ' | ' || " dep_commitscn || '|' " FROM gv$streams_apply_server " ORDER BY apply_name,server_id; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " streams_name || '| ' || " COUNT(*) || '| ' || " SUM(cumulative_message_count) || '|' " FROM gv$streams_transaction " WHERE streams_type='APPLY' " GROUP BY streams_name; "PROMPT ___Macro_separator(14)___ "SELECT '| ' || " inst_id || '|' || " streams_name || ' |' || " streams_type || ' | ' || " xidusn || '| ' || " xidslt || '| ' || " xidsqn || '| ' || " cumulative_message_count || '| ' || " total_message_count || '|' || " first_message_time || ' | ' || " first_message_number || '|' || " last_message_time || ' | ' || " last_message_number || '| ' " FROM gv$streams_transaction " WHERE streams_type = 'APPLY' " ORDER BY streams_name,first_message_number; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " apply_name || ' |' || " source_database || ' | ' || " applied_message_number || '| ' || " oldest_message_number || '|' || " TO_CHAR(apply_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(applied_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " oldest_transaction_id || ' |' " FROM dba_apply_progress; } } elsif match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Apply Reader Statistics 1',\ '---+ Apply Reader Statistics 2',\ '---+ Apply Reader Statistics 3',\ '---+ Apply Spilled Transactions',\ '---+ Apply Coordinator Statistics 1',\ '---+ Apply Coordinator Statistics 2',\ '---+ Apply Coordinator Statistics 3',\ '---+ Apply Server Statistics 1',\ '---+ Apply Server Statistics 2',\ '---+ Apply Server Statistics 3',\ '---+ Apply Server Statistics 4',\ '---+ Apply Server Statistics 5',\ '---+ ** Count **',\ '---+ ** Detail **',\ '---+ Apply Progress',\ '---+ Apply CCA Statistics') var @HDR = ('',\ '|*Apply Name*|*Apply Captured*|*Process Name*|*State*| \ *Total Messages Dequeued*| *Total Messages Spilled*| \ *Sga Used*| *Oldest SCN Num*| *Oldest Transaction ID*|',\ '|*Apply Name*| *Latency*|*Creation*| *Last Dequeue*| \ *Dequeued Msg No*| *Last Browse No*|',\ '|*Apply Name*| *Total Messages Dequeued*| \ *Total Messages Spilled*| *Elapsed Dequeue Time*| \ *Elapsed Schedule Time*|',\ '|*Apply Name*| *Txn ID*| *First SCN*|*First Msg Create Time*| \ *Message Count*|*Spill Creation Time*|',\ '|*Apply Name*|*Process*|*State*| *Recieved*| *Assigned*| \ *Applied*| *Errors*| *Total Ignored*| *Total Rollbacks*| \ *Wait Deps*| *Wait Commits*|',\ '|*Apply Name*|*Lwm Msg Ts*| *Lwm Msg Nbr*|*Lwm Updated*|\ *Hwm Msg Ts*| *Hwm Msg Nbr*|*Hwm Updated*|',\ '|*Apply Name*| *Total Received*| *Total Assigned*| \ *Total Applied*|*Startup Time*| *Elapsed Schedule Time*| \ *Elapsed Idle Time*|',\ '|*Apply Name*|*Process Name*| *Server*|*State*| *Assigned*| \ *Msg Applied*| *Applied Msg No*|*Applied Msg Create Time*| \ *Msg Seq*| *Elapsed Dequeue Time*| *Elapsed Apply Time*|\ *Apply Time*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Sql Text*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Event*| \ *Seconds In Wait*|',\ '| *Inst ID*|*Apply Name*| *Server ID*|*Event*| *Total Waits*| \ *Total Timeouts*| *Time Waited*| *Average Wait*| *Max Wait*|',\ '|*Apply Name*| *Server ID*|*Current Txn*| *Commitscn*|\ *Dependent Txn*| *Dep Commitscn*|',\ '|*Streams Name*| *Open Transactions*| *Total LCRs*|',\ '| *Inst ID*|*Streams Name*|*Streams Type*| *Xidusn*| *Xidslt*| \ *Xidsqn*| *Cumulative Message Count*| *Total Message Count*|\ *First Message Time*| *First Message Number*|\ *Last Message Time*| *Last Message Number*|',\ '|*Apply Name*|*Source DB*| *Applied Msg No*| *Oldest Msg No*|\ *Apply Time*|*Applied Msg Create Time*|*Oldest Transaction ID*| \ *Spill Message Number*|',\ '|*Apply Name*|*State*| *Capture Bytes Received*|*Proxy Spid*| \ *Proxy SID*| *Proxy Serial*|') set $sql {SELECT '|' || " ap.apply_name || ' |' || " DECODE(ap.apply_captured,'YES','Captured LCRS', " 'NO','User-Enqueued', " 'UNKNOWN') || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " r.state || ' | ' || " r.total_messages_dequeued || '| ' || " r.total_messages_spilled || '| ' || " r.sga_used || '| ' || " oldest_scn_num || '| ' || " oldest_xidusn ||'.'|| oldest_xidslt ||'.'|| oldest_xidsqn || '|' " FROM gv$streams_apply_reader r,gv$session s,dba_apply ap " WHERE r.sid = s.sid " AND r.serial# = s.serial# " AND r.apply_name = ap.apply_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " apply_name || ' | ' || " (dequeue_time - dequeued_message_create_time) * 86400 || '|' || " TO_CHAR(dequeued_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(dequeue_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " dequeued_message_number || '| ' || " last_browse_num || '|' " FROM gv$streams_apply_reader; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " apply_name || ' | ' || " total_messages_dequeued || '| ' || " total_messages_spilled || '| ' || " elapsed_schedule_time || '| ' || " elapsed_spill_time || '| ' " FROM gv$STREAMS_APPLY_READER; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " apply_name || ' | ' || " xidusn ||'.'|| xidslt ||'.'|| xidsqn || '| ' || " first_scn || '|' || " first_message_create_time || ' | ' || " message_count || '|' || " spill_creation_time || ' |' " FROM dba_apply_SPILL_TXN; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " c.state || ' | ' || " c.total_received || '| ' || " c.total_assigned || '| ' || " c.total_applied || '| ' || " c.total_errors || '| ' || " c.total_ignored || '| ' || " c.total_rollbacks || '| ' || " c.total_wait_deps || '| ' || " c.total_wait_commits || '|' " FROM gv$streams_apply_coordinator c,gv$session s,dba_apply ap " WHERE c.sid = s.sid " AND c.serial# = s.serial# " AND c.apply_name = ap.apply_name; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " apply_name || ' |' || " TO_CHAR(lwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " lwm_message_number || '|' || " TO_CHAR(lwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(hwm_message_create_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " hwm_message_number || '|' || " TO_CHAR(hwm_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM gv$streams_apply_coordinator; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " apply_name || ' | ' || " total_received || '| ' || " total_assigned || '| ' || " total_applied || '|' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " elapsed_schedule_time || '| ' || " elapsed_idle_time || '|' " FROM gv$streams_apply_coordinator; "PROMPT ___Macro_separator(8)___ "SELECT '|' || " ap.apply_name || ' |' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' | ' || " a.server_id || '|' || " a.state || ' | ' || " a.total_assigned || '| ' || " a.total_messages_applied || '| ' || " a.applied_message_number || '|' || " TO_CHAR(a.applied_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " a.message_sequence || '| ' || " a.elapsed_dequeue_time || '| ' || " a.elapsed_apply_time || '|' || " a.apply_time || ' |' " FROM gv$streams_apply_server a,gv$session s,dba_apply ap " WHERE a.sid = s.sid " AND a.serial# = s.serial# " AND a.apply_name = ap.apply_name " ORDER BY a.apply_name,a.server_id; "PROMPT ___Macro_separator(9)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " q.sql_text || ' |' " FROM gv$streams_apply_server a,gv$sqltext q,gv$session s " WHERE a.sid = s.sid " AND s.sql_hash_value = q.hash_value " AND s.sql_address = q.address " AND s.sql_id = q.sql_id " ORDER BY a.apply_name,a.server_id,q.piece; "PROMPT ___Macro_separator(10)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " w.event || ' | ' || " w.seconds_in_wait || '|' " FROM gv$streams_apply_server a,gv$session_wait w " WHERE a.sid = w.sid " ORDER BY a.apply_name,a.server_id; "PROMPT ___Macro_separator(11)___ "SELECT '| ' || " a.inst_id || '|' || " a.apply_name || ' | ' || " a.server_id || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '|' " FROM gv$streams_apply_server a,gv$session_event e " WHERE a.sid = e.sid " ORDER BY a.apply_name,a.server_id,e.time_waited DESC; "PROMPT ___Macro_separator(12)___ "SELECT '|' || " apply_name || ' | ' || " server_id || '|' || " xidusn || '.' || xidslt || '.' || xidsqn || ' | ' || " commitscn || '|' || " dep_xidusn || '.' || dep_xidslt || '.' || dep_xidsqn || ' | ' || " dep_commitscn || '|' " FROM gv$streams_apply_server " ORDER BY apply_name,server_id; "PROMPT ___Macro_separator(13)___ "SELECT '|' || " streams_name || '| ' || " COUNT(*) || '| ' || " SUM(cumulative_message_count) || '|' " FROM gv$streams_transaction " WHERE streams_type='APPLY' " GROUP BY streams_name; "PROMPT ___Macro_separator(14)___ "SELECT '| ' || " inst_id || '|' || " streams_name || ' |' || " streams_type || ' | ' || " xidusn || '| ' || " xidslt || '| ' || " xidsqn || '| ' || " cumulative_message_count || '| ' || " total_message_count || '|' || " first_message_time || ' | ' || " first_message_number || '|' || " last_message_time || ' | ' || " last_message_number || '| ' " FROM gv$streams_transaction " WHERE streams_type = 'APPLY' " ORDER BY streams_name,first_message_number; "PROMPT ___Macro_separator(15)___ "SELECT '|' || " apply_name || ' |' || " source_database || ' | ' || " applied_message_number || '| ' || " oldest_message_number || '|' || " TO_CHAR(apply_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(applied_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " oldest_transaction_id || ' | ' || " spill_message_number || '|' " FROM dba_apply_progress; "PROMPT ___Macro_separator(16)___ "SELECT '|' || " apply_name || ' |' || " state || ' | ' || " capture_bytes_received || '|' || " proxy_spid || ' | ' || " proxy_sid || '| ' || " proxy_serial || '| ' " FROM gv$streams_apply_reader; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Apply Statistics',3) } =head2 apply_error - Apply Errors Collects information about Apply Errors Statistics. =cut debug ' Inside STC module, gathering apply errors information' report apply_error var $TTL = '---+!! Apply Errors' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Error Queue',\ '---+ Instantiation SCN for Apply Tables',\ '---+ Instantiation SCN for Apply Schemas and Database',\ '---+ DBA OBJECTS - Rules and Streams Processes') var @HDR = ('',\ '|*Apply Name*|*Source Database*| *Source Commit SCN*| *Msg No*| \ *Msg Count*|*Local Transaction ID*|*Error Msg*|',\ '|*Source Database*|*Object*|*DB Link*| *Ignore SCN*| \ *Instantiation SCN*|',\ '|*Source Database*|*Object*|*DB Link*| *Inst SCN*| \ *Global Flag*| *Spare1*|',\ '|*Object*| *Object ID*|*Object Type*|*Created*|*Last DDL Time*|\ *Status*|') set $sql {SELECT '|' || " apply_name || ' |' || " source_database || ' | ' || " source_commit_scn || '| ' || " message_number || '| ' || " message_count || '|' || " local_transaction_id || ' |' || " SUBSTR(error_message,1,100) || ' |' " FROM dba_apply_error " ORDER BY apply_name,source_commit_scn; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " source_database || ' |' || " source_object_owner || '.' || source_object_name || ' |' || " apply_database_link || ' | ' || " ignore_scn || '| ' || " instantiation_scn || '|' " FROM dba_apply_instantiated_objects " ORDER BY source_database,source_object_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " source_db_name || ' |' || " name || ' |' || " dblink || ' | ' || " inst_scn || '| ' || " global_flag || '| ' || " spare1 || '|' " FROM sys.apply$_source_schema " ORDER BY source_db_name,name; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " owner || '.' || object_name || ' | ' || " object_id || '|' || " object_type || ' |' || " created || ' |' || " last_ddl_time || ' |' || " status || ' |' " FROM dba_objects " WHERE object_type IN ('RULE','RULE SET','UNDEFINED'); } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Error Queue',\ '---+ Instantiation SCN for Apply Tables',\ '---+ Instantiation SCN for Apply Schemas and Database',\ '---+ DBA OBJECTS - Rules and Streams Processes') var @HDR = ('',\ '|*Apply Name*|*Source DB*| *Source Commit SCN*| *Msg No*| \ *Msg Cnt*| *Local Transaction ID*|*Error Message*|',\ '|*Source DB*|*Object*| *Ignore SCN*| *Instantiation SCN*|\ *DB Link*|',\ '|*Source DB*|*Object*|*DBlink*| *Inst SCN*| *Global Flag*|',\ '|*Object*| *Object ID*|*Object Type*|*Created*|*Last DDL Time*|\ *Status*|') set $sql {SELECT '|' || " apply_name || ' |' || " source_database || ' | ' || " source_commit_scn || '| ' || " message_number || '| ' || " message_count || '|' || " local_transaction_id || ' |' || " SUBSTR(error_message,1,10) || ' |' " FROM dba_apply_error " ORDER BY apply_name,source_commit_scn; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " source_database || ' |' || " source_object_owner || '.' || source_object_name || ' | ' || " ignore_scn || '| ' || " instantiation_scn || '|' || " apply_database_link || ' |' " FROM dba_apply_instantiated_objects " ORDER BY source_database,source_object_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " source_db_name || ' |' || " name || ' |' || " dblink || ' | ' || " inst_scn || '| ' || " DECODE(global_flag,0,'SCHEMA',1,'DATABASE') || '|' " FROM sys.apply$_source_schema " ORDER BY source_db_name,name; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " owner ||'.' || object_name || ' | ' || " object_id || '|' || " object_type || ' |' || " created || ' |' || " last_ddl_time || ' |' || " status || ' |' "FROM dba_objects " WHERE object_type IN ('RULE','RULE SET','CAPTURE','APPLY') " ORDER BY object_type,object_name; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Error Queue',\ '---+ Instantiation SCN for Apply Tables',\ '---+ Instantiation SCN for Apply Schemas and Database(DDL)',\ '---+ DBA Objects - Rules and Streams Processes',\ '---+ Check RECOVERABLE tables populated by MAINTAIN_* scripts',\ '---+ Check RECOVERABLE error',\ '---+ Identify Script Blocks') var @HDR = ('',\ '|*Apply Name*|*Source Database*| *Source Commit SCN*| *Msg No*| \ *Msg Count*|*Local Transaction ID*|*Error Msg*|\ *Error Creation Time*|*Source Transaction ID*|',\ '|*Source Database*|*Object*| *Ignore SCN*| *Instantiation SCN*|\ *DB Link*|',\ '|*Source Database*|*Object*|*DB Link*| *Inst SCN*| \ *Global Flag*|',\ '|*Object*| *Object ID*|*Object Type*|*Created*|*Last DDL Time*|\ *Status*|',\ '|*Sysdate*|*Creation Time*|*Procedure*|*Status*|*Progress*|\ *Elapsed Seconds*|*Script ID*|*Forward Block*|',\ '|*Script ID*| *Block Num*| *Error Number*|*Error Message*|\ *Error Creation Time*|',\ '|*Script ID*| *Block Num*|*Status*|*Forward Block DBlink*|\ *Forward Block*|') set $sql {SELECT '|' || " apply_name || ' |' || " source_database || ' | ' || " source_commit_scn || '| ' || " message_number || '| ' || " message_count || '|' || " local_transaction_id || ' |' || " SUBSTR(error_message,1,10) || ' |' || " error_creation_time || '|' || " source_transaction_id || ' |' " FROM dba_apply_error " ORDER BY apply_name,source_commit_scn; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " source_database || ' |' || " apply_database_link || ' | ' || " ignore_scn || '| ' || " instantiation_scn || '|' || " source_object_owner || '.' || source_object_name || ' |' " FROM dba_apply_instantiated_objects " ORDER BY source_database,source_object_owner || '.' || source_object_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " source_db_name || ' |' || " name || ' |' || " dblink || ' | ' || " inst_scn || '| ' || " DECODE(global_flag,0,'SCHEMA',1,'DATABASE') || '| ' " FROM sys.apply$_source_schema " ORDER BY source_db_name,name; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " owner || '.' || object_name || ' | ' || " object_id || '|' || " object_type || ' |' || " created || ' |' || " last_ddl_time || ' |' || " status || ' |' " FROM dba_objects " WHERE object_type IN ('RULE','RULE SET','CAPTURE','APPLY') " ORDER BY object_type,owner ||'.'|| object_name; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " SYSDATE || ' |' || " rs.creation_time || ' |' || " rs.invoking_package||'.'||rs.invoking_procedure || ' |' || " rs.status || ' |' || " rs.done_block_num||' of '||rs.total_blocks||' Steps Completed' || ' |' || " TO_NUMBER(SYSDATE-rs.creation_time)*86400 || ' |' || " rs.script_id || ' |' || " rsb.forward_block || ' |' " FROM dba_recoverable_script rs,dba_recoverable_script_blocks rsb " WHERE rs.script_id = rsb.script_id " AND rsb.block_num = rs.done_block_num + 1; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " script_id || ' | ' || " block_num || '| ' || " error_number || '|' || " error_message || ' |' || " error_creation_time || ' |' " FROM dba_recoverable_script_errors; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " script_id || ' | ' || " block_num || '|' || " status || ' |' || " forward_block_dblink || ' |' || " forward_block || ' |' " FROM dba_recoverable_script_blocks " ORDER BY script_id,block_num; } } elsif match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Defined Comparisons',\ '---+ Comparison Information') var @HDR = ('',\ '|*Owner*|*Comparison Name*|*Comparison Mode*|*Schema Name*|\ *Object Name*|*Object Type*|*Remote Schema Name*|\ *Remote Object Name*|*Remote Object Type*|*DBlink Name*|\ *Scan Mode*| *Scan Percent*|*Cyclic Index Value*|*Null Value*|\ *Local Converge Tag*|*Remote Converge Tag*| *Max Num Buckets*| \ *Min Rows in Bucket*|*Last Update Time*|',\ '|*Owner*|*Comparison Name*| *Scan ID*| *Parent Scan ID*|\ *Status*| *Count Rows*|*Scan Nulls*|*Last Update Time*|') append $sql {SELECT '|' || " owner || ' |' || " comparison_name || ' | ' || " comparison_mode || ' |' || " schema_name || ' |' || " object_name || ' |' || " object_type || ' |' || " remote_schema_name || ' |' || " remote_object_name || ' |' || " remote_object_type || ' |' || " dblink_name || ' |' || " scan_mode || ' | ' || " scan_percent || '|' || " cyclic_index_value || ' |' || " null_value || ' |' || " local_converge_tag || ' |' || " remote_converge_tag || ' | ' || " max_num_buckets || '| ' || " min_rows_in_bucket || '|' || " last_update_time || ' | ' " FROM dba_comparison " ORDER BY owner,comparison_name,comparison_mode; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " owner || ' |' || " comparison_name || ' | ' || " scan_id || '| ' || " parent_scan_id || '|' || " status || ' | ' || " count_rows || '|' || " scan_nulls || ' |' || " last_update_time || ' |' " FROM dba_comparison_scan " ORDER BY owner,comparison_name,parent_scan_id,scan_id; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Apply Errors',3) } =head2 capture_stat - Capture Statistics Collects information about Capture Statistics. =cut debug ' Inside STC module, gathering capture statistics information' report capture_stat var $TTL = '---+!! Capture Statistics' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Capture Statistics 1',\ '---+ Capture Statistics 2') var @HDR = ('',\ '|*Process Name*|*Capture Name*| *SID*| *Serial No*|*State*|\ *Startup Time*| *Messages Captured*| *Messages Enqueued*|',\ '|*Capture Name*|*Current Time*|*Capture Time*| *Message No*|\ *Msg Create Time*| *Enqueue Msg No*|*Enqeue Msg Create Time*|\ *Enqueue Time*|') set $sql {SELECT '|' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " c.capture_name || ' | ' || " c.sid || '| ' || " c.serial# || '|' || " c.state || ' |' || " TO_CHAR(c.startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " c.total_messages_captured || '| ' || " c.total_messages_enqueued || '|' " FROM gv$streams_capture c,gv$session s " WHERE c.sid = s.sid " AND c.serial# = s.serial#; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " capture_name || ' |' || " TO_CHAR(SYSDATE,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " capture_time || ' | ' || " capture_message_number || '|' || " TO_CHAR(capture_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " enqueue_message_number || '|' || " TO_CHAR(enqueue_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(enqueue_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM gv$streams_capture c; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Capture Statistics 1',\ '---+ Capture Statistics 2',\ '---+ Capture Statistics 3',\ '---+ Capture Statistics 4',\ '---+ Capture Statistics 5',\ '---+ Logminer Statistics',\ '---+ Buffered Publishers') var @HDR = ('',\ '|*Process Name*|*Capture Name*| *SID*| *Serial No*|*State*|\ *Startup Time*| *Messages Captured*| *Messages Enqueued*|',\ '|*Capture Name*|*Current Time*|*Capture Process Ts*| \ *Message No*|*Msg Create Time*|*Enqueue Time*| \ *Enqueue Msg No*|*Enqeue Msg Create Time*| *Available Msg No*| \ *Available Msg Create Time*|',\ '|*Capture Name*| *Total Prefilter Discarded*| \ *Total Prefilter Kept*| *Total Prefilter Evaluations*| \ *Undecided*| *Total Full Evaluations*|',\ '|*Capture Name*| *Processed SCN*| *Available Msg No*|',\ '|*Capture Name*| *Elapsed Capture*| *Elapsed Rule*| \ *Elapsed Enqueue*| *Elapsed Lcr*| *Elapsed Redo*| \ *Total Messages Created*| *Total Messages Enqueued*| \ *Total Full Evaluations*|',\ '|*Capture Name*|*Name*|*Value*|',\ '| *Inst ID*| *Queue ID*|*Queue Schema*|*Queue Name*|\ *Sender Name*|*Sender Address*| *Sender Protocol*| *Num Msgs*| \ *Cnum msgs*| *Last Enqueued Msg*|') set $sql {SELECT '|' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " c.capture_name || ' | ' || " c.sid || '| ' || " c.serial# || '|' || " c.state || ' |' || " TO_CHAR(c.startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " c.total_messages_captured || '| ' || " c.total_messages_enqueued || '|' " FROM gv$streams_capture c,gv$session s " WHERE c.sid = s.sid " AND c.serial# = s.serial#; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " capture_name || ' |' || " TO_CHAR(SYSDATE,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " capture_time || ' | ' || " capture_message_number || '|' || " TO_CHAR(capture_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(enqueue_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " enqueue_message_number || '|' || " TO_CHAR(enqueue_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " available_message_number || '|' || " TO_CHAR(available_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM gv$streams_capture; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " capture_name || ' | ' || " total_prefilter_discarded || '| ' || " total_prefilter_kept || '| ' || " total_prefilter_evaluations || '| ' || " (total_prefilter_evaluations - " (total_prefilter_kept + total_prefilter_discarded)) || '| ' || " total_full_evaluations || '|' " FROM gv$streams_capture; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " c.capture_name || ' | ' || " l.processed_scn || '| ' || " c.available_message_number || '|' " FROM gv$logmnr_session l,gv$streams_capture c " WHERE c.logminer_id = l.session_id; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " capture_name || ' | ' || " elapsed_capture_time || '| ' || " elapsed_rule_time || '| ' || " elapsed_enqueue_time || '| ' || " elapsed_lcr_time || '| ' || " elapsed_redo_wait_time || '| ' || " total_messages_created || '| ' || " total_messages_enqueued || '| ' || " total_full_evaluations || '|' " FROM gv$streams_capture; "PROMPT ___Macro_separator(6)___ "SELECT '|' || " c.capture_name || ' |' || " name || ' |' || " value || ' |' " FROM gv$streams_capture c,gv$logmnr_stats l " WHERE c.logminer_id = l.session_id " AND name IN ('bytes paged out', " 'microsecs spent in pageout', " 'bytes of redo processed', " 'bytes checkpointed', " 'seconds spent in checkpoint', " 'resume from low memory'); "PROMPT ___Macro_separator(7)___ "SELECT '| ' || " inst_id || '| ' || " queue_id || '|' || " queue_schema || ' |' || " queue_name || ' |' || " sender_name || ' |' || " sender_address || ' | ' || " sender_protocol || '| ' || " num_msgs || '| ' || " cnum_msgs || '| ' || " last_enqueued_msg || '|' " FROM gv$buffered_publishers; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Capture Statistics 1',\ '---+ Capture Statistics 2',\ '---+ Capture Statistics 3',\ '---+ Capture Statistics 4',\ '---+ Capture Statistics 5',\ '---+ Buffered Publishers',\ '---+ ** Count **',\ '---+ ** Detail **') var @HDR = ('',\ '|*Process Name*|*Capture Name*|*Startup Time*| *SID*| \ *Serial No*|*State*|*State Changed Time*| \ *Total Messages Captured*| *Total Messages Enqueued*| \ *Total Messages Created*|',\ '|*Capture Name*|*Current Time*|*Capture Process Ts*| \ *Message No*|*Msg Create Time*|*Enqueue Time*| \ *Enqueue Msg No*|*Enqeue Msg Create Time*| *Available Msg No*| \ *Available Msg Create Time*|',\ '|*Capture Name*| *Total Prefilter Discarded*| \ *Total Prefilter Kept*| *Total Prefilter Evaluations*| \ *Undecided*| *Total Full Evaluations*|',\ '|*Capture Name*| *Processed SCN*| *Available Msg No*|',\ '|*Capture Name*| *Elapsed Capture*| *Elapsed Rule*| \ *Elapsed Enqueue*| *Elapsed Lcr*| *Elapsed Redo*| \ *Elapsed Pause*| *Total Messages Created*| \ *Total Messages Enqueued*| *Total Full Evaluations*|',\ '| *Inst ID*| *Queue ID*|*Queue Schema*|*Queue Name*|\ *Sender Name*|*Sender Address*| *Sender Protocol*| *Num Msgs*| \ *Cnum msgs*| *Last Enqueued Msg*| *Unbrowsed Msgs*| \ *Overspilled Msgs*| *Memory Usage*|*Publisher State*|',\ '|*Streams Name*| *Open Transactions*| *Total LCRs*|',\ '| *Inst ID*|*Streams Name*|*Streams Type*| *Xidusn*| *Xidslt*| \ *Xidsqn*| *Cumulative Message Count*| *Total Message Count*|\ *First Message Time*| *First Message Number*|\ *Last Message Time*| *Last Message Number*|') set $sql {SELECT '|' || " SUBSTR(s.program,INSTR(s.program,'(') + 1,4) || ' |' || " c.capture_name || ' |' || " TO_CHAR(c.startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " c.sid || '| ' || " c.serial# || '|' || " c.state || ' |' || " c.state_changed_time || ' | ' || " c.total_messages_captured || '| ' || " c.total_messages_enqueued || '| ' || " total_messages_created || '|' " FROM gv$streams_capture c,gv$session s " WHERE c.sid = s.sid " AND c.serial# = s.serial#; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " capture_name || ' |' || " TO_CHAR(SYSDATE,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " capture_time || ' | ' || " capture_message_number || '|' || " TO_CHAR(capture_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(enqueue_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " enqueue_message_number || '|' || " TO_CHAR(enqueue_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " available_message_number || '|' || " TO_CHAR(available_message_create_time, " 'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM gv$streams_capture; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " capture_name || ' | ' || " total_prefilter_discarded || '| ' || " total_prefilter_kept || '| ' || " total_prefilter_evaluations || '| ' || " (total_prefilter_evaluations - " (total_prefilter_kept + total_prefilter_discarded)) || '| ' || " total_full_evaluations || '|' " FROM gv$streams_capture; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " c.capture_name || ' | ' || " l.processed_scn || '| ' || " c.available_message_number || '|' " FROM gv$logmnr_session l,gv$streams_capture c " WHERE c.logminer_id = l.session_id; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " capture_name || ' | ' || " elapsed_capture_time || '| ' || " elapsed_rule_time || '| ' || " elapsed_enqueue_time || '| ' || " elapsed_lcr_time || '| ' || " elapsed_redo_wait_time || '| ' || " elapsed_pause_time || '| ' || " total_messages_created || '| ' || " total_messages_enqueued || '| ' || " total_full_evaluations || '|' " FROM gv$streams_capture; "PROMPT ___Macro_separator(6)___ "SELECT '| ' || " inst_id || '| ' || " queue_id || '|' || " queue_schema || ' |' || " queue_name || ' |' || " sender_name || ' |' || " sender_address || ' | ' || " sender_protocol || '| ' || " num_msgs || '| ' || " cnum_msgs || '| ' || " last_enqueued_msg || '| ' || " unbrowsed_msgs || '| ' || " overspilled_msgs || '| ' || " memory_usage || '|' || " publisher_state || ' |' " FROM gv$buffered_publishers; "PROMPT ___Macro_separator(7)___ "SELECT '|' || " streams_name || '| ' || " COUNT(*) || '| ' || " SUM(cumulative_message_count) || '|' " FROM gv$streams_transaction " WHERE streams_type='CAPTURE' " GROUP BY streams_name; "PROMPT ___Macro_separator(8)___ "SELECT '| ' || " inst_id || '|' || " streams_name || ' |' || " streams_type || ' | ' || " xidusn || '| ' || " xidslt || '| ' || " xidsqn || '| ' || " cumulative_message_count || '| ' || " total_message_count || '|' || " first_message_time || ' | ' || " first_message_number || '|' || " last_message_time || ' | ' || " last_message_number || '| ' " FROM gv$streams_transaction " WHERE streams_type = 'CAPTURE' " ORDER BY streams_name,first_message_number; } } elsif match($ORACLE_VERSION,'^(102)') {var @TTL = ('',\ '---+ Logminer Statistics') var @HDR = ('',\ '|*Capture Name*|*Name*|*Value*|') append $sql {SELECT '|' || " c.capture_name || ' |' || " name || ' |' || " value || ' |' " FROM gv$streams_capture c,gv$logmnr_stats l " WHERE c.logminer_id = l.session_id " AND name IN ('bytes paged out', " 'microsecs spent in pageout', " 'bytes of redo processed', " 'bytes checkpointed', " 'seconds spent in checkpoint', " 'resume from low memory', " 'DDL txns mined', " 'CTAS txns mined', " 'rolled back txns mined', " 'DDL txns delivered', " 'DML txns delivered', " 'CTAS txns delivered', " 'recursive txns delivered'); } } elsif match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Capture CCA Statistics',\ '---+ Logminer Statistics') var @HDR = ('',\ '|*Capture Name*|*Capture Time*|*State*| *Apply Messages Sent*| \ *Apply Bytes Sent*| *SID*| *Serial#*|*Apply Name*|\ *Apply DBlink*|',\ '|*Capture Name*|*Name*|*Value*|') append $sql {SELECT '|' || " capture_name || ' |' || " TO_CHAR(capture_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " state || ' | ' || " apply_messages_sent || '| ' || " apply_bytes_sent || '| ' || " sid || '| ' || " serial# || '|' || " apply_name || ' |' || " apply_dblink || ' |' " FROM gv$streams_capture; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " c.capture_name || ' |' || " name || ' |' || " value || ' |' " FROM gv$streams_capture c,gv$logmnr_stats l " WHERE c.logminer_id = l.session_id " AND name IN ('bytes paged out', " 'microsecs spent in pageout', " 'bytes of redo processed', " 'bytes checkpointed', " 'seconds spent in checkpoint', " 'resume from low memory'); } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Capture Statistics',3) } =head2 prpgt_stat - Propagation Statistics Collects information about Propagation Statistics. =cut debug ' Inside STC module, gathering propagation statistics information' report prpgt_stat var $TTL = '---+!! Propagation Statistics' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Schedule for Propagation',\ '---+ Schedule for each Propagation',\ '---+ Events and Bytes Propagated for each Propagation') var @HDR = ('',\ '|*Propagation Name*|*Start Date*|*Prop Window*|*Next Time*| \ *Latency*|*Schedule Disabled*|*Process Name*| *Failure*|\ *Last Error Msg*|',\ '|*Propagation Name*|*Last Run Date*|*Current Start Date*|\ *Next Run Date*|*Last Error Date*|',\ '|*Propagation Name*|*Total Time*| *Total No*| *Total Bytes*|') set $sql {"SELECT '|' || " p.propagation_name || ' |' || " TO_CHAR(s.start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " s.propagation_window || ' |' || " s.next_time || ' | ' || " s.latency || '|' || " DECODE(s.schedule_disabled,'Y','Disabled','N','Enabled') || ' |' || " s.process_name || ' | ' || " s.failures || '|' || " REPLACE(s.last_error_msg,CHR(10),'%BR%') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = s.destination " AND s.schema = p.source_queue_owner " AND s.qname = p.source_queue_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " p.propagation_name || ' |' || " TO_CHAR(s.last_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.current_start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.next_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.last_error_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = s.destination " AND s.schema = p.source_queue_owner " AND s.qname = p.source_queue_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " p.propagation_name || ' | ' || " s.total_time || '| ' || " s.total_number || '| ' || " s.total_bytes || '|' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = s.destination " AND s.schema = p.source_queue_owner " AND s.qname = p.source_queue_name; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Schedule for Propagation',\ '---+ Schedule for each Propagation',\ '---+ Events and Bytes Propagated for each Propagation',\ '---+ Sender Statistics',\ '---+ Propagation Receiver Statistics',\ '---+ Buffered Subscribers') var @HDR = ('',\ '|*Propagation Name*|*Start Date*|*Prop Window*|*Next Time*| \ *Latency*|*Schedule Disabled*|*Process Name*| *Total Bytes*| \ *Failure*|*Last Error Msg*|',\ '|*Propagation Name*|*Last Run Date*|*Current Start Date*|\ *Next Run Date*|*Last Error Date*|',\ '|*Propagation Name*|*Schedule Status*| *Instance*| *Total No*| \ *Total Bytes*|',\ '|*Propagation Name*| *Total No*| *Total Bytes*| \ *High Water Mark*| *Acknowledgement*| \ *Elapsed Dequeue Time/100*| *Elapsed Pickle Time/100*| \ *Elapsed Propagation Time/100*|',\ '|*Source DB*|*Source Queue*|*Startup Time*| *High Water Mark*| \ *Acknowledgement*| *Elapsed Unpickle Time/100*| \ *Elapsed Rule Time/100*| *Elapsed Enqueue Time/100*|',\ '| *Inst ID*| *Queue ID*|*Queue Schema*|*Queue Name*| \ *Subscriber ID*|*Subscriber Name*|*Subscriber Address*| \ *Protocol*|*Subscriber Type*|*Startup Time*| \ *Last Browsed Seq*| *Last Browsed Num*| *Last Dequeued Seq*| \ *Last Dequeued Num*| *Current Enq Seq*| *Num Msgs*| \ *Cnum Msgs*| *Total Dequeued Msg*| *Total Spilled Msg*|') set $sql {SELECT '|' || " p.propagation_name || ' |' || " TO_CHAR(s.start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " s.propagation_window || ' |' || " s.next_time || ' | ' || " s.latency || '|' || " DECODE(s.schedule_disabled,'Y','Disabled','N','Enabled') || ' |' || " s.process_name || ' | ' || " s.total_bytes || '| ' || " s.failures || '|' || " REPLACE(s.last_error_msg,CHR(10),'%BR%') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(s.destination, " '[^@]+',1,2),s.destination) " AND s.schema = p.source_queue_owner " AND s.qname = p.SOURCE_QUEUE_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " p.propagation_name || ' |' || " TO_CHAR(s.last_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.current_start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.next_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.last_error_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(s.destination, " '[^@]+',1,2),s.destination) " AND s.schema = p.source_queue_owner " AND s.qname = p.source_queue_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " p.propagation_name || ' |' || " DECODE(q.schedule_disabled,'Y','Disabled','N','Enabled') || ' | ' || " q.instance || '| ' || " q.total_number || '| ' || " q.total_bytes || '|' " FROM dba_propagation p,dba_queue_schedules q " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(q.destination, " '[^@]+',1,2),q.destination) " AND q.schema = p.source_queue_owner " AND q.qname = p.source_queue_name " ORDER BY p.propagation_name; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " p.propagation_name || ' | ' || " s.total_msgs || '| ' || " s.total_bytes || '| ' || " s.high_water_mark || '| ' || " s.acknowledgement || '| ' || " s.elapsed_dequeue_time / 100 || '| ' || " s.elapsed_pickle_time / 100 || '| ' || " s.elapsed_propagation_time / 100 || '|' " FROM gv$propagation_sender s,dba_propagation p " WHERE p.destination_dblink = s.dblink " AND s.queue_schema = p.source_queue_owner " AND s.queue_name = p.source_queue_name; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " src_dbname || ' |' || " src_queue_name || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " high_water_mark || '| ' || " acknowledgement || '| ' || " elapsed_unpickle_time / 100 || '| ' || " elapsed_rule_time / 100 || '| ' || " elapsed_enqueue_time / 100 || '|' " FROM gv$propagation_receiver; "PROMPT ___Macro_separator(6)___ "SELECT '| ' || " inst_id || '| ' || " queue_id || '|' || " queue_schema || ' |' || " queue_name || ' | ' || " subscriber_id || '|' || " subscriber_name || ' |' || " subscriber_address || ' | ' || " protocol || '|' || " subscriber_type || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " last_browsed_seq || '| ' || " last_browsed_num || '| ' || " last_dequeued_seq || '| ' || " last_dequeued_num || '| ' || " current_enq_seq || '| ' || " num_msgs || '| ' || " cnum_msgs || '| ' || " total_dequeued_msg || '| ' || " total_spilled_msg || '|' " FROM gv$buffered_subscribers; } } elsif match($ORACLE_VERSION,'102') {var @TTL = ('',\ '---+ Schedule for Propagation',\ '---+ Schedule for each Propagation',\ '---+ Events and Bytes Propagated for each Propagation',\ '---+ Propagation Sender Statistics',\ '---+ Propagation Receiver Statistics',\ '---+ Buffered Subscribers') var @HDR = ('',\ '|*Propagation Name*|*Start Date*|*Prop Window*|*Next Time*| \ *Latency*|*Schedule Disabled*|*Process Name*| *Total Bytes*| \ *Failure*|*Message Delivery Mode*|*Queue to Queue*|\ *Last Error Msg*|',\ '|*Propagation Name*|*Message Delivery Mode*|*Last Run Date*|\ *Current Start Date*|*Next Run Date*|*Last Error Date*|',\ '|*Propagation Name*|*Message Delivery Mode*|*Schedule Status*| \ *Instance*| *Total No*| *Total Bytes*| *Elapsed Dequeue Time*| \ *Elapsed Pickle Time*| *Total Time*|',\ '| *Queue ID*|*Queue Schema*|*Queue Name*|\ *Destination Queue Schema*|*Destination Queue Name*|\ *Startup Time*|*DBlink*| *High Water Mark*| *Acknowledgement*|\ *Schedule Status*| *Total Msgs*| *Total Bytes*| \ *Elapsed Dequeue Time*| *Elapsed Pickle Time*| \ *Elapsed Propagation Time*| *Max Num Per Win*| *Max Size*|',\ '| *Inst ID*|*Src Queue Schema*|*Src Queue Name*|*Src DBname*|\ *Destination Queue Schema*|*Destination Queue Name*|\ *Startup Time*| *High Water Mark*| *Acknowledgement*| \ *Total Msgs*| *Elapsed UnPickle Time*| *Elapsed Rule Time*| \ *Elapsed Enqueue Time*|',\ '| *Inst ID*| *Queue ID*|*Queue Schema*|*Queue Name*| \ *Subscriber ID*|*Subscriber Name*|*Subscriber Address*| \ *Protocol*|*Subscriber Type*|*Startup Time*| \ *Last Browsed Seq*| *Last Browsed Num*| *Last Dequeued Seq*| \ *Last Dequeued Num*| *Current Enq Seq*| *Num Msgs*| \ *Cnum Msgs*| *Total Dequeued Msg*| *Total Spilled Msg*| \ *Expired Msg*|') set $sql {SELECT '|' || " p.propagation_name || ' |' || " TO_CHAR(s.start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " s.propagation_window || ' |' || " s.next_time || ' | ' || " s.latency || '|' || " DECODE(s.schedule_disabled,'Y','Disabled','N','Enabled') || ' |' || " s.process_name || ' | ' || " s.total_bytes || '|' || " s.failures || ' |' || " s.message_delivery_mode || ' |' || " p.queue_to_queue || ' |' || " REPLACE(s.last_error_msg,CHR(10),'%BR%') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(s.destination, " '[^@]+',1,2),s.destination) " AND s.schema = p.source_queue_owner " AND s.qname = p.SOURCE_QUEUE_name " ORDER BY message_delivery_mode,propagation_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " p.propagation_name || ' |' || " message_delivery_mode || ' |' || " TO_CHAR(s.last_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.current_start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.next_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.last_error_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(s.destination, " '[^@]+',1,2),s.destination) " AND s.schema = p.source_queue_owner " AND s.qname = p.source_queue_name " ORDER BY message_delivery_mode,propagation_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " p.propagation_name || ' |' || " q.message_delivery_mode || ' |' || " DECODE(p.STATUS,'DISABLED','Disabled','ENABLED','Enabled') || ' |' || " q.instance || '| ' || " q.total_number || '| ' || " q.total_bytes || '| ' || " q.elapsed_dequeue_time/100 || '| ' || " q.elapsed_pickle_time/100 || '| ' || " q.total_time/100 || '| ' " FROM dba_propagation p,dba_queue_schedules q " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(q.destination, " '[^@]+',1,2),q.destination) " AND q.schema = p.source_queue_owner " AND q.qname = p.source_queue_name " ORDER BY q.message_delivery_mode,p.propagation_name; "PROMPT ___Macro_separator(4)___ "SELECT '| ' || " queue_id || '|' || " queue_schema || ' |' || " queue_name || ' |' || " dst_queue_schema || ' |' || " dst_queue_name || ' |' || " startup_time || ' |' || " dblink || ' | ' || " high_water_mark || '| ' || " acknowledgement || '|' || " schedule_status || ' | ' || " total_msgs || '| ' || " total_bytes || '| ' || " elapsed_dequeue_time || '| ' || " elapsed_pickle_time || '| ' || " elapsed_propagation_time || '| ' || " max_num_per_win || '| ' || " max_size || '|' " FROM v$propagation_sender; "PROMPT ___Macro_separator(5)___ "SELECT '| ' || " inst_id || '|' || " src_queue_schema || ' |' || " src_queue_name || ' |' || " src_dbname || ' |' || " dst_queue_schema || ' |' || " dst_queue_name || ' |' || " startup_time || ' | ' || " high_water_mark || '| ' || " acknowledgement || '| ' || " total_msgs || '| ' || " elapsed_unpickle_time || '| ' || " elapsed_rule_time || '| ' || " elapsed_enqueue_time || '|' " FROM gv$propagation_receiver; "PROMPT ___Macro_separator(6)___ "SELECT '| ' || " inst_id || '| ' || " queue_id || '|' || " queue_schema || ' |' || " queue_name || ' | ' || " subscriber_id || '|' || " subscriber_name || ' |' || " subscriber_address || ' | ' || " protocol || '|' || " subscriber_type || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " last_browsed_seq || '| ' || " last_browsed_num || '| ' || " last_dequeued_seq || '| ' || " last_dequeued_num || '| ' || " current_enq_seq || '| ' || " num_msgs || '| ' || " cnum_msgs || '| ' || " total_dequeued_msg || '| ' || " total_spilled_msg || '| ' || " expired_msgs || '|' " FROM gv$buffered_subscribers; } } elsif match($ORACLE_VERSION,'^(11|12)') {var @TTL = ('',\ '---+ Schedule for Propagation',\ '---+ Schedule for each Propagation',\ '---+ Events and Bytes Propagated for each Propagation',\ '---+ Propagation Sender Statistics',\ '---+ Propagation Receiver Statistics',\ '---+ Buffered Subscribers') var @HDR = ('',\ '|*Propagation Name*|*Start Date*|*Prop Window*|*Next Time*| \ *Latency*|*Schedule Disabled*|*Process Name*| *Total Bytes*| \ *Failure*|*Message Delivery Mode*|*Queue to Queue*|\ *Last Error Msg*|',\ '|*Propagation Name*|*Message Delivery Mode*|*Last Run Date*|\ *Current Start Date*|*Next Run Date*|*Last Error Date*|',\ '|*Propagation Name*|*Message Delivery Mode*|*Schedule Status*| \ *Instance*| *Total No*| *Total Bytes*| *Elapsed Dequeue Time*| \ *Elapsed Pickle Time*| *Total Time*|',\ '| *Queue ID*|*Queue Schema*|*Queue Name*|\ *Destination Queue Schema*|*Destination Queue Name*|\ *Startup Time*|*DBlink*| *High Water Mark*| *Acknowledgement*|\ *Schedule Status*| *Total Msgs*| *Total Bytes*| \ *Elapsed Dequeue Time*| *Elapsed Pickle Time*| \ *Elapsed Propagation Time*| *Max Num Per Win*| *Max Size*| \ *Last Msg Latency*|*Last Msg Enqueue Time*|\ *Last Msg Propagation Time*| *Last LCR Latency*|\ *Last LCR Creation Time*|*Last LCR Propagation Time*|\ *Destination Database Name*|',\ '| *Inst ID*|*Src Queue Schema*|*Src Queue Name*|*Src DBname*|\ *Destination Queue Schema*|*Destination Queue Name*|\ *Startup Time*| *High Water Mark*| *Acknowledgement*| \ *Last Received Msg| *Total Msgs*| *Elapsed UnPickle Time*| \ *Elapsed Rule Time*| *Elapsed Enqueue Time*|',\ '| *Inst ID*| *Queue ID*|*Queue Schema*|*Queue Name*| \ *Subscriber ID*|*Subscriber Name*|*Subscriber Address*| \ *Protocol*|*Subscriber Type*|*Startup Time*| \ *Last Browsed Seq*| *Last Browsed Num*| *Last Dequeued Seq*| \ *Last Dequeued Num*| *Current Enq Seq*| *Num Msgs*| \ *Cnum Msgs*| *Total Dequeued Msg*| *Total Spilled Msg*| \ *Expired Msg*| *Message Lag*|') set $sql {SELECT '|' || " p.propagation_name || ' |' || " TO_CHAR(s.start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " s.propagation_window || ' |' || " s.next_time || ' | ' || " s.latency || '|' || " DECODE(s.schedule_disabled,'Y','Disabled','N','Enabled') || ' |' || " s.process_name || ' | ' || " s.total_bytes || '|' || " s.failures || ' |' || " s.message_delivery_mode || ' |' || " p.queue_to_queue || ' |' || " REPLACE(s.last_error_msg,CHR(10),'%BR%') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(s.destination, " '[^@]+',1,2),s.destination) " AND s.schema = p.source_queue_owner " AND s.qname = p.SOURCE_QUEUE_name " ORDER BY message_delivery_mode,propagation_name; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " p.propagation_name || ' |' || " message_delivery_mode || ' |' || " TO_CHAR(s.last_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.current_start_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.next_run_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " TO_CHAR(s.last_error_date,'DD-Mon-YYYY HH24:MI:SS') || ' |' " FROM dba_queue_schedules s,dba_propagation p " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(s.destination, " '[^@]+',1,2),s.destination) " AND s.schema = p.source_queue_owner " AND s.qname = p.source_queue_name " ORDER BY message_delivery_mode,propagation_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " p.propagation_name || ' |' || " q.message_delivery_mode || ' |' || " DECODE(p.STATUS,'DISABLED','Disabled','ENABLED','Enabled') || ' |' || " q.instance || '| ' || " q.total_number || '| ' || " q.total_bytes || '| ' || " q.elapsed_dequeue_time/100 || '| ' || " q.elapsed_pickle_time/100 || '| ' || " q.total_time/100 || '| ' " FROM dba_propagation p,dba_queue_schedules q " WHERE p.destination_dblink = NVL(REGEXP_SUBSTR(q.destination, " '[^@]+',1,2),q.destination) " AND q.schema = p.source_queue_owner " AND q.qname = p.source_queue_name " ORDER BY q.message_delivery_mode,p.propagation_name; "PROMPT ___Macro_separator(4)___ "SELECT '| ' || " queue_id || '|' || " queue_schema || ' |' || " queue_name || ' |' || " dst_queue_schema || ' |' || " dst_queue_name || ' |' || " startup_time || ' |' || " dblink || ' | ' || " high_water_mark || '| ' || " acknowledgement || '|' || " schedule_status || ' | ' || " total_msgs || '| ' || " total_bytes || '| ' || " elapsed_dequeue_time || '| ' || " elapsed_pickle_time || '| ' || " elapsed_propagation_time || '| ' || " max_num_per_win || '| ' || " max_size || '| ' || " last_msg_latency || '|' || " last_msg_enqueue_time || ' |' || " last_msg_propagation_time || ' | ' || " last_lcr_latency || '|' || " last_lcr_creation_time || ' |' || " last_lcr_propagation_time || ' |' || " dst_database_name || ' |' " FROM v$propagation_sender; "PROMPT ___Macro_separator(5)___ "SELECT '| ' || " inst_id || '|' || " src_queue_schema || ' |' || " src_queue_name || ' |' || " src_dbname || ' |' || " dst_queue_schema || ' |' || " dst_queue_name || ' |' || " startup_time || ' | ' || " high_water_mark || '| ' || " acknowledgement || '| ' || " last_received_msg || '| ' || " total_msgs || '| ' || " elapsed_unpickle_time || '| ' || " elapsed_rule_time || '| ' || " elapsed_enqueue_time || '|' " FROM gv$propagation_receiver; "PROMPT ___Macro_separator(6)___ "SELECT '| ' || " inst_id || '| ' || " queue_id || '|' || " queue_schema || ' |' || " queue_name || ' | ' || " subscriber_id || '|' || " subscriber_name || ' |' || " subscriber_address || ' | ' || " protocol || '|' || " subscriber_type || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " last_browsed_seq || '| ' || " last_browsed_num || '| ' || " last_dequeued_seq || '| ' || " last_dequeued_num || '| ' || " current_enq_seq || '| ' || " num_msgs || '| ' || " cnum_msgs || '| ' || " total_dequeued_msg || '| ' || " total_spilled_msg || '| ' || " expired_msgs || '| ' || " message_lag || '|' " FROM gv$buffered_subscribers; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Propagation Statistics',3) } =head2 queue_stat - Queue Statistics Collects information about Queue Statistics. =cut debug ' Inside STC module, gathering queue statistics information' report queue_stat var $TTL = '---+!! Queue Statistics' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Messages in Buffer Queue') var @HDR = ('',\ '|*Queue*| *Message Count*|') set $sql {SELECT '|' || " q.owner||'.'||q.name || ' | ' || " x.bufqm_nmsg || '|' " FROM dba_queues q,x$bufqm x " WHERE x.bufqm_qid=q.qid; } } elsif match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ Messages in Buffer Queue') var @HDR = ('',\ '|*Queue*|*Startup Time*| *Msg Count*| *Spilled Msgs*| \ *Total Msgs*| *Total Spilled Msgs*|') set $sql {SELECT '|' || " queue_schema || '.' || queue_name || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " num_msgs || '| ' || " spill_msgs || '| ' || " cnum_msgs || '| ' || " cspill_msgs || '|' " FROM gv$buffered_queues; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Messages in Buffer Queue') var @HDR = ('',\ '|*Queue*|*Startup Time*| *Message Count*| *Spilled Msgs*| \ *Total Msgs*| *Total Spilled Msgs*| *Expired Msgs*|') set $sql {SELECT '|' || " queue_schema || '.' || queue_name || ' |' || " TO_CHAR(startup_time,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " num_msgs || '| ' || " spill_msgs || '| ' || " cnum_msgs || '| ' || " cspill_msgs || '| ' || " expired_msgs || '| ' " FROM gv$buffered_queues; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Queue Statistics',3) } =head2 ruleset - Rules and Rule Sets Collects information about the various Rule and Rule Set Statistics. =cut debug ' Inside STC module, gathering information about rules and rule sets' report ruleset var $sql = undef var $TTL = '---+!! Rules and Rule Sets' if match($ORACLE_VERSION,'101') {var @TTL = ('',\ '---+ RUle Set Statistics',\ '---+ Rule Statistics') var @HDR = ('',\ '| *Inst ID*|*Owner*|*Name*| *CPU Time*| *Elapsed Time*| \ *First Load Time*|*Last Load Time*| *Last Loading Time*| \ *Sharable Mem*| *Reloads*| *Invalidations*| *Evaluations*| \ *First Hit Evaluations*| *Simple Rules Only Evaluations*| \ *Sql Free Evaluations*| *SQL Executions*| \ *Conditions Processed*| *True Rules*| *Maybe Rules*| \ *Variable Value Function Calls*| \ *Variable Method Function Calls*| \ *Evaluation Function Calls*|',\ '| *Inst ID*| *Rule Set Object ID*| \ *Evaluation Context Object ID*|*Rule Owner*|*Rule Name*|\ *Rule Condition*| *True Hits*| *Maybe Hits*| *SQL Evaluations*|') set $sql {SELECT '| ' || " inst_id || '|' || " owner || ' |' || " name || ' | ' || " cpu_time || '| ' || " elapsed_time || '|' || " first_load_time || ' |' || " last_load_time || ' | ' || " last_loading_time || '| ' || " sharable_mem || '| ' || " reloads || '| ' || " invalidations || '| ' || " evaluations || '| ' || " first_hit_evaluations || '| ' || " simple_rules_only_evaluations || '| ' || " sql_free_evaluations || '| ' || " sql_executions || '| ' || " conditions_processed || '| ' || " true_rules || '| ' || " maybe_rules || '| ' || " variable_value_function_calls || '| ' || " variable_method_function_calls || '| ' || " evaluation_function_calls || '|' " FROM gv$rule_set; "PROMPT ___Macro_separator(2)___ "SELECT '| ' || " inst_id || '| ' || " rule_set_object_id || '| ' || " evaluation_context_object_id || '|' || " rule_owner || ' |' || " rule_name || ' |' || " rule_condition || ' | ' || " true_hits || '| ' || " maybe_hits || '| ' || " sql_evaluations || '|' " FROM gv$rule; } } elsif match($ORACLE_VERSION,'^(102|11|12)') {var @TTL = ('',\ '---+ Rule Set Statistics',\ '---+ Rule Statistics') var @HDR = ('',\ '| *Inst ID*|*Owner*|*Name*| *CPU Time*| *Elapsed Time*|\ *First Load Time*|*Last Load Time*| *Last Loading Time*| \ *Sharable Mem*| *Reloads*| *Invalidations*| *Evaluations*| \ *First Hit Evaluations*| *Simple Rules Only Evaluations*| \ *Sql Free Evaluations*| *SQL Executions*| \ *Conditions Processed*| *True Rules*| *Maybe Rules*| \ *Variable Value Function Calls*| \ *Variable Method Function Calls*| \ *Evaluation Function Calls*|',\ '| *Inst ID*| *Rule Set Object ID*| \ *Evaluation Context Object ID*|*Rule Owner*|*Rule Name*|\ *Rule Condition*| *True Hits*| *Maybe Hits*| *SQL Evaluations*|') set $sql {SELECT '| ' || " inst_id || '|' || " owner || ' |' || " name || ' | ' || " cpu_time || '| ' || " elapsed_time || '|' || " first_load_time || ' |' || " last_load_time || ' | ' || " last_loading_time || '| ' || " sharable_mem || '| ' || " reloads || '| ' || " invalidations || '| ' || " evaluations || '| ' || " first_hit_evaluations || '| ' || " simple_rules_only_evaluations || '| ' || " sql_free_evaluations || '| ' || " sql_executions || '| ' || " conditions_processed || '| ' || " true_rules || '| ' || " maybe_rules || '| ' || " variable_value_function_calls || '| ' || " variable_method_function_calls || '| ' || " evaluation_function_calls || '|' " FROM gv$rule_set; "PROMPT ___Macro_separator(2)___ "SELECT '| ' || " inst_id || '| ' || " rule_set_object_id || '| ' || " evaluation_context_object_id || '|' || " rule_owner || ' |' || " rule_name || ' |' || " rule_condition || ' | ' || " true_hits || '| ' || " maybe_hits || '| ' || " sql_evaluations || '|' " FROM gv$rule; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Rules and Rule Sets',3) } =head2 wait_events - Wait Events Collects information about Wait Events. (Oracle 9i Release 2) =cut debug ' Inside STC module, gathering wait events information' report wait_event var $sql = undef var $TTL = '---+!! Wait Events' if match($ORACLE_VERSION,'92') {var @TTL = ('',\ '---+ Apply Reader Wait Events',\ '---+ Apply Coordinator Wait Events',\ '---+ Apply Server Wait Events',\ '---+ Propagation Receiver Wait Events',\ '---+ Capture Wait events') var @HDR = ('',\ '|*Apply Name*| *SID*|*Event*| *Total Waits*| *Total Timeouts*| \ *Time Waited*| *Average Wait*| *Max Wait*| \ *Time Waited Micro*|',\ '|*Apply Name*| *SID*|*Event*| *Total Waits*| *Total Timeouts*| \ *Time Waited*| *Average Wait*| *Max Wait*| \ *Time Waited Micro*|',\ '|*Apply Name*| *SID*|*Event*| *Total Waits*| *Total Timeouts*| \ *Time Waited*| *Average Wait*| *Max Wait*| \ *Time Waited Micro*|',\ '|*Queue*| *SID*|*Event*| *Total Waits*| *Total Timeouts*| \ *Time Waited*| *Average Wait*| *Max Wait*| \ *Time Waited Micro*|',\ '|*Capture Name*| *SID*|*Event*| *Total Waits*| *Total Timeouts*| \ *Time Waited*| *Average Wait*| *Max Wait*| \ *Time Waited Micro*|') set $sql {SELECT '|' || " c.apply_name || ' | ' || " e.sid || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '| ' || " e.time_waited_micro || '|' " FROM v$session_event e,v$streams_apply_reader c " WHERE e.sid = c.sid " ORDER BY time_waited DESC; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " c.apply_name || ' | ' || " e.sid || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '| ' || " e.time_waited_micro || '|' " FROM v$session_event e,v$streams_apply_coordinator c " WHERE e.sid = c.sid " ORDER BY time_waited DESC; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " c.apply_name || ' | ' || " e.sid || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '| ' || " e.time_waited_micro || '|' " FROM v$session_event e,v$streams_apply_server c " WHERE e.sid = c.sid " ORDER BY e.sid,time_waited DESC; "PROMPT ___Macro_separator(4)___ "SELECT '|' || " k.kwqpdsqn||'@'||k.kwqpddbn||'=>'||k.kwqpddqn || ' |' || " e.sid || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '| ' || " e.time_waited_micro || '|' " FROM v$session_event e,x$kwqpd k " WHERE e.sid = k.kwqpdsid " ORDER BY e.sid,time_waited DESC; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " c.capture_name || ' |' || " e.sid || '|' || " e.event || ' | ' || " e.total_waits || '| ' || " e.total_timeouts || '| ' || " e.time_waited || '| ' || " e.average_wait || '| ' || " e.max_wait || '| ' || " e.time_waited_micro || '|' " FROM v$session_event e,v$streams_capture c " WHERE e.sid = c.sid " ORDER BY time_waited DESC; } } if $sql {call separator(1) call writeSql($sql,2) call separator(0,'Wait Events',2) } =head1 SEE ALSO L, L =begin credits =over 10 =item RDA 4.4: Malcolm Mckellar, James Mullaney. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut