Create a Data Source for an ATP Database

Oracle WebLogic Server for Oracle Cloud Infrastructure provides two utility scripts to help you create Oracle Autonomous Transaction Processing (ATP) data sources:

  • A download script that downloads the ATP wallet files to a node
  • A create script that creates the data source using the downloaded ATP wallet files and data source properties you provide

To run the scripts, you need to access the nodes in your WebLogic domain as the opc user. The scripts are located in /opt/scripts/utils and can only be run as the oracle user.

The ATP database must allow the WebLogic Server compute instances to access the database listen port (1521 by default). Update your access control list (ACL), if necessary. See Security Tools for Serverless Deployments.

Download the ATP Wallet

The download script unpacks and copies the ATP wallet contents to a node.

Note:

The download script must be run before the create script that configures a data source.

If the data source target is the domain cluster, you must run the download script on every node in the cluster. If the target is individual servers, then run the script on those servers.

You need the public IP address of each node on which you plan to run the download script. Find the IP address on the compute instance details page in the Oracle Cloud Infrastructure console. Look up the bastion's public IP address and the private IP address of a node if the WebLogic domain is in a private subnet.

  1. Open an SSH connection to a node as the opc user.
    ssh -i <path_to_private_key> opc@<node_public_ip>

    Or,

    ssh -i <path_to_private_key> -o ProxyCommand="ssh -W %h:%p -i <path_to_private_key> opc@<bastion_public_ip>" opc@<node_private_ip>
  2. Change to the oracle user.
    sudo su oracle
  3. Run the script download_atp_wallet.sh by providing the following parameters:
    • OCID of the ATP database - You can find the OCID from the ATP database details page in the Oracle Cloud Infrastructure console.
    • Password for the ATP wallet - The password must be at least 8 characters long, and includes at least 1 letter and either 1 numeric character or 1 special character.
    • Path to save the extracted ATP wallet files - The path to a directory on the domain where the script saves the extracted ATP wallet files. For example:

      /u01/data/domains/thestack_domain/config/atp

      The directory must be identical on every node where you run the script.

    Command:

    /opt/scripts/utils/download_atp_wallet.sh <atp_database_ocid> <atp_wallet_password> <path_to_extract_wallet_files>

    Example:

    /opt/scripts/utils/download_atp_wallet.sh ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v password /u01/data/domains/servicename_domain/config/atp

    The download script creates a subdirectory in the path you provide using the ATP database OCID value. For example:

    /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v

    Seven files are extracted to the subdirectory. The following is an example of the script response:

    <Aug 22, 2019 10:39:50 PM GMT> <INFO> <oci_utils> <(host:servicename-wls-0.subnet_dns_domain_name) - <WLSC-VM-INFO-001> ATP Wallet downloaded>
    Archive:  /tmp/atp_wallet.zip
      inflating: /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v/cwallet.sso
      inflating: /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v/tnsnames.ora
      inflating: /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v/truststore.jks
      inflating: /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v/ojdbc.properties
      inflating: /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v/sqlnet.ora
      inflating: /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v/ewallet.p12
      inflating: /u01/data/domains/servicename_domain/config/atp/ocid1.autonomousdatabase.oc1.phx.a1b2c3d4e56z7y8x9w10v/keystore.jks
  4. Repeat steps 1 through 3 on each node where you have to run the download script. Depending on the data source target, run the download script on every node in the cluster or on individual servers.

Configure a Data Source for an ATP Database

The create script configures a JDBC data source using the downloaded ATP wallet files and the data source properties you provide.

Note:

You must run the download script before you run the create script to configure the data source.

When you execute the create script, you can let the script prompt you for the properties one at a time, or you can supply the properties in a configuration file.

  1. Before you run the create script, prepare the required information for the following data source properties. If you plan to provide a properties configuration file when you run the create script, put each property name and value pair on one line. For example:
    ds.name=myds1
    ds.jndi.name=jdbc/myds1
    Property Description Property Name Required

    Name for the JDBC data source

    ds.name

    Y

    OCID of the ATP database

    atp.db.id

    Y

    Path to the extracted ATP wallet files

    atp.wallet.path

    Y

    ATP database user name

    db.user

    Y

    ATP database user password

    db.password

    Y

    ATP wallet password.

    This is the password you provided when you ran the download script.

    db.wallet.password

    Y

    WebLogic Server administrator user name

    wls.admin.user

    Y

    WebLogic Server administrator password

    wls.admin.password

    Y

    t3 or t3s URL to the WebLogic Administration Server node

    wls.admin.url

    Y

    Type of target on which to deploy the data source. Value: Cluster or Server

    ds.target.type

    Y

    Name of the cluster or a comma separated list of server names

    ds.target.names

    Y

    JNDI namespace

    Default is jdbc/<ds.name>

    ds.jndi.name

    N

    ATP database service for the data source connection. Value: low (default), medium, tp, or tpurgent

    db.level

    N

    JDBC driver class

    Default is oracle.jdbc.OracleDriver

    ds.jdbc.driver

    N

  2. Open an SSH connection to any node as the opc user, then change to the oracle user.
  3. Run the script create_atp_datasource.sh in one of the following ways:
    • Execute and follow user prompts:

      /opt/scripts/utils/create_atp_datasource.sh

      At each prompt, enter a value or press Enter to accept the default value. The following is an example of the script response after entering the values:

      INFO: Found wallet config file
      INFO: Verifying existing datasources.
      INFO: Verified that no existing data source has the same name.
      
      INFO: Created datasource configuration file /tmp/.ds_config
      INFO: Creating the datasource ==> datasource1
      INFO: Connecting to the admin server [t3://servicename-wls-0:7001]...
      INFO: Adding properties to datasource
      INFO: Target Type : Server
      INFO: Targets : servicename_server_1
      INFO: Setting targets [[com.bea:Name=servicename_server_1,Type=Server]]
      INFO: Successfully create datasource [datasource1]
      INFO: Validating the Datasource [datasource1]
      INFO: Verify datasource on Server AdminServer
      -- Datasource datasource1 not found on server AdminServer.
      INFO: Verify datasource on Server servicename_server_1
      -- datasource1:      State[Running] Connection Test is OK
    • Execute using a properties configuration file:

      /opt/scripts/utils/create_atp_datasource.sh <path_to_configuration_file_and_file_name>

      For example:

      /opt/scripts/utils/create_atp_datasource.sh /u01/.ds_config

      The following is an example of the script response:

      INFO: Creating the datasource ==> datasource1
      INFO: Connecting to the admin server [t3://servicename-wls-0:7001]...
      INFO: Adding properties to datasource
      INFO: Target Type : Server
      INFO: Targets : servicename_server_1,servicename_server_2
      INFO: Setting targets [[com.bea:Name=servicename_server_1,Type=Server, com.bea:Name=servicename_server_2,Type=Server]]
      INFO: Successfully create datasource [datasource1]
      INFO: Validating the Datasource [datasource1]
      INFO: Verify datasource on Server servicename_server_2
      -- datasource1:  State[Running] Connection Test is OK
      INFO: Verify datasource on Server servicename_server_3
      -- Datasource datasource1 not found on server servicename_server_3.
      INFO: Verify datasource on Server servicename_server_1
      -- datasource1:  State[Running] Connection Test is OK
      INFO: Verify datasource on Server AdminServer
      -- Datasource datasource1 not found on server AdminServer.