作者:Joel Pérez 和 Skant Gupta
本文介绍如何使用 Oracle Database 的 Data Pump 特性的常规导出和导入功能将内部部署的源数据库、表空间、模式或表迁移到 Oracle 数据库云服务数据库部署。无论内部部署数据库的字节序格式和数据库字符集如何,都可以使用此方法。
要完成迁移,请执行以下步骤:
expdp
) 并导出内部部署数据库。impdp
) 并将数据导入到数据库。以下几节介绍一个完整过程的示例。该示例演示了模式导出和导入。不过,可以使用同样的过程导出和导入完整的数据库、表空间或表。
在本例中,内部部署数据库位于一台 Linux 主机上。
在内部部署数据库主机上执行以下步骤,导出模式:
[oracle@cloud ~]$ mkdir -p /u01/app/dbpump
[oracle@cloud ~]$ sqlplus sys@PDB_PREM as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sun May 21 16:05:26 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Enter Password: Connected to: Oracle Database12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> create directory prem_to_cloud as '/u01/app/dpdump'; Directory created
[oracle@cloud ]$ expdp system@PDB_PREM full=y directory=prem_to_cloud Export: Release 12.1.0.2.0 - Production on Sun May 21 16:05:26 2017 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Password: Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options ...
Cloud-Mig
。图 1. 创建新服务 (Cloud-Mig)
MIGORCL
。25
。rsa-key-20170111.pub
。图 2. 指定服务详细信息
图 3. 创建云数据库实例
几分钟后,云数据库实例已成功创建。
图 4. 云数据库已创建
图 5. 云数据库的主页面
图 6. 选择 Access Rules 项目
b.对于 ora_p2_dblistener 规则,从 Actions 菜单中选择 Enable。图 7. 启用 ora_p2_dblistener 规则
图 8. 使用 PuTTY 连接到数据库云服务计算节点
pmon
进程: [oracle@Cloud-Mig ~]$ ps -ef|grep pmon oracle 311 32724 0 10:31 pts/1 00:00:00 grep pmon oracle 7695 1 0 07:57 ? 00:00:00 ora_pmon_MIGORCL [oracle@Cloud-Mig ~]$ sqlplus sys as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sun May 21 10:31:42 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Enter Password: Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics and Real Application Testing options SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ---------- ----------- ------------ 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO
/u01
目录。根据要传输文件的大小选择适当的位置。[oracle@Cloud-Mig admin]$ mkdir -p /u01/app/dump
scp
命令复制导出的转储文件之前,确保提供对 Oracle 数据库云服务计算节点的访问权限的 SSH 私钥在您的内部部署主机上可用。scp
命令将转储文件传输到 Oracle 数据库云服务计算节点:[oracle@cloud dpdump]$ ls expdat.dmp export.log [oracle@cloud dpdump]$ scp -i /home/oracle/rsa-key-20170111.ssh expdat.dmp oracle@129.157.129.107:/u01/app/dump Enter passphrase for key '/home/oracle/rsa-key-20170111.ssh': expdat.dmp 4% 2704KB 856.1KB/s 01:12 ETA
[oracle@Cloud-Mig admin]$ sqlplus sys@pdprem2 as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sun May 21 11:56:53 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Enter Password: Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics and Real Application Testing options
SQL> create directory cloud_mig as '/u01/app/dpump'; Directory created.
[oracle@Cloud-Mig admin] $ impdb system@pdbprem2 full=y directory=cloud_mig Import: Release 12.1.0.1.0 - Production on Sun May 21 12:24:39 2017 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Password: Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options ...
我们希望本文能为您提供一些帮助,欢迎继续阅读本专栏关于 Oracle 云的后续文章。
Joel Pérez 是一位资深 DBA 和 Oracle ACE 总监,同时还是 Oracle 高可用性架构、Oracle 数据库云管理以及 Oracle Database 11g 和 12c 领域的 Oracle 认证大师。他在 Oracle 技术领域拥有超过 17 年的实践经验,致力于从事云、高可用性 (HA)、灾难恢复、升级、复制以及与 Oracle 数据库相关的大部分领域的设计和实施工作。目前,他在云和恩墨(北京)信息技术有限公司担任云技术、Oracle 高可用架构和高可用性领域的首席技术专家和架构师。
Skant Gupta 是 Oracle Database 12c 的 Oracle 认证云专家,Oracle Database 11g 中的 Oracle Real Application Clusters (Oracle RAC) 的 Oracle 认证专家以及 Oracle Database 10g、11g 和 12c 的 Oracle 认证专家。他目前任职于英国的 Vodafone Technology,此前曾在迪拜的 Etisalat 担任高级 DBA。他拥有六年的 Oracle 技术经验,主要致力于云、数据库和高可用性解决方案、Oracle WebLogic Suite 和 Oracle GoldenGate。他经常在全球各地的 Oracle 用户组活动上发表演讲,最近刚在美国、阿联酋和印度的活动上发表了演讲。