ORA-39166: 找不到对象 SYS.T。 ORA-31655: 尚未为作业选择数据或元数据对象

RDBMS 11.2.0.4

Windows Server 2008R2 (1个服务上,创建了2个数据库,分别为test1,test2)

oracle SID: test1、test2

字符集

字符集信息(test1)
NLS_CHARACTERSET               WE8MSWIN1252
NLS_NCHAR_CHARACTERSET         UTF8
字符集信息(test2)
NLS_CHARACTERSET               UTF8
NLS_NCHAR_CHARACTERSET         AL16UTF16

 

昨天,在测试一个案例的时候,需要导出一个表。结果发现两个问题

问题1 在test1上导出sys.t表的时候,界面显示乱码。但是在test2上导出sys.t的时候,显示是正常的。

比较奇怪,分别在test1和test2上expdp出表的时候,界面分别显示乱码和中文,难道和数据库字符集有关?难以理解。

解决方法:设置NLS_LANG环境变量 set NLS_LANG=american_america.AL32UTF8

-- 导出test1库的sys.t之前的情况

C:\Users\Administrator>expdp '/as sysdba' directory =dump logfile=exp_t.log dumpfile=t_exp_1.dmp tables=t

Export: Release 11.2.0.4.0 - Production on 星期四 9月 24 15:54:11 2020

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 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
?? "SYS"."SYS_EXPORT_TABLE_01":  "/******** AS SYSDBA" directory=dump logfile=exp_t.log dumpfile=t_exp_1.dmp tables=t

???? BLOCKS ??????...
?? BLOCKS ??????: 0 KB
ORA-39166: ????? SYS.T?
ORA-31655: ???????????????
?? "SYS"."SYS_EXPORT_TABLE_01" ????, ??? 2 ??? (? ??? 9? 24 15:54:17 2020 elapsed 0 00:00:04 ??)

-- 导出test2库的sys.t的情况

C:\Users\Administrator>expdp '/as sysdba' dumpfile=t2_t.dmp logfile=t2_t.log directory=DUMP tables=t

Export: Release 11.2.0.4.0 - Production on 星期四 9月 24 16:43:21 2020

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 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
启动 "SYS"."SYS_EXPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=t2_t.dmp logfile=t2_t.log directory=DUMP tables=t
正在使用 BLOCKS 方法进行估计...
使用 BLOCKS 方法的总估计: 0 KB
ORA-39166: 找不到对象 SYS.T。
ORA-31655: 尚未为作业选择数据或元数据对象
作业 "SYS"."SYS_EXPORT_TABLE_01" 已经完成, 但是有 2 个错误 (于 星期四 9月 24 16:43:27 2020 elapsed 0 00:00:04 完成)


C:\Users\Administrator>

-- 设置NLS_LANG后,导出test1库的sys.t的情况(乱码消失)

C:\Users\Administrator>set NLS_LANG=american_america.AL32UTF8

C:\Users\Administrator>expdp '/as sysdba' dumpfile=t2_t-2.dmp logfile=t2_t-2.log directory=DUMP tables=t

Export: Release 11.2.0.4.0 - Production on Thu Sep 24 16:54:28 2020

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 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=t2_t-2.dmp logfile=t2_t-2.log directory=DUMP table
s=t
Estimate in progress using BLOCKS method...
Total estimation using BLOCKS method: 0 KB
ORA-39166: Object SYS.T was not found.
ORA-31655: no data or metadata objects selected for job
Job "SYS"."SYS_EXPORT_TABLE_01" completed with 2 error(s) at Thu Sep 24 16:54:33 2020 elapsed 0 00:00:03


C:\Users\Administrator>

问题2 ,分别在test1和test2库上导出sys.t表的时候,提示“ORA-39166: 找不到对象 SYS.T。ORA-31655: 尚未为作业选择数据或元数据对象 ”

解决方法

解决方法1 ,使用exp导出

C:\Users\Administrator>exp system/oracle file=c:\exp_t.dmp log=c:\exp_t.log tables=sys.t

Export: Release 11.2.0.4.0 - Production on 星期四 9月 24 16:25:07 2020

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 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and UTF8 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
Current user changed to SYS
. . exporting table                              T        999 rows exported
Export terminated successfully without warnings.

C:\Users\Administrator>

解决方法2,将该表的schame有sys变为bb.t ,再次expdp出sys.t 就可以了。

原因: 根据MOS DataPump Export (EXPDP) Fails With Error ORA-39165: Schema SYS Was Not Found (Doc ID 553402.1)上的解释,单独导出sys等下的表,是会报这个错,当使用full模式导出的话,不会报错(oracle认为sys等schema是受限制的schame)。

Cause

There is a restriction on DataPump export. It cannot export schemas like SYS, ORDSYS, EXFSYS, MDSYS, DMSYS, CTXSYS, ORDPLUGINS, LBACSYS, XDB, SI_INFORMTN_SCHEMA, DIP, DBSNMP and WMSYS in any mode. The Utilities Guide indicates the restriction only on full export mode, but the restriction actually applies to all modes.

 

END

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值