Preparing your external Oracle database

Prepare your external Oracle database by using the provided the database preparation scripts to help you streamline the process.

Before you begin

Download the database preparation scripts.

About this task

Procedure

  1. Install your Oracle database by using the provider's documentation.
  2. Run the create-ts.sql command to create the table spaces.

    Ensure that you update the DATAFILE path based on your Oracle installation.

  3. Create the database schema and user.
    1. Run the following command:
      
      alter session set "_ORACLE_SCRIPT"=true;
      
    2. Then, run the createuser.sql command.

      Ensure that you update the $dbuser$ and $dbpassword$ values based on your Oracle installation.

  4. Set up SSL and extract the certificate.
    1. Run the following commands, substituting your Oracle installation directory:
      
      export ORACLE_SID=orcl
      export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
      export PATH=/u01/app/oracle/product/19.0.0/dbhome_1/bin:$PATH
      
    2. Locate the following files, depending on your Oracle version:
      For Oracle 19c:
      Table 1. Oracle 19c
      File name Path
      listener.ora $ORACLE_HOME/network/admin
      sqlnet.ora $ORACLE_HOME/network/admin
      xdbwallet /u01/app/oracle/admin/orcl/xdb_wallet
      For Oracle 21c:
      Table 2. Oracle 21c
      File name Path
      listener.ora /u01/app/oracle/homes/OraDB21Home1/network/admin
      sqlnet.ora /u01/app/oracle/homes/OraDB21Home1/network/admin
      xdbwallet /u01/app/oracle/homes/OraDB21Home1/admin/orcl/xdb_wallet
    3. Update listener.ora:
      
      LISTENER =
        (DESCRIPTION_LIST =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname>)(PORT = 1521))
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
            (ADDRESS = (PROTOCOL = TCPS)(HOST = <hostname>)(PORT = 5500))
          )
        )
      
      SSL_VERSION = 1.2
      SSL_CLIENT_AUTHENTICATION = FALSE
      
      WALLET_LOCATION =
        (SOURCE =
          (METHOD = FILE)
          (METHOD_DATA =
            (DIRECTORY = /u01/app/oracle/admin/orcl/xdb_wallet)
          )
        )
      
    4. Update sqlnet.ora:
      
      SQLNET.AUTHENTICATION_SERVICES= (TCPS, NTS)
      NAMES.DIRECTORY_PATH= (TNSNAMES)
      
      SSL_VERSION = 1.2
      SSL_CLIENT_AUTHENTICATION = FALSE
      
      WALLET_LOCATION =
        (SOURCE =
          (METHOD = FILE)
          (METHOD_DATA =
            (DIRECTORY = /u01/app/oracle/admin/orcl/xdb_wallet)
          )
        )
      
    5. Restart Listener Control by running the following commands:
      
      lsnrctl stop
      lsnrctl start
      lsnrctl status
      

      Ensure that the listener shows that the services have started their instances and are in ready state.

      Draft comment: David
      Sample lsnrctl status output

      If the listener shows no services, run the following command:
      
      dbstart $ORACLE_HOME
      
    6. Extract the certificate by running the following commands:
      
      orapki wallet display -wallet /u01/app/oracle/admin/orcl/xdb_wallet
      orapki wallet export -wallet /u01/app/oracle/admin/orcl/xdb_wallet -dn 'CN=orcl' -cert /home/oracle/CA.cert
      cat /home/oracle/CA.cert