Utilizzo dell'interfaccia della riga di comando

Utilizzare l'interfaccia CLI per creare connessioni agli strumenti di database.

Per informazioni sull'uso dell'interfaccia CLI, vedere Command Line Interface (CLI). Per un elenco completo dei flag e delle opzioni disponibili per i comandi CLI, vedere Command Line Reference.

Argomenti:

Per le connessioni Oracle Database

Per creare una connessione ad ADB con IP pubblico utilizzando mTLS

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-oracle-database per creare una nuova connessione agli strumenti di database all'interno del compartimento specificato:

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>
Nota

In questo esempio si presume che i segreti richiesti esistano già in un vault.

Ad esempio, specificando tutti i dettagli richiesti come argomenti:

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

Per creare una connessione ad ADB con IP pubblico utilizzando mTLS nel file JSON

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-oracle-database per creare una nuova connessione a Database Tools come specificato nel file JSON:

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

In questo esempio si presume che i segreti richiesti esistano già in un vault.

Ad esempio, specificando tutti i dettagli richiesti in un file 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"
}
Nota

In questo esempio nella directory di lavoro corrente è presente un file JSON denominato example.json come mostrato sopra.
oci dbtools connection create-oracle-database --from-json "file://example.json"

Per creare una connessione a un sistema DB Oracle VM utilizzando un endpoint privato

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-oracle-database per creare una nuova connessione agli strumenti di database all'interno del compartimento specificato:

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>
Nota

In questo esempio si presume che i segreti richiesti esistano già in un vault.

Ad esempio:

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

Per creare una connessione proxy a Oracle Database con il nome utente

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-oracle-database per creare una nuova connessione agli strumenti di database all'interno del compartimento specificato:

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>
Nota

In questo esempio si presume che un endpoint privato e il segreto richiesto in un vault esistano già. Questo esempio può essere utilizzato senza autenticazione proxy.

Ad esempio:

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

Per creare una connessione proxy a Oracle Database con proprietà avanzate

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-oracle-database per creare una nuova connessione agli strumenti di database all'interno del compartimento specificato:

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>
Nota

In questo esempio si presume che un endpoint privato e il segreto richiesto in un vault esistano già. Questo esempio può essere utilizzato senza autenticazione proxy.

Ad esempio:

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" }'

Per creare una connessione proxy a Oracle Database con il parametro proxy-client

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-oracle-database per creare una nuova connessione agli strumenti di database all'interno del compartimento specificato:

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>
Nota

In questo esempio si presume che un endpoint privato e il segreto richiesto in un vault esistano già. Questo esempio può essere utilizzato senza autenticazione proxy.

Ad esempio:

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" ]}'

Per creare una connessione proxy a Oracle Database con il parametro proxy-client nel file JSON

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-oracle-database per creare una nuova connessione a Database Tools come specificato nel file JSON:

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

In questo esempio si presume che un endpoint privato e il segreto richiesto in un vault esistano già. Questo esempio può essere utilizzato senza autenticazione proxy.

Ad esempio, specificando tutti i dettagli richiesti in un file 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" ]
  }
}

Per connessioni a MySQL Database

Per creare una connessione a un MySQL Database

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-mysql-database per creare una nuova connessione agli strumenti di database all'interno del compartimento specificato:

oci dbtools connection create-mysql-database -c <target_compartment_ocid> --user-name <database_user> --user-password-secret-id <vault_secret_ocid> --connection-string <connection_string> --display-name <connection_name>
Nota

In questo esempio si presume che il segreto richiesto in un vault esista già.

Ad esempio:

oci dbtools connection create-mysql-database -c ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz --user-name "example-user" --user-password-secret-id ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya --connection-string "mysql://public-ip-or-fqdn:3306/exampledatabase" --display-name example-connection

Per creare una connessione a un sistema DB MySQL

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-mysql-database per creare una nuova connessione agli strumenti di database all'interno del compartimento specificato:

oci dbtools connection create-mysql-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>
Nota

In questo esempio si presume che un endpoint privato e il segreto richiesto in un vault esistano già.

Ad esempio:

oci dbtools connection create-mysql-database -c ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz --user-name "example-user" --user-password-secret-id ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsabcdefzf3423ya --connection-string "mysql://10.0.0.42:3306/exampledatabase" --private-endpoint-id cid1.databasetoolsprivateendpoint.oc1.phx.exampleendpoint25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabcdefg --display-name example-connection

Per creare una connessione a un sistema DB MySQL tramite JSON

Aprire un prompt dei comandi ed eseguire oci dbtools connection create-mysql-database per creare una nuova connessione a Database Tools come specificato nel file JSON:

oci dbtools connection create-mysql-database --from-json "file://<path-to-json>"
Nota

In questo esempio si presume che un endpoint privato e il segreto richiesto in un vault esistano già.

Ad esempio, specificando tutti i dettagli richiesti in un file JSON:

{  
    "compartmentId": "ocid1.compartment.oc1..example1example25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabwk3zz",  
    "userName": "example-user",  
    "userPasswordSecretId": "ocid1.vaultsecret.oc1.phx.example1secrettxiu7mwuabcdefxl67fj5niy4akfzsababcdefzf3423ya",  
    "connectionString": "mysql://10.0.0.42:3306/exampledatabase",  
    "privateEndpointId": "cid1.databasetoolsprivateendpoint.oc1.phx.exampleendpoint25qrlpo4agcmothkbgqgmuz2zzum45ibplooqtabcdefg",  
    "displayName": "example-connection-from-json"
}
Nota

In questo esempio, nella directory di lavoro corrente è presente un file JSON denominato example.json come mostrato sopra.
oci dbtools connection create-mysql-database --from-json "file://example.json"