SRDC

SRDC - ORA-1555: Query Duration 0: Checklist of Evidence to Supply (Doc ID 1682704.1)

Action Plan

1. Execute srdc_db_undo_1555-1.sql  as sysdba and provide the spool output DB_Undo_1555-1.html  以sysdba的身份执行

--srdc_db_undo_1555-1.sql

REM srdc_db_undo_1555-1.sql
REM collect collect Undo parameters and Segments details.
define SRDCNAME='DB_Undo_1555-1'
set pagesize 200 verify off sqlprompt "" term off entmap off echo off
set markup html on spool on
COLUMN SRDCSPOOLNAME NOPRINT NEW_VALUE SRDCSPOOLNAME
select 'SRDC_'||upper('&&SRDCNAME')||'_'||upper(instance_name)||'_'|| to_char(sysdate,'YYYYMMDD_HH24MISS') SRDCSPOOLNAME from v$instance;
spool &&SRDCSPOOLNAME..htm
select 'Diagnostic-Name : ' "Diagnostic-Name ", '&&SRDCNAME' "Report Info" from dual
union all
select 'Time : ' , to_char(systimestamp, 'YYYY-MM-DD HH24MISS TZHTZM' ) from dual
union all
select 'Machine : ' , host_name from v$instance
union all
select 'Version : ',version from v$instance
union all
select 'DBName : ',name from v$database
union all
select 'Instance : ',instance_name from v$instance
/
set echo on

--***********************Undo Extents breakdown information***********************

select status, count(*) cnt from dba_rollback_segs
group by status
/

col segment_name format a30 head "Segment Name"
 col "ACT BYTES" format 999,999,999,999 head "Active Bytes"
 col "UNEXP BYTES" format 999,999,999,999 head "Unexpired Bytes"
 col "EXP BYTES" format 999,999,999,999 head "Expired Bytes"
 
 select segment_name, nvl(sum(act),0) "ACT BYTES",
    nvl(sum(unexp),0) "UNEXP BYTES",
    nvl(sum(exp),0) "EXP BYTES"
    from (select segment_name, nvl(sum(bytes),0) act,00 unexp, 00 exp
    from dba_undo_extents where status='ACTIVE' group by segment_name
    union
    select segment_name, 00 act, nvl(sum(bytes),0) unexp, 00 exp
    from dba_undo_extents where status='UNEXPIRED' group by segment_name
    union
   select segment_name, 00 act, 00 unexp, nvl(sum(bytes),0) exp
   from dba_undo_extents where status='EXPIRED' group by segment_name)
   group by segment_name
   order by 1
/

select distinct status st, count(*) "HOW MANY", sum(bytes) "SIZE"
from dba_undo_extents
group by status
/

select SEGMENT_NAME, TABLESPACE_NAME, EXTENT_ID, 
FILE_ID, BLOCK_ID, BYTES, BLOCKS, STATUS
from dba_undo_extents
order by 1,3,4,5
/



---***********************Undo Extents Contention breakdown***********************
-- Take out column TUNED_UNDORETENTION if customer 
-- prior to 10.2.x
--
-- The time frame can be adjusted with this query
-- By default using around 4 hour window of time
--
-- Ex.
-- Using sysdate-.04 looking at the last hour
-- Using sysdate-.1 looking at the last 4 hours
-- Using sysdate-.32 looking at the last 8 hours
-- Using sysdate-1 looking at the last 24 hours


select inst_id, to_char(begin_time,'MM/DD/YYYY HH24:MI') begin_time, 
UNXPSTEALCNT, EXPSTEALCNT , SSOLDERRCNT, NOSPACEERRCNT, MAXQUERYLEN,
TUNED_UNDORETENTION, TUNED_UNDORETENTION/60/60 hours
from gv$undostat
where begin_time between (sysdate-.1) 
and sysdate
order by inst_id, begin_time
/

set echo off
set sqlprompt "SQL> " term on
set verify on
spool off
set markup html off spool off

2. Analyze the table using srdc_db_analyze_table.sql (for non partitioned tables) or srdc_db_analyze_partition.sql (for partitioned tables). Upload the spool output.

2. 使用  srdc_db_analyze_table.sql  (用于非分区表)或  srdc_db_analyze_partition.sql  (用于分区表)分析表

--srdc_db_analyze_table.sql

REM srdc_db_analyze_table.sql 
REM To identify corrupted row(s) in a LOB segment
define SRDCNAME='DB_Analyze_Table'
set pagesize 200 verify off term off entmap off echo off
set markup html on spool on
COLUMN SRDCSPOOLNAME NOPRINT NEW_VALUE SRDCSPOOLNAME
select 'SRDC_'||upper('&&SRDCNAME')||'_'||upper(instance_name)||'_'|| to_char(sysdate,'YYYYMMDD_HH24MISS') SRDCSPOOLNAME from v$instance;
spool &&SRDCSPOOLNAME..htm
select 'Diagnostic-Name : ' "Diagnostic-Name ", '&&SRDCNAME' "Report Info" from dual
union all
select 'Time : ' , to_char(systimestamp, 'YYYY-MM-DD HH24MISS TZHTZM' ) from dual
union all
select 'Machine : ' , host_name from v$instance
union all
select 'Version : ',version from v$instance
union all
select 'DBName : ',name from v$database
union all
select 'Instance : ',instance_name from v$instance
/
set echo on

set term on
ACCEPT table_name CHAR PROMPT 'Table Name  :'
ACCEPT table_owner CHAR PROMPT 'Table Owner  :'

set term off
set serveroutput on

analyze table &&table_owner..&&table_name validate structure cascade
/

--**** Execute the script again, if you want to analyze another table****

spool off
set markup html off spool off
set term on
PROMPT
PROMPT **** Execute the script again, if you want to analyze another table****
PROMPT
PROMPT
PROMPT REPORT GENERATED : &SRDCSPOOLNAME..htm
set echo off
set sqlprompt "SQL> " term on
set verify on
set echo on
-- srdc_db_analyze_partition.sql

REM srdc_db_analyze_partition.sql 
REM To identify corrupted row(s) in a LOB segment
define SRDCNAME='DB_Analyze_Partition'
set pagesize 200 verify off term off entmap off echo off
set markup html on spool on
COLUMN SRDCSPOOLNAME NOPRINT NEW_VALUE SRDCSPOOLNAME
select 'SRDC_'||upper('&&SRDCNAME')||'_'||upper(instance_name)||'_'|| to_char(sysdate,'YYYYMMDD_HH24MISS') SRDCSPOOLNAME from v$instance;
spool &&SRDCSPOOLNAME..htm
select 'Diagnostic-Name : ' "Diagnostic-Name ", '&&SRDCNAME' "Report Info" from dual
union all
select 'Time : ' , to_char(systimestamp, 'YYYY-MM-DD HH24MISS TZHTZM' ) from dual
union all
select 'Machine : ' , host_name from v$instance
union all
select 'Version : ',version from v$instance
union all
select 'DBName : ',name from v$database
union all
select 'Instance : ',instance_name from v$instance
/

-- You must run the script utlvalid.sql from your $ORACLE_HOME/rdbms/admin directory. 
--The utlvalid.sql script creates the table 'INVALID_ROWS'.
--This script should be run as the same user who is issuing the analyze command.

drop table INVALID_ROWS
/
@?/rdbms/admin/utlvalid.sql
/
set echo on
set term on
ACCEPT table_owner CHAR PROMPT 'Table Owner  :'
ACCEPT table_name CHAR PROMPT 'Table Name  :'
ACCEPT partition_name CHAR PROMPT 'Partition Name :'
set term off
set serveroutput on
analyze table &&table_owner..&&table_name partition (&&partition_name) validate structure cascade into invalid_rows
/

--**** Execute the script again, if you want to analyze another partition****

spool off
set markup html off spool off
set term on
PROMPT
PROMPT Execute the script again, if you want to analyze another partition
PROMPT
PROMPT
PROMPT REPORT GENERATED : &SRDCSPOOLNAME..htm
set echo off
set sqlprompt "SQL> " term on
set verify on
set echo on

3. If the error is reproducible:  如果错误是可重现的

Set the follwing traces:  设置以下跟踪

SQL> conn / as sysdba
SQL> ALTER SESSION SET EVENTS '1555 trace name errorstack level 12';
SQL> ALTER SESSION SET EVENTS '10442 trace name context forever, level 10';
SQL> ALTER SESSION set MAX_DUMP_FILE_SIZE= unlimited ;
SQL> ALTER SESSION set TIMED_STATISTICS = true;
SQL> ALTER SESSION set TRACEFILE_IDENTIFIER = "ORA-1555";
... Reproduce the error    --重现错误

SQL> ALTER SESSION SET EVENTS '1555 trace name errorstack off';
SQL> ALTER SESSION SET EVENTS '10442 TRACE NAME CONTEXT OFF’;

Then upload the resulting trace file from the directory specified by user_dump_dest or the diagnostic_dest parameter .

4. If the error is not reproducible:  如果错误无法重现

Set the follwing traces:

SQL> CONN / AS SYSDBA
SQL> ALTER SYSTEM SET EVENTS '1555 trace name errorstack level 12';
SQL> ALTER SYSTEM SET EVENTS '10442 trace name context forever, level 10';
SQL> ALTER SYSTEM set MAX_DUMP_FILE_SIZE= unlimited ;
SQL> ALTER SYSTEM set TIMED_STATISTICS = true;
Wait until the error (ORA-1555) occurs again .
--等待直到再次出现错误(ORA-1555)
Note: When the ALTER SYSTEM SET EVENTS command is used , only new sessions will be impacted by the events set by this command.
--注意:使用ALTER SYSTEM SET EVENTS命令时,此命令设置的事件只会影响新的会话
SQL> ALTER SYSTEM SET EVENTS '1555 trace name errorstack off';

Then upload the resulting trace file from the directory specified by user_dump_dest or the diagnostic_dest parameter .

5. Attach all of the above evidence to the Service Request at SR creation time. The evidence can all be placed into a single ZIP or similar compressed archive or can be attached as separate files.

原文地址:https://www.cnblogs.com/zylong-sys/p/11961910.html