Mac OS 安裝配置 instant client

1. 下載資源python

    下載三個文件(oracle 官網)sql

  • instantclient-basic-macos.x64-18.1.0.0.0.zip
  • instantclient-sdk-macos.x64-18.1.0.0.0-2.zip
  • instantclient-sqlplus-macos.x64-18.1.0.0.0.zip

2. 建立目錄 解壓縮文件數據庫

sudo mkdir -p /opt/oracle

將下載文件複製到剛剛建立的目錄下(/opt/oracle/)macos

sudo cp ****.zip /opt/oracle/

按上面順序解壓縮zipvim

unzip instantclient-basic-macos.x64-18.1.0.0.0.zip
unzip instantclient-sdk-macos.x64-18.1.0.0.0-2.zip
unzip instantclient-sqlplus-macos.x64-18.1.0.0.0.zip

解壓第一個之後會產生一個 instantclient_18_1目錄(版本不一樣產生的目錄不一樣),而後解壓 sdk和sqlplus 執行命令之後會自動解壓到instantclient_18_1,裏面會建立一個sdk和sqlplus的目錄。bash

而後咱們將sdk裏的文件所有copy到instantclient_18_1目錄oracle

切換到instantclient_18_1目錄裏執行:
cp sdk/* .

3.配置環境變量code

打開.base_profile或者.profile文件,我這裏沒有建立.base_profile因此直接在.profile文件裏面配置,效果都是同樣的。若是你想配置成全局的環境變量能夠在/etc/profile文件裏面配置,也沒有問題。ip

vim ~/.profile
而後輸入:
export ORACLE_HOME=/opt/oracle/instantclient_18_1/
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
PATH=$PATH:$ORACLE_HOME

:wq //保存退出

打開一個新的終端執行:
source ~/.profile //命令生效

而後執行:
sqlplus

SQL*Plus: Release 18.0.0.0.0 Production on Sun Jun 30 16:02:48 2019
Version 18.1.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Enter user-name: user/password@host/數據庫名稱

鍵入你的鏈接信息就能夠鏈接到遠程oracle服務了。
例:test/test@123@192.168.1.100/orcl

到此Mac安裝配置instant client 完畢。下篇文章咱們接受python利用cx_Oracle 鏈接和操做遠程oracle數據庫服務資源

相關文章
相關標籤/搜索