全量恢复
imp 用户名/密码@数据库 file=导入文件地址 full=y ignore=y
部分表恢复
imp 用户名/密码@数据库 file=导入文件地址 fromuser=数据拥有者 touser=数据所需者 tables=(表a,表b)
问题及解决方案
问题1:
Import: Release 11.2.0.1.0 - Production on Mon Dec 30 14:54:35 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
IMP-00013: only a DBA can import a file exported by another DBA
IMP-00000: Import terminated unsuccessfully
解决方案:
进入到SQL*Plus,给用户授权即可,例如:
#以下命令报错了
imp user1/pwd1@数据库 file=导入文件地址 fromuser=数据拥有者 touser=数据所需者 tables=(表a,表b)
#给user1授权即可
GRANT IMP_FULL_DATABASE to user1;
问题2:
Import: Release 11.2.0.1.0 - Production on Mon Dec 30 15:00:36 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
Warning: the objects were exported by CHENHAO, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing CHENHAO's objects into XS
IMP-00033: Warning: Table "TABLE_A" not found in export file
Import terminated successfully with warnings.
解决方案:
指定备份文件拥有者和备份的用户关系即可,例子:
#以下命令报错
imp 用户名/密码@数据库 file=导入文件地址 tables=(表a,表b)
imp 用户名/密码@数据库 file=导入文件地址 tables=表名
imp hcdl/hcdl@127.0.0.1:1521/orcl file=/mountssd/oracle/db_backup/hc/hc_2020-01-07.dmp fromuser=hc touser=hcdl tables=KR_ID
#加上后
imp 用户名/密码@数据库 file=导入文件地址 fromuser=数据拥有者 touser=数据所需者 tables=(表a,表b)
#全量恢复一样
imp 用户名/密码@数据库 file=导入文件地址 fromuser=数据拥有者 touser=数据所需者 full=y ignore=y