Oracle Database接続

mTLSを使用してパブリックIPを持つADBへの接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database -c <target_compartment_ocid> --user-name <database_user> --user-password-secret-id <vault_secret_ocid> --key-stores <keystore_json_array> --connection-string <connection_string> --display-name <connection_name>
ノート

この例では、必要なシークレットがボールトにすでに存在することを前提としています。

たとえば、引数として必要なすべての詳細を指定します。

oci dbtools connection create-oracle-database -c ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz --user-name "example-user" --user-password-secret-id ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya --key-stores '[{ "keyStoreContent":{ "secretId": "ocid1.vaultsecret.oc1.phx.example1ssowalletxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya","valueType": "SECRETID" }, "keyStoreType": "SSO" }]' --connection-string '(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=example_databaseservice_low.adb.oraclecloud.com))(security=(ssl_server_cert_dn="CN=adwc.uscom-east-1.oraclecloud.com, OU=Oracle BMCS US, O=Oracle Corporation, L=Redwood City, ST=California, C=US")))' --display-name example-connection

JSONファイルでmTLSを使用してパブリックIPを持つADBへの接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、JSONファイルの指定に従って新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --from-json "file://<path-to-json>"
ノート

この例では、必要なシークレットがボールトにすでに存在することを前提としています。

たとえば、JSONファイルで必要なすべての詳細を指定します:

{
  "compartmentId": "ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz",
  "connectionString": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-phoenix-1.oraclecloud.com))
(connect_data=(service_name=example_databaseservice_low.adb.oraclecloud.com))
(security=(ssl_server_cert_dn=\"CN=adwc.uscom-east-1.oraclecloud.com, OU=Oracle BMCS US, O=Oracle Corporation, L=Redwood City, ST=California, C=US\")))",
  "displayName": "example-connection-from-json",
  "keyStores": [
    {
      "keyStoreContent": {
        "secretId": "ocid1.vaultsecret.oc1.phx.example1ssowalletxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya",
        "valueType": "SECRETID"
      },
      "keyStoreType": "SSO"
    }
  ],
  "userName": "example-user",
  "userPasswordSecretId": "ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya"
}
ノート

この例では、前述のように、現在の作業ディレクトリにexample.jsonというJSONファイルがあります。
oci dbtools connection create-oracle-database --from-json "file://example.json"

プライベート・エンドポイントを使用してOracle VM DBシステムへの接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database -c <target_compartment_ocid> --user-name <database_user> --user-password-secret-id <vault_secret_ocid> --connection-string <connection_string> -private-endpoint-id <private_endpoint_ocid> --display-name <connection_name>
ノート

この例では、必要なシークレットがボールトにすでに存在することを前提としています。

次に例を示します。

oci dbtools connection create-oracle-database -c ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz --user-name "example-user" --user-password-secret-id ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya --connection-string "examplevmdb.privatesubnet.example.oraclevcn.com:1521/example_pdb.privatesubnet.example.oraclevcn.com" --private-endpoint-id ocid1.databasetoolsprivateendpoint.oc1.phx.exampleendpoint25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabcdefg --display-name example-connection

ユーザー名を使用してOracle Databaseへのプロキシ接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database -c <target_compartment_ocid> 
--user-name <database_user[proxy_client]> --user-password-secret-id <vault_secret_ocid> 
--key-stores <keystore_json_array> --connection-string <connection_string> 
--private-endpoint-id <private_endpoint_ocid> --display-name <connection_name>
ノート

この例では、プライベート・エンドポイントおよびボールトの必要なシークレットがすでに存在することを前提としています。この例は、プロキシ認証なしで使用できます。

次に例を示します。

oci dbtools connection create-oracle-database -c ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz --user-name "example-user[proxy-client]" --user-password-secret-id ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya --connection-string "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=example_databaseservice_low.adb.oraclecloud.com))(security=(ssl_server_cert_dn="CN=adwc.uscom-east-1.oraclecloud.com,OU=Oracle BMCS US, O=Oracle Corporation, L=Redwood City, ST=California, C=US")))" --key-stores '[{ "keyStoreContent":{ "secretId": "ocid1.vaultsecret.oc1.phx.example1ssowalletxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya", "valueType": "SECRETID" }, "keyStoreType": "SSO" }]' --private-endpoint-id ocid1.databasetoolsprivateendpoint.oc1.phx.exampleendpoint25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabcdefg --display-name example-connection

拡張プロパティを使用してOracle Databaseへのプロキシ接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database -c <target_compartment_ocid> 
--user-name <database_user> --user-password-secret-id <vault_secret_ocid> --key-stores <keystore_json_array>
--connection-string <connection_string> --private-endpoint-id <private_endpoint_ocid>
--display-name <connection_name> --advanced-properties <advanced_properties_json>
ノート

この例では、プライベート・エンドポイントおよびボールトの必要なシークレットがすでに存在することを前提としています。この例は、プロキシ認証なしで使用できます。

次に例を示します。

oci dbtools connection create-oracle-database -c ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz --user-name "example-user" --user-password-secret-id ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya --connection-string "(description= retry_count=20)(retry_delay=3)(address=(protocol=tcps) (port=1522)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=example_databaseservice_low.adb.oraclecloud.com)) (security=(ssl_server_cert_dn="CN=adwc.uscom-east-1.oraclecloud.com, OU=Oracle BMCS US, O=Oracle Corporation, L=Redwood City, ST=California, C=US")))" --key-stores '[{ "keyStoreContent":{ "secretId": "ocid1.vaultsecret.oc1.phx.example1ssowalletxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya", "valueType": "SECRETID" }, "keyStoreType": "SSO" }]' --private-endpoint-id ocid1.databasetoolsprivateendpoint.oc1.phx.exampleendpoint25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabcdefg --display-name example-connection --advanced-properties '{ "oracle.jdbc.proxyClientName": "proxy-client" }'

proxy-clientパラメータを使用してOracle Databaseへのプロキシ接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database -c <target_compartment_ocid> --user-name
<database_user> --user-password-secret-id <vault_secret_ocid> --key-stores <keystore_json_array>
--connection-string <connection_string> --private-endpoint-id <private_endpoint_ocid>
--display-name <connection_name> --proxy-client <proxy_client_json>
ノート

この例では、プライベート・エンドポイントおよびボールトの必要なシークレットがすでに存在することを前提としています。この例は、プロキシ認証なしで使用できます。

次に例を示します。

oci dbtools connection create-oracle-database -c ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz --user-name "example-user" --user-password-secret-id ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya --connection-string "(description=(retry_count=20)(retry_delay=3)(address=(protocol=tcps) (port=1522)(host=adb.us-phoenix-1.oraclecloud.com)) (connect_data=(service_name=example_databaseservice_low.adb.oraclecloud.com)) (security=(ssl_server_cert_dn="CN=adwc.uscom-east-1.oraclecloud.com, OU=Oracle BMCS US, O=Oracle Corporation, L=Redwood City, ST=California, C=US")))" --key-stores '[{ "keyStoreContent":{ "secretId": "ocid1.vaultsecret.oc1.phx.example1ssowalletxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya", "valueType": "SECRETID" }, "keyStoreType": "SSO" }]' --private-endpoint-id ocid1.databasetoolsprivateendpoint.oc1.phx.exampleendpoint25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabcdefg --display-name example-connection --proxy-client '{ "proxy-authentication-type": "USER_NAME", "user-name": "proxy-client", "roles": [ "connect" ]}'

JSONファイルのproxy-clientパラメータを使用してOracle Databaseへのプロキシ接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、JSONファイルの指定に従って新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --from-json "file://<path-to-json>"
ノート

この例では、プライベート・エンドポイントおよびボールトの必要なシークレットがすでに存在することを前提としています。この例は、プロキシ認証なしで使用できます。

たとえば、JSONファイルで必要なすべての詳細を指定します:

{
  "compartmentId": "ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz",
  "connectionString": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=example_databaseservice_low.adb.oraclecloud.com))(security=(ssl_server_cert_dn=\"CN=adwc.uscom-east-1.oraclecloud.com, OU=Oracle BMCS US, O=Oracle Corporation, L=Redwood City, ST=California, C=US\")))",
  "displayName": "example-connection-from-json",
  "keyStores": [
    {
      "keyStoreContent": {
        "secretId": "ocid1.vaultsecret.oc1.phx.example1ssowalletxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya",
        "valueType": "SECRETID"
      },
      "keyStoreType": "SSO"
    }
  ],
  "userName": "example-user",
  "userPasswordSecretId": "ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya",
  "proxyClient": {
     "proxyAuthenticationType": "USER_NAME",
     "userName": "proxyClient",
     "userPassword": {
        "valueType": "SECRETID",
        "secretId": "ocid1.vaultsecret.oc1.phx.amaaaaaacsc5xjaanv6tjndg4dujfcarguywkftbvgsolw5w6fb22rhpb6ta"
     },
     "roles": [ "connect" ]
  }
}

IAM認証済接続

IAMトークンベース認証を使用してOracle Databaseへの接続を作成するには

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --compartment-id <compartment_ocid> 
--display-name <connection_name> --connection-string <connection_string> --authentication-type TOKEN

次に例を示します。

oci dbtools connection create-oracle-database --compartment-id ocid1.compartment.oc1..exampleexamplegs3lajseq 
--display-name example-iam-connection 
--connection-string "(description=(retry_count=0)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<adb-hostname>))(connect_data=(service_name=service-name))(security=(ssl_server_dn_match=yes)))" 
--authentication-type TOKEN

IAMトークンベース認証を使用してOracle Databaseへのプロキシ接続を作成するには

このオプションは、IAMがプロキシ・ユーザーを認証し、データベース・セッションがプロキシ・クライアント・ユーザーとして確立されている場合に使用します。

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --compartment-id <compartment_ocid> --display-name <connection_name> 
--connection-string <connection_string> --user-name '[proxy_client1]' --authentication-type TOKEN

次に例を示します。

 oci dbtools connection create-oracle-database --compartment-id ocid1.compartment.oc1..example7augka7wugqsmsdcyw5olcazkp4no3h47lia 
--display-name proxy-abc --connection-string "(description=(retry_count=0)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<adb-hostname>))(connect_data=(service_name=<service-name))(security=(ssl_server_dn_match=yes)))'"
--user-name '[proxy_client1]' --authentication-type TOKEN --endpoint "https://dbtools.<region>.oci.oraclecloud.com" 

パスワード認証を使用してユーザー名でプロキシ接続を作成するには

このオプションは、データベース・パスワードで認証し、プロキシ・クライアント・ユーザーを介して接続する場合に使用します。

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --compartment-id <compartment_ocid> 
--display-name <connection_name> --connection-string <connection_string> --user-name 'proxy_user[proxy_client1]' 
--authentication-type PASSWORD --user-password-secret-id <password-secret-ocid>

次に例を示します。

oci dbtools connection create-oracle-database --compartment-id ocid1.compartment.oc1..exampleaugka7wugqsmsdcyw5olcazkp4no3h47lia
--display-name proxy-abc --connection-string "(description=(retry_count=0)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<adb-hostname>))(connect_data=(service_name=service-name))(security=(ssl_server_dn_match=yes)))" 
--user-name 'proxy_user[proxy_client1]' --authentication-type PASSWORD 
--user-password-secret-id ocid1.vaultsecret.oc1.exampleaaiaqsoeecjlur7kyptlhu7yggiffb5oqdvfayf6rozrpxma

パスワード認証を使用して拡張プロパティを使用してプロキシ接続を作成するには

このオプションは、接続プロパティを使用してプロキシ・クライアント・ユーザーを指定する場合に使用します。

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --compartment-id <compartment_ocid> --display-name <connection_name>
--connection-string <connection_string> --user-name proxy_user --authentication-type PASSWORD
--user-password-secret-id <vault_secret_ocid> --advanced-properties '{ "oracle.jdbc.proxyClientName": "proxy_client1" }' --endpoint <region-url>

次に例を示します。

oci dbtools connection create-oracle-database --compartment-id ocid1.compartment.oc1..exampleaugka7wugqsmsdcyw5olcazkp4no3h47lia
--display-name proxy-abc --connection-string  "(description=(retry_count=0)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<adb-hostname>))(connect_data=(service_name=service-name))(security=(ssl_server_dn_match=yes)))"
--user-name proxy_user --authentication-type PASSWORD --user-password-secret-id ocid1.vaultsecret.oc1.examplekyptlhu7yggiffb5oqdvfayf6rozrpxma
--advanced-properties '{"oracle.jdbc.proxyClientName":"proxy_client1"}' --endpoint "https://dbtools.<region>.oci.oraclecloud.com/20201005" 

トークンベース認証を使用して拡張プロパティを使用してプロキシ接続を作成するには

このオプションは、接続プロパティを使用してプロキシ・クライアント・ユーザーを指定する場合に使用します。

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --compartment-id <compartment_ocid> --display-name <connection_name>
--connection-string <connection_string> --user-name proxy_user --authentication-type TOKEN
--advanced-properties '{ "oracle.jdbc.proxyClientName": "proxy_client1" }' --endpoint <region-url>

次に例を示します。

oci dbtools connection create-oracle-database --compartment-id ocid1.compartment.oc1..exampleaugka7wugqsmsdcyw5olcazkp4no3h47lia
--display-name proxy-abc --connection-string  "(description=(retry_count=0)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<adb-hostname>))(connect_data=(service_name=service-name))(security=(ssl_server_dn_match=yes)))"
--user-name proxy_user --authentication-type TOKEN --advanced-properties '{"oracle.jdbc.proxyClientName":"proxy_client1"}' 
--endpoint "https://dbtools.<region>.oci.oraclecloud.com" 

パスワード認証を使用してプロキシ・クライアント・パラメータでプロキシ接続を作成するには

このオプションを使用して、プロキシ・クライアントの詳細を明示的に指定します。

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --compartment-id <compartment_ocid> --display-name <connection_name>
--connection-string <connection_string> --user-name proxy_user --authentication-type PASSWORD
--user-password-secret-id <vault_secret_ocid> --proxy-client <proxy_client_json> --endpoint <region-url>

次に例を示します。

oci dbtools connection create-oracle-database --compartment-id ocid1.compartment.oc1..examplewugqsmsdcyw5olcazkp4no3h47lia
--display-name proxy-abc--connection-string '(description=(retry_count=0)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<adb-hostname>))(connect_data=(service_name=service-name))(security=(ssl_server_dn_match=yes)))'
--user-name 'proxy_user' --authentication-type PASSWORD 
--user-password-secret-id ocid1.vaultsecret.oc1.exampleyptlhu7yggiffb5oqdvfayf6rozrpx
--proxy-client '{"proxyAuthenticationType":"USER_NAME","userName":"proxy_client1"}'
--endpoint 'https://dbtools.<region>.oci.oraclecloud.com'

トークンベース認証を使用して自動検出されたプロキシ・クライアントでプロキシ接続を作成するには

このオプションを使用して、実行時にプロキシ・クライアントを動的に決定します。

コマンド・プロンプトを開き、oci dbtools connection create-oracle-databaseを実行して、指定したコンパートメント内に新しいデータベース・ツール接続を作成します:

oci dbtools connection create-oracle-database --compartment-id <compartment_ocid> --display-name <connection_name>
--connection-string <connection_string> --authentication-type TOKEN 
--proxy-client '{"proxyAuthenticationType":"USER_NAME","userName":"<proxy-client>"}' --endpoint <region-url>

次に例を示します。

oci dbtools connection create-oracle-database --compartment-id ocid1.compartment.oc1..exampleugka7wugqsmsdcyw5olcazkp4no3h47lia
--display-name proxy-abc --connection-string '(description=(retry_count=0)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<adb-hostname>))(connect_data=(service_name=service-name))(security=(ssl_server_dn_match=yes)))'
--authentication-type TOKEN --proxy-client '{"proxyAuthenticationType":"USER_NAME_AUTO_DETECT"}'
--endpoint 'https://dbtools.<region>.oci.oraclecloud.com'