安装oracle client
sqlplus 这个环境就是 oracle client 提供的 ,现在数据库在别人的系统上 我得用oracle client 远程访问别人的数据库
目录
文章目录
#(1). 教程和下载地址
总共下载五个包 用在线安装的方法 rpm
教程:
https://blog.csdn.net/karloo/article/details/51862226
下载地址:
http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/b35f46ea05bafb525541207198c1586a.png)
是发现找不到sqlplus命令,而且有些话没讲明白,然后换了一个教程,然后发现自己的包没有安装完成,然后按照原来的教程继续做
#(2). 环境变量
如果不确定有没有配好 就用命令配
989 export ORACLE_HOME=/usr/lib/oracle/11.2/client64
990 export TNS_ADMIN=$ORACLE_HOME/network/admin
991 export NLS_LANG='simplified chinese_china'.ZHS16GBK
992 export LD_LIBRARY_PATH=$ORACLE_HOME/lib
993 export PATH=$ORACLE_HOME/bin:$PATH
#(3).乱码
sqlplus之后,可能会出现乱码的问题 采取的办法是(说明还是utf8的问题)
echo 'export NLS_LANG="AMERICAN_AMERICA.UTF8"'>>/etc/profile
#(4). 测试是否正确安装
https://www.cnblogs.com/jiaxiaoai/archive/2011/05/09/2041008.html
查看当前库的所有数据表
select * from all_tables;
select table_name from all_tables; (用的是这个)
select table_name from user_tables;
select table_name from all_tables where owner='用户名';
最后汇总所有的命令
rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-odbc-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-jdbc-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
mkdir -p /usr/lib/oracle/11.2/client64/network/admin/
vim /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora
vim ~/.bashrc
source ~/.bashrc
echo 'export NLS_LANG="AMERICAN_AMERICA.UTF8"'>>/etc/profile
source /etc/profile
sqlplus username/passwd//10.113.1.50:1521/orcl;
select table_name from all_tables;
这是中间修改过的文件
[root@localhost ~]# vim /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *IP*)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = *SID*)
)
)
~
[root@localhost ~]# vim ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG='simplified chinese_china'.ZHS16GBK
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
thanks for sjx‘s help!