Oracle使用imp恢复数据

全量恢复

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值