===== Red Hat =====
==== Installing Software ====
== Searhing RPM packages ==
The packages can be downloaded under
http://rpmfind.net/linux/rpm2html/search.php?query=p7zip
== Installing SQL Plus ==
Download
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
Install
Here is an introduction for rpm: \\
installing http://www.rpm.org/max-rpm/ch-rpm-install.html
uninstalling etc. http://www.rpm.org/max-rpm/index.html
rpm -ivh oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
Set environment variables in your ~/.bash_profile
ORACLE_HOME=/usr/lib/oracle/12.1/client64
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_HOME
export LD_LIBRARY_PATH
export PATH
Reload the session or just relogin:
source ~/.bash_profile
Start sqlplus
$ sqlplus
SSH Script for starting sqlplus
#!/bin/bash
DBNAME="MYDB"
DBHOST="123456789abcdefg.eu-west-1.rds.amazonaws.com"
DBPORT="1521"
DBUSER="auser"
DBPASS="apassword"
# set environment vars
ORACLE_HOME=/usr/lib/oracle/12.1/client64
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export LD_LIBRARY_PATH
export PATH
# connect DB via sqltools
set ORACLE_SID=$DBNAME; export ORACLE_SID
sqlplus "$DBUSER/$DBPASS@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$DBHOST)(PORT=$DBPORT))(CONNECT_DATA=(SID=$DBNAME)))"
=== Persisting environment variables===
The relevant file is **~/.bashrc**
The vars have to be set.
The vars have to be exported.
# User specific aliases and functions
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
To reaply the changed bashrc without reloggin in
source ~/.bashrc