Non-Interactive ORDS Installation with custom database XOR PL/SQL gateway user.

           Non-Interactive ORDS Installation process

 

This blog will provide some examples for non-interactive install/upgrade, it covers multiple scenarios specially if you want to install ORDS with a custom database XOR PL/SQL gateway user. 

Note:
  • During installation, ORDS_PUBLIC_USER will always be created, you can define its password via --proxy-user sub-command, or otherwise a random password will be generated. 

Install/Upgrade ORDS with default user 

1.1. Install: 

  • The runtime and database user is defaulted in this case to ORDS_PUBLIC_USER.
  • Within the configuration file, the db.username will be set to ORDS_PUBLIC_USER, and its password will be stored within the wallet.
  • Consider using  "--proxy-user" sub-command if you want to define a password for ORDS_PUBLIC_USER.
  • Secret file contains the password for the admin user (SYS in this case). 

 ords --config  /path/to/config  install
     --db-pool oradb 
     --db-hostname localhost
     --db-port 1521 
     --db-servicename freepdb1
     --feature-sdw true 
     --admin-user SYS 
     --password-stdin < secret.txt

1.2. Upgrade: 

  • Secret file contains the password for the admin user (SYS in this case)
  • All the required information (database user password and DB connection information) will be retrieved from the configuration file.
ords --config /path/to/config install 
     --db-pool oradb 
     --admin-user SYS 
     --password-stdin < secret.txt
  • If the configuration file is obsolete or you want to create it in another location while updating ORDS:
ords --config /path/to/config install 
     --db-pool oradb 
     --db-hostname localhost 
     --db-port 1521 
     --db-servicename freepdb1
     --feature-sdw true 
     --admin-user SYS 
     --password-stdin < secret.txt
  • If you only want to perform an upgrade without creating/updating the configuration files - You must specify the "--db-only" option and provide the database connection information
  • Secret file contains the password for the admin user (SYS in this case)

 ords install 
    --db-only 
    --admin-user SYS 
    --db-hostname localhost
    --db-port 1521 
    --db-servicename freepdb1 
    --password-stdin < secret.txt



 Install/Upgrade ORDS with custom database and PL/SQL gateway user

2.1. Install

2.1.1. Connect to your database as an admin user and create the required users and assign grants:

CREATE USER CUSTOM_USER identified by <secret>;
GRANT CONNECT TO CUSTOM_USER;
 
CREATE USER CUSTOM_PLSQL_GATEWAY_USER identified by <secret>;
GRANT CONNECT TO CUSTOM_PLSQL_GATEWAY_USER;

2.1.2. Install ORDS: 

  • "--proxy-user" sub-command to specify a custom password for ORDS_PUBLIC_USER.
  • The database user in this case is CUSTOM_USER.
  • The secret file contains 3 secrets: (for --admin-user, --proxy-user, --db-user)

    • Admin user password (SYS in this case)
    • Proxy user password (ORDS_PUBLIC_USER password)
    • DB user password (CUSTOM_USER in this case)
ords --config /path/to/config install 
     --proxy-user 
     --db-pool oradb 
     --db-hostname localhost 
     --db-port 1521 
     --db-servicename freepdb1 
     --admin-user SYS 
     --db-user CUSTOM_USER 
     --gateway-user CUSTOM_PLSQL_GATEWAY_USER 
     --feature-sdw true 
     --password-stdin < secrets.txt

2.1.3. Connect to your database as an admin user and run the following:

Provision the database user (CUSTOM_USER) so that it can act as an ORDS runtime user.

execute ORDS_ADMIN.PROVISION_RUNTIME_ROLE( 
            p_user => 'CUSTOM_USER',
            p_proxy_enabled_schemas => TRUE);

Configure the database proxy user (CUSTOM_PLSQL_GATEWAY_USER) that must be used for PL/SQL Gateway calls serviced by the custom runtime user (CUSTOM_USER).


execute ORDS_ADMIN.CONFIG_PLSQL_GATEWAY( 
            p_runtime_user => 'CUSTOM_USER'
            p_plsql_gateway_user => 'CUSTOM_PLSQL_GATEWAY_USER');

2.1.4. Verification 

select * from sys.proxy_users where proxy='CUSTOM_USER';
select * from ords_metadata.plsql_gateway_config;

2.2. Update

  • Because ORDS_PUBLIC_USER was not defined as the runtime/dbuser, its password must be included via "--proxy-user" option.
  • The secret file contains 2 secrets: (for --admin-user, --proxy-user)

    • Admin user password (SYS in this case)
    • Proxy user password (ORDS_PUBLIC_USER password)
ords --config /path/to/config install
     --db-pool oradb 
     --proxy-user 
     --admin-user SYS 
     --password-stdin < secrets.txt
  • If the password of ORDS_PUBLIC_USER was not specified during the first installation, you can either 
    • Directly upgrade its password within the database and then specify it during the upgrade.
    • Use ORDS CLI to update both ORDS and the password of ORDS_PUBLIC_USER.
      • Note that in this case you'll need to provide all the necessary information to the CLI.
      • The configuration file will either be created or updated if it exits. 
ords --config /path/to/config install 
     --proxy-user --db-pool oradb 
     --db-hostname localhost 
     --db-port 1521 
     --db-servicename freepdb1 
     --admin-user SYS 
     --db-user CUSTOM_USER
     --gateway-user CUSTOM_PLSQL_GATEWAY_USER 
     --feature-sdw true 
     --password-stdin < secrets.txt


3. Install adb command with custom runtime and PL/SQL gateway user.

  • No need to manually create the users (db user and gateway user), and no need to setup the runtime user and config_plsql_gateway. They will automatically be configured/created.
  • No no need to use "--proxy-user" option when you're running an ORDS install in ABD context.
  • The secret file contains secrets for: (--admin-user, --db-user and --gateway-user) 
    • Admin user password (ADMIN in this case)
    • DB user password (CUSTOM_USER in this case)
    • GATEWAY user password  ( CUSTOM_PLSQL_GATEWAY_USER in this case)
ords --config /path/to/config install adb     
       --admin-user ADMIN     
       --db-user CUSTOM_USER 
       --gateway-user CUSTOM_PLSQL_GATEWAY_USER 
       --wallet /path/to/wallet 
       --wallet-service-name <name>     
       --feature-sdw true
       --password-stdin < secrets.txt




You can check the official documentation for more information: 



























Comments

Popular posts from this blog

Introduction to Oracle Rest Data Services (ORDS) – A Beginner’s Guide

Response Format and REST-Enabled SQL service in ORDS

ORDS Auto REST vs C# with Entity Framework.