By Joel Peréz ACED.gifSkant Gupta

 

This article is brought by en.enmotech.com

 

Full Index of Oracle Cloud Articles:

Sir.CloudDBaaSjoelperez

 

If you want to be updated with all our articles send us the Invitation or Follow us:

Joel Perez’s LinkedIn: www.linkedin.com/in/SirDBaaSJoelPerez

Skant Gupta's LinkedIn: www.linkedin.com/in/skantali/

or Join our LinkedIn group: Oracle Cloud DBaaS

 

There are a lot of methods to move our "On-Prem" databases to Cloud using RMAN, such us:

 

  • RMAN Cross-Platform Transportable PDB

#12 Oracle Cloud (DBaaS): Migration “On-prem” database to Cloud Using RMAN Cross-Platform Transportable PDB

 

  • RMAN CONVERT Transportable Tablespace with Data Pump
  • RMAN Cross-Platform Transportable Tablespace Backup Sets
  • RMAN Transportable Tablespace with Data Pump

 

If you want to read about Oracle18c New Features for RMAN, you can go go here:

#16 Oracle 18c: RMAN New Features.. What’s NEWS..

 

Very soon we will post here the links of our articles showing how to move databases to Cloud using the methods already mentioned.

 

As a topic related you can read here one of our hotest articles:

#10 Oracle 18c: “Oracle 18c and its impact on DBAs”

 

Now, Let's continue with this one:

The method to be worked in this article is based on the tradicional backup/restore/recover database. It has been one of the methods most effective to migrate/move an Oracle Database from one host to another host or even in the same host. The advantages of this method are several, one of them is that the downtime normally is almost zero, depending on the archive redo log generation of the "On-prem" or source database.

 

When to use this method?

 

  • No Cross-Endian
  • No structural changes
  • No upgrade to a new version
  • Source version 11.2.0.4, 12.1.0.2, 12.2.0.1

 

The objective of this article is not highlight the typical advantages of the method, since is very well known, the objective of this article is to realise how we can use it to move a database to Cloud.

Please use following steps to migrate on-premise database to Oracle cloud.

 

Backup source Database

 

1. Backup the source database

[oracle@PREMISE premise]$ rman target /

 

Recovery Manager: Release 11.2.0.4.0 - Production on Tue Aug 8 04:34:16 2017

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: ORCL (DBID=1478563967)

 

RMAN> run

{

allocate channel c1 type DISK FORMAT '/u01/bkp/premise/%d_FULL_C_DISK_%T_%s_%p';

allocate channel c2 type DISK FORMAT '/u01/bkp/premise/%d_FULL_C_DISK_%T_%s_%p';

allocate channel c3 type DISK FORMAT '/u01/bkp/premise/%d_FULL_C_DISK_%T_%s_%p';

allocate channel c4 type DISK FORMAT '/u01/bkp/premise/%d_FULL_C_DISK_%T_%s_%p';

BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;

backup spfile format '/u01/bkp/premise/spfile_%d_%s_%T_dbid%I.rman';

backup current controlfile format '/u01/bkp/premise/Controlfile_%d_%T_dbid%I_s%s_p%p';

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}

 

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: SID=146 device type=DISK

 

allocated channel: c2

channel c2: SID=33 device type=DISK

 

allocated channel: c3

channel c3: SID=150 device type=DISK

 

allocated channel: c4

channel c4: SID=17 device type=DISK

 

Starting backup at 08-AUG-17

current log archived

skipping archived logs of thread 1 from sequence 7 to 8; already backed up

channel c1: starting compressed archived log backup set

channel c1: specifying archived log(s) in backup set

input archived log thread=1 sequence=9 RECID=9 STAMP=951453273

channel c1: starting piece 1 at 08-AUG-17

channel c1: finished piece 1 at 08-AUG-17

piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_9_1 tag=TAG20170808T043433 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 08-AUG-17

 

Starting backup at 08-AUG-17

channel c1: starting compressed full datafile backup set

channel c1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u02/app/oracle/oradata/ORCL/system01.dbf

channel c1: starting piece 1 at 08-AUG-17

channel c2: starting compressed full datafile backup set

channel c2: specifying datafile(s) in backup set

input datafile file number=00002 name=/u02/app/oracle/oradata/ORCL/sysaux01.dbf

input datafile file number=00004 name=/u02/app/oracle/oradata/ORCL/users01.dbf

channel c2: starting piece 1 at 08-AUG-17

channel c3: starting compressed full datafile backup set

channel c3: specifying datafile(s) in backup set

input datafile file number=00005 name=/u02/app/oracle/oradata/ORCL/example01.dbf

input datafile file number=00003 name=/u02/app/oracle/oradata/ORCL/undotbs01.dbf

channel c3: starting piece 1 at 08-AUG-17

channel c3: finished piece 1 at 08-AUG-17

piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_12_1 tag=TAG20170808T043434 comment=NONE

channel c3: backup set complete, elapsed time: 00:00:07

channel c1: finished piece 1 at 08-AUG-17

piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_10_1 tag=TAG20170808T043434 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:25

channel c2: finished piece 1 at 08-AUG-17

piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_11_1 tag=TAG20170808T043434 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:25

Finished backup at 08-AUG-17

 

Starting backup at 08-AUG-17

current log archived

channel c1: starting compressed archived log backup set

channel c1: specifying archived log(s) in backup set

input archived log thread=1 sequence=10 RECID=10 STAMP=951453301

channel c1: starting piece 1 at 08-AUG-17

channel c1: finished piece 1 at 08-AUG-17

piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_13_1 tag=TAG20170808T043501 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 08-AUG-17

 

Starting backup at 08-AUG-17

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

including current SPFILE in backup set

channel c1: starting piece 1 at 08-AUG-17

channel c1: finished piece 1 at 08-AUG-17

piece handle=/u01/bkp/premise/spfile_ORCL_14_20170808_dbid1478563967.rman tag=TAG20170808T043502 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 08-AUG-17

 

Starting backup at 08-AUG-17

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

including current control file in backup set

channel c1: starting piece 1 at 08-AUG-17

channel c1: finished piece 1 at 08-AUG-17

piece handle=/u01/bkp/premise/Controlfile_ORCL_20170808_dbid1478563967_s15_p1 tag=TAG20170808T043503 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 08-AUG-17

 

Starting Control File and SPFILE Autobackup at 08-AUG-17

piece handle=/u03/app/oracle/fast_recovery_area/ORCL/autobackup/2017_08_08/o1_mf_s_951453306_drlhvton_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 08-AUG-17

 

released channel: c1

 

released channel: c2

 

released channel: c3

 

released channel: c4

 

RMAN>

RMAN> exit

Recovery Manager complete.

[oracle@PREMISE premise]$

 

2. Check the backup sets

[oracle@PREMISE premise]$ cd /u01/bkp/premise

[oracle@PREMISE premise]$ ls

Controlfile_ORCL_20170808_dbid1478563967_s15_p1  ORCL_FULL_C_DISK_20170808_11_1  ORCL_FULL_C_DISK_20170808_13_1  spfile_ORCL_14_20170808_dbid1478563967.rman

ORCL_FULL_C_DISK_20170808_10_1                   ORCL_FULL_C_DISK_20170808_12_1  ORCL_FULL_C_DISK_20170808_9_1

[oracle@PREMISE premise]$

 

Create the new Cloud Database Service

a) Login to your Oracle cloud services account, go to the "Oracle Database Cloud Service" page and create a new service.

  • For Service Name, select PREMISE.
  • From the Service Level list, select Oracle Database Cloud Service.
  • From the Metering Frequency list, select whatever frequency is appropriate for your environment.
  • From the Software Release list, select Oracle Database 11g Release2.
  • From the Software Edition list, select Enterprise Edition.
  • From the Database Type list, select Single Instance.

Then click Next to continue.

figura1.JPG

Figure1. Creating a new service (PREMISE)

 

b) In the Service Details screen, do the following:

  • For DB Name (SID), enter ORCL.
  • Set an administrative password of your choice and confirm the password (this will be your sys password).
  • For Usable Database Storage (GB), enter 25.
  • From the Compute Shape list, select OC3 -1 OCPU, 7.5GB RAM (this is the bare minimum required).
  • For SSH Public Key, enter rsa-key-20170111.pub.

Then click Next to continue.

figura2.JPG

Figure 2. Specifying the service details

 

c) Finally, review the configuration and click Create to create your cloud database.

figura3.JPG

Figure 3. Creating the cloud database instance

 

After a few minutes, the cloud database instance has been created successfully.

figura4.JPG

Figure 4. The cloud database has been created

 

d) Click the service name (PREMISE) to open the main page of the database.

figura5.JPG

Figure 5. Main page of the cloud database

 

Connect the Cloud Database

1. Open the instance of the PuTTY executable and connect to the machine using SSH public key.

figura6.jpg

Figure 6. Connecting to machine using PuTTY

 

Copy backup to Oracle Cloud compute Node

 

1. Copy the backup set to cloud database

[oracle@Cloud ~]$ mkdir –p /u01/app/premise/

[oracle@PREMISE ~]$ scp -i rsa-key-20170111.ssh /u01/app/premise/* oracle@141.144.32.52:/u01/app/premise

 

2. Delete the dummy database of cloud

[oracle@Cloud ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 8 04:37:45 2017

 

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Testing options

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount exclusive restrict

ORACLE instance started.

 

Total System Global Area 2755870720 bytes

Fixed Size                  2256432 bytes

Variable Size             637534672 bytes

Database Buffers         2030043136 bytes

Redo Buffers               86036480 bytes

Database mounted.

SQL> drop database;

Database dropped.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Testing options

SQL>

 

Restore backup to Oracle Cloud Instance

        

1. Startup database in nomount mode

[oracle@Cloud ~]$ mkdir -p /u01/app/oracle/admin/ORCL/adump

[oracle@Cloud ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 8 04:41:09 2017

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

Connected to an idle instance.

SQL> startup nomount;

ORACLE instance started.

 

Total System Global Area 2755870720 bytes

Fixed Size                  2256432 bytes

Variable Size             637534672 bytes

Database Buffers         2030043136 bytes

Redo Buffers               86036480 bytes

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Testing options

[oracle@Cloud ~]$ ps -ef|grep pmon

oracle   23518     1  0 04:41 ?        00:00:00 ora_pmon_ORCL

oracle   23649 18890  0 04:41 pts/0    00:00:00 grep pmon

 

2. Restore control file and mount database

[oracle@Cloud ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Tue Aug 8 04:42:34 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (not mounted)

RMAN> RESTORE CONTROLFILE from '/u01/bkp/premise/Controlfile_ORCL_20170808_dbid1478563967_s15_p1';

Starting restore at 08-AUG-17

using channel ORA_DISK_1

 

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

output file name=/u02/app/oracle/oradata/ORCL/control01.ctl

output file name=/u03/app/oracle/fast_recovery_area/ORCL/control02.ctl

Finished restore at 08-AUG-17

RMAN>

RMAN> alter database mount;

database mounted

released channel: ORA_DISK_1

RMAN>

 

3. Catalog backup if location is different

RMAN> catalog start with '/u01/bkp/premise/';

Starting implicit crosscheck backup at 08-AUG-17

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=134 device type=DISK

Crosschecked 14 objects

Finished implicit crosscheck backup at 08-AUG-17

Starting implicit crosscheck copy at 08-AUG-17

using channel ORA_DISK_1

Finished implicit crosscheck copy at 08-AUG-17

searching for all files in the recovery area

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /u03/app/oracle/fast_recovery_area/ORCL/autobackup/2017_08_08/o1_mf_s_951453306_drlhvton_.bkp

 

searching for all files that match the pattern /u01/bkp/premise/

List of Files Unknown to the Database

=====================================

File Name: /u01/bkp/premise/Controlfile_ORCL_20170808_dbid1478563967_s15_p1

Do you really want to catalog the above files (enter YES or NO)? y

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /u01/bkp/premise/Controlfile_ORCL_20170808_dbid1478563967_s15_p1

RMAN>

 

4. Restore Database

RMAN> RUN {

SET NEWNAME FOR DATABASE TO '/u02/app/oracle/oradata/ORCL/%U';

RESTORE DATABASE;

SWITCH DATAFILE ALL;

}

executing command: SET NEWNAME

Starting restore at 08-AUG-17

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00003 to /u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-UNDOTBS1_FNO-3

channel ORA_DISK_1: restoring datafile 00005 to /u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-EXAMPLE_FNO-5

channel ORA_DISK_1: reading from backup piece /u01/bkp/premise/ORCL_FULL_C_DISK_20170808_12_1

channel ORA_DISK_1: piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_12_1 tag=TAG20170808T043434

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00002 to /u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-SYSAUX_FNO-2

channel ORA_DISK_1: restoring datafile 00004 to /u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-USERS_FNO-4

channel ORA_DISK_1: reading from backup piece /u01/bkp/premise/ORCL_FULL_C_DISK_20170808_11_1

channel ORA_DISK_1: piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_11_1 tag=TAG20170808T043434

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to /u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-SYSTEM_FNO-1

channel ORA_DISK_1: reading from backup piece /u01/bkp/premise/ORCL_FULL_C_DISK_20170808_10_1

channel ORA_DISK_1: piece handle=/u01/bkp/premise/ORCL_FULL_C_DISK_20170808_10_1 tag=TAG20170808T043434

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:35

Finished restore at 08-AUG-17

 

datafile 1 switched to datafile copy

input datafile copy RECID=6 STAMP=951454265 file name=/u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-SYSTEM_FNO-1

datafile 2 switched to datafile copy

input datafile copy RECID=7 STAMP=951454266 file name=/u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-SYSAUX_FNO-2

datafile 3 switched to datafile copy

input datafile copy RECID=8 STAMP=951454266 file name=/u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-UNDOTBS1_FNO-3

datafile 4 switched to datafile copy

input datafile copy RECID=9 STAMP=951454266 file name=/u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-USERS_FNO-4

datafile 5 switched to datafile copy

input datafile copy RECID=10 STAMP=951454266 file name=/u02/app/oracle/oradata/ORCL/data_D-ORCL_TS-EXAMPLE_FNO-5

 

RMAN>

 

5. Recover database and open it with resetlogs

RMAN> recover database;

Starting recover at 08-AUG-17

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 10 is already on disk as file /u03/app/oracle/fast_recovery_area/ORCL/archivelog/2017_08_08/o1_mf_1_10_drlhvnw3_.arc

archived log file name=/u03/app/oracle/fast_recovery_area/ORCL/archivelog/2017_08_08/o1_mf_1_10_drlhvnw3_.arc thread=1 sequence=10

unable to find archived log

archived log thread=1 sequence=11

RMAN-03002: failure of recover command at 08/08/2017 05:01:05

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 11 and starting SCN of 2519715

RMAN> alter database open resetlogs;

database opened

RMAN> exit

Recovery Manager complete.

[oracle@Cloud ~]$

 

6. Check the database instance

[oracle@Cloud ~]$ ps -ef | grep smon

oracle     945 18890  0 05:01 pts/0    00:00:00 grep smon

oracle   31545     1  0 04:57 ?        00:00:00 ora_smon_ORCL

[oracle@Cloud ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 8 05:02:14 2017

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Testing options

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE

--------- --------------------

ORCL      READ WRITE

 

Conclusion

So, now you know  it's very easy to perform Migration On-premises database to Cloud Using RMAN.

We hope this article is useful and we invite you to continue reading our next publications focused on Oracle Cloud.

 

If you want to be updated with all our articles send us the Invitation or Follow us:

Joel Perez’s LinkedIn: www.linkedin.com/in/SirDBaaSJoelPerez

Skant Gupta's LinkedIn: www.linkedin.com/in/skantali/

or Join our LinkedIn group: Oracle Cloud DBaaS

 

Full Index of Oracle Cloud Articles:

Sir.CloudDBaaSjoelperez

 

Author Bios:

 

Joel Pérez is an Expert DBA ( Oracle ACE Director, Maximum Availability OCM, OCM Cloud Admin. & OCM12c/11g ) with over 17 years of Real World Experience in Oracle Technology, specialised in design and implement solutions of: High Availability, Disaster Recovery, Upgrades, Replication, Cloud and all area related to Oracle Databases. International consultant with duties, conferences & activities in more than 50 countries and countless clients around the world. Habitual and one of leading writers of Technical Oracle articles for: OTN Spanish, Portuguese, English and more. Regular Speaker in worldwide Oracle events  like: OTN LAD (Latin America), OTN MENA (Middle East & Africa), OTN APAC ( Asian Pacific), DTCC China, Oracle Code.. . Joel has always been known for being a pioneer in Oracle technology since the early days of his career being the first Latin American awarded as “OTN Expert” at year 2003 by Oracle Corp., one of the first “Oracle ACE” globally in the Oracle ACE Program at year 2004. He was honoured as one of the first “OCM Database Cloud Administrator” & Maximum Availability OCM in the world. Currently Joel works as Senior Cloud Database Architect in “Yunhe Enmo (Beijing) Technology Co.,Ltd”., company located in Beijing, China En.enmotech.com

 

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 12c, and an Oracle Exadata Certified 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, Oracle Exadata and Oracle GoldenGate. He has presented at several Oracle user groups worldwide, most recently in the US, the United Arab Emirates, and the India. Skant website link: oracle-help.com