by Joel Pérez and Skant Gupta
This article shows how to migrate an on-premises source database, tablespace, schema, or table to an Oracle Database Cloud Service database deployment using the conventional export and import functionality of the Data Pump feature of Oracle Database. This method can be used regardless of the endian format and database character set of the on-premises database.
To accomplish the migration, perform the following steps:
expdp
) and export the on-premises database.impdp
) and import the data into the database.The following sections show an example of the entire process. The example illustrates a schema export and import. However, the same procedure applies for exporting and importing a full database, a tablespace, or a table.
In this example, the on-premises database is on a Linux host.
Perform the following steps on the on-premises database host to export the schemas:
[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
.Then click Next to continue.
Figure1. Creating a new service (Cloud-Mig)
MIGORCL
.25
.rsa-key-20170111.pub
.Then click Next to continue.
Figure 2. Specifying the service details
Figure 3. Creating the cloud database instance
After a few minutes, the cloud database instance has been created successfully.
Figure 4. The cloud database has been created
Figure 5. Main page of the cloud database
a. Open the database service and select Access Rules from the menu.
Figure 6. Selecting the Access Rules item
b. For the ora_p2_dblistener rule, select Enable from the Actions menu.
Figure 7. Enabling the ora_p2_dblistener rule
Figure 8. Connecting to Database Cloud Service compute node using PuTTY
pmon
process:
[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
In this example, the dump file is copied to the /u01
directory. Choose an appropriate location based on the size of the file that will be transferred.
a. On the Oracle Database Cloud Service compute node, create a directory for the dump file:
[oracle@Cloud-Mig admin]$ mkdir -p /u01/app/dump
b. Before using the scp
command to copy the exported dump file, make sure the SSH private key that provides access to the Oracle Database Cloud Service compute node is available on your on-premises host.
c. On the on-premises database host, use the scp
command to transfer the dump file to the Oracle Database Cloud Service compute node:
[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
a. On the Oracle Database Cloud Service compute node, invoke SQL*Plus and log in to the database as the SYSTEM user.
[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
b. Create a directory object in the Oracle Database Cloud Service database.
SQL> create directory cloud_mig as '/u01/app/dpump';
Directory created.
c. If they do not exist, create the tablespace(s) for the objects that will be imported.
d. Exit from SQL*Plus.
e. On the Oracle Database Cloud Service compute node, invoke the Data Pump Import utility and connect to the database. Import the data into the database.
[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
...
We hope this article will be useful and we invite you to continue reading our next publications focused on Oracle Cloud.
Joel Pérez is an expert DBA and Oracle ACE Director and an Oracle Certified Master in Oracle Maximum Availability Architecture, Oracle Database cloud administration, and Oracle Database 11g and12c. He has over 17 years of real-world experience with Oracle technology and specializes in the design and implementation of solutions for the cloud, high availability (HA), disaster recovery, upgrades, replication, and most areas related to Oracle Database. Currently, he works as chief technologist and architect for cloud technologies, Oracle Maximum Availability Architecture, and HA at Yunhe Enmo (Beijing) Technology Co., Ltd. in Beijing, China.
Skant Gupta is an Oracle Certified Cloud Professional in Oracle Database 12c, an Oracle Certified Expert in Oracle Real Application Clusters (Oracle RAC) in Oracle Database 11g, and an Oracle Certified Professional in Oracle Database 10g, 11g, and 12c. He works at Vodafone Technology in the UK and formerly worked as a senior DBA at Etisalat in Dubai. He has six years of experience with various Oracle technologies, focusing mainly on cloud, database, and high availability solutions, Oracle WebLogic Suite, and Oracle GoldenGate. He has presented at several Oracle user groups worldwide, most recently in the US, the United Arab Emirates, and India.