Create $TNS_ADMIN/tnsnames.ora:
LEGACYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.2.1.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
Then test:
tnsping LEGACYDB # Should show "OK (20 msec)"
The Windows installation is GUI-driven and straightforward for most users. install oracle client 12c
The modern dynamic linker (ld.so) needs to know about non-standard library paths. Many guides tell you to set LD_LIBRARY_PATH—that’s fragile and breaks containerization. Use ldconfig:
Create a configuration file:
echo "/opt/oracle/instantclient_12_2" | sudo tee /etc/ld.so.conf.d/oracle-instantclient.conf
sudo ldconfig
Verify:
ldconfig -p | grep clntsh
# Output should show libclntsh.so.12.1
Why this matters: Without ldconfig, Python’s cx_Oracle or PHP’s oci8 will throw ImportError: libclntsh.so.12.1: cannot open shared object file. Create $TNS_ADMIN/tnsnames
This often happens with locale settings. Unset it:
unset LANG LC_ALL
export NLS_LANG=AMERICAN_AMERICA.US7ASCII