1396彩票-珠海制冷设备有限公司

首页

AD联系:507867812

1396彩票

时间:2019-11-18 21:26:47 作者:AG真人游戏 浏览量:24643

1396彩票EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决,见下图

EXP导出aud$报错EXP-00008,ORA-00904 解决

EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux,见下图

EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决,如下图

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

EXP导出aud$报错EXP-00008,ORA-00904 解决

如下图

EXP导出aud$报错EXP-00008,ORA-00904 解决,如下图

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux,见图

1396彩票EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

EXP导出aud$报错EXP-00008,ORA-00904 解决

EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

1396彩票

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决。

EXP导出aud$报错EXP-00008,ORA-00904 解决

1.

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

2.EXP导出aud$报错EXP-00008,ORA-00904 解决。

EXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

3.EXP导出aud$报错EXP-00008,ORA-00904 解决。

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

4.EXP导出aud$报错EXP-00008,ORA-00904 解决。

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linuxEXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决EXP导出aud$报错EXP-00008,ORA-00904 解决。1396彩票

展开全文
相关文章
ag环亚娱乐游戏

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux

瑞彩彩票

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux....

万博彩票

EXP导出aud$报错EXP-00008,ORA-00904 解决....

幸运彩票

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux....

白小姐七尾

EXP导出aud$报错EXP-00008,ORA-00904 解决....

相关资讯
北京赛车PK10计划网

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux....

极速快乐8

主题:EXP导出aud$报错EXP-00008,ORA-00904 解决环境:Oracle 11.2.0.4问题:在自己的测试环境,导出sys用户下的aud$表报错。

1.故障现场

2.跟踪处理

3.匹配MOS文章

4.使用MOS解决方案

1.故障现场

导出sys用户下的表,依据经验使用system用户导出:

Oracle如何导出sys用户下的系统表 http://www.linuxidc.com/Linux/2018-01/150540.htm按照这个方法,exp导出时报错,具体报错信息如下:

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:16:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifierExport terminated successfully with warnings.

2.跟踪处理

使用oradebug跟踪对应的exp进程:

2.1 exp 交互式

[oracle@jyrac1 ~]$ exp system/oracle

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:20:17 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesEnter array fetch buffer size: 4096 >

2.2 定位exp进程的SPID:

SELECT p.spid, p.addr, p.pid, s.sid, SUBSTR(s.username, 1, 15) "USERNAME", SUBSTR(s.program, 1, 15) "PROGRAM" FROM v$process p, v$session sWHERE s.paddr = p.addr AND addr = (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

结果如下:

SYS@jyzhao1 >SELECT p.spid, 2 p.addr, 3 p.pid, 4 s.sid, 5 SUBSTR(s.username, 1, 15) "USERNAME", 6 SUBSTR(s.program, 1, 15) "PROGRAM" 7 FROM v$process p, v$session s 8 WHERE s.paddr = p.addr 9 AND addr =10 (SELECT paddr FROM v$session WHERE UPPER(program) LIKE 'EXP%');

SPID ADDR PID SID USERNAME PROGRAM------------------------ ---------------- ---------- ---------- ------------------------------ ------------------------------15552 000000007F4CA268 33 141 SYSTEM exp@jyrac1 (TNS

2.3 oradebug跟踪spid:

SQL> oradebug setospid 15552SQL> oradebug unlimitSQL> oradebug tracefile_nameSQL> oradebug Event 10046 trace name context forever, level 12

实际过程记录:

SYS@jyzhao1 >oradebug setospid 15552Oracle pid: 33, Unix process pid: 15552, image: oracle@jyrac1 (TNS V1-V3)SYS@jyzhao1 >oradebug unlimitStatement processed.SYS@jyzhao1 >oradebug tracefile_name/opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trcSYS@jyzhao1 >oradebug Event 10046 trace name context forever, level 12Statement processed.

2.4 查看10046的跟踪文件:

我搜索904这个错误,可以匹配到err=904的部分

=====================PARSE ERROR #139705015595160:len=301 dep=0 uid=5 oct=3 lid=5 tim=1516181414835913 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMEWAIT #139705015595160: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836191WAIT #139705015595160: nam='SQL*Net message from client' ela= 127 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836355WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181414836399

*** 2018-01-17 17:30:19.545WAIT #0: nam='SQL*Net message from client' ela= 4709518 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419545928WAIT #0: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546119WAIT #0: nam='SQL*Net message from client' ela= 65 driver id=1650815232 #bytes=1 p3=0 obj#=18 tim=1516181419546230PARSE #139705014733696:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547202BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=00002451.0000.0001EXEC #139705014733696:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419547371FETCH #139705014733696:c=0,e=59,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419547468CLOSE #139705014733696:c=0,e=29,dep=1,type=3,tim=1516181419547548PARSE #139705014733696:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419548823BINDS #139705014733696:Bind#0 oacdty=11 mxl=16(16) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=00 csi=00 siz=16 off=0 kxsbbbfp=7f0f9bca8510 bln=16 avl=16 flg=05 value=0000243C.0007.0001EXEC #139705014733696:c=0,e=112,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1516181419549015FETCH #139705014733696:c=1000,e=116,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1516181419549155CLOSE #139705014733696:c=0,e=9,dep=1,type=3,tim=1516181419549188=====================

也可以选择tkprof美化trc文件:

[root@jyrac1 ~]# tkprof /opt/app/oracle/diag/rdbms/jyzhao/jyzhao1/trace/jyzhao1_ora_15552.trc /tmp/jyzhao1_ora_15552.out waits=y sort=exeela

TKPROF: Release 11.2.0.4.0 - Development on Wed Jan 17 17:33:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

美化后的文档可以更清晰的看到904错误的原因:

********************************************************************************

The following statement encountered a error during parse:

SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIME

Error encountered: ORA-00904********************************************************************************

3.匹配MOS文章

根据报错和trc文件的内容,匹配到MOS文档:Errors EXP-8 ORA-904 During Export (文档 ID 1091927.1)

APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.4 and laterInformation in this document applies to any platform.Checked for relevance on 16-Dec-2014SYMPTOMSYou are attempting to perform an export as the SYSTEM user or a DBA. During export, the following errors occurred:

EXP-00008: ORACLE error 904 encounteredORA-00904: : invalid identifier

When performing a trace on the export, we see that the ORA-904 error is caused by the following statement:

PARSE ERROR #9:len=302 dep=0 uid=5 oct=3 lid=5 tim=778463694169 err=904SELECT SYNNAM, DBMS_JAVA.LONGNAME(SYNNAM), DBMS_JAVA.LONGNAME(SYNTAB), TABOWN, TABNODE, PUBLIC$, SYNOWN, SYNOWNID, TABOWNID, SYNOBJNO FROM SYS.EXU9PTS WHERE SYNOBJNO IN ( SELECT SYNOBJNO FROM SYS.EXU9TYPT WHERE TABOBJNO = :1 ) ORDER BY SYNTIMECAUSEThe PUBLIC privilege has been revoked from the DBMS_JAVA package.

Privileges to the DBMS_JAVA package are needed for the export to succeed. However, as there is concern about security issues due to privileges on the DBMS_JAVA many have revoked the execute privilege to this package to keep the database secure.

SOLUTIONExplicitly grant EXECUTE on the DBMS_JAVA package to the DBA role:

SQL> grant execute on DBMS_JAVA to dba;

This will give members of the DBA role the rights to perform the export while keeping the DBMS_JAVA package out of the PUBLIC role.

4.使用MOS解决方案

MOS解决方案赋权DBMS_JAVA给DBA角色:

SYS@jyzhao1 >grant execute on DBMS_JAVA to dba;

Grant succeeded.

再次尝试exp导出成功。

[oracle@jyrac1 ~]$ exp system/oracle file=audit.dmp log=audit.log tables=sys.aud$

Export: Release 11.2.0.4.0 - Production on Wed Jan 17 17:39:07 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application TesExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to SYS. . exporting table AUD$ 25 rows exportedExport terminated successfully without warnings.

至此,问题完美解决,该案例的定位,主要用到了oradebug的跟踪技能。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux....

热门资讯