はじめに
Migrating from Oracle to Amazon Aurora (Japanese) (日本語吹き替え版)を実施する際にM1 MacのローカルにSQLPlusを導入する際に若干詰まったので、M1 MacでSQLPlusを利用する方法について記載しておきます。
M1 MacでSQL*Plusを利用する方法
Oracleのページを見る限りMac版はIntel x86
or PPC(PowerPC)
版しか提供されていないようです。
Intel x86
版をインストールすることでSQL*Plus(sqlplusコマンド)が利用できるようになります。
前提条件
- Homebrewが導入済みであること
M1 MacへのSQL*Plusインストール方法
1. Homebrewローカルリポジトリ作成
以下コマンドを実行してローカルリポジトリを作成します。
コマンド:
$ brew tap InstantClientTap/instantclient
出力例:
$ brew tap InstantClientTap/instantclient
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 4 formulae.
==> Tapping instantclienttap/instantclient
Cloning into '/opt/homebrew/Library/Taps/instantclienttap/homebrew-instantclient'...
remote: Enumerating objects: 244, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 244 (delta 13), reused 16 (delta 6), pack-reused 213
Receiving objects: 100% (244/244), 40.72 KiB | 2.54 MiB/s, done.
Resolving deltas: 100% (146/146), done.
Tapped 6 formulae (19 files, 60KB).
2. "Basic Package"と"SQL*Plus Package"をダウンロード
Oracle公式ページから"Basic Package (ZIP)"と"SQL*Plus Package (ZIP)"を1.
で作成したローカルリポジトリにダウンロードします。
※今回の場合、"/opt/homebrew/Library/Taps/instantclienttap/homebrew-instantclient"にzipをダウンロードする。
zip配置後の確認コマンド:
$ ls -l /opt/homebrew/Library/Taps/instantclienttap/homebrew-instantclient
total 166928
drwxr-xr-x 8 xxxx admin 256 3 3 20:45 Formula/
-rw-r--r-- 1 xxxx admin 1084 3 3 20:45 LICENSE
-rw-r--r-- 1 xxxx admin 1701 3 3 20:45 README.md
-rw-r--r--@ 1 xxxx staff 75201214 3 3 20:45 instantclient-basic-macos.x64-19.8.0.0.0dbru.zip
-rw-r--r--@ 1 xxxx staff 935200 3 3 20:45 instantclient-sqlplus-macos.x64-19.8.0.0.0dbru.zip
3. "Basic Package"と"SQL*Plus Package"をインストール
以下コマンドを実行してパッケージをインストールします。
コマンド:
$ brew install instantclient-basic instantclient-sqlplus
出力例:
$ brew install instantclient-basic instantclient-sqlplus
==> Downloading https://download.oracle.com/otn_software/mac/instantclient/198000/instantclient-basic-macos.x64-19.8.0.0.0dbru.zip
Already downloaded: /Users/xxxx/Library/Caches/Homebrew/downloads/191dde932f97653277f159e87a93a6cb967e74f9f89f53163adc5d70de337b81--instantclient-basic-macos.x64-19.8.0.0.0dbru.zip
==> Downloading https://download.oracle.com/otn_software/mac/instantclient/198000/instantclient-sqlplus-macos.x64-19.8.0.0.0dbru.zip
Already downloaded: /Users/xxxx/Library/Caches/Homebrew/downloads/ac57f4a89ca32a065edbcaf16914c20dfd4c4b77ac695fda8191d839e264571b--instantclient-sqlplus-macos.x64-19.8.0.0.0dbru.zip
==> Installing instantclient-basic from instantclienttap/instantclient
🍺 /opt/homebrew/Cellar/instantclient-basic/19.8.0.0.0dbru: 19 files, 234.6MB, built in 3 seconds
==> Running `brew cleanup instantclient-basic`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Installing instantclient-sqlplus from instantclienttap/instantclient
==> /usr/bin/install_name_tool -add_rpath /opt/homebrew/lib sqlplus
🍺 /opt/homebrew/Cellar/instantclient-sqlplus/19.8.0.0.0dbru: 6 files, 2.9MB, built in 1 second
==> Running `brew cleanup instantclient-sqlplus`...
4. sqlplusコマンドの確認
sqlplusコマンドの確認を行う。
SQL*Plusユーザーズ・ガイドおよびリファレンス
コマンド例:
$ sqlplus user/password@server:port/sid
おわりに
もしも神龍がいるならば、全宇宙のRDB統一を願おうと思います。