User Tools

Site Tools


linux:redhat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
linux:redhat [2023/11/02 07:12] – removed - external edit (Unknown date) 127.0.0.1linux:redhat [2023/11/02 07:12] (current) – ↷ Page moved from webserver:redhat to linux:redhat skipidar
Line 1: Line 1:
 +===== 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
 +
 +<code>
 +oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
 +oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
 +</code>
 +
 +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
 +
 +<code>
 +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
 +</code>
 +
 +Set environment variables in your ~/.bash_profile
 +
 +<code>
 +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
 +</code>
 +
 +Reload the session or just relogin:
 +<code>
 +source ~/.bash_profile
 +</code>
 +
 +Start sqlplus
 +<code>
 +$ sqlplus
 +</code>
 +
 +
 +SSH Script for starting sqlplus
 +<code>
 +#!/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)))"
 +</code>
 +
 +
 +=== Persisting environment variables===
 +
 +The relevant file is **~/.bashrc**
 +The vars have to be set.
 +The vars have to be exported.
 +
 +<code>
 +# 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
 +</code>
 +
 +To reaply the changed bashrc without reloggin in
 +<code>
 +source ~/.bashrc
 +</code>