You are on page 1of 96

Table of Contents

Overview
Considerations for Oracle VMs
Quickstarts
Create an Oracle DB
Tutorials
Configure Oracle ASM
Configure Oracle DataGuard
Configure Oracle GoldenGate
Concepts
Architect an Oracle DB
Backup strategy for Oracle DB
Oracle Disaster Recovery options
Resources
Azure Roadmap
Oracle solutions and their deployment on Microsoft
Azure
11/30/2017 • 9 min to read • Edit Online

This article covers information required to successfully deploy various Oracle solutions on Microsoft Azure. These
solutions are based on Virtual Machine images published by Oracle in the Azure Marketplace. To get a list of
currently available images, run the following command:

az vm image list --publisher oracle -o table --all

As of 6-16-2017 the list of images are the following:

Offer Publisher Sku Urn


Version
---------------------- ----------- ---------------------- --------------------------------------------------
--------- -------------
Oracle-Database-Ee Oracle 12.1.0.2 Oracle:Oracle-Database-Ee:12.1.0.2:12.1.20170202
12.1.20170202
Oracle-Database-Se Oracle 12.1.0.2 Oracle:Oracle-Database-Se:12.1.0.2:12.1.20170202
12.1.20170202
Oracle-Linux Oracle 6.4 Oracle:Oracle-Linux:6.4:6.4.20141206
6.4.20141206
Oracle-Linux Oracle 6.7 Oracle:Oracle-Linux:6.7:6.7.20161007
6.7.20161007
Oracle-Linux Oracle 6.8 Oracle:Oracle-Linux:6.8:6.8.20161020
6.8.20161020
Oracle-Linux Oracle 6.9 Oracle:Oracle-Linux:6.9:6.9.20170406
6.9.20170406
Oracle-Linux Oracle 7.0 Oracle:Oracle-Linux:7.0:7.0.20141217
7.0.20141217
Oracle-Linux Oracle 7.2 Oracle:Oracle-Linux:7.2:7.2.20161020
7.2.20161020
Oracle-Linux Oracle 7.3 Oracle:Oracle-Linux:7.3:7.3.20170320
7.3.20170320
Oracle-WebLogic-Server Oracle Oracle-WebLogic-Server Oracle:Oracle-WebLogic-Server:Oracle-WebLogic-
Server:12.1.2 12.1.2

These images are considered "Bring Your Own License" and as such you will only be charged for compute, storage,
and networking costs incurred by running a VM. It is assumed you are properly licensed to use Oracle software and
that you have a current support agreement in place with Oracle. Oracle has guaranteed license mobility from on-
premises to Azure. See the published Oracle and Microsoft note for details on license mobility.
Individuals can also choose to base their solutions on a custom image they create from scratch in Azure or upload a
custom image from their on premises environment.

Support for JD Edwards


According to Oracle Support note Doc ID 2178595.1 , JD Edwards EnterpriseOne versions 9.2 and above are
supported on any public cloud offering that meets their specific Minimum Technical Requirements (MTR). You
need to create custom images that meet their MTR specifications for OS and software application compatibility.

Oracle Database virtual machine images


Oracle supports running Oracle DB 12.1 Standard and Enterprise editions in Azure on virtual machine images
based on Oracle Linux. For the best performance for production workloads of Oracle DB on Azure, be sure to
properly size the VM image and use Managed Disks that are backed by Premium Storage. For instructions on how
to quickly get an Oracle DB up and running in Azure using the Oracle published VM image, try the Oracle DB
Quickstart walkthrough.
Attached disk configuration options
Attached disks rely on the Azure Blob storage service. Each standard disk is capable of a theoretical maximum of
approximately 500 input/output operations per second (IOPS). Our premium disk offering is preferred for high-
performance database workloads and can achieve up to 5000 IOps per disk. While you can use a single disk if that
meets your performance needs - you can improve the effective IOPS performance if you use multiple attached
disks, spread database data across them, and then use Oracle Automatic Storage Management (ASM). See Oracle
Automatic Storage overview for more Oracle ASM specific information. For an example of how to install and
configure Oracle ASM on a Linux Azure VM - you can try the Installing and Configuring Oracle Automated Storage
Management tutorial.

Oracle Real Application Cluster (Oracle RAC)


Oracle RAC is designed to mitigate the failure of a single node in an on-premises multi-node cluster configuration.
It relies on two on-premises technologies which are not native to hyper-scale public cloud environments: network
multi-cast and shared disk. If your database solution requires Oracle RAC in Azure, you need 3rd party software to
enable these technologies. A Microsoft Azure Certified offering called FlashGrid Node for Oracle RAC is available
in the Azure Marketplace, published by FlashGrid Inc. For more information on this solution and how it works in
Azure, please see the FlashGrid solution page.

High availability and disaster recovery considerations


When using Oracle Databases in Azure, you are responsible for implementing a high availability and disaster
recovery solution to avoid any downtime.
High availability and disaster recovery for Oracle Database Enterprise Edition (without relying on Oracle RAC) can
be achieved on Azure using Data Guard, Active Data Guard, or Oracle Golden Gate, with two databases on two
separate virtual machines. Both virtual machines should be in the same virtual network to ensure they can access
each other over the private persistent IP address. Additionally, we recommend placing the virtual machines in the
same availability set to allow Azure to place them into separate fault domains and upgrade domains. Should you
want to have geo-redundancy - you can have these two databases replicate between two different regions and
connect the two instances with a VPN Gateway.
We have a tutorial "Implement Oracle DataGuard on Azure", which walks you through the basic setup procedure to
trial this on Azure.
With Oracle Data Guard, high availability can be achieved with a primary database in one virtual machine, a
secondary (standby) database in another virtual machine, and one-way replication set up between them. The result
is read access to the copy of the database. With Oracle GoldenGate, you can configure bi-directional replication
between the two databases. To learn how to set up a high-availability solution for your databases using these tools,
see Active Data Guard and GoldenGate documentation at the Oracle website. If you need read-write access to the
copy of the database, you can use Oracle Active Data Guard.
We have a tutorial "Implement Oracle GoldenGate on Azure", which walks you through the basic setup procedure
to trial this on Azure.
Despite having an HA and DR solution architected in Azure, you want to ensure you have a backup strategy in place
to restore your database. We have a tutorial Backup and recover an Oracle Database which walks you through the
basic procedure for establishing a consistent backup.
Oracle WebLogic Server virtual machine images
Clustering is supported on Enterprise Edition only. You are licensed to use WebLogic clustering only when
using the Enterprise Edition of WebLogic Server. Do not use clustering with WebLogic Server Standard Edition.
UDP multicast is not supported. Azure supports UDP unicasting, but not multicasting or broadcasting.
WebLogic Server is able to rely on Azure UDP unicast capabilities. For best results relying on UDP unicast, we
recommend that the WebLogic cluster size be kept static, or be kept with no more than 10 managed servers
included in the cluster.
WebLogic Server expects public and private ports to be the same for T3 access (for example, when
using Enterprise JavaBeans). Consider a multi-tier scenario where a service layer (EJB) application is
running on a WebLogic Server cluster consisting of two or more VMs, in a vNet named SLWLS. The client
tier is in a different subnet in the same vNet, running a simple Java program trying to call EJB in the service
layer. Because it is necessary to load balance the service layer, a public load-balanced endpoint needs to be
created for the Virtual Machines in the WebLogic Server cluster. If the private port that you specify is
different from the public port (for example, 7006:7008), an error such as the following occurs:

[java] javax.naming.CommunicationException [Root exception is java.net.ConnectException:


t3://example.cloudapp.net:7006:

Bootstrap to: example.cloudapp.net/138.91.142.178:7006' over: 't3' got an error or timed out]

This is because for any remote T3 access, WebLogic Server expects the load balancer port and the WebLogic
managed server port to be the same. In the preceding case, the client is accessing port 7006 (the load
balancer port) and the managed server is listening on 7008 (the private port). This restriction is applicable
only for T3 access, not HTTP.
To avoid this issue, use one of the following workarounds:
Use the same private and public port numbers for load balanced endpoints dedicated to T3 access.
Include the following JVM parameter when starting WebLogic Server:

-Dweblogic.rjvm.enableprotocolswitch=true

For related information, see KB article 860340.1 at http://support.oracle.com.


Dynamic clustering and load balancing limitations. Suppose you want to use a dynamic cluster in
WebLogic Server and expose it through a single, public load-balanced endpoint in Azure. This can be done as
long as you use a fixed port number for each of the managed servers (not dynamically assigned from a
range) and do not start more managed servers than there are machines the administrator is tracking (that is,
no more than one managed server per virtual machine). If your configuration results in more WebLogic
servers being started than there are virtual machines (that is, where multiple WebLogic Server instances
share the same virtual machine), then it is not possible for more than one of those instances of WebLogic
servers to bind to a given port number – the others on that virtual machine fail.
If you configure the admin server to automatically assign unique port numbers to its managed servers, then
load balancing is not possible because Azure does not support mapping from a single public port to multiple
private ports, as would be required for this configuration.
Multiple instances of Weblogic Server on a virtual machine. Depending on your deployment’s
requirements, you might consider the option of running multiple instances of WebLogic Server on the same
virtual machine, if the virtual machine is large enough. For example, on a medium size virtual machine, which
contains two cores, you could choose to run two instances of WebLogic Server. Note however that we still
recommend that you avoid introducing single points of failure into your architecture, which would be the case if
you used just one virtual machine that is running multiple instances of WebLogic Server. Using at least two
virtual machines could be a better approach, and each of those virtual machines could then run multiple
instances of WebLogic Server. Each of these instances of WebLogic Server could still be part of the same cluster.
Note, however, it is currently not possible to use Azure to load-balance endpoints that are exposed by such
WebLogic Server deployments within the same virtual machine, because Azure load balancer requires the load-
balanced servers to be distributed among unique virtual machines.

Oracle JDK virtual machine images


JDK 6 and 7 latest updates. While we recommend using the latest public, supported version of Java
(currently Java 8), Azure also makes JDK 6 and 7 images available. This is intended for legacy applications
that are not yet ready to be upgraded to JDK 8. While updates to previous JDK images might no longer be
available to the general public, given the Microsoft partnership with Oracle, the JDK 6 and 7 images provided
by Azure are intended to contain a more recent non-public update that is normally offered by Oracle to only
a select group of Oracle’s supported customers. New versions of the JDK images will be made available over
time with updated releases of JDK 6 and 7.
The JDK available in this JDK 6 and 7 images, and the virtual machines and images derived from them, can
only be used within Azure.
64-bit JDK. The Oracle WebLogic Server virtual machine images and the Oracle JDK virtual machine images
provided by Azure contain the 64-bit versions of both Windows Server and the JDK.

Next steps
You now have an overview of current Oracle Solutions on Microsoft Azure. Your next step is to deploy your first
Oracle Database on Azure.
Try the Create an Oracle Database on Azure tutorial to get started.
Create an Oracle Database in an Azure VM
7/19/2017 • 6 min to read • Edit Online

This guide details using the Azure CLI to deploy an Azure virtual machine from the Oracle marketplace gallery
image in order to create an Oracle 12c database. Once the server is deployed, you will connect via SSH in order to
configure the Oracle database.
If you don't have an Azure subscription, create a free account before you begin.

Launch Azure Cloud Shell


The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common
Azure tools preinstalled and configured to use with your account. Just click the Copy to copy the code, paste it into
the Cloud Shell, and then press enter to run it. There are a few ways to launch the Cloud Shell:

Click Try It in the upper right corner of a code block.

Open Cloud Shell in your browser.

Click the Cloud Shell button on the menu in the upper right
of the Azure portal.

If you choose to install and use the CLI locally, this quickstart requires that you are running the Azure CLI version
2.0.4 or later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI 2.0.

Create a resource group


Create a resource group with the az group create command. An Azure resource group is a logical container into
which Azure resources are deployed and managed.
The following example creates a resource group named myResourceGroup in the eastus location.

az group create --name myResourceGroup --location eastus

Create virtual machine


To create a virtual machine (VM), use the az vm create command.
The following example creates a VM named myVM . It also creates SSH keys, if they do not already exist in a default
key location. To use a specific set of keys, use the --ssh-key-value option.
az vm create \
--resource-group myResourceGroup \
--name myVM \
--image Oracle:Oracle-Database-Ee:12.1.0.2:latest \
--size Standard_DS2_v2 \
--admin-username azureuser \
--generate-ssh-keys

After you create the VM, Azure CLI displays information similar to the following example. Note the value for
publicIpAddress . You use this address to access the VM.

{
"fqdns": "",
"id":
"/subscriptions/{snip}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM",
"location": "westus",
"macAddress": "00-0D-3A-36-2F-56",
"powerState": "VM running",
"privateIpAddress": "10.0.0.4",
"publicIpAddress": "13.64.104.241",
"resourceGroup": "myResourceGroup"
}

Connect to the VM
To create an SSH session with the VM, use the following command. Replace the IP address with the
publicIpAddress value for your VM.

ssh <publicIpAddress>

Create the database


The Oracle software is already installed on the Marketplace image. Create a sample database as follows.
1. Switch to the oracle superuser, then initialize the listener for logging:

$ sudo su - oracle
$ lsnrctl start

The output is similar to the following:


Copyright (c) 1991, 2014, Oracle. All rights reserved.

Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production


Log messages written to /u01/app/oracle/diag/tnslsnr/myVM/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)
(HOST=myVM.twltkue3xvsujaz1bvlrhfuiwf.dx.internal.cloudapp.net)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 23-MAR-2017 15:32:08
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/myVM/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myVM.twltkue3xvsujaz1bvlrhfuiwf.dx.internal.cloudapp.net)
(PORT=1521)))
The listener supports no services
The command completed successfully

2. Create the database:

dbca -silent \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbname cdb1 \
-sid cdb1 \
-responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword OraPasswd1 \
-systemPassword OraPasswd1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName pdb1 \
-pdbAdminPassword OraPasswd1 \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-storageType FS \
-ignorePreReqs

It takes a few minutes to create the database.


3. Set Oracle variables
Before you connect, you need to set two environment variables: ORACLE_HOME and ORACLE_SID.

ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1; export ORACLE_HOME


ORACLE_SID=cdb1; export ORACLE_SID

You also can add ORACLE_HOME and ORACLE_SID variables to the .bashrc file. This would save the environment
variables for future sign-ins. Confirm the following statements have been added to the ~/.bashrc file using editor
of your choice.
# Add ORACLE_HOME.
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
# Add ORACLE_SID.
export ORACLE_SID=cdb1

Oracle EM Express connectivity


For a GUI management tool that you can use to explore the database, set up Oracle EM Express. To connect to
Oracle EM Express, you must first set up the port in Oracle.
1. Connect to your database using sqlplus:

sqlplus / as sysdba

2. Once connected, set the port 5502 for EM Express

exec DBMS_XDB_CONFIG.SETHTTPSPORT(5502);

3. Open the container PDB1 if not already opened, but first check the status:

select con_id, name, open_mode from v$pdbs;

The output is similar to the following:

CON_ID NAME OPEN_MODE


----------- ------------------------- ----------
2 PDB$SEED READ ONLY
3 PDB1 MOUNT

4. If the OPEN_MODE for PDB1 is not READ WRITE, then run the followings commands to open PDB1:

alter session set container=pdb1;


alter database open;

You need to type quit to end the sqlplus session and type exit to logout of the oracle user.

Automate database startup and shutdown


The Oracle database by default doesn't automatically start when you restart the VM. To set up the Oracle database
to start automatically, first sign in as root. Then, create and update some system files.
1. Sign on as root

sudo su -

2. Using your favorite editor, edit the file /etc/oratab and change the default N to Y :

cdb1:/u01/app/oracle/product/12.1.0/dbhome_1:Y

3. Create a file named /etc/init.d/dbora and paste the following contents:


#!/bin/sh
# chkconfig: 345 99 10
# Description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to $ORACLE_HOME.
ORA_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORA_OWNER=oracle

case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the Oracle sign-in
# will not prompt the user for any values.
# Remove "&" if you don't want startup as a background process.
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" &
touch /var/lock/subsys/dbora
;;

'stop')
# Stop the Oracle databases:
# The following command assumes that the Oracle sign-in
# will not prompt the user for any values.
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" &
rm -f /var/lock/subsys/dbora
;;
esac

4. Change permissions on files with chmod as follows:

chgrp dba /etc/init.d/dbora


chmod 750 /etc/init.d/dbora

5. Create symbolic links for startup and shutdown as follows:

ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

6. To test your changes, restart the VM:

reboot

Open ports for connectivity


The final task is to configure some external endpoints. To set up the Azure Network Security Group that protects
the VM, first exit your SSH session in the VM (should have been kicked out of SSH when rebooting in previous
step).
1. To open the endpoint that you use to access the Oracle database remotely, create a Network Security Group
rule with az network nsg rule create as follows:
az network nsg rule create \
--resource-group myResourceGroup\
--nsg-name myVmNSG \
--name allow-oracle \
--protocol tcp \
--priority 1001 \
--destination-port-range 1521

2. To open the endpoint that you use to access Oracle EM Express remotely, create a Network Security Group
rule with az network nsg rule create as follows:

az network nsg rule create \


--resource-group myResourceGroup \
--nsg-name myVmNSG \
--name allow-oracle-EM \
--protocol tcp \
--priority 1002 \
--destination-port-range 5502

3. If needed, obtain the public IP address of your VM again with az network public-ip show as follows:

az network public-ip show \


--resource-group myResourceGroup \
--name myVMPublicIP \
--query [ipAddress] \
--output tsv

4. Connect EM Express from your browser. Make sure your browser is compatible with EM Express (Flash
install is required):

https://<VM ip address or hostname>:5502/em

You can log in by using the SYS account, and check the as sysdba checkbox. Use the password OraPasswd1 that
you set during installation.

Clean up resources
Once you have finished exploring your first Oracle database on Azure and the VM is no longer needed, you can use
the az group delete command to remove the resource group, VM, and all related resources.
az group delete --name myResourceGroup

Next steps
Learn about other Oracle solutions on Azure.
Try the Installing and Configuring Oracle Automated Storage Management tutorial.
Set up Oracle ASM on an Azure Linux virtual
machine
7/31/2017 • 14 min to read • Edit Online

Azure virtual machines provide a fully configurable and flexible computing environment. This tutorial covers basic
Azure virtual machine deployment combined with the installation and configuration of Oracle Automated Storage
Management (ASM). You learn how to:
Create and connect to an Oracle Database VM
Install and configure Oracle Automated Storage Management
Install and configure Oracle Grid infrastructure
Initialize an Oracle ASM installation
Create an Oracle DB managed by ASM

Launch Azure Cloud Shell


The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common
Azure tools preinstalled and configured to use with your account. Just click the Copy to copy the code, paste it into
the Cloud Shell, and then press enter to run it. There are a few ways to launch the Cloud Shell:

Click Try It in the upper right corner of a code block.

Open Cloud Shell in your browser.

Click the Cloud Shell button on the menu in the upper right
of the Azure portal.

If you choose to install and use the CLI locally, this tutorial requires that you are running the Azure CLI version 2.0.4
or later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI 2.0.

Prepare the environment


Create a resource group
To create a resource group, use the az group create command. An Azure resource group is a logical container in
which Azure resources are deployed and managed. In this example, a resource group named myResourceGroup in
the eastus region.

az group create --name myResourceGroup --location eastus

Create a VM
To create a virtual machine based on the Oracle Database image and configure it to use Oracle ASM, use the az vm
create command.
The following example creates a VM named myVM that is a Standard_DS2_v2 size with four attached data disks of
50 GB each. If they do not already exist in the default key location, it also creates SSH keys. To use a specific set of
keys, use the --ssh-key-value option.

az vm create --resource-group myResourceGroup \


--name myVM \
--image Oracle:Oracle-Database-Ee:12.1.0.2:latest \
--size Standard_DS2_v2 \
--generate-ssh-keys \
--data-disk-sizes-gb 50 50 50 50

After you create the VM, Azure CLI displays information similar to the following example. Note the value for
publicIpAddress . You use this address to access the VM.

{
"fqdns": "",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM",
"location": "eastus",
"macAddress": "00-0D-3A-36-2F-56",
"powerState": "VM running",
"privateIpAddress": "10.0.0.4",
"publicIpAddress": "13.64.104.241",
"resourceGroup": "myResourceGroup"
}

Connect to the VM
To create an SSH session with the VM and configure additional settings, use the following command. Replace the
IP address with the publicIpAddress value for your VM.

ssh <publicIpAddress>

Install Oracle ASM


To install Oracle ASM, complete the following steps.
For more information about installing Oracle ASM, see Oracle ASMLib Downloads for Oracle Linux 6.
1. You need to login as root in order to continue with ASM installation:

sudo su -

2. Run these additional commands to install Oracle ASM components:

yum list | grep oracleasm


yum -y install kmod-oracleasm.x86_64
yum -y install oracleasm-support.x86_64
wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el6.x86_64.rpm
yum -y install oracleasmlib-2.0.12-1.el6.x86_64.rpm
rm -f oracleasmlib-2.0.12-1.el6.x86_64.rpm

3. Verify that Oracle ASM is installed:

rpm -qa |grep oracleasm

The output of this command should list the following components:


oracleasm-support-2.1.10-4.el6.x86_64
kmod-oracleasm-2.0.8-15.el6_9.x86_64
oracleasmlib-2.0.12-1.el6.x86_64

4. ASM requires specific users and roles in order to function correctly. The following commands create the pre-
requisite user accounts and groups:

groupadd -g 54345 asmadmin


groupadd -g 54346 asmdba
groupadd -g 54347 asmoper
useradd -u 3000 -g oinstall -G dba,asmadmin,asmdba,asmoper grid
usermod -g oinstall -G dba,asmdba,asmadmin oracle

5. Verify users and groups were created correctly:

id grid

The output of this command should list the following users and groups:

uid=3000(grid) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54345(asmadmin),54346(asmdba),54347(asmoper)

6. Create a folder for user grid and change the owner:

mkdir /u01/app/grid
chown grid:oinstall /u01/app/grid

Set up Oracle ASM


For this tutorial, the default user is grid and the default group is asmadmin. Ensure that the oracle user is part of
the asmadmin group. To set up your Oracle ASM installation, complete the following steps:
1. Setting up the Oracle ASM library driver involves defining the default user (grid) and default group
(asmadmin) as well as configuring the drive to start on boot (choose y) and to scan for disks on boot
(choose y). You need to answer the prompts from the following command:

/usr/sbin/oracleasm configure -i

The output of this command should look similar to the following, stopping with prompts to be answered.
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []: grid


Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

2. View the disk configuration:

cat /proc/partitions

The output of this command should look similar to the following listing of available disks

8 16 14680064 sdb
8 17 14678976 sdb1
8 0 52428800 sda
8 1 512000 sda1
8 2 51915776 sda2
8 48 52428800 sdd
8 64 52428800 sde
8 80 52428800 sdf
8 32 52428800 sdc
11 0 1152 sr0

3. Format disk /dev/sdc by running the following command and answering the prompts with:
n for new partition
p for primary partition
1 to select the first partition
press enter for the default first cylinder
press enter for the default last cylinder
press w to write the changes to the partition table

fdisk /dev/sdc

Using the answers provided above, the output for the fdisk command should look like the following:
Device contains not a valid DOS partition table, or Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf865c6ca.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

The device presents a logical sector size that is smaller than


the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to


switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): n


Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527):
Using default value 6527

Command (m for help): w


The partition table has been altered!

Calling ioctl() to re-read partition table.


Syncing disks.

4. Repeat the preceding fdisk command for /dev/sdd , /dev/sde , and /dev/sdf .
5. Check the disk configuration:

cat /proc/partitions

The output of the command should look like the following:

major minor #blocks name

8 16 14680064 sdb
8 17 14678976 sdb1
8 32 52428800 sdc
8 33 52428096 sdc1
8 48 52428800 sdd
8 49 52428096 sdd1
8 64 52428800 sde
8 65 52428096 sde1
8 80 52428800 sdf
8 81 52428096 sdf1
8 0 52428800 sda
8 1 512000 sda1
8 2 51915776 sda2
11 0 1048575 sr0

6. Check the Oracle ASM service status and start the Oracle ASM service:

service oracleasm status


service oracleasm start
The output of the command should look like the following:

Checking if ASM is loaded: no


Checking if /dev/oracleasm is mounted: no
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]

7. Create Oracle ASM disks:

service oracleasm createdisk ASMSP /dev/sdc1


service oracleasm createdisk DATA /dev/sdd1
service oracleasm createdisk DATA1 /dev/sde1
service oracleasm createdisk FRA /dev/sdf1

The output of the command should look like the following:

Marking disk "ASMSP" as an ASM disk: [ OK ]


Marking disk "DATA" as an ASM disk: [ OK ]
Marking disk "DATA1" as an ASM disk: [ OK ]
Marking disk "FRA" as an ASM disk: [ OK ]

8. List Oracle ASM disks:

service oracleasm listdisks

The output of the command should list off the following Oracle ASM disks:

ASMSP
DATA
DATA1
FRA

9. Change the passwords for the root, oracle, and grid users. Make note of these new passwords as you are
using them later during the installation.

passwd oracle
passwd grid
passwd root

10. Change the folder permission:

chmod -R 775 /opt


chown grid:oinstall /opt
chown oracle:oinstall /dev/sdc1
chown oracle:oinstall /dev/sdd1
chown oracle:oinstall /dev/sde1
chown oracle:oinstall /dev/sdf1
chmod 600 /dev/sdc1
chmod 600 /dev/sdd1
chmod 600 /dev/sde1
chmod 600 /dev/sdf1

Download and prepare Oracle Grid Infrastructure


To download and prepare the Oracle Grid Infrastructure software, complete the following steps:
1. Download Oracle Grid Infrastructure from the Oracle ASM download page.
Under the download titled Oracle Database 12c Release 1 Grid Infrastructure (12.1.0.2.0) for Linux
x86-64, download the two .zip files.
2. After you download the .zip files to your client computer, you can use Secure Copy Protocol (SCP) to copy
the files to your VM:

scp *.zip <publicIpAddress>:.

3. SSH back into your Oracle VM in Azure in order to move the .zip files into the /opt folder. Then, change the
owner of the files:

ssh <publicIPAddress>
sudo mv ./*.zip /opt
cd /opt
sudo chown grid:oinstall linuxamd64_12102_grid_1of2.zip
sudo chown grid:oinstall linuxamd64_12102_grid_2of2.zip

4. Unzip the files. (Install the Linux unzip tool if it's not already installed.)

sudo yum install unzip


sudo unzip linuxamd64_12102_grid_1of2.zip
sudo unzip linuxamd64_12102_grid_2of2.zip

5. Change permission:

sudo chown -R grid:oinstall /opt/grid

6. Update configured swap space. Oracle Grid components need at least 6.8 GB of swap space to install Grid.
The default swap file size for Oracle Linux images in Azure is only 2048MB. You need to increase
ResourceDisk.SwapSizeMB in the /etc/waagent.conf file and restart the WALinuxAgent service in order for
the updated settings to take effect. Because it is a read-only file, you need to change file permissions to
enable write access.

sudo chmod 777 /etc/waagent.conf


vi /etc/waagent.conf

Search for ResourceDisk.SwapSizeMB and change the value to 8192. You will need to press insert to enter
insert mode, type in the value of 8192 and then press esc to return to command mode. To write the
changes and quit the file, type :wq and press enter .

NOTE
We highly recommend that you always use WALinuxAgent to configure swap space so that it's always created on
the local ephemeral disk (temporary disk) for best performance. For more information on, see How to add a swap file
in Linux Azure virtual machines.

Prepare your local client and VM to run x11


Configuring Oracle ASM requires a graphical interface to complete the install and configuration. We are using the
x11 protocol to facilitate this installation. If you are using a client system (Mac or Linux) that already has X11
capabilities enabled and configured - you can skip this configuration and setup exclusive to Windows machines.
1. Download PuTTY and download Xming to your Windows computer. You will need to complete the
installation of both of these applications with the default values before proceeding.
2. After you install PuTTY, open a command prompt, change into the PuTTY folder (for example, C:\Program
Files\PuTTY), and run puttygen.exe in order to generate a key.
3. In PuTTY Key Generator:
a. Generate a key by selecting the Generate button.
b. Copy the contents of the key (Ctrl+C).
c. Select the Save private key button.
d. Ignore the warning about securing the key with a passphrase, and then select OK .

4. In your VM, run these commands:

sudo su - grid
mkdir .ssh
cd .ssh

5. Create a file named authorized_keys . Paste the contents of the key in this file, and then save the file.

NOTE
The key must contain the string ssh-rsa . Also, the contents of the key must be a single line of text.

6. On your client system, start PuTTY. In the Category pane, go to Connection > SSH > Auth. In the Private
key file for authentication box, browse to the key that you generated earlier.
7. In the Category pane, go to Connection > SSH > X11. Select the Enable X11 forwarding check box.

8. In the Category pane, go to Session. Enter your Oracle ASM VM <publicIPaddress> in the host name
dialog box, fill in a new Saved Session name and then click on Save . Once saved, click on open to connect
to your Oracle ASM virtual machine. The first time you connect you are warned the remote system is not
cached in your registry. Click on yes to add it and continue.
Install Oracle Grid Infrastructure
To install Oracle Grid Infrastructure, complete the following steps:
1. Sign in as grid. (You should be able to sign in without being prompted for a password.)

NOTE
If you are running Windows, make sure you have started Xming before you begin the installation.

cd /opt/grid
./runInstaller

Oracle Grid Infrastructure 12c Release 1 Installer opens. (It might take a few minutes for the installer to
start.)
2. On the Select Installation Option page, select Install and Configure Oracle Grid Infrastructure for a
Standalone Server.
3. On the Select Product Languages page, ensure English or the language that you want is selected. Click
next .

4. On the Create ASM Disk Group page:


Enter a name for the disk group.
Under Redundancy, select External.
Under Allocation Unit Size, select 4.
Under Add Disks, select ORCLASMSP.
Click next .
5. On the Specify ASM Password page, select the Use same passwords for these accounts option, and
enter a password.
6. On the Specify Management Options page, you have the option to configure EM Cloud Control. We are
skipping this option - click next to continue.
7. On the Privileged Operating System Groups page, use the default settings. Click next to continue.
8. On the Specify Installation Location page, use the default settings. Click next to continue.
9. On the Create Inventory page, change the Inventory Directory to /u01/app/grid/oraInventory . Click next
to continue.
10. On the Root script execution configuration page, select the Automatically run configuration scripts
check box. Then, select the Use "root" user credential option, and enter the root user password.

11. On the Perform Prerequisite Checks page, the current setup will fail with errors. This is an expected
behavior. Select Fix & Check Again .
12. In the Fixup Script dialog box, click OK .
13. On the Summary page, review your selected settings, and then click Install .

14. A warning dialog box appears informing you configuration scripts need to be run as a privileged user. Click
Yes to continue.

15. On the Finish page, click Close to finish the installation.

Set up your Oracle ASM installation


To set up your Oracle ASM installation, complete the following steps:
1. Ensure you are still signed in as grid, from your X11 session. You might need to hit enter to revive the
terminal. Then launch the Oracle Automated Storage Management Configuration Assistant:

cd /u01/app/grid/product/12.1.0/grid/bin
./asmca

Oracle ASM Configuration Assistant opens.


2. In the Configure ASM: Disk Groups dialog box, click the Create button, and then click
Show Advanced Options .

3. In the Create Disk Group dialog box:


Enter the disk group name DATA.
Under Select Member Disks, select ORCL_DATA and ORCL_DATA1.
Under Allocation Unit Size, select 4.
Click ok to create the disk group.
Click ok to close the confirmation window.

4. In the Configure ASM: Disk Groups dialog box, click the Create button, and then click
Show Advanced Options .

5. In the Create Disk Group dialog box:


Enter the disk group name FRA.
Under Redundancy, select External (none).
Under Select Member Disks, select ORCL_FRA.
Under Allocation Unit Size, select 4.
Click ok to create the disk group.
Click ok to close the confirmation window.
6. Select Exit to close ASM Configuration Assistant.
Create the database
The Oracle database software is already installed on the Azure Marketplace image. To create a database, complete
the following steps:
1. Switch users to the Oracle superuser, and then initialize the listener for logging:

su - oracle
cd /u01/app/oracle/product/12.1.0/dbhome_1/bin
./dbca

Database Configuration Assistant opens.


2. On the Database Operation page, click Create Database .
3. On the Creation Mode page:
Enter a name for the database.
For Storage Type, ensure Automatic Storage Management (ASM) is selected.
For Database Files Location, use the default ASM suggested location.
For Fast Recovery Area, use the default ASM suggested location.
type in an Administrative Password and confirm password.
ensure create as container database is selected.
type in a pluggable database name value.
4. On the Summary page, review your selected settings, and then click Finish to create the database.

5. The Database has been created. On the Finish page, you have the option to unlock additional accounts to
use this database and change the passwords. If you wish to do so, select Password Management -
otherwise click on close .
Delete the VM
You have successfully configured Oracle Automated Storage Management on the Oracle DB image from the Azure
Marketplace. When you no longer need this VM, you can use the following command to remove the resource
group, VM, and all related resources:

az group delete --name myResourceGroup

Next steps
Tutorial: Configure Oracle DataGuard
Tutorial: Configure Oracle GoldenGate
Review Architect an Oracle DB
Implement Oracle Data Guard on an Azure Linux
virtual machine
7/10/2017 • 9 min to read • Edit Online

Azure CLI is used to create and manage Azure resources from the command line or in scripts. This article describes
how to use Azure CLI to deploy an Oracle Database 12c database from the Azure Marketplace image. This article
then shows you, step by step, how to install and configure Data Guard on an Azure virtual machine (VM).
Before you start, make sure that Azure CLI is installed. For more information, see the Azure CLI installation guide.

Prepare the environment


Assumptions
To install Oracle Data Guard, you need to create two Azure VMs on the same availability set:
The primary VM (myVM1) has a running Oracle instance.
The standby VM (myVM2) has the Oracle software installed only.
The Marketplace image that you use to create the VMs is Oracle:Oracle-Database-Ee:12.1.0.2:latest.
Sign in to Azure
Sign in to your Azure subscription by using the az login command and follow the on-screen directions.

az login

Create a resource group


Create a resource group by using the az group create command. An Azure resource group is a logical container in
which Azure resources are deployed and managed.
The following example creates a resource group named myResourceGroup in the westus location:

az group create --name myResourceGroup --location westus

Create an availability set


Creating an availability set is optional, but we recommend it. For more information, see Azure availability sets
guidelines.

az vm availability-set create \
--resource-group myResourceGroup \
--name myAvailabilitySet \
--platform-fault-domain-count 2 \
--platform-update-domain-count 2

Create a virtual machine


Create a VM by using the az vm create command.
The following example creates two VMs named myVM1 and myVM2 . It also creates SSH keys, if they do not already
exist in a default key location. To use a specific set of keys, use the --ssh-key-value option.
Create myVM1 (primary):

az vm create \
--resource-group myResourceGroup \
--name myVM1 \
--availability-set myAvailabilitySet \
--image Oracle:Oracle-Database-Ee:12.1.0.2:latest \
--size Standard_DS1_v2 \
--admin-username azureuser \
--generate-ssh-keys \

After you create the VM, Azure CLI shows information similar to the following example. Note the value of
publicIpAddress . You use this address to access the VM.

{
"fqdns": "",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM",
"location": "westus",
"macAddress": "00-0D-3A-36-2F-56",
"powerState": "VM running",
"privateIpAddress": "10.0.0.4",
"publicIpAddress": "13.64.104.241",
"resourceGroup": "myResourceGroup"
}

Create myVM2 (standby):

az vm create \
--resource-group myResourceGroup \
--name myVM2 \
--availability-set myAvailabilitySet \
--image Oracle:Oracle-Database-Ee:12.1.0.2:latest \
--size Standard_DS1_v2 \
--admin-username azureuser \
--generate-ssh-keys \

Note the value of publicIpAddress after you create myVM2.


Open the TCP port for connectivity
This step configures external endpoints, which allow remote access to the Oracle database.
Open the port for myVM1:

az network nsg rule create --resource-group myResourceGroup\


--nsg-name myVM1NSG --name allow-oracle\
--protocol tcp --direction inbound --priority 999 \
--source-address-prefix '*' --source-port-range '*' \
--destination-address-prefix '*' --destination-port-range 1521 --access allow

The result should look similar to the following response:


{
"access": "Allow",
"description": null,
"destinationAddressPrefix": "*",
"destinationPortRange": "1521",
"direction": "Inbound",
"etag": "W/\"bd77dcae-e5fd-4bd6-a632-26045b646414\"",
"id": "/subscriptions/<subscription-
id>/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myVmNSG/securityRules/all
ow-oracle",
"name": "allow-oracle",
"priority": 999,
"protocol": "Tcp",
"provisioningState": "Succeeded",
"resourceGroup": "myResourceGroup",
"sourceAddressPrefix": "*",
"sourcePortRange": "*"
}

Open the port for myVM2:

az network nsg rule create --resource-group myResourceGroup\


--nsg-name myVM2NSG --name allow-oracle\
--protocol tcp --direction inbound --priority 999 \
--source-address-prefix '*' --source-port-range '*' \
--destination-address-prefix '*' --destination-port-range 1521 --access allow

Connect to the virtual machine


Use the following command to create an SSH session with the virtual machine. Replace the IP address with the
publicIpAddress value for your virtual machine.

$ ssh azureuser@<publicIpAddress>

Create the database on myVM1 (primary)


The Oracle software is already installed on the Marketplace image, so the next step is to install the database.
Switch to the Oracle superuser:

$ sudo su - oracle

Create the database:


$ dbca -silent \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbname cdb1 \
-sid cdb1 \
-responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword OraPasswd1 \
-systemPassword OraPasswd1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName pdb1 \
-pdbAdminPassword OraPasswd1 \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-storageType FS \
-ignorePreReqs

Outputs should look similar to the following response:

Copying database files


1% complete
2% complete
8% complete
13% complete
19% complete
27% complete
Creating and starting Oracle instance
29% complete
32% complete
33% complete
34% complete
38% complete
42% complete
43% complete
45% complete
Completing Database Creation
48% complete
51% complete
53% complete
62% complete
70% complete
72% complete
Creating Pluggable Databases
78% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb1/cdb1.log" for further details.

Set the ORACLE_SID and ORACLE_HOME variables:

$ ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1; export ORACLE_HOME


$ ORACLE_SID=cdb1; export ORACLE_SID

Optionally, you can add ORACLE_HOME and ORACLE_SID to the /home/oracle/.bashrc file, so that these settings
are saved for future logins:

# add oracle home


export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
# add oracle sid
export ORACLE_SID=cdb1
Configure Data Guard
Enable archive log mode on myVM1 (primary)

$ sqlplus / as sysdba
SQL> SELECT log_mode FROM v$database;

LOG_MODE
------------
NOARCHIVELOG

SQL> SHUTDOWN IMMEDIATE;


SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;

Enable force logging, and make sure at least one log file is present:

SQL> ALTER DATABASE FORCE LOGGING;


SQL> ALTER SYSTEM SWITCH LOGFILE;

Create standby redo logs:

SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/cdb1/standby_redo01.log') SIZE 50M;


SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/cdb1/standby_redo02.log') SIZE 50M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/cdb1/standby_redo03.log') SIZE 50M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/cdb1/standby_redo04.log') SIZE 50M;

Turn on Flashback (which makes recovery a lot easier) and set STANDBY_FILE_MANAGEMENT to auto. Exit
SQL*Plus after that.

SQL> ALTER DATABASE FLASHBACK ON;


SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
SQL> EXIT;

Set up service on myVM1 (primary)


Edit or create the tnsnames.ora file, which is in the $ORACLE_HOME\network\admin folder.
Add the following entries:
cdb1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myVM1)(PORT = 1521))
)
(CONNECT_DATA =
(SID = cdb1)
)
)

cdb1_stby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myVM2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = cdb1)
)
)

Edit or create the listener.ora file, which is in the $ORACLE_HOME\network\admin folder.


Add the following entries:

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myVM1)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = cdb1_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = cdb1)
)
)

ADR_BASE_LISTENER = /u01/app/oracle

Enable Data Guard Broker:

$ sqlplus / as sysdba
SQL> ALTER SYSTEM SET dg_broker_start=true;
SQL> EXIT;

Start the listener:

$ lsnrctl stop
$ lsnrctl start

Set up service on myVM2 (standby)


SSH to myVM2:

$ ssh azureuser@<publicIpAddress>
Log in as Oracle:

$ sudo su - oracle

Edit or create the tnsnames.ora file, which is in the $ORACLE_HOME\network\admin folder.


Add the following entries:

cdb1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myVM1)(PORT = 1521))
)
(CONNECT_DATA =
(SID = cdb1)
)
)

cdb1_stby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myVM2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = cdb1)
)
)

Edit or create the listener.ora file, which is in the $ORACLE_HOME\network\admin folder.


Add the following entries:

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myVM2)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = cdb1_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = cdb1)
)
)

ADR_BASE_LISTENER = /u01/app/oracle

Start the listener:

$ lsnrctl stop
$ lsnrctl start

Restore the database to myVM2 (standby)


Create the parameter file /tmp/initcdb1_stby.ora with the following contents:
*.db_name='cdb1'

Create folders:

mkdir -p /u01/app/oracle/oradata/cdb1/pdbseed
mkdir -p /u01/app/oracle/oradata/cdb1/pdb1
mkdir -p /u01/app/oracle/fast_recovery_area/cdb1
mkdir -p /u01/app/oracle/admin/cdb1/adump

Create a password file:

$ orapwd file=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwcdb1 password=OraPasswd1 entries=10

Start the database on myVM2:

$ export ORACLE_SID=cdb1
$ sqlplus / as sysdba

SQL> STARTUP NOMOUNT PFILE='/tmp/initcdb1_stby.ora';


SQL> EXIT;

Restore the database by using the RMAN tool:

$ rman TARGET sys/OraPasswd1@cdb1 AUXILIARY sys/OraPasswd1@cdb1_stby

Run the following commands in RMAN:

DUPLICATE TARGET DATABASE


FOR STANDBY
FROM ACTIVE DATABASE
DORECOVER
SPFILE
SET db_unique_name='CDB1_STBY' COMMENT 'Is standby'
NOFILENAMECHECK;

You should see messages similar to the following when the command is completed. Exit RMAN.

media recovery complete, elapsed time: 00:00:00


Finished recover at 29-JUN-17
Finished Duplicate Db at 29-JUN-17

RMAN> EXIT;

Optionally, you can add ORACLE_HOME and ORACLE_SID to the /home/oracle/.bashrc file, so that these settings
are saved for future logins:

# add oracle home


export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
# add oracle sid
export ORACLE_SID=cdb1

Enable Data Guard Broker:


$ sqlplus / as sysdba
SQL> ALTER SYSTEM SET dg_broker_start=true;
SQL> EXIT;

Configure Data Guard Broker on myVM1 (primary)


Start Data Guard Manager and log in by using SYS and a password. (Do not use OS authentication.) Perform the
following:

$ dgmgrl sys/OraPasswd1@cdb1
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.


Connected as SYSDBA.
DGMGRL> CREATE CONFIGURATION my_dg_config AS PRIMARY DATABASE IS cdb1 CONNECT IDENTIFIER IS cdb1;
Configuration "my_dg_config" created with primary database "cdb1"
DGMGRL> ADD DATABASE cdb1_stby AS CONNECT IDENTIFIER IS cdb1_stby MAINTAINED AS PHYSICAL;
Database "cdb1_stby" added
DGMGRL> ENABLE CONFIGURATION;
Enabled.

Review the configuration:

DGMGRL> SHOW CONFIGURATION;

Configuration - my_dg_config

Protection Mode: MaxPerformance


Members:
cdb1 - Primary database
cdb1_stby - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS (status updated 26 seconds ago)

You've completed the Oracle Data Guard setup. The next section shows you how to test the connectivity and
switch over.
Connect the database from the client machine
Update or create the tnsnames.ora file on your client machine. This file is usually in
$ORACLE_HOME\network\admin.
Replace the IP addresses with your publicIpAddress values for myVM1 and myVM2:
cdb1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=<myVM1 IP address>)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=cdb1)
)
)

cdb1_stby=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=<myVM2 IP address>)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=cdb1_stby)
)
)

Start SQL*Plus:

$ sqlplus sys/OraPasswd1@cdb1
SQL*Plus: Release 12.2.0.1.0 Production on Wed May 10 14:18:31 2017

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

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

SQL>

Test the Data Guard configuration


Switch over the database on myVM1 (primary)
To switch from primary to standby (cdb1 to cdb1_stby):
$ dgmgrl sys/OraPasswd1@cdb1
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.


Connected as SYSDBA.
DGMGRL> SWITCHOVER TO cdb1_stby;
Performing switchover NOW, please wait...
Operation requires a connection to instance "cdb1" on database "cdb1_stby"
Connecting to instance "cdb1"...
Connected as SYSDBA.
New primary database "cdb1_stby" is opening...
Operation requires start up of instance "cdb1" on database "cdb1"
Starting instance "cdb1"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "cdb1_stby"
DGMGRL>

You can now connect to the standby database.


Start SQL*Plus:

$ sqlplus sys/OraPasswd1@cdb1_stby
SQL*Plus: Release 12.2.0.1.0 Production on Wed May 10 14:18:31 2017

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

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

SQL>

Switch over the database on myVM2 (standby)


To switch over, run the following on myVM2:

$ dgmgrl sys/OraPasswd1@cdb1_stby
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.


Connected as SYSDBA.
DGMGRL> SWITCHOVER TO cdb1;
Performing switchover NOW, please wait...
Operation requires a connection to instance "cdb1" on database "cdb1"
Connecting to instance "cdb1"...
Connected as SYSDBA.
New primary database "cdb1" is opening...
Operation requires start up of instance "cdb1" on database "cdb1_stby"
Starting instance "cdb1"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "cdb1"

Once again, you should now be able to connect to the primary database.
Start SQL*Plus:
$ sqlplus sys/OraPasswd1@cdb1
SQL*Plus: Release 12.2.0.1.0 Production on Wed May 10 14:18:31 2017

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

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

SQL>

You've finished the installation and configuration of Data Guard on Oracle Linux.

Delete the virtual machine


When you no longer need the VM, you can use the following command to remove the resource group, VM, and all
related resources:

az group delete --name myResourceGroup

Next steps
Tutorial: Create highly available virtual machines
Explore VM deployment Azure CLI samples
Implement Oracle Golden Gate on an Azure Linux
VM
6/27/2017 • 12 min to read • Edit Online

The Azure CLI is used to create and manage Azure resources from the command line or in scripts. This guide
details how to use the Azure CLI to deploy an Oracle 12c database from the Azure Marketplace gallery image.
This document shows you step-by-step how to create, install, and configure Oracle Golden Gate on an Azure VM.
Before you start, make sure that the Azure CLI has been installed. For more information, see Azure CLI installation
guide.

Prepare the environment


To perform the Oracle Golden Gate installation, you need to create two Azure VMs on the same availability set. The
Marketplace image you use to create the VMs is Oracle:Oracle-Database-Ee:12.1.0.2:latest.
You also need to be familiar with Unix editor vi and have a basic understanding of x11 (X Windows).
The following is a summary of the environment configuration:

PRIMARY SITE REPLICATE SITE

Oracle release Oracle 12c Release 2 – (12.1.0.2) Oracle 12c Release 2 – (12.1.0.2)

Machine name myVM1 myVM2

Operating system Oracle Linux 6.x Oracle Linux 6.x

Oracle SID CDB1 CDB1

Replication schema TEST TEST

Golden Gate owner/replicate C##GGADMIN REPUSER

Golden Gate process EXTORA REPORA

Sign in to Azure
Sign in to your Azure subscription with the az login command. Then follow the on-screen directions.

az login

Create a resource group


Create a resource group with the az group create command. An Azure resource group is a logical container into
which Azure resources are deployed and from which they can be managed.
The following example creates a resource group named myResourceGroup in the westus location.
az group create --name myResourceGroup --location westus

Create an availability set


The following step is optional but recommended. For more information, see Azure availability sets guide.

az vm availability-set create \
--resource-group myResourceGroup \
--name myAvailabilitySet \
--platform-fault-domain-count 2 \
--platform-update-domain-count 2

Create a virtual machine


Create a VM with the az vm create command.
The following example creates two VMs named myVM1 and myVM2 . Create SSH keys if they do not already exist in
a default key location. To use a specific set of keys, use the --ssh-key-value option.
Create myVM1 (primary ):

az vm create \
--resource-group myResourceGroup \
--name myVM1 \
--availability-set myAvailabilitySet \
--image Oracle:Oracle-Database-Ee:12.1.0.2:latest \
--size Standard_DS1_v2 \
--generate-ssh-keys \

After the VM has been created, the Azure CLI shows information similar to the following example. (Take note of the
publicIpAddress . This address is used to access the VM.)

{
"fqdns": "",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM",
"location": "westus",
"macAddress": "00-0D-3A-36-2F-56",
"powerState": "VM running",
"privateIpAddress": "10.0.0.4",
"publicIpAddress": "13.64.104.241",
"resourceGroup": "myResourceGroup"
}

Create myVM2 (replicate):

az vm create \
--resource-group myResourceGroup \
--name myVM2 \
--availability-set myAvailabilitySet \
--image Oracle:Oracle-Database-Ee:12.1.0.2:latest \
--size Standard_DS1_v2 \
--generate-ssh-keys \

Take note of the publicIpAddress as well after it has been created.


Open the TCP port for connectivity
The next step is to configure external endpoints, which enable you to access the Oracle database remotely. To
configure the external endpoints, run the following commands.
Open the port for myVM1:

az network nsg rule create --resource-group myResourceGroup\


--nsg-name myVm1NSG --name allow-oracle\
--protocol tcp --direction inbound --priority 999 \
--source-address-prefix '*' --source-port-range '*' \
--destination-address-prefix '*' --destination-port-range 1521 --access allow

The results should look similar to the following response:

{
"access": "Allow",
"description": null,
"destinationAddressPrefix": "*",
"destinationPortRange": "1521",
"direction": "Inbound",
"etag": "W/\"bd77dcae-e5fd-4bd6-a632-26045b646414\"",
"id": "/subscriptions/<subscription-
id>/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myVmNSG/securityRules/all
ow-oracle",
"name": "allow-oracle",
"priority": 999,
"protocol": "Tcp",
"provisioningState": "Succeeded",
"resourceGroup": "myResourceGroup",
"sourceAddressPrefix": "*",
"sourcePortRange": "*"
}

Open the port for myVM2:

az network nsg rule create --resource-group myResourceGroup\


--nsg-name myVm2NSG --name allow-oracle\
--protocol tcp --direction inbound --priority 999 \
--source-address-prefix '*' --source-port-range '*' \
--destination-address-prefix '*' --destination-port-range 1521 --access allow

Connect to the virtual machine


Use the following command to create an SSH session with the virtual machine. Replace the IP address with the
publicIpAddress of your virtual machine.

ssh <publicIpAddress>

Create the database on myVM1 (primary)


The Oracle software is already installed on the Marketplace image, so the next step is to install the database.
Run the software as the 'oracle' superuser:

sudo su - oracle

Create the database:


$ dbca -silent \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbname cdb1 \
-sid cdb1 \
-responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword OraPasswd1 \
-systemPassword OraPasswd1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName pdb1 \
-pdbAdminPassword OraPasswd1 \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-storageType FS \
-ignorePreReqs

Outputs should look similar to the following response:

Copying database files


1% complete
2% complete
8% complete
13% complete
19% complete
27% complete
Creating and starting Oracle instance
29% complete
32% complete
33% complete
34% complete
38% complete
42% complete
43% complete
45% complete
Completing Database Creation
48% complete
51% complete
53% complete
62% complete
70% complete
72% complete
Creating Pluggable Databases
78% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb1/cdb1.log" for more details.

Set the ORACLE_SID and ORACLE_HOME variables.

$ ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1; export ORACLE_HOME


$ ORACLE_SID=gg1; export ORACLE_SID
$ LD_LIBRARY_PATH=ORACLE_HOME/lib; export LD_LIBRARY_PATH

Optionally, you can add ORACLE_HOME and ORACLE_SID to the .bashrc file, so that these settings are saved for
future sign-ins:
# add oracle home
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
# add oracle sid
export ORACLE_SID=gg1
# add Oracle library path
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Start Oracle listener

$ sudo su - oracle
$ lsnrctl start

Create the database on myVM2 (replicate )

sudo su - oracle

Create the database:

$ dbca -silent \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbname cdb1 \
-sid cdb1 \
-responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword OraPasswd1 \
-systemPassword OraPasswd1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName pdb1 \
-pdbAdminPassword OraPasswd1 \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-storageType FS \
-ignorePreReqs

Set the ORACLE_SID and ORACLE_HOME variables.

$ ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1; export ORACLE_HOME


$ ORACLE_SID=cdb1; export ORACLE_SID
$ LD_LIBRARY_PATH=ORACLE_HOME/lib; export LD_LIBRARY_PATH

Optionally, you can added ORACLE_HOME and ORACLE_SID to the .bashrc file, so that these settings are saved for
future sign-ins.

# add oracle home


export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
# add oracle sid
export ORACLE_SID=cdb1
# add Oracle library path
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Start Oracle listener

$ sudo su - oracle
$ lsnrctl start
Configure Golden Gate
To configure Golden Gate, take the steps in this section.
Enable archive log mode on myVM1 (primary)

$ sqlplus / as sysdba
SQL> SELECT log_mode FROM v$database;

LOG_MODE
------------
NOARCHIVELOG

SQL> SHUTDOWN IMMEDIATE;


SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;

Enable force logging, and make sure at least one log file is present.

SQL> ALTER DATABASE FORCE LOGGING;


SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> ALTER SYSTEM set enable_goldengate_replication=true;
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;
SQL> ALTER SESSION SET CONTAINER=PDB1;
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
SQL> EXIT;

Download Golden Gate software


To download and prepare the Oracle Golden Gate software, complete the following steps:
1. Download the fbo_ggs_Linux_x64_shiphome.zip file from the Oracle Golden Gate download page. Under
the download title Oracle GoldenGate 12.x.x.x for Oracle Linux x86-64, there should be a set of .zip files
to download.
2. After you download the .zip files to your client computer, use Secure Copy Protocol (SCP) to copy the files
to your VM:

$ scp fbo_ggs_Linux_x64_shiphome.zip <publicIpAddress>:<folder>

3. Move the .zip files to the /opt folder. Then change the owner of the files as follows:

$ sudo su -
# mv <folder>/*.zip /opt

4. Unzip the files (install the Linux unzip utility if it's not already installed):

# yum install unzip


# cd /opt
# unzip fbo_ggs_Linux_x64_shiphome.zip

5. Change permission:

# chown -R oracle:oinstall /opt/fbo_ggs_Linux_x64_shiphome


Prepare the client and VM to run x11 (for Windows clients only)
This is an optional step. You can skip this step if you are using a Linux client or already have x11 setup.
1. Download PuTTY and Xming to your Windows computer:
Download PuTTY
Download Xming
2. After you install PuTTY, in the PuTTY folder (for example, C:\Program Files\PuTTY), run puttygen.exe (PuTTY
Key Generator).
3. In PuTTY Key Generator:
To generate a key, select the Generate button.
Copy the contents of the key (Ctrl+C).
Select the Save private key button.
Ignore the warning that appears, and then select OK.

4. In your VM, run these commands:

# sudo su - oracle
$ mkdir .ssh (if not already created)
$ cd .ssh

5. Create a file named authorized_keys. Paste the contents of the key in this file, and then save the file.

NOTE
The key must contain the string ssh-rsa . Also, the contents of the key must be a single line of text.

6. Start PuTTY. In the Category pane, select Connection > SSH > Auth. In the Private key file for
authentication box, browse to the key that you generated earlier.
7. In the Category pane, select Connection > SSH > X11. Then select the Enable X11 forwarding box.

8. In the Category pane, go to Session. Enter the host information, and then select Open.
Install Golden Gate software
To install Oracle Golden Gate, complete the following steps:
1. Sign in as oracle. (You should be able to sign in without being prompted for a password.) Make sure that
Xming is running before you begin the installation.

$ cd /opt/fbo_ggs_Linux_x64_shiphome/Disk1
$ ./runInstaller

2. Select 'Oracle GoldenGate for Oracle Database 12c'. Then select Next to continue.
3. Change the software location. Then select the Start Manager box and enter the database location. Select
Next to continue.

4. Change the inventory directory, and then select Next to continue.


5. On the Summary screen, select Install to continue.

6. You might be prompted to run a script as 'root'. If so, open a separate session, ssh to the VM, sudo to root,
and then run the script. Select OK continue.

7. When the installation has finished, select Close to complete the process.
Set up service on myVM1 (primary)
1. Create or update the tnsnames.ora file:

$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora

cdb1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=localhost)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=cdb1)
)
)

pdb1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=localhost)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=pdb1)
)
)

2. Create the Golden Gate owner and user accounts.


NOTE
The owner account must have C## prefix.

$ sqlplus / as sysdba
SQL> CREATE USER C##GGADMIN identified by ggadmin;
SQL> EXEC dbms_goldengate_auth.grant_admin_privilege('C##GGADMIN',container=>'ALL');
SQL> GRANT DBA to C##GGADMIN container=all;
SQL> connect C##GGADMIN/ggadmin
SQL> ALTER SESSION SET CONTAINER=PDB1;
SQL> EXIT;

3. Create the Golden Gate test user account:

$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ sqlplus system/OraPasswd1@pdb1
SQL> CREATE USER test identified by test DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
SQL> GRANT connect, resource, dba TO test;
SQL> ALTER USER test QUOTA 100M on USERS;
SQL> connect test/test@pdb1
SQL> @demo_ora_create
SQL> @demo_ora_insert
SQL> EXIT;

4. Configure the extract parameter file.


Start the Golden gate command-line interface (ggsci):

$ sudo su - oracle
$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ ./ggsci
GGSCI> DBLOGIN USERID test@pdb1, PASSWORD test
Successfully logged into database pdb1
GGSCI> ADD SCHEMATRANDATA pdb1.test
2017-05-23 15:44:25 INFO OGG-01788 SCHEMATRANDATA has been added on schema test.
2017-05-23 15:44:25 INFO OGG-01976 SCHEMATRANDATA for scheduling columns has been added on schema
test.

GGSCI> EDIT PARAMS EXTORA

5. Add the following to the EXTRACT parameter file (by using vi commands). Press Esc key, ':wq!' to save file.

EXTRACT EXTORA
USERID C##GGADMIN, PASSWORD ggadmin
RMTHOST 10.0.0.5, MGRPORT 7809
RMTTRAIL ./dirdat/rt
DDL INCLUDE MAPPED
DDLOPTIONS REPORT
LOGALLSUPCOLS
UPDATERECORDFORMAT COMPACT
TABLE pdb1.test.TCUSTMER;
TABLE pdb1.test.TCUSTORD;

6. Register extract--integrated extract:


$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ ./ggsci

GGSCI> dblogin userid C##GGADMIN, password ggadmin


Successfully logged into database CDB$ROOT.

GGSCI> REGISTER EXTRACT EXTORA DATABASE CONTAINER(pdb1)

2017-05-23 15:58:34 INFO OGG-02003 Extract EXTORA successfully registered with database at SCN
1821260.

GGSCI> exit

7. Set up extract checkpoints and start real-time extract:

$ ./ggsci
GGSCI> ADD EXTRACT EXTORA, INTEGRATED TRANLOG, BEGIN NOW
EXTRACT (Integrated) added.

GGSCI> ADD RMTTRAIL ./dirdat/rt, EXTRACT EXTORA, MEGABYTES 10


RMTTRAIL added.

GGSCI> START EXTRACT EXTORA

Sending START request to MANAGER ...


EXTRACT EXTORA starting

GGSCI > info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT RUNNING EXTORA 00:00:11 00:00:04

In this step, you find the starting SCN, which will be used later, in a different section:

$ sqlplus / as sysdba
SQL> alter session set container = pdb1;
SQL> SELECT current_scn from v$database;
CURRENT_SCN
-----------
1857887
SQL> EXIT;

$ ./ggsci
GGSCI> EDIT PARAMS INITEXT

EXTRACT INITEXT
USERID C##GGADMIN, PASSWORD ggadmin
RMTHOST 10.0.0.5, MGRPORT 7809
RMTTASK REPLICAT, GROUP INITREP
TABLE pdb1.test.*, SQLPREDICATE 'AS OF SCN 1857887';

GGSCI> ADD EXTRACT INITEXT, SOURCEISTABLE

Set up service on myVM2 (replicate )


1. Create or update the tnsnames.ora file:
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora

cdb1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=localhost)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=cdb1)
)
)

pdb1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=localhost)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=pdb1)
)
)

2. Create a replicate account:

$ sqlplus / as sysdba
SQL> alter session set container = pdb1;
SQL> create user repuser identified by rep_pass container=current;
SQL> grant dba to repuser;
SQL> exec dbms_goldengate_auth.grant_admin_privilege('REPUSER',container=>'PDB1');
SQL> connect repuser/rep_pass@pdb1
SQL> EXIT;

3. Create a Golden Gate test user account:

$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ sqlplus system/OraPasswd1@pdb1
SQL> CREATE USER test identified by test DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
SQL> GRANT connect, resource, dba TO test;
SQL> ALTER USER test QUOTA 100M on USERS;
SQL> connect test/test@pdb1
SQL> @demo_ora_create
SQL> EXIT;

4. REPLICAT parameter file to replicate changes:

$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ ./ggsci
GGSCI> EDIT PARAMS REPORA

Content of REPORA parameter file:


REPLICAT REPORA
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/repora.dsc, PURGE, MEGABYTES 100
DDL INCLUDE MAPPED
DDLOPTIONS REPORT
DBOPTIONS INTEGRATEDPARAMS(parallelism 6)
USERID repuser@pdb1, PASSWORD rep_pass
MAP pdb1.test.*, TARGET pdb1.test.*;

5. Set up a replicat checkpoint:

GGSCI> ADD REPLICAT REPORA, INTEGRATED, EXTTRAIL ./dirdat/rt


GGSCI> EDIT PARAMS INITREP

REPLICAT INITREP
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/tcustmer.dsc, APPEND
USERID repuser@pdb1, PASSWORD rep_pass
MAP pdb1.test.*, TARGET pdb1.test.*;

GGSCI> ADD REPLICAT INITREP, SPECIALRUN

Set up the replication (myVM1 and myVM2)


1. Set up the replication on myVM2 (replicate)

$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ ./ggsci
GGSCI> EDIT PARAMS MGR

Update the file with the following:

PORT 7809
ACCESSRULE, PROG *, IPADDR *, ALLOW

Then restart the Manager service:

GGSCI> STOP MGR


GGSCI> START MGR
GGSCI> EXIT

2. Set up the replication on myVM1 (primary )


Start the initial load and check for errors:

$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ ./ggsci
GGSCI> START EXTRACT INITEXT
GGSCI> VIEW REPORT INITEXT

3. Set up the replication on myVM2 (replicate)


Change the SCN number with the number you obtained before:
$ cd /u01/app/oracle/product/12.1.0/oggcore_1
$ ./ggsci
START REPLICAT REPORA, AFTERCSN 1857887

The replication has begun, and you can test it by inserting new records to TEST tables.
View job status and troubleshooting
View reports
To view reports on myVM1, run the following commands:

GGSCI> VIEW REPORT EXTORA

To view reports on myVM2, run the following commands:

GGSCI> VIEW REPORT REPORA

View status and history


To view status and history on myVM1, run the following commands:

GGSCI> dblogin userid c##ggadmin, password ggadmin


GGSCI> INFO EXTRACT EXTORA, DETAIL

To view status and history on myVM2, run the following commands:

GGSCI> dblogin userid repuser@pdb1 password rep_pass


GGSCI> INFO REP REPORA, DETAIL

This completes the installation and configuration of Golden Gate on Oracle linux.

Delete the virtual machine


When it's no longer needed, the following command can be used to remove the resource group, VM, and all
related resources.

az group delete --name myResourceGroup

Next steps
Create highly available virtual machines tutorial
Explore VM deployment CLI samples
Design and implement an Oracle database in Azure
10/17/2017 • 8 min to read • Edit Online

Assumptions
You're planning to migrate an Oracle database from on-premises to Azure.
You have an understanding of the various metrics in Oracle AWR reports.
You have a baseline understanding of application performance and platform utilization.

Goals
Understand how to optimize your Oracle deployment in Azure.
Explore performance tuning options for an Oracle database in an Azure environment.

The differences between an on-premises and Azure implementation


Following are some important things to keep in mind when you're migrating on-premises applications to Azure.
One important difference is that in an Azure implementation, resources such as VMs, disks, and virtual networks
are shared among other clients. In addition, resources can be throttled based on the requirements. Instead of
focusing on avoiding failing (MTBF), Azure is more focused on surviving the failure (MTTR).
The following table lists some of the differences between an on-premises implementation and an Azure
implementation of an Oracle database.

ON-PREMISES IMPLEMENTATION AZURE IMPLEMENTATION

Networking LAN/WAN SDN (software-defined networking)

Security group IP/port restriction tools Network Security Group (NSG)

Resilience MTBF (mean time between failures) MTTR (mean time to recovery)

Planned maintenance Patching/upgrades Availability sets (patching/upgrades


managed by Azure)

Resource Dedicated Shared with other clients

Regions Datacenters Region pairs

Storage SAN/physical disks Azure-managed storage

Scale Vertical scale Horizontal scale

Requirements
Determine the database size and growth rate.
Determine the IOPS requirements, which you can estimate based on Oracle AWR reports or other network
monitoring tools.
Configuration options
There are four potential areas that you can tune to improve performance in an Azure environment:
Virtual machine size
Network throughput
Disk types and configurations
Disk cache settings
Generate an AWR report
If you have an existing an Oracle database and are planning to migrate to Azure, you have several options. You can
run the Oracle AWR report to get the metrics (IOPS, Mbps, GiBs, and so on). Then choose the VM based on the
metrics that you collected. Or you can contact your infrastructure team to get similar information.
You might consider running your AWR report during both regular and peak workloads, so you can compare. Based
on these reports, you can size the VMs based on either the average workload or the maximum workload.
Following is an example of how to generate an AWR report:

$ sqlplus / as sysdba
SQL> EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT;
SQL> @?/rdbms/admin/awrrpt.sql

Key metrics
Following are the metrics that you can obtain from the AWR report:
Total number of cores
CPU clock speed
Total memory in GB
CPU utilization
Peak data transfer rate
Rate of I/O changes (read/write)
Redo log rate (MBPs)
Network throughput
Network latency rate (low/high)
Database size in GB
Bytes received via SQL*Net from/to client
Virtual machine size
1. Estimate VM size based on CPU, memory, and I/O usage from the AWR report
One thing you might look at is the top five timed foreground events that indicate where the system bottlenecks
are.
For example, in the following diagram, the log file sync is at the top. It indicates the number of waits that are
required before the LGWR writes the log buffer to the redo log file. These results indicate that better performing
storage or disks are required. In addition, the diagram also shows the number of CPU (cores) and the amount of
memory.
The following diagram shows the total I/O of read and write. There were 59 GB read and 247.3 GB written during
the time of the report.

2. Choose a VM
Based on the information that you collected from the AWR report, the next step is to choose a VM of a similar size
that meets your requirements. You can find a list of available VMs in the article Memory optimized.
3. Fine-tune the VM sizing with a similar VM series based on the ACU
After you've chosen the VM, pay attention to the ACU for the VM. You might choose a different VM based on the
ACU value that better suits your requirements. For more information, see Azure compute unit.
Network throughput
The following diagram shows the relation between throughput and IOPS:

The total network throughput is estimated based on the following information:


SQL*Net traffic
MBps x number of servers (outbound stream such as Oracle Data Guard)
Other factors, such as application replication

Based on your network bandwidth requirements, there are various gateway types for you to choose from. These
include basic, VpnGw, and Azure ExpressRoute. For more information, see the VPN gateway pricing page.
Recommendations
Network latency is higher compared to an on-premises deployment. Reducing network round trips can greatly
improve performance.
To reduce round-trips, consolidate applications that have high transactions or “chatty” apps on the same virtual
machine.
Disk types and configurations
Default OS disks: These disk types offer persistent data and caching. They are optimized for OS access at
startup, and aren't designed for either transactional or data warehouse (analytical) workloads.
Unmanaged disks: With these disk types, you manage the storage accounts that store the virtual hard disk
(VHD) files that correspond to your VM disks. VHD files are stored as page blobs in Azure storage accounts.
Managed disks: Azure manages the storage accounts that you use for your VM disks. You specify the disk
type (premium or standard) and the size of the disk that you need. Azure creates and manages the disk for
you.
Premium storage disks: These disk types are best suited for production workloads. Premium storage
supports VM disks that can be attached to specific size-series VMs, such as DS, DSv2, GS, and F series VMs.
The premium disk comes with different sizes, and you can choose between disks ranging from 32 GB to
4,096 GB. Each disk size has its own performance specifications. Depending on your application
requirements, you can attach one or more disks to your VM.
When you create a new managed disk from the portal, you can choose the Account type for the type of disk you
want to use. Keep in mind that not all available disks are shown in the drop-down menu. After you choose a
particular VM size, the menu shows only the available premium storage SKUs that are based on that VM size.

For more information, see High-performance Premium Storage and managed disks for VMs.
After you configure your storage on a VM, you might want to load test the disks before creating a database.
Knowing the I/O rate in terms of both latency and throughput can help you determine if the VMs support the
expected throughput with latency targets.
There are a number of tools for application load testing, such as Oracle Orion, Sysbench, and Fio.
Run the load test again after you've deployed an Oracle database. Start your regular and peak workloads, and the
results show you the baseline of your environment.
It might be more important to size the storage based on the IOPS rate rather than the storage size. For example, if
the required IOPS is 5,000, but you only need 200 GB, you might still get the P30 class premium disk even though
it comes with more than 200 GB of storage.
The IOPS rate can be obtained from the AWR report. It's determined by the redo log, physical reads, and writes
rate.
For example, the redo size is 12,200,000 bytes per second, which is equal to 11.63 MBPs. The IOPS is 12,200,000 /
2,358 = 5,174.
After you have a clear picture of the I/O requirements, you can choose a combination of drives that are best suited
to meet those requirements.
Recommendations
For data tablespace, spread the I/O workload across a number of disks by using managed storage or Oracle
ASM.
As the I/O block size increases for read-intensive and write-intensive operations, add more data disks.
Increase the block size for large sequential processes.
Use data compression to reduce I/O (for both data and indexes).
Separate redo logs, system, and temps, and undo TS on separate data disks.
Don't put any application files on default OS disks (/dev/sda). These disks aren't optimized for fast VM boot
times, and they might not provide good performance for your application.
Disk cache settings
There are three options for host caching:
Read-only: All requests are cached for future reads. All writes are persisted directly to Azure Blob storage.
Read-write: This is a “read-ahead” algorithm. The reads and writes are cached for future reads. Non-write-
through writes are persisted to the local cache first. For SQL Server, writes are persisted to Azure Storage
because it uses write-through. It also provides the lowest disk latency for light workloads.
None (disabled): By using this option, you can bypass the cache. All the data is transferred to disk and
persisted to Azure Storage. This method gives you the highest I/O rate for I/O intensive workloads. You also
need to take “transaction cost” into consideration.
Recommendations
To maximize the throughput, we recommend that you start with None for host caching. For Premium Storage,
keep in mind that you must disable the "barriers" when you mount the file system with the ReadOnly or None
options. Update the /etc/fstab file with the UUID to the disks.
For more information, see Premium Storage for Linux VMs.
For OS disks, use default Read/Write caching.
For SYSTEM, TEMP, and UNDO use None for caching.
For DATA, use None for caching. But if your database is read-only or read-intensive, use Read-only caching.
After your data disk setting is saved, you can't change the host cache setting unless you unmount the drive at the
OS level and then remount it after you've made the change.

Security
After you have set up and configured your Azure environment, the next step is to secure your network. Here are
some recommendations:
NSG policy: NSG can be defined by a subnet or NIC. It's simpler to control access at the subnet level both for
security and force routing for things like application firewalls.
Jumpbox: For more secure access, administrators should not directly connect to the application service or
database. A jumpbox is used as a media between the administrator machine and Azure resources.

The administrator machine should offer IP-restricted access to the jumpbox only. The jumpbox should have
access to the application and database.
Private network (subnets): We recommend that you have the application service and database on separate
subnets, so better control can be set by NSG policy.

Additional reading
Configure Oracle ASM
Configure Oracle Data Guard
Configure Oracle Golden Gate
Oracle backup and recovery

Next steps
Tutorial: Create highly available VMs
Explore VM deployment Azure CLI samples
Back up and recover an Oracle Database 12c
database on an Azure Linux virtual machine
7/6/2017 • 10 min to read • Edit Online

You can use Azure CLI to create and manage Azure resources at a command prompt, or use scripts. In this article,
we use Azure CLI scripts to deploy an Oracle Database 12c database from an Azure Marketplace gallery image.
Before you begin, make sure that Azure CLI is installed. For more information, see the Azure CLI installation guide.

Prepare the environment


Step 1: Prerequisites
To perform the backup and recovery process, you must first create a Linux VM that has an installed instance
of Oracle Database 12c. The Marketplace image you use to create the VM is named Oracle:Oracle-
Database-Ee:12.1.0.2:latest.
To learn how to create an Oracle database, see the Oracle create database quickstart.
Step 2: Connect to the VM
To create a Secure Shell (SSH) session with the VM, use the following command. Replace the IP address and
the host name combination with the publicIpAddress value for your VM.

ssh <publicIpAddress>

Step 3: Prepare the database


1. This step assumes that you have an Oracle instance (cdb1) that is running on a VM named myVM.
Run the oracle superuser root, and then initialize the listener:
$ sudo su - oracle
$ lsnrctl start
Copyright (c) 1991, 2014, Oracle. All rights reserved.

Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production


Log messages written to /u01/app/oracle/diag/tnslsnr/myVM/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)
(HOST=myVM.twltkue3xvsujaz1bvlrhfuiwf.dx.internal.cloudapp.net)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 23-MAR-2017 15:32:08
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/myVM/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myVM.twltkue3xvsujaz1bvlrhfuiwf.dx.internal.cloudapp.net)
(PORT=1521)))
The listener supports no services
The command completed successfully

2. (Optional) Make sure the database is in archive log mode:

$ sqlplus / as sysdba
SQL> SELECT log_mode FROM v$database;

LOG_MODE
------------
NOARCHIVELOG

SQL> SHUTDOWN IMMEDIATE;


SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;
SQL> ALTER SYSTEM SWITCH LOGFILE;

3. (Optional) Create a table to test the commit:

SQL> alter session set "_ORACLE_SCRIPT"=true ;


Session altered.
SQL> create user scott identified by tiger;
User created.
SQL> grant create session to scott;
Grant succeeded.
SQL> grant create table to scott;
Grant succeeded.
SQL> alter user scott quota 100M on users;
User altered.
SQL> connect scott/tiger
SQL> create table scott_table(col1 number, col2 varchar2(50));
Table created.
SQL> insert into scott_Table VALUES(1,'Line 1');
1 row created.
SQL> commit;
Commit complete.
4. Verify or change the backup file location and size:

$ sqlplus / as sysdba
SQL> show parameter db_recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size big integer 4560M

5. Use Oracle Recovery Manager (RMAN) to back up the database:

$ rman target /
RMAN> backup database plus archivelog;

Step 4: Application-consistent backup for Linux VMs


Application-consistent backups is a new feature in Azure Backup. You can create and select scripts to execute
before and after the VM snapshot (pre-snapshot and post-snapshot).
1. Download the JSON file.
Download VMSnapshotScriptPluginConfig.json from
https://github.com/MicrosoftAzureBackup/VMSnapshotPluginConfig. The file contents look similar to the
following:

{
"pluginName" : "ScriptRunner",
"preScriptLocation" : "",
"postScriptLocation" : "",
"preScriptParams" : ["", ""],
"postScriptParams" : ["", ""],
"preScriptNoOfRetries" : 0,
"postScriptNoOfRetries" : 0,
"timeoutInSeconds" : 30,
"continueBackupOnFailure" : true,
"fsFreezeEnabled" : true
}

2. Create the /etc/azure folder on the VM:

$ sudo su -
# mkdir /etc/azure
# cd /etc/azure

3. Copy the JSON file.


Copy VMSnapshotScriptPluginConfig.json to the /etc/azure folder.
4. Edit the JSON file.
Edit the VMSnapshotScriptPluginConfig.json file to include the PreScriptLocation and PostScriptlocation
parameters. For example:
{
"pluginName" : "ScriptRunner",
"preScriptLocation" : "/etc/azure/pre_script.sh",
"postScriptLocation" : "/etc/azure/post_script.sh",
"preScriptParams" : ["", ""],
"postScriptParams" : ["", ""],
"preScriptNoOfRetries" : 0,
"postScriptNoOfRetries" : 0,
"timeoutInSeconds" : 30,
"continueBackupOnFailure" : true,
"fsFreezeEnabled" : true
}

5. Create the pre-snapshot and post-snapshot script files.


Here's an example of pre-snapshot and post-snapshot scripts for a "cold backup" (an offline backup, with
shutdown and restart):
For /etc/azure/pre_script.sh:

v_date=`date +%Y%m%d%H%M`
ORA_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORA_OWNER=oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" > /etc/azure/pre_script_$v_date.log

For /etc/azure/post_script.sh:

v_date=`date +%Y%m%d%H%M`
ORA_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORA_OWNER=oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" > /etc/azure/post_script_$v_date.log

Here's an example of pre-snapshot and post-snapshot scripts for a "hot backup" (an online backup):

v_date=`date +%Y%m%d%H%M`
ORA_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORA_OWNER=oracle
su - $ORA_OWNER -c "sqlplus / as sysdba @/etc/azure/pre_script.sql" > /etc/azure/pre_script_$v_date.log

For /etc/azure/post_script.sh:

v_date=`date +%Y%m%d%H%M`
ORA_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORA_OWNER=oracle
su - $ORA_OWNER -c "sqlplus / as sysdba @/etc/azure/post_script.sql" >
/etc/azure/pre_script_$v_date.log

For /etc/azure/pre_script.sql, modify the contents of the file per your requirements:

alter tablespace SYSTEM begin backup;


...
...
alter system switch logfile;
alter system archive log stop;

For /etc/azure/post_script.sql, modify the contents of the file per your requirements:
alter tablespace SYSTEM end backup;
...
...
alter system archive log start;

6. Change file permissions:

# chmod 600 /etc/azure/VMSnapshotScriptPluginConfig.json


# chmod 700 /etc/azure/pre_script.sh
# chmod 700 /etc/azure/post_script.sh

7. Test the scripts.


To test the scripts, first, sign in as root. Then, ensure that there are no errors:

# /etc/azure/pre_script.sh
# /etc/azure/post_script.sh

For more information, see Application-consistent backup for Linux VMs.


Step 5: Use Azure Recovery Services vaults to back up the VM
1. In the Azure portal, search for Recovery Services vaults.

2. On the Recovery Services vaults blade, to add a new vault, click Add.
3. To continue, click myVault.

4. On the myVault blade, click Backup.


5. On the Backup Goal blade, use the default values of Azure and Virtual machine. Click OK.
6. For Backup policy, use DefaultPolicy, or select Create New policy. Click OK.
7. On the Select virtual machines blade, select the myVM1 check box, and then click OK. Click the Enable
backup button.
IMPORTANT
After you click Enable backup, the backup process doesn't start until the scheduled time expires. To set up an
immediate backup, complete the next step.

8. On the myVault - Backup items blade, under BACKUP ITEM COUNT, select the backup item count.
9. On the Backup Items (Azure Virtual Machine) blade, on the right side of the page, click the ellipsis (...)
button, and then click Backup now.

10. Click the Backup button. Wait for the backup process to finish. Then, go to Step 6: Remove the database
files.
To view the status of the backup job, click Jobs.
The status of the backup job appears in the following image:

11. For an application-consistent backup, address any errors in the log file. The log file is located at
/var/log/azure/Microsoft.Azure.RecoveryServices.VMSnapshotLinux/1.0.9114.0.
Step 6: Remove the database files
Later in this article, you'll learn how to test the recovery process. Before you can test the recovery process, you
have to remove the database files.
1. Remove the tablespace and backup files:

$ sudo su - oracle
$ cd /u01/app/oracle/oradata/cdb1
$ rm -f *.dbf
$ cd /u01/app/oracle/fast_recovery_area/CDB1/backupset
$ rm -rf *

2. (Optional) Shut down the Oracle instance:

$ sqlplus / as sysdba
SQL> shutdown abort
ORACLE instance shut down.

Restore the deleted files from the Recovery Services vaults


To restore the deleted files, complete the following steps:
1. In the Azure portal, search for the myVault Recovery Services vaults item. On the Overview blade, under
Backup items, select the number of items.

2. Under BACKUP ITEM COUNT, select the number of items.


3. On the myvm1 blade, click File Recovery (Preview).

4. On the File Recovery (Preview) pane, click Download Script. Then, save the download (.sh) file to a
folder on the client computer.
5. Copy the .sh file to the VM.
The following example shows how you to use a secure copy (scp) command to move the file to the VM. You
also can copy the contents to the clipboard, and then paste the contents in a new file that is set up on the
VM.

IMPORTANT
In the following example, ensure that you update the IP address and folder values. The values must map to the
folder where the file is saved.

$ scp Linux_myvm1_xx-xx-2017 xx-xx-xx PM.sh <publicIpAddress>:/<folder>

6. Change the file, so that it's owned by the root.


In the following example, change the file so that it's owned by the root. Then, change permissions.

$ ssh <publicIpAddress>
$ sudo su -
# chown root:root /<folder>/Linux_myvm1_xx-xx-2017 xx-xx-xx PM.sh
# chmod 755 /<folder>/Linux_myvm1_xx-xx-2017 xx-xx-xx PM.sh
# /<folder>/Linux_myvm1_xx-xx-2017 xx-xx-xx PM.sh

The following example shows what you should see after you run the preceding script. When you're
prompted to continue, enter Y.
Microsoft Azure VM Backup - File Recovery
______________________________________________
The script requires 'open-iscsi' and 'lshw' to run.
Do you want us to install 'open-iscsi' and 'lshw' on this machine?
Please press 'Y' to continue with installation, 'N' to abort the operation. : Y
Installing 'open-iscsi'....
Installing 'lshw'....

Connecting to recovery point using ISCSI service...

Connection succeeded!

Please wait while we attach volumes of the recovery point to this machine...

************ Volumes of the recovery point and their mount paths on this machine ************

Sr.No. | Disk | Volume | MountPath

1) | /dev/sde | /dev/sde1 | /root/myVM-20170517093913/Volume1

2) | /dev/sde | /dev/sde2 | /root/myVM-20170517093913/Volume2

************ Open File Explorer to browse for files. ************

After recovery, to remove the disks and close the connection to the recovery point, please click
'Unmount Disks' in step 3 of the portal.

Please enter 'q/Q' to exit...

7. Access to the mounted volumes is confirmed.


To exit, enter q, and then search for the mounted volumes. To create a list of the added volumes, at a
command prompt, enter df -k.

8. Use the following script to copy the missing files back to the folders:
# cd /root/myVM-2017XXXXXXX/Volume2/u01/app/oracle/fast_recovery_area/CDB1/backupset/2017_xx_xx
# cp *.bkp /u01/app/oracle/fast_recovery_area/CDB1/backupset/2017_xx_xx
# cd /u01/app/oracle/fast_recovery_area/CDB1/backupset/2017_xx_xx
# chown oracle:oinstall *.bkp
# cd /root/myVM-2017XXXXXXX/Volume2/u01/app/oracle/oradata/cdb1
# cp *.dbf /u01/app/oracle/oradata/cdb1
# cd /u01/app/oracle/oradata/cdb1
# chown oracle:oinstall *.dbf

9. In the following script, use RMAN to recover the database:

# sudo su - oracle
$ rman target /
RMAN> startup mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;
RMAN> SELECT * FROM scott.scott_table;

10. Unmount the disk.


In the Azure portal, on the File Recovery (Preview) blade, click Unmount Disks.

Restore the entire VM


Instead of restoring the deleted files from the Recovery Services vaults, you can restore the entire VM.
Step 1: Delete myVM
In the Azure portal, go to the myVM1 vault, and then select Delete.
Step 2: Recover the VM
1. Go to Recovery Services vaults, and then select myVault.

2. On the Overview blade, under Backup items, select the number of items.
3. On the Backup Items (Azure Virtual Machine) blade, select myvm1.

4. On the myvm1 blade, click the ellipsis (...) button, and then click Restore VM.
5. On the Select restore point blade, select the item that you want to restore, and then click OK.

If you have enabled application-consistent backup, a vertical blue bar appears.


6. On the Restore configuration blade, select the virtual machine name, select the resource group, and then
click OK.
7. To restore the VM, click the Restore button.
8. To view the status of the restore process, click Jobs, and then click Backup Jobs.

The following figure shows the status of the restore process:


Step 3: Set the public IP address
After the VM is restored, set up the public IP address.
1. In the search box, enter public IP address.

2. On the Public IP addresses blade, click Add. On the Create public IP address blade, for Name, select the
public IP name. For Resource group, select Use existing. Then, click Create.

3. To associate the public IP address with the network interface for the VM, search for and select myVMip.
Then, click Associate.

4. For Resource type, select Network interface. Select the network interface that is used by the myVM
instance, and then click OK.
5. Search for and open the instance of myVM that is ported from the portal. The IP address that is associated
with the VM appears on the myVM Overview blade.

Step 4: Connect to the VM


To connect to the VM, use the following script:
ssh <publicIpAddress>

Step 5: Test whether the database is accessible


To test accessibility, use the following script:

$ sudo su - oracle
$ sqlplus / as sysdba
SQL> startup

IMPORTANT
If the database startup command generates an error, to recover the database, see Step 6: Use RMAN to recover the
database.

Step 6: (Optional) Use RMAN to recover the database


To recover the database, use the following script:

# sudo su - oracle
$ rman target /
RMAN> startup mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;
RMAN> SELECT * FROM scott.scott_table;

The backup and recovery of the Oracle Database 12c database on an Azure Linux VM is now finished.

Delete the VM
When you no longer need the VM, you can use the following command to remove the resource group, the VM,
and all related resources:

az group delete --name myResourceGroup

Next steps
Tutorial: Create highly available VMs
Explore VM deployment Azure CLI samples
Disaster recovery for an Oracle Database 12c
database in an Azure environment
12/7/2017 • 2 min to read • Edit Online

Assumptions
You have an understanding of Oracle Data Guard design and Azure environments.

Goals
Design the topology and configuration that meet your disaster recovery (DR) requirements.

Scenario 1: Primary and DR sites on Azure


A customer has an Oracle database set up on the primary site. A DR site is in a different region. The customer uses
Oracle Data Guard for quick recovery between these sites. The primary site also has a secondary database for
reporting and other uses.
Topology
Here is a summary of the Azure setup:
Two sites (a primary site and a DR site)
Two virtual networks
Two Oracle databases with Data Guard (primary and standby)
Two Oracle databases with Golden Gate or Data Guard (primary site only)
Two application services, one primary and one on the DR site
An availability set, which is used for database and application service on the primary site
One jumpbox on each site, which restricts access to the private network and only allows sign-in by an
administrator
A jumpbox, application service, database, and VPN gateway on separate subnets
NSG enforced on application and database subnets
Scenario 2: Primary site on-premises and DR site on Azure
A customer has an on-premises Oracle database setup (primary site). A DR site is on Azure. Oracle Data Guard is
used for quick recovery between these sites. The primary site also has a secondary database for reporting and other
uses.
There are two approaches for this setup.
Approach 1: Direct connections between on-premises and Azure, requiring open TCP ports on the firewall
We don't recommend direct connections because they expose the TCP ports to the outside world.
Topology
Following is a summary of the Azure setup:
One DR site
One virtual network
One Oracle database with Data Guard (active)
One application service on the DR site
One jumpbox, which restricts access to the private network and only allows sign-in by an administrator
A jumpbox, application service, database, and VPN gateway on separate subnets
NSG enforced on application and database subnets
An NSG policy/rule to allow inbound TCP port 1521 (or a user-defined port)
An NSG policy/rule to restrict only the IP address/addresses on-premises (DB or application) to access the
virtual network
Approach 2: Site -to -site VPN
Site-to-site VPN is a better approach. For more information about setting up a VPN, see Create a virtual network
with a Site-to-Site VPN connection using CLI.
Topology
Following is a summary of the Azure setup:
One DR site
One virtual network
One Oracle database with Data Guard (active)
One application service on the DR site
One jumpbox, which restricts access to the private network and only allows sign-in by an administrator
A jumpbox, application service, database, and VPN gateway are on separate subnets
NSG enforced on application and database subnets
Site-to-site VPN connection between on-premises and Azure
Additional reading
Design and implement an Oracle database on Azure
Configure Oracle Data Guard
Configure Oracle Golden Gate
Oracle backup and recovery

Next steps
Tutorial: Create highly available VMs
Explore VM deployment Azure CLI samples

You might also like