mkdir -p /opt/oracle
cd /opt/oracle
wget https://download.oracle.com/otn_software/linux/instantclient/218000/instantclient-basic-linux.x64-21.8.0.0.0dbru.zip
unzip instantclient-basic-linux.x64-21.8.0.0.0dbru.zip
wget https://download.oracle.com/otn_software/linux/instantclient/218000/instantclient-sqlplus-linux.x64-21.8.0.0.0dbru.zip
unzip instantclient-sqlplus-linux.x64-21.8.0.0.0dbru.zip
After you unzip sqlplus package, you will see both lib files and sqlplus
command inside directory instantclient_21_8
ls -la /opt/oracle/instantclient_21_8
sudo apt install libaio1
sudo sh -c "echo /opt/oracle/instantclient_21_8 > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig
Add follow code to ~/.bashrc
export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_8:$LD_LIBRARY_PATH
export PATH=/opt/oracle/instantclient_21_8:$PATH
Then logout and login again or run source ~/.bashrc
to reload $PATH
environment
sqlplus username:password@host:port/service_name
# password promt (better)
sqlplus username@host:port/service_name
pip install cx_Oracle
import cx_Oracle as Database
user = 'username'
password = 'password'
dsn = Database.makedsn('host', 'port', service_name='service_name')
conn = Database.connect(user=user, password=password, dsn=dsn, encoding='UTF-8')
DATABASES = {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'host:port/service_name',
'USER': 'username',
'PASSWORD': 'password',
}
DATABASES = {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'sid',
'USER': 'username',
'PASSWORD': 'password',
'HOST': 'host',
'PORT': 'port',
}
https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html#ic_x64_inst
first line: after
mkdir -p /opt/oracle
addcd /opt/oracle