mac下安装配置sql plus

下载

oracle instantclient

解压

将两个压缩包解压到同一个目录:instantclient下

配置环境变量

vim ~/.bash_profile

增加如下内容:

DYLD_LIBRARY_PATH="/Users/mac/opt/oracle/instantclient"
export DYLD_LIBRARY_PATH
export ORACLE_HOME=$DYLD_LIBRARY_PATH
export PATH=$ORACLE_HOME:$PATH

# mac下防止中文乱码
export NLS_LANG="AMERICAN_AMERICA.UTF8"

source .bash_profile

配置数据库

instantclient/network/admin/tnsnames.ora

wuhu_jh =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.247.52)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = meter)
    )
  )

连接

sqlplus meter/meter@172.18.247.52/meter

username/password@ip/servicename

历史命令

mac下安装rlwrap

brew install rlwrap

配置到sql plus中:
vim .bash_profile

alias sqlplus='rlwrap sqlplus'
posted @ 2020-11-05 19:39  fight139  阅读(1365)  评论(0编辑  收藏  举报