Skip to main content
NetApp Solutions

Step-by-Step Oracle deployment procedures on Azure VM and Azure NetApp Files

Contributors acao8888 banum-netapp

Deploy an Azure VM with ANF for Oracle via Azure portal console

If you are new to Azure, you first need to set up an Azure account environment. This includes signing up your organization to use Azure Active Directory. The following section is a summary of these steps. For details, see the linked Azure-specific documentation.

Create and consume Azure resources

After your Azure environment is set up and an account is created and associated with a subscription, you can log into Azure portal with the account to create the necessary resources to run Oracle.

1. Create a virtual network or VNet

Azure Virtual Network (VNet) is the fundamental building block for your private network in Azure. VNet enables many types of Azure resources, such as Azure Virtual Machines (VMs), to securely communicate with each other, the internet, and on-premises networks. Before provisioning an Azure VM, a VNet (where a VM is deployed) must first be configured.

2. Create a NetApp storage account and capacity pool for ANF

In this deployment scenario, an Azure VM OS is provisioned using regular Azure storage, but ANF volumes are provisioned to run Oracle database via NFS. First, you need to create a NetApp storage account and a capacity pool to host the storage volumes.

See Set up Azure NetApp Files and create an NFS volume to set up an ANF capacity pool.

3. Provision Azure VM for Oracle

Based on your workload, determine what type of Azure VM you need and the size of the VM vCPU and RAM to deploy for Oracle. Then, from the Azure console, click the VM icon to launch the VM deployment workflow.

  1. From the Azure VM page, click Create and then choose Azure virtual machine.

    This screenshot shows the list of available Azure VMs.

  2. Choose the subscription ID for the deployment, and then choose the resource group, region, host name, VM image, size, and authentication method. Go to the Disk page.

    This screenshot shows the input for the Create a Virtual Machine page.
    This screenshot shows additional input for the Create a Virtual Machine page.

  3. Choose premium SSD for OS local redundancy and leave the data disk blank because the data disks are mounted from ANF storage. Go to the Networking page.

    This screenshot shows the input for the Create a Virtual Machine Disks page.

  4. Choose the VNet and subnet. Allocate a public IP for external VM access. Then go to the Management page.

    This screenshot shows further input for the Create a Virtual Machine page.

  5. Keep all defaults for Management and move to the Advanced page.

    This screenshot shows the input for the Create a Virtual Machine Management page.

  6. Keep all defaults for the Advanced page unless you need to customize a VM after deployment with custom scripts. Then go to Tags page.

    This screenshot shows the input for the Create a Virtual Machine Advanced page.

  7. Add a tag for the VM if desired. Then, go to the Review + create page.

    This screenshot shows the input for the Create a Virtual Machine Tags page.

  8. The deployment workflow runs a validation on the configuration, and, if the validation passes, click Create to create the VM.

    This screenshot shows the input for the Create a Virtual Machine review and create page

4. Provision ANF database volumes for Oracle

You must create three NFS volumes for an ANF capacity pool for the Oracle binary, data, and log volumes respectively.

  1. From the Azure console, under the list of Azure services, click Azure NetApp Files to open a volume creation workflow. If you have more than one ANF storage account, click the account that you would like to provision volumes from.

    This screenshot shows the Azure Services page, with ANF highlighted.

  2. Under your NetApp storage account, click Volumes, and then Add volume to create new Oracle volumes.

    This screenshot shows the landing screen for a NetApp storage account.
    This screenshot shows the volumes available for the NetApp storage account.

  3. As a good practice, identify Oracle volumes with the VM hostname as a prefix and then followed by the mount point on the host, such as u01 for Oracle binary, u02 for Oracle data, and u03 for Oracle log. Choose the same VNet for the volume as for the VM. Click Next: Protocol>.

    Volume creation screen.

  4. Choose the NFS protocol, add the Oracle host IP address to the allowed client, and remove the default policy that allows all IP addresses 0.0.0.0/0. Then click Next: Tags>.

    Protocol input on the Volume creation screen.

  5. Add a volume tag if desired. Then click Review + Create>.

    Tags input on the Volume creation screen.

  6. If the validation passes, click Create to create the volume.

    Review and create stage of the Volume creation screen.

Install and configure Oracle on Azure VM with ANF

The NetApp solutions team has created many Ansible-based automation toolkits to help you deploy Oracle in Azure smoothly. Follow these steps to deploy Oracle on an Azure VM.

Set up an Ansible controller

If you have not set up an Ansible controller, see NetApp Solution Automation, which has detailed instructions on how to setup an Ansible controller.

Obtain Oracle deployment automation toolkit

Clone a copy of the Oracle deployment toolkit in your home directory under the user ID that you use to log into the Ansible controller.

git clone https://github.com/NetApp-Automation/na_oracle19c_deploy.git

Execute the toolkit with your configuration

See the CLI deployment Oracle 19c Database to execute the playbook with the CLI. You can ignore the ONTAP portion of the variables configuration in the global VARS file when you create database volumes from the Azure console rather than the CLI.

Note The toolkit default deploys Oracle 19c with RU 19.8. It can be easily adapted for any other patch level with minor default configuration changes. Also default seed-database active log files are deployed into the data volume. If you need active log files on the log volume, it should be relocated after initial deployment. Reach out to the NetApp Solution team for help if needed.

Set up AzAcSnap backup tool for app-consistent snapshots for Oracle

The Azure Application-Consistent Snapshot tool (AzAcSnap) is a command-line tool that enables data protection for third-party databases by handling all the orchestration required to put them into an application-consistent state before taking a storage snapshot. It then returns these databases to an operational state. NetApp recommends installing the tool on the database server host. See the following installation and configuration procedures.

Install AzAcSnap tool

  1. Get the most recent version of the the AzArcSnap Installer.

  2. Copy the downloaded self-installer to the target system.

  3. Execute the self-installer as the root user with the default installation option. If necessary, make the file executable using the chmod +x *.run command.

     ./azacsnap_installer_v5.0.run -I

Configure Oracle connectivity

The snapshot tools communicate with the Oracle database and need a database user with appropriate permissions to enable or disable backup mode.

1. Set up AzAcSnap database user

The following examples show the setup of the Oracle database user and the use of sqlplus for communication to the Oracle database. The example commands set up a user (AZACSNAP) in the Oracle database and change the IP address, usernames, and passwords as appropriate.

  1. From the Oracle database installation, launch sqlplus to log into the database.

    su – oracle
    sqlplus / AS SYSDBA
  2. Create the user.

    CREATE USER azacsnap IDENTIFIED BY password;
  3. Grant the user permissions. This example sets the permission for the AZACSNAP user to enable putting the database into backup mode.

    GRANT CREATE SESSION TO azacsnap;
    GRANT SYSBACKUP TO azacsnap;
  4. Change the default user's password expiration to unlimited.

    ALTER PROFILE default LIMIT PASSWORD_LIFE_TIME unlimited;
  5. Validate azacsnap connectivity for the database.

    connect azacsnap/password
    quit;

2. Configure Linux-user azacsnap for DB access with Oracle wallet

The AzAcSnap default installation creates an azacsnap OS user. It's Bash shell environment must be configured for Oracle database access with the password stored in an Oracle wallet.

  1. As root user, run the cat /etc/oratab command to identify the ORACLE_HOME and ORACLE_SID variables on the host.

    cat /etc/oratab
  2. Add ORACLE_HOME, ORACLE_SID, TNS_ADMIN, and PATH variables to the azacsnap user bash profile. Change the variables as needed.

    echo "export ORACLE_SID=ORATEST" >> /home/azacsnap/.bash_profile
    echo "export ORACLE_HOME=/u01/app/oracle/product/19800/ORATST" >> /home/azacsnap/.bash_profile
    echo "export TNS_ADMIN=/home/azacsnap" >> /home/azacsnap/.bash_profile
    echo "export PATH=\$PATH:\$ORACLE_HOME/bin" >> /home/azacsnap/.bash_profile
  3. As the Linux user azacsnap, create the wallet. You are prompted for the wallet password.

    sudo su - azacsnap
    
    mkstore -wrl $TNS_ADMIN/.oracle_wallet/ -create
  4. Add the connect string credentials to the Oracle Wallet. In the following example command, AZACSNAP is the ConnectString to be used by AzAcSnap, azacsnap is the Oracle Database User, and AzPasswd1 is the Oracle User's database password. You are again prompted for the wallet password.

    mkstore -wrl $TNS_ADMIN/.oracle_wallet/ -createCredential AZACSNAP azacsnap AzPasswd1
  5. Create the tnsnames-ora file. In the following example command, HOST should be set to the IP address of the Oracle Database and the Server SID should be set to the Oracle Database SID.

    echo "# Connection string
    AZACSNAP=\"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.30.137.142)(PORT=1521))(CONNECT_DATA=(SID=ORATST)))\"
    " > $TNS_ADMIN/tnsnames.ora
  6. Create the sqlnet.ora file.

    echo "SQLNET.WALLET_OVERRIDE = TRUE
    WALLET_LOCATION=(
        SOURCE=(METHOD=FILE)
        (METHOD_DATA=(DIRECTORY=\$TNS_ADMIN/.oracle_wallet))
    ) " > $TNS_ADMIN/sqlnet.ora
  7. Test Oracle access using the wallet.

    sqlplus /@AZACSNAP as SYSBACKUP

    The expected output from the command:

    [azacsnap@acao-ora01 ~]$ sqlplus /@AZACSNAP as SYSBACKUP
    
    SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 8 18:02:07 2022
    Version 19.8.0.0.0
    
    Copyright (c) 1982, 2019, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.8.0.0.0
    
    SQL>

Configure ANF connectivity

This section explains how to enable communication with Azure NetApp Files (with a VM).

  1. Within an Azure Cloud Shell session, make sure that you are logged into the subscription that you want to be associated with the service principal by default.

    az account show
  2. If the subscription isn't correct, use the following command:

    az account set -s <subscription name or id>
  3. Create a service principal using the Azure CLI as in the following example:

    az ad sp create-for-rbac --name "AzAcSnap" --role Contributor --scopes /subscriptions/{subscription-id} --sdk-auth

    The expected output:

    {
      "clientId": "00aa000a-aaaa-0000-00a0-00aa000aaa0a",
      "clientSecret": "00aa000a-aaaa-0000-00a0-00aa000aaa0a",
      "subscriptionId": "00aa000a-aaaa-0000-00a0-00aa000aaa0a",
      "tenantId": "00aa000a-aaaa-0000-00a0-00aa000aaa0a",
      "activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
      "resourceManagerEndpointUrl": "https://management.azure.com/",
      "activeDirectoryGraphResourceId": "https://graph.windows.net/",
      "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
      "galleryEndpointUrl": "https://gallery.azure.com/",
      "managementEndpointUrl": "https://management.core.windows.net/"
    }
  4. Cut and paste the output content into a file called oracle.json stored in the Linux user azacsnap user bin directory and secure the file with the appropriate system permissions.

Note Make sure the format of the JSON file is exactly as described above, especially with the URLs enclosed in double quotes (").

Complete the setup of AzAcSnap tool

Follow these steps to configure and test the snapshot tools. After successful testing, you can perform the first database-consistent storage snapshot.

  1. Change into the snapshot user account.

    su - azacsnap
  2. Change the location of commands.

    cd /home/azacsnap/bin/
  3. Configure a storage backup detail file. This creates an azacsnap.json configuration file.

    azacsnap -c configure –-configuration new

    The expected output with three Oracle volumes:

    [azacsnap@acao-ora01 bin]$ azacsnap -c configure --configuration new
    Building new config file
    Add comment to config file (blank entry to exit adding comments): Oracle snapshot bkup
    Add comment to config file (blank entry to exit adding comments):
    Enter the database type to add, 'hana', 'oracle', or 'exit' (for no database): oracle
    
    === Add Oracle Database details ===
    Oracle Database SID (e.g. CDB1): ORATST
    Database Server's Address (hostname or IP address): 172.30.137.142
    Oracle connect string (e.g. /@AZACSNAP): /@AZACSNAP
    
    === Azure NetApp Files Storage details ===
    Are you using Azure NetApp Files for the database? (y/n) [n]: y
    --- DATA Volumes have the Application put into a consistent state before they are snapshot ---
    Add Azure NetApp Files resource to DATA Volume section of Database configuration? (y/n) [n]: y
    Full Azure NetApp Files Storage Volume Resource ID (e.g. /subscriptions/.../resourceGroups/.../providers/Microsoft.NetApp/netAppAccounts/.../capacityPools/Premium/volumes/...): /subscriptions/0efa2dfb-917c-4497-b56a-b3f4eadb8111/resourceGroups/ANFAVSRG/providers/Microsoft.NetApp/netAppAccounts/ANFAVSAcct/capacityPools/CapPool/volumes/acao-ora01-u01
    Service Principal Authentication filename or Azure Key Vault Resource ID (e.g. auth-file.json or https://...): oracle.json
    Add Azure NetApp Files resource to DATA Volume section of Database configuration? (y/n) [n]: y
    Full Azure NetApp Files Storage Volume Resource ID (e.g. /subscriptions/.../resourceGroups/.../providers/Microsoft.NetApp/netAppAccounts/.../capacityPools/Premium/volumes/...): /subscriptions/0efa2dfb-917c-4497-b56a-b3f4eadb8111/resourceGroups/ANFAVSRG/providers/Microsoft.NetApp/netAppAccounts/ANFAVSAcct/capacityPools/CapPool/volumes/acao-ora01-u02
    Service Principal Authentication filename or Azure Key Vault Resource ID (e.g. auth-file.json or https://...): oracle.json
    Add Azure NetApp Files resource to DATA Volume section of Database configuration? (y/n) [n]: n
    --- OTHER Volumes are snapshot immediately without preparing any application for snapshot ---
    Add Azure NetApp Files resource to OTHER Volume section of Database configuration? (y/n) [n]: y
    Full Azure NetApp Files Storage Volume Resource ID (e.g. /subscriptions/.../resourceGroups/.../providers/Microsoft.NetApp/netAppAccounts/.../capacityPools/Premium/volumes/...): /subscriptions/0efa2dfb-917c-4497-b56a-b3f4eadb8111/resourceGroups/ANFAVSRG/providers/Microsoft.NetApp/netAppAccounts/ANFAVSAcct/capacityPools/CapPool/volumes/acao-ora01-u03
    Service Principal Authentication filename or Azure Key Vault Resource ID (e.g. auth-file.json or https://...): oracle.json
    Add Azure NetApp Files resource to OTHER Volume section of Database configuration? (y/n) [n]: n
    
    === Azure Managed Disk details ===
    Are you using Azure Managed Disks for the database? (y/n) [n]: n
    
    === Azure Large Instance (Bare Metal) Storage details ===
    Are you using Azure Large Instance (Bare Metal) for the database? (y/n) [n]: n
    
    Enter the database type to add, 'hana', 'oracle', or 'exit' (for no database): exit
    
    Editing configuration complete, writing output to 'azacsnap.json'.
  4. As the azacsnap Linux user, run the azacsnap test command for an Oracle backup.

    cd ~/bin
    azacsnap -c test --test oracle --configfile azacsnap.json

    The expected output:

    [azacsnap@acao-ora01 bin]$ azacsnap -c test --test oracle --configfile azacsnap.json
    BEGIN : Test process started for 'oracle'
    BEGIN : Oracle DB tests
    PASSED: Successful connectivity to Oracle DB version 1908000000
    END   : Test process complete for 'oracle'
    [azacsnap@acao-ora01 bin]$
  5. Run your first snapshot backup.

    azacsnap -c backup –-volume data --prefix ora_test --retention=1