docker导入Oracle备份dmp文件

导入命令

imp 用户名/密码 file=/home/oracle/test.dmp full=y ignore=y

示例

imp system/system file=/home/oracle/20190917.dmp full=y ignore=y


# 备份文件目录 /home/oracle/app/oracle/admin/orcl/dpdump
# 采用数据泵方式导入,需要预先将dmp文件放置到指定的directory目录下,
# https://blog.csdn.net/pierre_/article/details/46346843
# 可通过以下命令查看数据库已有的目录:
select * from DBA_DIRECTORIES;
# 授权
grant read,write on directory DATA_PUMP_DIR to suplab;
# 如果导出采用的是expdp方式,则要使用impdp命令
impdp suplab/suplab file=SUPLAB20201014.DMP  full=y ignore=y

执行结果

[oracle@58ef6fab3e67 ~]$ imp system/system file=/home/oracle/20190917.dmp full=y ignore=y

Import: Release 11.2.0.1.0 - Production on Mon Oct 28 11:53:23 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
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 CLINPATH's objects into CLINPATH
Import terminated successfully with warnings.

实战

现有一个通过 expdp 命令导出的Oracle数据库,名为:SUPLAB20201014.DMP 文件。

进入oracle服务器,切换为oracle用户

su - oracle

用户名密码为:system/system

[oracle@029bcb21ca45 ~]$ sqlplus 

SQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 16 17:34:12 2020

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

Enter user-name:
# 创建表空间
SQL> create tablespace suplab datafile '/home/oracle/app/oracle/oradata/helowin/suplab.dbf' size 1024M autoextend on next 500M maxsize unlimited extent management local segment space management auto;
# 创建用户
SQL> create user suplab identified by suplab default tablespace suplab;
# 授权
SQL> grant connect to suplab;
SQL> grant resource to suplab;
SQL> grant create any view to suplab;
SQL> grant unlimited tablespace to suplab;
SQL> grant create job to suplab;
SQL> grant create synonym to suplab;
SQL> grant debug any procedure to suplab;
SQL> grant debug connect session to suplab;
SQL> grant create sequence,select any sequence to suplab;
SQL> grant read, write on directory DATA_PUMP_DIR to suplab;
SQL> grant dba to suplab;

查看DATA_PUMP_DIR目录

SQL> select * from DBA_DIRECTORIES;
DIRECTORY_PATH
--------------------------------------------------------------------------------

SYS			       DATA_PUMP_DIR
/home/oracle/app/oracle/admin/orcl/dpdump/

SUPLAB20201014.DMP文件上传至服务器DATA_PUMP_DIR目录下,确保文件权限用户组为oracle:oinstall,如下

-rw-r--r--  1 oracle oinstall 218738688 Oct 16 15:24 SUPLAB20201014.DMP

如果不是,则用root用户授权

chown oracle:oinstall SUPLAB20201014.DMP

如果没有该目录,则创建

mkdir -p /home/oracle/app/oracle/admin/orcl/dpdump/

使用impdp命令还原dmp文件

impdp suplab/suplab file=SUPLAB20201014.DMP  full=y ignore=y
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值