阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Oracle如何导出sys用户下的系统表

183次阅读
没有评论

共计 2124 个字符,预计需要花费 6 分钟才能阅读完成。

环境:Solaris 10 + Oracle 10.2.0.4

  • 1. 导出实例
  • 2. 参考内容
  • Reference

1. 导出实例

导出 sys 用户下的 HIST_HEAD$WRI$_OPTSTAT_HISTHEAD_HISTORY两张表:
由于 expdp 尝试导出失败,改用传统 exp 导出, 导出命令如下:

% nohup exp system/******  file=/tmp/jy/system_exp_2tables.dmp log=/tmp/jy/exp_system_exp_2tables.log tables=sys.HIST_HEAD\$, sys.WRI\$_OPTSTAT_HISTHEAD_HISTORY &

传统 exp 可以正常导出,导出过程显示如下:

Export: Release 10.2.0.4.0 - Production on 星期五 1030 13:49:51 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

即将导出指定的表通过常规路径...
当前的用户已更改为 SYS
. . 正在导出表                      HIST_HEAD$ 导出了   169225445 行
. . 正在导出表   WRI$_OPTSTAT_HISTHEAD_HISTORY

2. 参考内容

文档 ID 553402.1

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.2.0.3 and later
Information in this document applies to any platform.
***Checked for relevance on 29-Jan-2015***

SYMPTOMS

DataPump export of table SYS.AUD$ fails with errors:

ORA-39165: Schema SYS was not found.
ORA-39166: Object AUD$ was not found.
ORA-31655: no data or metadata objects selected for job
Job "SYS"."SYS_EXPORT_TABLE_01" completed with 3 error(s) at 13:49:47

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.

SOLUTION

Export the table SYS.AUD$ using the traditional export:

#> exp system/<password> file=dumpfile.dmp log=logfile.log tables=sys.aud$

Reference

  • DataPump Export (EXPDP) Fails With Error ORA-39165: Schema SYS Was Not Found (文档 ID 553402.1)

注意:即使不考虑性能问题,truncate table HIST_HEAD$ 也不被允许,只能 delete 你认为不需要的记录。

SQL> truncate table WRI$_OPTSTAT_HISTHEAD_HISTORY;
 
表被截断。
 
已用时间:  00: 00: 25.98
SQL> truncate table HIST_HEAD$;
truncate table HIST_HEAD$
              *
第 1 行出现错误:
ORA-00701: 无法变更热启动数据库所需的对象
 
% oerr ora 701
00701, 00000, “object necessary for warmstarting database cannot be altered”
// *Cause:  Attempt to alter or drop a database object (table, cluster, or
//          index) which are needed for warmstarting the database.
// *Action: None.

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

本文永久更新链接地址:http://www.linuxidc.com/Linux/2018-01/150540.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计2124字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中