Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 知乎專欄 | 視頻教程 | About

74.6. Linux 安裝 sqlplus

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
		

安裝

yum localinstall oracle-instantclient11.2-*		
		

創建sqlnet.ora和tnsnames.ora兩個檔案

mkdir -p /usr/lib/oracle/11.2/client64/network/admin
cd /usr/lib/oracle/11.2/client64/network/admin
 
[root@localhost admin]# cat sqlnet.ora
NAMES.DIRECTORY_PATH=(TNSNAMES, EZCONNECT)
ADR_BASE = /usr/lib/oracle/

[root@localhost admin]# cat tnsnames.ora
XXX =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.2)(PORT = 1521))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = DB)
     )
   )		
		

~/.bash_profile

ORACLE_HOME=/usr/lib/oracle/11.2/client64
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_HOME
export LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH		
		
sqlplus "username/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.1)(PORT=1521))(CONNECT_DATA=(SID=YOURSID)))"