12c pdb使用数据泵导入导出

1.查看当前的SID,查看pdb并切换到容器数据库,这里的pluggable数据库是orcl

[oracle@orcl ~]$ echo $ORACLE_SID
zzorcl
[oracle@orcl ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Jul 3 16:40:56 2018

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCL                           READ WRITE NO
SQL> 

2.切换到插件库

SQL> alter session set container = orcl;

Session altered.

3.可以自己创建数据泵目录,也可以用oracle默认目录,这里以目录dp_dir,路径为oracle家目录

SQL> create or replace directory dp_dir as  '/home/oracle';

Directory created.

SQL> exit

4.授予dp用户在数据泵路径有读写权限

SQL> grant read,write on directory dp_dir to dp;
Grant succeeded.

5.设置tnsnames.ora,增加pdborcl。SERVICE_NAME为orcl,下面是我在TNSNAMES.ora 里加的

pdbORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = zzorcl)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

  ZZORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = zzorcl)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = zzorcl)
    )
  )

LISTENER_ZSQ =
  (ADDRESS = (PROTOCOL = TCP)(HOST =zzorcl)(PORT = 1521))

6.数据泵导出、导入(scott为例子)

expdp dp/dp@pdborcl directory=dp_dir dumpfile=scott_pdborcl.dmp logfile=scott_pdborcl.log schemas=scott


impdp dp/dp@pdborcl directory=dp_dir dumpfile=scott_pdborcl.dmp logfile=scott_pdborcl_imp.log schemas=scott
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值