Oracle Database Client 19c on Rocky Linux 8 on Azure User Guide
Videos
Overview
This guide covers deploying cloudimg's Oracle Database Client 19c on Rocky Linux 8 image on Microsoft Azure. Oracle Database Client 19c is the set of tools and libraries an application or a DBA uses to reach a remote Oracle database: SQL*Plus, Oracle Net (tnsping, tnsnames.ora), SQL*Loader, Data Pump (expdp, impdp), RMAN and the OCI and JDBC client libraries. It does not include a database server: the VM connects out to an Oracle database you already run.
What's included in this VM image:
- Oracle Database Client 19c, version 19.3.0.0.0 (Administrator install), in
/u01/app/oracle/product/19.3.0/client_1 - A dedicated
oracleOS user, with an environment script at/home/oracle/setEnv.sh - SQL*Plus, tnsping, sqlldr, expdp, impdp, exp, imp, rman, adrci, tkprof, mkstore and orapki
- The JDBC drivers (
ojdbc8.jar) and the OCI and OCCI client libraries (libclntsh.so,libocci.so) - A starter
tnsnames.ora(an example entry, commented out) andsqlnet.ora(TNSNAMES and EZCONNECT naming) - A system wide hook,
/etc/profile.d/oracle-client.sh, so every Linux user on the VM finds the client tools on login - The Oracle software on its own 20 GB Azure data disk, mounted at
/u01 - Rocky Linux 8.10, SELinux enforcing
- Azure Linux Agent (waagent) and cloud-init for provisioning
- cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours
Platform: Microsoft Azure (Gen1 and Gen2 Hyper-V)
Login user: the administrator username you choose when you deploy (azureuser in the examples below)
Oracle Home: /u01/app/oracle/product/19.3.0/client_1
TNS Admin: /u01/app/oracle/product/19.3.0/client_1/network/admin
Prerequisites
Before deploying this image, make sure you have:
- An active Microsoft Azure subscription
- The Azure CLI, signed in to that subscription
- An SSH key pair for Linux VM access
- The hostname, port and service name of the Oracle database you want to connect to
- Network connectivity from the new VM to that database (usually TCP 1521 outbound)
Recommended VM size: Standard_B2s (2 vCPU, 4 GB RAM) or larger. The Oracle Client is a set of tools and libraries rather than a running service, so its needs are modest.
Step 1: Deploy the Virtual Machine
Create the VM from the image's Marketplace URN with the Azure CLI. First check the image's Marketplace terms are accepted (you accept them once per subscription, with az vm image terms accept), then create the VM from the Marketplace image, with your SSH key:
az vm image terms show --urn cloudimg1647283583153:0eeb7094-2144-42ac-98ef-a77e126bb4b9:0eeb7094-2144-42ac-98ef-a77e126bb4b9-gen2:latest --query accepted
az vm image terms accept --urn cloudimg1647283583153:0eeb7094-2144-42ac-98ef-a77e126bb4b9:0eeb7094-2144-42ac-98ef-a77e126bb4b9-gen2:latest
az vm create \
--resource-group my-resource-group \
--name my-oracle-client-19c-vm \
--image cloudimg1647283583153:0eeb7094-2144-42ac-98ef-a77e126bb4b9:0eeb7094-2144-42ac-98ef-a77e126bb4b9-gen2:latest \
--size Standard_B2s \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_rsa.pub \
--public-ip-sku Standard
The 0eeb7094-2144-42ac-98ef-a77e126bb4b9-gen2 plan is the Gen2 image. For a Gen1 VM, use the plan 0eeb7094-2144-42ac-98ef-a77e126bb4b9 (the offer's own id) in all three commands.
The image carries a 20 GB data disk (LUN 0) that holds the Oracle software; az vm create attaches it for you. az vm create opens SSH (port 22) in the new Network Security Group: restrict that rule to your own IP address once the VM is created.
Important: the Oracle Client makes outbound connections to your databases, on port 1521 by default. You do not need to open port 1521 inbound on this VM. Check that your Network Security Group and route tables let the VM reach your database's listener.
Step 2: Connect via SSH
Once it's running, read off its public IP address:
az vm show --resource-group my-resource-group --name my-oracle-client-19c-vm --show-details --query publicIps -o tsv
Then connect with SSH:
ssh azureuser@<public-ip>
Important: wait for the VM to reach the running state before connecting. An early attempt can be refused while cloud-init finishes provisioning.
Step 3: Switch to the Oracle User and Set the Environment
The Oracle Client software belongs to the dedicated oracle OS user. Switch to it and source the environment script:
sudo su - oracle
cd $HOME
. ./setEnv.sh
setEnv.sh sets the Oracle environment that SQL*Plus and the other tools need:
export ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/19.3.0/client_1 TNS_ADMIN=/u01/app/oracle/product/19.3.0/client_1/network/admin NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export PATH=/u01/app/oracle/product/19.3.0/client_1/bin:$PATH LD_LIBRARY_PATH=/u01/app/oracle/product/19.3.0/client_1/lib:${LD_LIBRARY_PATH:-}
/etc/profile.d/oracle-client.sh sets the same variables for every Linux user at login, so azureuser can run sqlplus too.
Check the client is ready:
sqlplus -V
which sqlplus tnsping sqlldr expdp impdp
Expected output:
SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
/u01/app/oracle/product/19.3.0/client_1/bin/sqlplus
/u01/app/oracle/product/19.3.0/client_1/bin/tnsping
/u01/app/oracle/product/19.3.0/client_1/bin/sqlldr
/u01/app/oracle/product/19.3.0/client_1/bin/expdp
/u01/app/oracle/product/19.3.0/client_1/bin/impdp
Step 4: Configure tnsnames.ora
Before connecting to a remote database, add an entry for it to tnsnames.ora. As the oracle user, run the following, replacing the placeholder values with your database's details:
cat >> "$ORACLE_HOME/network/admin/tnsnames.ora" << 'TNS'
MY_DATABASE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = YOUR_DB_HOSTNAME)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = YOUR_SERVICE_NAME)
)
)
TNS
Replace:
- YOUR_DB_HOSTNAME with the IP address or DNS name of your Oracle database server
- 1521 with your listener's port, if it is different
- YOUR_SERVICE_NAME with the service name of the database
Check that Oracle Net resolves the alias:
tnsping MY_DATABASE
Expected output (the common part):
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on <date>
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/19.3.0/client_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = YOUR_DB_HOSTNAME)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = YOUR_SERVICE_NAME)))
followed by one of:
OK (n msec): the host resolves and the remote listener answers. This is what you want to see.TNS-12545: Connect failed because target host or object does not exist: the host is still the placeholder, or does not resolve. Oracle Net itself is working; put in a real database host you can reach.TNS-12541: TNS:no listener: the host resolves, but nothing listens on that port. Check that the database listener is up and reachable from this VM.
Step 5: Connect to a Remote Database with SQL*Plus
With the environment sourced and the alias in place, connect with a database user and password of your own:
sqlplus your_user@MY_DATABASE
SQL*Plus prompts for the password and does not echo it, so it never lands in your shell history. You can also connect with EZCONNECT, without editing tnsnames.ora:
sqlplus your_user@//your-db-host:1521/your-service-name
Expected output, once you have typed the password at its prompt:
SQL*Plus: Release 19.0.0.0.0 - Production on <date>
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database ...
SQL>
Type EXIT to leave SQL*Plus. If nothing listens at the address, SQL*Plus reports ORA-12541: TNS:no listener instead (see Troubleshooting).
Step 6: The Other Client Tools
The same Oracle Home carries the rest of the client toolset. As the oracle user, with the environment sourced:
ls $ORACLE_HOME/bin | grep -xE "sqlplus|sqlldr|tnsping|expdp|impdp|exp|imp|rman|adrci|tkprof|mkstore|orapki"
ls $ORACLE_HOME/jdbc/lib/ojdbc8.jar $ORACLE_HOME/lib/libclntsh.so $ORACLE_HOME/lib/libocci.so
Expected output:
adrci
exp
expdp
imp
impdp
mkstore
orapki
rman
sqlldr
sqlplus
tkprof
tnsping
/u01/app/oracle/product/19.3.0/client_1/jdbc/lib/ojdbc8.jar
/u01/app/oracle/product/19.3.0/client_1/lib/libclntsh.so
/u01/app/oracle/product/19.3.0/client_1/lib/libocci.so
SQL*Loader (sqlldr) loads flat files into tables, Data Pump (expdp, impdp) moves schemas and tables between databases, and RMAN backs up a database it connects to. Applications on the VM link against libclntsh.so (OCI) or load ojdbc8.jar (JDBC).
Server Components
| Component | Version | Install Path |
|---|---|---|
| Oracle Database Client 19c (Administrator) | 19.3.0.0.0 | /u01/app/oracle/product/19.3.0/client_1 |
| Rocky Linux | 8.10 | / |
Filesystem Layout
| Mount Point | Size | Description |
|---|---|---|
| / | 63 GB | Root filesystem (XFS) |
| /boot | 1 GB | Operating system kernel files |
| /boot/efi | 100 MB | UEFI boot partition (Gen2) |
| /u01 | 20 GB | Azure data disk (LUN 0, ext4): the Oracle software |
| /mnt | varies | Azure temporary resource disk (not kept across stop/deallocate) |
Key Oracle directories:
| Directory | Purpose |
|---|---|
| /u01/app/oracle | Oracle base directory |
| /u01/app/oracle/product/19.3.0/client_1 | Oracle Client home |
| /u01/app/oracle/product/19.3.0/client_1/bin | Client binaries (sqlplus, sqlldr, tnsping, expdp, impdp, rman) |
| /u01/app/oracle/product/19.3.0/client_1/lib | Oracle client libraries (libclntsh.so, libocci.so) |
| /u01/app/oracle/product/19.3.0/client_1/jdbc/lib | JDBC drivers (ojdbc8.jar) |
| /u01/app/oracle/product/19.3.0/client_1/network/admin | Oracle Net configuration (tnsnames.ora, sqlnet.ora) |
| /u01/app/oraInventory | Oracle Universal Installer inventory |
Managing the Oracle Client
The Oracle Client is a set of tools and libraries, not a running service: there is nothing to start or stop. Switch to the oracle user and source the environment to use it:
sudo su - oracle
cd $HOME
. ./setEnv.sh
Scripts and Log Files
| Script/Log | Path | Description |
|---|---|---|
| setEnv.sh | /home/oracle | Sets the Oracle environment for sqlplus and the other tools |
| oracle-client.sh | /etc/profile.d | System wide environment hook for every logged in user |
| cloudimg-datadisk | /usr/local/sbin | First boot: puts /u01 on the VM's data disk (cloudimg-datadisk.service) |
| datadisk.conf | /etc/cloudimg | The disk cloudimg-datadisk places: LUN 0 at /u01 |
On Startup
On a new VM's first boot, cloudimg-datadisk.service formats the VM's data disk, copies the Oracle software onto it, and mounts it at /u01 (an entry in /etc/fstab). On later boots it finds the disk already formatted and leaves it alone. Its messages are in the journal:
sudo journalctl -u cloudimg-datadisk
Expected output (the last line):
cloudimg-datadisk: lun0 (/dev/sdc) -> /u01 (ext4, UUID=..., 1.8G copied)
This image does not update its packages on first boot, and no automatic update job is installed. Apply the latest Rocky Linux updates as soon as the VM is running, and regularly after that:
sudo dnf -y update
sudo reboot
Troubleshooting
Cannot connect via SSH
- Check the VM is running:
az vm show --resource-group my-resource-group --name my-oracle-client-19c-vm --show-details --query powerState -o tsv - Check that port 22 is allowed in the Network Security Group, from your IP address
- Use the administrator username you chose at deployment (
azureuseronly if you kept the example) - Check that your SSH key matches the one you gave at deployment
sqlplus: command not found
- Switch to the oracle user:
sudo su - oracle - Source the environment script:
. ~/setEnv.sh - Check the software is there:
ls /u01/app/oracle/product/19.3.0/client_1/bin/sqlplus - If
/u01is empty, check the data disk is attached and mounted:df -h /u01andsudo journalctl -u cloudimg-datadisk
ORA-12154: TNS:could not resolve the connect identifier specified
- Check that your alias is in tnsnames.ora:
cat $ORACLE_HOME/network/admin/tnsnames.ora - Check that
TNS_ADMINpoints at the network/admin directory:echo $TNS_ADMIN - Check that the alias resolves:
tnsping MY_DATABASE - Look for typos in the alias name
ORA-12170: TNS:Connect timeout occurred
- Check the database host and port are reachable from the VM:
timeout 5 bash -c '</dev/tcp/YOUR_DB_HOSTNAME/1521' && echo reachable - Check that the database side's Network Security Group or firewall allows this VM in
- Check route tables, peering or VPN between this VM and the database's network
- For a database on premises, check your ExpressRoute or site-to-site VPN
ORA-12541: TNS:no listener
- The database listener may be down: check with whoever manages the database
- Check the port in your tnsnames.ora entry
- Run
tnsping MY_DATABASEto see whether the listener answers
Security Recommendations
- Restrict SSH: allow port 22 only from the addresses that need it. The image has no host firewall (firewalld is not installed): the Network Security Group is what filters traffic to the VM
- Turn off rpcbind if you do not use NFS: the base system's
rpcbindlistens on port 111. Keep that port closed in the Network Security Group, or switch the service off; afterwards only SSH listens:
sudo systemctl disable --now rpcbind.service rpcbind.socket
sudo ss -tlnp
- Restrict outbound access: allow outbound TCP 1521 only to the database servers this VM needs to reach
- Protect tnsnames.ora: it names your internal database hosts and services; keep its permissions tight
- Keep passwords out of scripts: let SQL*Plus prompt for them, or set up an Oracle Wallet (
mkstore) - Encrypt connections: configure Oracle Net native encryption or TLS between the client and your databases
- Keep the system updated: apply Rocky Linux updates (
sudo dnf -y update) regularly
Support
If you have any issue with this product, contact cloudimg support:
- Email: support@cloudimg.co.uk
- Website: www.cloudimg.co.uk
- Product Catalogue: www.cloudimg.co.uk/products
- User Guides: www.cloudimg.co.uk/guides
- Support hours: 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours
Oracle and Oracle Database are registered trademarks of Oracle Corporation. Rocky Linux is a trademark of the Rocky Enterprise Software Foundation. cloudimg is an independent provider and is not affiliated with or endorsed by Oracle Corporation or the Rocky Enterprise Software Foundation.