ORDSがデフォルト・プールを使ってPDBに接続している場合、以下のURLよりAPEXにアクセスできます。
最初にPDBをクローンします。
[oracle@apex-test config]$ sqlplus / as sysdba
SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Wed May 24 15:54:38 2023
Version 23.2.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 FREEPDB1 READ WRITE NO
SQL>
alter pluggable database freepdb2 open read write;
SQL> create pluggable database freepdb2 from freepdb1 file_name_convert = ('FREEPDB1','FREEPDB2');
Pluggable database created.
SQL> alter pluggable database freepdb2 open read write;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 FREEPDB1 READ WRITE NO
4 FREEPDB2 READ WRITE NO
SQL> exit
追加したPDBに接続する接続プールを、ORDSに作成します。
対話的に接続プールを追加
- 接続プールの追加のみを行うので、3のCreate or update a database pool onlyを選択します。
- 追加する接続プールは新規作成なので、2のCreate an additional database poolを選択します。
- Enter the database pool nameに作成する接続プールの名前を与えます。今回は接続プール名をpdb2としています。
- データベースへの接続情報として1のBasicを選択し、接続先ホスト名、ポート番号、サービス名を指定します。サービス名はfreepdb2になります。
- 有効にするORDSの機能を指定します。今回は1を選択しています。
- すでにWebサーバーは設定されているためSkipを選択し、構成を終了します。
[oracle@apex-test config]$ ords --config /etc/ords/config install
ORDS: Release 23.1 Production on Thu May 25 07:36:07 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
Oracle REST Data Services - Interactive Install
Enter a number to select the type of installation
[1] Install or upgrade ORDS in the database only
[2] Create or update a database pool and install/upgrade ORDS in the database
[3] Create or update a database pool only
Choose [1]: 3
Enter a number to select the database pool to update, or create an additional database pool.
[1] default jdbc:oracle:thin:@//localhost:1521/freepdb1
[2] Create an additional database pool
Choose [1]: 2
Enter the database pool name: pdb2
Enter a number to select the database connection type to use
[1] Basic (host name, port, service name)
[2] TNS (TNS alias, TNS directory)
[3] Custom database URL
Choose [1]:
Enter the database host name [localhost]:
Enter the database listen port [1521]:
Enter the database service name [orcl]: freepdb2
Enter a number to select additional feature(s) to enable:
[1] Database Actions (Enables all features)
[2] REST Enabled SQL and Database API
[3] REST Enabled SQL
[4] Database API
[5] None
Choose [1]:
Enter a number to configure ORDS for standalone mode
[1] Configure ORDS for standalone mode
[2] Skip
Choose [1]: 2
The setting named: db.connectionType was set to: basic in configuration: pdb2
The setting named: db.hostname was set to: localhost in configuration: pdb2
The setting named: db.port was set to: 1521 in configuration: pdb2
The setting named: db.servicename was set to: freepdb2 in configuration: pdb2
The setting named: db.username was set to: ORDS_PUBLIC_USER in configuration: pdb2
The setting named: db.password was set to: ****** in configuration: pdb2
The setting named: feature.sdw was set to: true in configuration: pdb2
The setting named: restEnabledSql.active was set to: true in configuration: pdb2
The setting named: security.requestValidationFunction was set to: ords_util.authorize_plsql_gateway in configuration: pdb2
[oracle@apex-test config]$
ords --config /etc/ords/config config --db-pool pdb2 set plsql.gateway.mode proxied
[oracle@apex-test config]$ ords --config /etc/ords/config config --db-pool pdb2 set plsql.gateway.mode proxied
ORDS: Release 23.1 Production on Wed May 24 07:27:45 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
The setting named: plsql.gateway.mode was set to: proxied in configuration: pdb2
[oracle@apex-test config]$
[oracle@apex-test config]$ ords --config /etc/ords/config install --admin-user sys --db-pool pdb2 --db-hostname localhost --db-port 1521 --db-servicename freepdb2 --proxy-user
ORDS: Release 23.1 Production on Thu May 25 05:54:53 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
Enter the database password for SYS AS SYSDBA: ********
Enter the database password for ORDS_PUBLIC_USER: ********
Confirm password: ********
Oracle REST Data Services - Non-Interactive Install
Retrieving information.
Connecting to database user: ORDS_PUBLIC_USER url: jdbc:oracle:thin:@//localhost:1521/freepdb2
The setting named: db.password was set to: ****** in configuration: pdb2
2023-05-25T05:55:24.491Z INFO Updating ORDS_PUBLIC_USER database password in FREEPDB2
------------------------------------------------------------
Date : 25 May 2023 05:55:24
Release : Oracle REST Data Services 23.1.2.r1151944
Database : Oracle Database 23c Free,
DB Version : 23.2.0.0.0
[*** script: ords_change_password.sql]
PL/SQL procedure successfully completed.
2023-05-25T05:55:26.383Z INFO Completed updating database password for ORDS_PUBLIC_USER. Elapsed time: 00:00:01.808
[*** Info: Completed updating database password for ORDS_PUBLIC_USER. Elapsed time: 00:00:01.808
]
2023-05-25T05:55:26.384Z INFO To run in standalone mode, use the ords serve command:
2023-05-25T05:55:26.385Z INFO ords --config /etc/ords/config serve
2023-05-25T05:55:26.385Z INFO Visit the ORDS Documentation to access tutorials, developer guides and more to help you get started with the new ORDS Command Line Interface (http://oracle.com/rest).
[oracle@apex-test config]$
alter user ords_public_user identified by <パスワード>;
SQL> alter user ords_public_user identified by <パスワード>;
User altered.
SQL> exit
[oracle@apex-test config]$ ords --config /etc/ords/config config --db-pool pdb2 secret db.password
ORDS: Release 23.1 Production on Wed May 24 07:19:19 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
Enter the database password: ********
Confirm password: ********
The setting named: db.password was set to: ****** in configuration: pdb2
[oracle@apex-test config]$
create profile ords_public_user_prof limit password_rollover_time 1;
alter user ords_public_user profile ords_public_user_prof;
SQL> create profile ords_public_user_prof limit password_rollover_time 1;
Profile created.
SQL> alter user ords_public_user profile ords_public_user_prof;
User altered.
SQL> exit
sqlplus ords_public_user/現在のパスワード@localhost/freepdb2
[oracle@apex-test ~]$ sqlplus ords_public_user/現在のパスワード@localhost/freepdb2
SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Thu May 25 17:13:28 2023
Version 23.2.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Last Successful login time: Thu May 25 2023 17:09:59 +09:00
Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
SQL> exit
パスワードを変更します。
alter user ords_public_user identified by 新しいパスワード;
SQL> alter user ords_public_user identified by 新しいパスワード;
User altered.
SQL> exit
Gradual Database Password Rollover Time (PASSWORD_ROLLOVER_TIME) in Oracle Database 19c and 21c
https://oracle-base.com/articles/21c/gradual-database-password-rollover-time-21c
引数指定で接続プールを追加
[oracle@apex-test config]$ ords --config /etc/ords/config install \
> --admin-user sys \
> --db-pool pdb2 --db-hostname localhost --db-port 1521 --db-servicename freepdb2 \
> --feature-db-api true --feature-rest-enabled-sql true --feature-sdw true \
> --gateway-mode proxied --gateway-user APEX_PUBLIC_USER --proxy-user \
> --config-only
ORDS: Release 23.1 Production on Thu May 25 09:47:57 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
Enter the database password for SYS AS SYSDBA: ********
Enter the database password for ORDS_PUBLIC_USER: *******
Confirm password: ********
Oracle REST Data Services - Non-Interactive Install
The setting named: db.connectionType was set to: basic in configuration: pdb2
The setting named: db.hostname was set to: localhost in configuration: pdb2
The setting named: db.port was set to: 1521 in configuration: pdb2
The setting named: db.servicename was set to: freepdb2 in configuration: pdb2
The setting named: plsql.gateway.mode was set to: proxied in configuration: pdb2
The setting named: db.username was set to: ORDS_PUBLIC_USER in configuration: pdb2
The setting named: db.password was set to: ****** in configuration: pdb2
The setting named: feature.sdw was set to: true in configuration: pdb2
The setting named: restEnabledSql.active was set to: true in configuration: pdb2
The setting named: security.requestValidationFunction was set to: ords_util.authorize_plsql_gateway in configuration: pdb2
2023-05-25T09:48:05.695Z INFO To run in standalone mode, use the ords serve command:
2023-05-25T09:48:05.697Z INFO ords --config /etc/ords/config serve
2023-05-25T09:48:05.697Z INFO Visit the ORDS Documentation to access tutorials, developer guides and more to help you get started with the new ORDS Command Line Interface (http://oracle.com/rest).
[oracle@apex-test config]$
設定ファイルのコピー
alter user ords_public_user identified by <新しいパスワード>;
[oracle@apex-test ~]$ sqlplus sys/<SYSのパスワード>@localhost/freepdb2 as sysdba
SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Tue May 30 10:36:06 2023
Version 23.2.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
SQL> alter user ords_public_user identified by <新しいパスワード>;
User altered.
SQL> exit
Disconnected from Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
[oracle@apex-test ~]$
mkdir databases/pdb2
cp databases/default/pool.xml databases/pdb2/
[oracle@apex-test ~]$ cd /etc/ords/config
[oracle@apex-test config]$ mkdir databases/pdb2
[oracle@apex-test config]$ cp databases/default/pool.xml databases/pdb2/
接続先となるデータベースのサービス名を変更し、ウォレットに設定されているパスワードを更新します。
ords --config /etc/ords/config config --db-pool pdb2 set db.servicename freepdb2
ords --config /etc/ords/config config --db-pool pdb2 secret db.password
[oracle@apex-test config]$ ords --config /etc/ords/config config --db-pool pdb2 set db.servicename freepdb2
ORDS: Release 23.1 Production on Tue May 30 01:39:52 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
The setting named: db.servicename was set to: freepdb2 in configuration: pdb2
[oracle@apex-test config]$ ords --config /etc/ords/config config --db-pool pdb2 secret db.password
ORDS: Release 23.1 Production on Tue May 30 01:40:10 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
Enter the database password: <ORDS_PUBLIC_USERのパスワード>
Confirm password: <ORDS_PUBLIC_USERのパスワード>
The setting named: db.password was set to: ****** in configuration: pdb2
[oracle@apex-test config]$