ORACLE 12C 导入9i导出的含有多个用户的dmp文件

从EBS 11i 中用system用户 exp了几个表,以 user.table
的形式导出,在12C中进行恢复的时候其中fromuser用户选择了system,结果发现没有导入成功数据,经过一番折腾发现fromuser必须是表的属主用户。记录下过程:

在9i数据库遇到的导出问题

#在没有赋予特殊权限的情况下,只能导出自己创建的表
$ exp userid=apps/<密码> tables=HR_ALL_ORGANIZATION_UNITS,FND_USER file=/redolog/sdprd/SDYD_all.dmp log=/redolog/s>

Export: Release 9.2.0.6.0 - Production on Tue Mar 15 16:42:15 2016

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
Export done in ZHS16GBK character set and UTF8 NCHAR character set

About to export specified tables via Conventional Path ...
EXP-00011: APPS.HR_ALL_ORGANIZATION_UNITS does not exist
EXP-00011: APPS.FND_USER does not exist
Export terminated successfully with warnings.

#加上schema也不可以,提示权限不够
$ exp userid=apps/<密码> tables=HR.HR_ALL_ORGANIZATION_UNITS,APPLSYS.FND_USER file=/redolog/sdprd/SDYD_all.dmp log>

Export: Release 9.2.0.6.0 - Production on Tue Mar 15 16:42:26 2016

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
Export done in ZHS16GBK character set and UTF8 NCHAR character set

About to export specified tables via Conventional Path ...
EXP-00009: no privilege to export HR's table HR_ALL_ORGANIZATION_UNITS
EXP-00009: no privilege to export APPLSYS's table FND_USER
Export terminated successfully with warnings.

#赋予 导出所有数据库的权限,就可以了
$ sqlplus "/ as sysdba"                                                                                                

SQL*Plus: Release 9.2.0.6.0 - Production on Tue Mar 15 16:44:03 2016

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production

SQL> grant exp_full_database to apps;

Grant succeeded.

SQL> commit
  2  ;

Commit complete.

SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production

#加上schema后进行导出
$ exp userid=apps/<密码> tables=HR.HR_ALL_ORGANIZATION_UNITS,APPLSYS.FND_USER file=/redolog/sdprd/SDYD_all.dmp log>

Export: Release 9.2.0.6.0 - Production on Tue Mar 15 16:44:50 2016

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
Export done in ZHS16GBK character set and UTF8 NCHAR character set

About to export specified tables via Conventional Path ...
Current user changed to HR
. . exporting table      HR_ALL_ORGANIZATION_UNITS       4444 rows exported
Current user changed to APPLSYS
. . exporting table                       FND_USER       3335 rows exported
Export terminated successfully without warnings.
$ 
#移除权限

SQL> revoke exp_full_database from apps;

在目标数据库进行恢复,遇到导入问题


C:\app\oracle\product\12.1.0\dbhome_1\BIN>sqlplus "/ as sysdba"

SQL*Plus: Release 12.1.0.2.0 Production on 星期二 315 18:18:34 2016

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


连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
#打开所有PDB
sys@CYANG> alter pluggable database all open;

插接式数据库已变更。

#切换到一个pdb
sys@CYANG> alter session set container = pyang1
  2  ;

会话已更改。

#查看当前登录身份
sys@CYANG> show user
USER 为 "SYS"
sys@CYANG> show con_id

CON_ID
------------------------------
3
sys@CYANG> show con_name

CON_NAME
------------------------------
PYANG1


#创建schema用户

sys@CYANG> create user test identified by test default tablespace users;

用户已创建。

sys@CYANG> grant connect,resource to test;

授权成功。

sys@CYANG> commit;

提交完成。


sys@CYANG> exit
从 Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options 断开

#进行导入

C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp test/test@localhost:1521/pyang1 file=c:\SDYD_test.dmp FROMUSER=system touser=test

Import: Release 12.1.0.2.0 - Production on 星期二 315 18:30:15 2016

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


连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

经由常规路径由 EXPORT:V09.02.00 创建的导出文件
IMP-00013: 只有 DBA 才能导入由其他 DBA 导出的文件
IMP-00000: 未成功终止导入

#权限不够,再进行赋权
C:\app\oracle\product\12.1.0\dbhome_1\BIN>sqlplus  sys/<密码>@localhost:1521/pyang1 as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on 星期二 315 18:30:35 2016

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


连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

sys@PYANG1> grant dba to test;

授权成功。

sys@PYANG1> commit;

提交完成。

sys@PYANG1> exit
从 Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options 断开

#再进行导入
C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp test/test@localhost:1521/pyang1 file=c:\SDYD_test.dmp FROMUSER=system touser=test

Import: Release 12.1.0.2.0 - Production on 星期二 315 18:31:26 2016

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


连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

经由常规路径由 EXPORT:V09.02.00 创建的导出文件

警告: 这些对象由 SYSTEM 导出, 而不是当前用户

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
导出服务器使用 UTF8 NCHAR 字符集 (可能的 ncharset 转换)
成功终止导入, 没有出现警告。

#加入指定表名
C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp test/test@localhost:1521/pyang1 file=c:\SDYD_test.dmp FROMUSER=system touser=test tables=(HR_ALL_ORGANIZATION_UNITS)

Import: Release 12.1.0.2.0 - Production on 星期二 315 18:33:34 2016

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


连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

经由常规路径由 EXPORT:V09.02.00 创建的导出文件

警告: 这些对象由 SYSTEM 导出, 而不是当前用户

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
导出服务器使用 UTF8 NCHAR 字符集 (可能的 ncharset 转换)
IMP-00033: 警告: 在导出文件中未找到表 "HR_ALL_ORGANIZATION_UNITS"
成功终止导入, 但出现警告。

#表名指定用户
C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp test/test@localhost:1521/pyang1 file=c:\SDYD_test.dmp FROMUSER=system touser=test tables=(HR.HR_ALL_ORGANIZATION_UNITS)

Import: Release 12.1.0.2.0 - Production on 星期二 315 18:34:01 2016

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


连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

经由常规路径由 EXPORT:V09.02.00 创建的导出文件

警告: 这些对象由 SYSTEM 导出, 而不是当前用户

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
导出服务器使用 UTF8 NCHAR 字符集 (可能的 ncharset 转换)
IMP-00029: 无法使用所有者 (HR.HR_ALL_ORGANIZATION_UNITS) 限定表名, 请使用 FROMUSER 参数
IMP-00000: 未成功终止导入

#更改fromuser 用户
C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp test/test@localhost:1521/pyang1 file=c:\SDYD_test.dmp FROMUSER=HR touser=test tables=(HR_ALL_ORGANIZATION_UNITS)

Import: Release 12.1.0.2.0 - Production on 星期二 315 18:34:34 2016

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


连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

经由常规路径由 EXPORT:V09.02.00 创建的导出文件

警告: 这些对象由 SYSTEM 导出, 而不是当前用户

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
导出服务器使用 UTF8 NCHAR 字符集 (可能的 ncharset 转换)
. 正在将 HR 的对象导入到 TEST
. . 正在导入表     "HR_ALL_ORGANIZATION_UNITS"导入了        4507 行
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT ALTER ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT DELETE ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT INDEX ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT INSERT ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT SELECT ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT UPDATE ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT REFERENCES ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT ON COMMIT REFRESH ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT"
 " OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT QUERY REWRITE ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPT"
 "ION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT DEBUG ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 1917, 以下语句失败:
 "GRANT FLASHBACK ON "HR_ALL_ORGANIZATION_UNITS" TO "APPS" WITH GRANT OPTION"
IMP-00003: 遇到 ORACLE 错误 1917
ORA-01917: 用户或角色 'APPS' 不存在
IMP-00017: 由于 ORACLE 错误 942, 以下语句失败:
 "ALTER TABLE "HR_ALL_ORGANIZATION_UNITS" ADD CONSTRAINT "HR_ORGANIZATION_UNI"
 "TS_FK3" FOREIGN KEY ("LOCATION_ID") REFERENCES "HR_LOCATIONS_ALL" ("LOCATIO"
 "N_ID") ENABLE NOVALIDATE"
IMP-00003: 遇到 ORACLE 错误 942
ORA-00942: 表或视图不存在
IMP-00017: 由于 ORACLE 错误 942, 以下语句失败:
 "ALTER TABLE "HR_ALL_ORGANIZATION_UNITS" ADD CONSTRAINT "HR_ORGANIZATION_UNI"
 "TS_FK2" FOREIGN KEY ("COST_ALLOCATION_KEYFLEX_ID") REFERENCES "PAY_COST_ALL"
 "OCATION_KEYFLEX" ("COST_ALLOCATION_KEYFLEX_ID") ENABLE NOVALIDATE"
IMP-00003: 遇到 ORACLE 错误 942
ORA-00942: 表或视图不存在
即将启用约束条件...
成功终止导入, 但出现警告。

C:\app\oracle\product\12.1.0\dbhome_1\BIN>

#   看下帮助
C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp help=y

Import: Release 12.1.0.2.0 - Production on 星期二 315 19:02:59 2016

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



通过输入 IMP 命令和您的用户名/口令, 导入
操作将提示您输入参数:

     例如: IMP SCOTT/TIGER

或者, 可以通过输入 IMP 命令和各种参数来控制导入
的运行方式。要指定参数, 您可以使用关键字:

     格式:  IMP KEYWORD=value 或 KEYWORD=(value1,value2,...,valueN)
     例如: IMP SCOTT/TIGER IGNORE=Y TABLES=(EMP,DEPT) FULL=N
               或 TABLES=(T1:P1,T1:P2), 如果 T1 是分区表

USERID 必须是命令行中的第一个参数。

关键字   说明 (默认值)        关键字      说明 (默认值)
--------------------------------------------------------------------------
USERID   用户名/口令           FULL       导入整个文件 (N)
BUFFER   数据缓冲区大小        FROMUSER    所有者用户名列表
FILE     输入文件 (EXPDAT.DMP)  TOUSER     用户名列表
SHOW     只列出文件内容 (N)     TABLES      表名列表
IGNORE   忽略创建错误 (N)    RECORDLENGTH  IO 记录的长度
GRANTS   导入权限 (Y)          INCTYPE     增量导入类型
INDEXES   导入索引 (Y)         COMMIT       提交数组插入 (N)
ROWS     导入数据行 (Y)        PARFILE      参数文件名
LOG     屏幕输出的日志文件    CONSTRAINTS    导入限制 (Y)
DESTROY                覆盖表空间数据文件 (N)
INDEXFILE              将表/索引信息写入指定的文件
SKIP_UNUSABLE_INDEXES  跳过不可用索引的维护 (N)
FEEDBACK               每 x 行显示进度 (0)
TOID_NOVALIDATE        跳过指定类型 ID 的验证
FILESIZE               每个转储文件的最大大小
STATISTICS             始终导入预计算的统计信息
RESUMABLE              在遇到有关空间的错误时挂起 (N)
RESUMABLE_NAME         用来标识可恢复语句的文本字符串
RESUMABLE_TIMEOUT      RESUMABLE 的等待时间
COMPILE                编译过程, 程序包和函数 (Y)
STREAMS_CONFIGURATION  导入流的一般元数据 (Y)
STREAMS_INSTANTIATION  导入流实例化元数据 (N)
DATA_ONLY              仅导入数据 (N)

下列关键字仅用于可传输的表空间
TRANSPORT_TABLESPACE 导入可传输的表空间元数据 (N)
TABLESPACES 将要传输到数据库的表空间
DATAFILES 将要传输到数据库的数据文件
TTS_OWNERS 拥有可传输表空间集中数据的用户

成功终止导入, 没有出现警告。

#加入忽略索引、授权、约束
C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp test/test@localhost:1521/pyang1 file=c:\SDYD_test.dmp  GRANTS=N INDEXES=N touser=test fromuser=HR CONSTRAINTS=N

Import: Release 12.1.0.2.0 - Production on 星期二 315 19:27:36 2016

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


连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

经由常规路径由 EXPORT:V09.02.00 创建的导出文件

警告: 这些对象由 SYSTEM 导出, 而不是当前用户

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
导出服务器使用 UTF8 NCHAR 字符集 (可能的 ncharset 转换)
. 正在将 HR 的对象导入到 TEST
. . 正在导入表     "HR_ALL_ORGANIZATION_UNITS"导入了        4507 行
即将启用约束条件...
成功终止导入, 没有出现警告。

C:\app\oracle\product\12.1.0\dbhome_1\BIN>imp test/test@localhost:1521/pyang1 file=c:\SDYD_test.dmp   GRANTS=N INDEXES=N touser=test fromuser=APPLSYS CONSTRAINTS=N

Import: Release 12.1.0.2.0 - Production on 星期二 315 19:28:11 2016

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


连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

经由常规路径由 EXPORT:V09.02.00 创建的导出文件

警告: 这些对象由 SYSTEM 导出, 而不是当前用户

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
导出服务器使用 UTF8 NCHAR 字符集 (可能的 ncharset 转换)
. 正在将 APPLSYS 的对象导入到 TEST
. . 正在导入表                      "FND_USER"导入了        3415 行
成功终止导入, 没有出现警告。

C:\app\oracle\product\12.1.0\dbhome_1\BIN>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贤时间

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值