LoginSignup
2
2

More than 3 years have passed since last update.

[Oracle Cloud] Windows Server から SQL*Plus で Autonomous Database に接続

Posted at

はじめに

Windows Server から Autonomous Database に接続するときに、必要な手順がよくわからなかっため、現時点での手順を整理しました。備忘録として記録しておきます。

接続には、SQL*Plus を使って接続します。

手順概要

  • Oracle Instance Client をインストール
  • Wallet をダウンロードして、所定の位置に格納
  • SQL*Plus から接続

Oracle Instance Client Install

次の URL から、Oracle Instance Client をダウンロードできます。
https://www.oracle.com/jp/topics/technologies/download-instant-client.html

お使いの環境に合わせて選択

1599689004663.png

こちら

1599689059949.png

今回は2種類の物をダウンロードします

  • Basic Package
  • SQL*Plus Package

ここから zip ファイルをダウンロード

1599689101969.png

ここからも zip ファイルをダウンロード

1599690074865.png

Microsoft Visual Studio 2017 Redistributable も必要なため Install

1599690231977.png

環境に合わせて、exe ファイルをダウンロードしてインストールしておきます

1599690474033.png

ダウンロードした2つの zip ファイルを解凍して、C ドライブ直下に格納します

  • instantclient-basic-windows.x64-19.8.0.0.0dbru.zip
  • instantclient-sqlplus-windows.x64-19.8.0.0.0dbru.zip

こんな感じで格納します。

C:\instantclient_19_8

1599690762260.png

次のフォルダを作成します。中身は空で大丈夫です。

C:\instantclient_19_8\network\admin

1599690877971.png

Wallet Download

OCI Console から、Wallet をダウンロードします

1599691254534.png

Download

1599691324684.png

password

1599691370660.png

ダウンロードした zip ファイルを解凍して次に全部格納

C:\instantclient_19_8\network\admin

1599691577061.png

tnsnames.ora のファイルの中身はこんな感じです。

adwsugi_high = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.ap-tokyo-1.oraclecloud.com))(connect_data=(service_name=sya6vphk3pzlkhq_adwsugi_high.adwc.oraclecloud.com))(security=(ssl_server_cert_dn="CN=adb.ap-tokyo-1.oraclecloud.com,OU=Oracle ADB TOKYO,O=Oracle Corporation,L=Redwood City,ST=California,C=US")))

adwsugi_low = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.ap-tokyo-1.oraclecloud.com))(connect_data=(service_name=sya6vphk3pzlkhq_adwsugi_low.adwc.oraclecloud.com))(security=(ssl_server_cert_dn="CN=adb.ap-tokyo-1.oraclecloud.com,OU=Oracle ADB TOKYO,O=Oracle Corporation,L=Redwood City,ST=California,C=US")))

adwsugi_medium = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.ap-tokyo-1.oraclecloud.com))(connect_data=(service_name=sya6vphk3pzlkhq_adwsugi_medium.adwc.oraclecloud.com))(security=(ssl_server_cert_dn="CN=adb.ap-tokyo-1.oraclecloud.com,OU=Oracle ADB TOKYO,O=Oracle Corporation,L=Redwood City,ST=California,C=US")))

sqlnet.ora のファイルのファイルの中身はこんな感じです。

WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="?/network/admin")))
SSL_SERVER_DN_MATCH=yes

SQL*Plus の起動

sqlplus.exe を実行します。

C:\instantclient_19_8

1599691750041.png

admin@ で接続します。

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 9 22:51:57 2020
Version 19.8.0.0.0

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

Enter user-name: admin@adwsugi_high
Enter password:
Last Successful login time: Wed Sep 02 2020 03:02:50 +00:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0

SQL>

SELECT 文を投げて、こんなかんじです。

SQL> select table_name from user_tables;

TABLE_NAME
--------------------------------------------------------------------------------
EXAMPLES
EXP_SD_46-13_35_26

SQL>

参考URL

Windows 10 - Oracle Instant Client and SQL Plus To Autonomous Database On Oracle Cloud
https://www.youtube.com/watch?v=SZmfPM1ZecU

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2