你的位置:首页 > 数据库

[数据库]CentOS oracle Client客户端安装


CentOS客户端安装方法如下:

1.安装客户端 

   rpm -ivh /当前目录/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm 

   rpm -ivh /当前目录/oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
 rpm -ivh /当前目录/oracle-instantclient12.1-odbc-12.1.0.2.0-1.x86_64.rpm
 rpm -ivh /当前目录/oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm


填加tnsanme信息:
创建文件夹nework/admin,整个路径如:/usr/lib/oracle/12.1/client64/network/admin 加入tnsnames.ora
#tnames.ora Network Configuration File: /opt/oracle/app/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.14.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

 

2、配置环境信息:

请打开 /etc/profile 文件,在这个文件里面追加如下内容:
export ORACLE_BASE=/usr/lib/oracle/12.1
export ORACLE_HOME=$ORACLE_BASE/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export SQLPATH=/usr/lib/oracle/12.1/client64/network/admin
export TNS_ADMIN=/home/oracle/network/admin

 

运行 #> source /etc/profile 命令使该profile立即生效
再次运行vi .bash_profile ,加入下面这个:
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

3、验证是否登陆成功
sqlplus xxx/xxx@192.168.14.31:1521/orcl