linux - GradedJestRisk/db-training GitHub Wiki

Linux

database

Use oracle-free

client

sqlplus

Download

wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip

Install

sudo mkdir -p /opt/oracle
sudo unzip -d /opt/oracle instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
sudo unzip -d /opt/oracle instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip
vi ~/.zshrc

Add environment variables

export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_4:$LD_LIBRARY_PATH
export PATH=$LD_LIBRARY_PATH:$PATH

Restart terminal

Test

sqlplus -V
sqlplus username/password@//localhost:1521/FREEPDB1

FREEPDB1 is the pluggable database PDB name https://docs.oracle.com/en-us/iaas/base-database/doc/pluggable-databases.html

Connect with // when no tnslanmes.ora file

Full description should be

connect user/pass@"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales.us.acme.com)))"

Conversely, the '//' syntax is known as "ezconnect" and is specifically designed for when there is NO tnsnames etc... https://asktom.oracle.com/ords/f?p=100:11:::::P11_QUESTION_ID:9531866400346022039

Configure keys

sudo apt install rlwrap
echo 'alias sqlplus="rlwrap sqlplus"' >> ~/.zshrc
source ~/.zshrc

Source

SQL Developer

Download "no-jre.zip" https://www.oracle.com/database/sqldeveloper/technologies/download/

Install

unzip $FILE
sudo mv sqldeveloper /opt/
chmod +x /opt/sqldeveloper/sqldeveloper.sh
vi ~/.bashrc
export PATH=$PATH:/opt/sqldeveloper/sqldeveloper/bin

Run

sqldeveloper

profiler

tvdxtat

Install

wget -O /tmp/tvdxtat.zip  https://antognini.ch/downloads/top2/chapter03/tvdxtat_40beta11_20170301.zip
unzip -d ~/tvdxtat /tmp/tvdxtat.zip
chmod +x ~/tvdxtat/tvdxtat.sh
mv ~/tvdxtat/tvdxtat.sh ~/tvdxtat/tvdxtat

vi ~/.zshrc
export TVDXTAT_HOME=~/tvdxtat
export PATH=$PATH:$TVDXTAT_HOME
source ~/.zshrc

vi ~/tvdxtat/tvdxtat.sh
export TVDXTAT_HOME=~/tvdxtat

Test

tvdxtat --version
⚠️ **GitHub.com Fallback** ⚠️