oracle数据库导出ORA-39127错误解决方案

错误类型及描述:

expdp 导出表在表分析是开始出现报错。
ORA-39127: unexpected error from call to export_string :=SYS.DBMS_AQ_EXP_QUEUE_TABLES.INSTANCE_INFO_EXP('CAPTURE_QUEUE_T_ALL1','STRMADMIN',1,1,'11.02.00.00.00',newblock) 
ORA-01403: no data found
ORA-01403: no data found
ORA-06512: at "SYS.DBMS_AQ_SYS_EXP_ACTIONS", line 123
ORA-06512: at "SYS.DBMS_AQ_EXP_QUEUE_TABLES", line 20
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 9081

错误原因

1、用户SYS用户事物处于无效状态
2、用户SYS用户的事物被删除

3、存在无效的object

4、以前做过的流复制没有清理干净,残留下来的很多垃圾导致的无效object.

解决方法:

1、DELETE FROM exppkgact$ WHERE SCHEMA='EXFSYS';

2、用TOAD登入数据库,然后删除无效的object.

3、删除残余的流复制垃圾

Object Owner Cleanup
Log in as the user who owns the queue_table. (This username will replace the <schema> value  where referred to below.)

Within sqlplus


SQL> SELECT object_name, object_type FROM user_objects WHERE object_name like '%<QUEUE_TABLE_NAME>%';
where <QUEUE_TABLE_NAME> is replaced with the appropriate value.
Depending on what parts of the queue table remain you could see a number of different objects.

SELECT object_name, object_type FROM user_objects 
WHERE object_name like '%ALL1%' or object_name like '%ALL3%' or object_name like '%ALL2%';

1. Drop any views associated with <QUEUE_TABLE_NAME> via drop view ... .
DROP VIEW AQ$CAPTURE_QUEUE_T_ALL1_R;
DROP VIEW AQ$CAPTURE_QUEUE_T_ALL1;
DROP VIEW AQ$_CAPTURE_QUEUE_T_ALL1_F;
DROP VIEW AQ$CAPTURE_QUEUE_T_ALL1_S;


DROP VIEW AQ$CAPTURE_QUEUE_T_ALL2_R;
DROP VIEW AQ$CAPTURE_QUEUE_T_ALL2;
DROP VIEW AQ$_CAPTURE_QUEUE_T_ALL2_F;
DROP VIEW AQ$CAPTURE_QUEUE_T_ALL2_S;


DROP VIEW AQ$CAPTURE_QUEUE_T_ALL3_R;
DROP VIEW AQ$CAPTURE_QUEUE_T_ALL3;
DROP VIEW AQ$_CAPTURE_QUEUE_T_ALL3_F;
DROP VIEW AQ$CAPTURE_QUEUE_T_ALL3_S;

2. Drop any sequences associated with <QUEUE_TABLE_NAME> via drop sequence ... .
drop sequence AQ$_CAPTURE_QUEUE_T_ALL1_N;
drop sequence AQ$_CAPTURE_QUEUE_T_ALL2_N;
drop sequence AQ$_CAPTURE_QUEUE_T_ALL3_N;


3. ALTER SESSION SET EVENTS '10851 trace name context forever, level 2';


4. DROP TABLE <QUEUE_TABLE_NAME> CASCADE CONSTRAINTS;
DROP TABLE CAPTURE_QUEUE_T_ALL1 CASCADE CONSTRAINTS;
DROP TABLE CAPTURE_QUEUE_T_ALL2 CASCADE CONSTRAINTS;
DROP TABLE CAPTURE_QUEUE_T_ALL3 CASCADE CONSTRAINTS;


5. Repeat for all the following tables
DROP TABLE AQ$_<QUEUE_TABLE_NAME>_<X> CASCADE CONSTRAINTS;
where <X> is replaced by the appropriate value.


DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_H CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_G CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_C CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_D CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_I CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_S CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_T CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_L CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL1_P CASCADE CONSTRAINTS;


DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_H CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_G CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_C CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_D CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_I CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_S CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_T CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_L CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL2_P CASCADE CONSTRAINTS;


DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_H CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_G CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_C CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_D CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_I CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_S CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_T CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_L CASCADE CONSTRAINTS;
DROP TABLE AQ$_CAPTURE_QUEUE_T_ALL3_P CASCADE CONSTRAINTS;

SYSTEM User Cleanup
connect as system
1. SELECT schema, name, objno FROM SYSTEM.AQ$_QUEUE_TABLES WHERE name LIKE '%<QUEUE_TABLE_NAME>%';
take a note of the schema, objno, and name, for the relevant schema, if any is returned.


SELECT schema, name, objno FROM SYSTEM.AQ$_QUEUE_TABLES WHERE name IN ('CAPTURE_QUEUE_T_ALL1','CAPTURE_QUEUE_T_ALL2','CAPTURE_QUEUE_T_ALL3')


2. SELECT oid, eventid, table_objno, name FROM SYSTEM.AQ$_QUEUES WHERE name IN ('<QUEUE_NAME_1>','<QUEUE_NAME_2>',....) ;
take a note of the oids, table_objnos and names. The oid values, i.e, OID_1, etc., eventid and names, e.g. QUEUE_NAME_1, etc., will be used in the Data Dictionary Cleanup section.


SELECT oid, eventid, table_objno, name FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E') ;


3. DELETE FROM SYSTEM.AQ$_QUEUE_TABLES where objno=<objno from above>;


DELETE FROM SYSTEM.AQ$_QUEUE_TABLES where objno IN (SELECT objno FROM SYSTEM.AQ$_QUEUE_TABLES WHERE name IN ('CAPTURE_QUEUE_T_ALL1','CAPTURE_QUEUE_T_ALL2','CAPTURE_QUEUE_T_ALL3')
)


4. DELETE FROM SYSTEM.AQ$_QUEUES WHERE table_objno=<table_objno from above>;


DELETE FROM SYSTEM.AQ$_QUEUES WHERE table_objno IN (SELECT table_objno FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E') );


commit;


Data Dictionary Cleanup
connect as sys as sysdba


Find the owner# corresponding to the relevant <schema> from


select distinct o.owner# from obj$ o, user$ u where o.owner#=u.user# and u.name='<schema>';
This result will be referred to a <owner_num> in the statements below.


select distinct o.owner# from obj$ o, user$ u where o.owner#=u.user# and u.name='STRMADMIN';


86


Then


1. (a) and (b) are valid for all versions. (c) and (d) are valid only for 
9.2.0.1 and above.






Queues (type#24)
(a) SELECT obj#,name FROM SYS.OBJ$ where type# ='24' AND owner# = <owner_num> AND name IN ('<QUEUE_NAME_1>','<QUEUE_NAME_2>',....);
where <QUEUE_NAME_1>, etc., are those found from the select of queue names. 


SELECT obj#,name FROM SYS.OBJ$ where type# ='24' AND owner#='86' 
and name in('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E')


Rule Sets (type#46)
(b) SELECT obj#,name FROM SYS.OBJ$ WHERE type#=46 AND owner# = <owner_num> AND name LIKE '%QUEUE_NAME_1%';
where <QUEUE_NAME_1>, etc., are those found from the select of queue names. 


SELECT obj#,name FROM SYS.OBJ$ where type# =46 AND owner#=86
and name in('CAPTURE_QUEUE_ALL1_N','CAPTURE_QUEUE_ALL1_R','CAPTURE_QUEUE_ALL2_N','CAPTURE_QUEUE_ALL2_R','CAPTURE_QUEUE_ALL3_N','CAPTURE_QUEUE_ALL3_R')


Rules (type#59)
(c) SELECT obj#,name FROM SYS.OBJ$ WHERE type#=59 AND owner# = <owner_num> AND name LIKE '%QUEUE_NAME_1%';
where <QUEUE_NAME_1>, etc., are those found from the select of queue names. 


SELECT obj#,name FROM SYS.OBJ$ WHERE type#=59 AND owner# = 86 AND ctime >= to_date('20131124','yyyymmdd') and ctime < to_date('20131130','yyyymmdd')
order by ctime


Evaluation Context (type#=62)
(d) SELECT obj#,name FROM SYS.OBJ$ WHERE type#=62 AND owner# = <owner_num> AND name LIKE '%QUEUE_TABLE_NAME%';
where <QUEUE_TABLE_NAME> is that found previously. 


SELECT obj#,name FROM SYS.OBJ$ WHERE type#=62 AND owner# = 86 AND name IN('AQ$_CAPTURE_QUEUE_T_ALL1_V','AQ$_CAPTURE_QUEUE_T_ALL2_V','AQ$_CAPTURE_QUEUE_T_ALL3_V');




(b) DELETE FROM SYS.OBJ$ WHERE obj# IN (<obj#1>, <obj#2>, ...);
where <obj#1>, etc are all the obj# found from Step 1 (a).


DELETE FROM SYS.OBJ$ WHERE OBJ# IN (SELECT obj# FROM SYS.OBJ$ where type# ='24' AND owner#='86' 
and name in('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E')
)


Using the name values for Step 1 (c) above
execute DBMS_RULE_ADM.DROP_RULE('<schema>.<rule_name>',TRUE);


SELECT 'execute DBMS_RULE_ADM.DROP_RULE(''' || 'STRMADMIN.'  || name || ''',TRUE);' FROM SYS.OBJ$ WHERE type#=59 AND owner# = 86 AND ctime >= to_date('20131124','yyyymmdd') and ctime < to_date('20131130','yyyymmdd')
order by ctime
类似:
execute DBMS_RULE_ADM.DROP_RULE('STRMADMIN.CWREPORT_NAME74761',TRUE);




Using the name values for Step 1 (d) above
--如果无法清除,报错ORA-24170的错误,则执行下面的语句后再清除:
--ALTER SESSION SET EVENTS = '25475 TRACE NAME CONTEXT FOREVER, LEVEL 2';


execute DBMS_RULE_ADM.DROP_EVALUATION_CONTEXT('STRMADMIN.AQ$_CAPTURE_QUEUE_T_ALL1_V',TRUE);
execute DBMS_RULE_ADM.DROP_EVALUATION_CONTEXT('STRMADMIN.AQ$_CAPTURE_QUEUE_T_ALL2_V',TRUE);
execute DBMS_RULE_ADM.DROP_EVALUATION_CONTEXT('STRMADMIN.AQ$_CAPTURE_QUEUE_T_ALL3_V',TRUE);




3. DELETE FROM SYS.EXPACT$ WHERE owner='<schema>' AND name LIKE '%<QUEUE_TABLE_NAME>%';
4. DELETE FROM SYS.EXPACT$ WHERE owner='<schema>' AND name LIKE '%<QUEUE_NAME>%';
5. DELETE FROM SYS.NOEXP$ WHERE owner='<schema>' AND name LIKE '%<QUEUE_TABLE_NAME>%';
6. DELETE FROM SYS.NOEXP$ WHERE owner='<schema>' AND name LIKE '%<QUEUE_NAME>%';


commit;


select * from SYS.NOEXP$ WHERE owner='STRMADMIN' AND NAME IN ('AQ$_CAPTURE_QUEUE_T_ALL1_D','AQ$_CAPTURE_QUEUE_T_ALL1_P','AQ$_CAPTURE_QUEUE_T_ALL2_D','AQ$_CAPTURE_QUEUE_T_ALL2_P','AQ$_CAPTURE_QUEUE_T_ALL3_D','AQ$_CAPTURE_QUEUE_T_ALL3_P')


DELETE from SYS.NOEXP$ WHERE owner='STRMADMIN' AND NAME IN ('AQ$_CAPTURE_QUEUE_T_ALL1_D','AQ$_CAPTURE_QUEUE_T_ALL1_P','AQ$_CAPTURE_QUEUE_T_ALL2_D','AQ$_CAPTURE_QUEUE_T_ALL2_P','AQ$_CAPTURE_QUEUE_T_ALL3_D','AQ$_CAPTURE_QUEUE_T_ALL3_P')
commit;


Propagation Cleanup [Optional]
1. DELETE FROM SYS.AQ$_SCHEDULES WHERE oid IN ('<OID_1>', ....);
where the <OID_1> values are those obtained from the SYSTEM Cleanup stage.


SELECT * FROM SYS.AQ$_SCHEDULES WHERE oid IN (SELECT oid FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E') );


DELETE FROM SYS.AQ$_SCHEDULES WHERE oid IN (SELECT oid FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E') );




2. DELETE FROM SYS.AQ$_MESSAGE_TYPES WHERE queue_oid IN ('<OID_1>', ....);
where the <OID_1> values are those obtained from the SYSTEM Cleanup stage.


SELECT * FROM SYS.AQ$_MESSAGE_TYPES WHERE queue_oid IN (SELECT oid FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E') );


DELETE FROM SYS.AQ$_MESSAGE_TYPES WHERE queue_oid IN (SELECT oid FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E') );


3. SELECT MIN(sequence), MAX(sequence) from SYS.AQ$_PROPAGATION_STATUS WHERE queue_id IN ('eventid', ....);
where the <eventid> values are those obtained from the SYSTEM Cleanup stage.


SELECT * from SYS.AQ$_PROPAGATION_STATUS WHERE queue_id IN (SELECT  eventid FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E'));


SELECT MIN(sequence), MAX(sequence) from SYS.AQ$_PROPAGATION_STATUS WHERE queue_id IN (SELECT  eventid FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E'));


4. DELETE FROM SYS.AQ$_PROPAGATION_STATUS WHERE queue_id IN ('<eventid>', ....);
where the <eventid> values are those obtained from the SYSTEM Cleanup stage.


DELETE FROM SYS.AQ$_PROPAGATION_STATUS WHERE queue_id IN (SELECT  eventid FROM SYSTEM.AQ$_QUEUES WHERE name IN ('CAPTURE_QUEUE_ALL1','CAPTURE_QUEUE_ALL2','CAPTURE_QUEUE_ALL3','AQ$_CAPTURE_QUEUE_T_ALL1_E','AQ$_CAPTURE_QUEUE_T_ALL2_E','AQ$_CAPTURE_QUEUE_T_ALL3_E'));


5. DELETE FROM SYS.AQ$_PENDING_MESSAGES WHERE sequence BETWEEN (<MIN>,<MAX);
where <MIN>, <MAX> are the minimum and maximum sequence values found in step 3.




commit;


EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_0_GA1');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_1_GY1');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_1_GY2');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_1_GY3');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_2_LPS1');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_2_LPS2');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_2_LPS3');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_4_TR1');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_4_TR2');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_4_TR3');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_8_QDN1');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_8_QDN2');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_8_QDN3');
EXEC DBMS_PROPAGATION_ADM.DROP_PROPAGATION('PROPAGATION_9_QN1');


exec  DBMS_RULE_ADM.DROP_RULE_SET(rule_set_name =>'CAPTURE_QUEUE_ALL2_R' ,delete_rules =>true );
exec  DBMS_RULE_ADM.DROP_RULE_SET(rule_set_name =>'CAPTURE_QUEUE_ALL2_N' ,delete_rules =>true );


    ALTER SESSION SET EVENTS '10046 trace name context forever, level 8';


 Event 10046 trace is disabled at session level using 
    ALTER SESSION SET EVENTS '10046 trace name context off';
 
ALTER SESSION SET EVENTS '10851 trace name context off';
ALTER SESSION SET EVENTS '25475 trace name context off';

进过以上处理后,expdp就不会出错了。

你可能感兴趣的:(oracle,Stream,expdp,ORA-06508,ORA-39127,ORA-04063)