Azure - Quick Oracle Database Installation from MarketPlace

> Azure

1 - About

Advertising

3 - Steps

3.1 - Create the VM

3.1.1 - With the azure cli

  • without ssh key but authentication
az.cmd vm create ^
    --resource-group myGROUP ^
    --name HI-ORACLE-DB-02 ^
    --image Oracle:Oracle-Database-Ee:12.1.0.2:latest ^
    --size Standard_DS1_v2 ^
    --authentication-type password ^
    --admin-username adm ^
    --admin-password ww ^
    --location westeurope
{/ Finished ..
  "fqdns": "",
  "id": "/subscriptions/a3c34725-da6a-41ac-87fa-090f6b96d44d/resourceGroups/VGZ_OBIEE/prov
  "location": "westeurope",
  "macAddress": "00-0D-3A-23-BF-B0",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.5",
  "publicIpAddress": "52.143.164.216",
  "resourceGroup": "myGROUP",
  "zones": ""
}

3.1.2 - With the Market place GUI

After a quick search, you can select the image that you want and follow the wizard.

3.2 - Connect to the VM

ssh adm@52.143.164.216

Personally, I connect with WinScp and start a putty session from there (Ctrl + P).

3.3 - As Oracle

sudo su - oracle
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for adm:
Advertising

3.3.1 - Start the listener

lsnrctl start
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 09-JAN-2018 01:30:41

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/HI-ORACLE-DB-02/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HI-ORACLE-DB-02.13wobvhsfboenhxe1vn1ey30oe.ax.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                09-JAN-2018 01:30:42
Uptime                    0 days 0 hr. 0 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/HI-ORACLE-DB-02/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HI-ORACLE-DB-02.13wobvhsfboenhxe1vn1ey30oe.ax.internal.cloudapp.net)(PORT=1521)))
The listener supports no services
The command completed successfully

3.3.2 - Create the database

dbca -silent \
       -createDatabase \
       -templateName General_Purpose.dbc \
       -gdbname orcl \
       -sid orcl \
       -responseFile NO_VALUE \
       -characterSet AL32UTF8 \
       -sysPassword OraPasswd1 \
       -systemPassword OraPasswd1 \
       -createAsContainerDatabase false \
       -databaseType MULTIPURPOSE \
       -automaticMemoryManagement true \
       -storageType FS \
       -ignorePreReqs
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

3.3.3 - Environment variable

vi ~/.bashrc
# ORACLE_HOME is already present
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 
# Add ORACLE_SID. 
export ORACLE_SID=orcl

3.3.4 - Oracle express em

. ~/.bash_profile
sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Tue Jan 9 01:55:36 2018

Copyright (c) 1982, 2014, 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> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5502);

PL/SQL procedure successfully completed.

SQL> quit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
exec DBMS_XDB_CONFIG.SETHTTPSPORT(5502);
quit
# return to adm
exit
Advertising

3.4 - As root

3.4.1 - Automate database startup and shutdown

  • Connect as root
sudo su -
  • change N as Y at the end of the oratab line
vi /etc/oratab
# /etc/oratab
orcl:/u01/app/oracle/product/12.1.0/dbhome_1:Y
  • Create the dbora file with the following content
vi /etc/init.d/dbora
#!/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
  • Change its permission
chgrp dba /etc/init.d/dbora
chmod 750 /etc/init.d/dbora
  • Create symlink for startup
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

3.5 - Network

  • Allow Oracle Port. Example to restrict the access of the port 1521 to a public IP defined in the –source-address-prefixes options
az.cmd network nsg rule create ^
    --resource-group myResourceGroup ^
    --nsg-name myVmNSG ^
    --name allow-oracle ^
    --protocol tcp ^
    --priority 1001 ^
    --destination-port-range 1521 ^
    --source-address-prefixes 193.172.53.8
  • Allow Em Port. Example to restrict the access of the port 5502 to a public IP defined in the –source-address-prefixes options
az.cmd network nsg rule create ^
    --resource-group myResourceGroup ^
    --nsg-name myVmNSG ^
    --name allow-em ^
    --protocol tcp ^
    --priority 1002 ^
    --destination-port-range 5502 ^
    --source-address-prefixes 193.172.53.8

3.6 - Test

  • Sql Developer

4 - Documentation / Reference