A PL/SQLゲートウェイ・ユーザーの設定

この項では、PL/SQLゲートウェイ・ユーザーの設定方法について説明します。

PL/SQLゲートウェイ・ユーザーを設定するには、次のステップを実行します。
  1. ords*.zipファイルを解凍します。
  2. パスワードを提供するスクリプトを実行します。

    例:

    SQL> @install <password>
    install.sql
    set define '^'
    set termout on
     
    define PWD       = '^1'
     
    -- Create the schema to hold the stored proc. This account is not directly accessible
    create user sample_plsql_app identified by L0ck3dAcc0unt password expire account lock;
     
    -- create the application users
    create user example_user1 identified by ^PWD;
    create user example_user2 identified by ^PWD;
    grant connect to example_user1;
    grant connect to example_user2;
     
    alter session set current_schema=sample_plsql_app;
     
    -- define the stored procedure
    create or replace procedure sample_proc as
     l_user varchar(255) := owa_util.get_cgi_env('REMOTE_USER');
    begin
     htp.prn('<h1>Hello ' || l_user || '!</h1>');
    end;
    /
     
    -- authorize users to access stored proc
    grant execute on sample_plsql_app.sample_proc to example_user1;
    grant execute on sample_plsql_app.sample_proc to example_user2;
     
    quit
    前のサンプルでは、次の3つのデータベース・ユーザーが作成されます。
    • SAMPLE_PLSQL_APP - 保護されたSAMPLE_PROCがインストールされるデータベース・スキーマ
    • EXAMPLE_USER1 - SAMPLE_PLSQL_APP.SAMPLE_PROCに対する実行権限が付与されたデータベース・ユーザー
    • EXAMPLE_USER2 - SAMPLE_PLSQL_APP.SAMPLE_PROCに対する実行権限が付与された2番目のデータベース・ユーザー

    非対話型インストール・コマンドを使用し、プロキシ設定されたオプション--gateway-user <database user>および--gateway-modeを含めて、PL/SQLゲートウェイ・ユーザーがプロキシ・ユーザーであることを示します。

PL/SQLゲートウェイ・ユーザーの構成

非対話型の例:

./bin/ords --config /path/to/test/config install-cli --db-pool pdb2 --admin-user SYS --proxy-user --db-hostname localhost --db-port 1521 --db-servicename pdb1 --feature-sdw true --gateway-user EXAMPLE_USER1 --gateway-mode proxied --log-folder /path/to/logs < password.txt

ORDSがローカルホストのポート8080でスタンドアロン・モードで実行されている場合、Webブラウザで次のURLにアクセスします: http://localhost:8080/ords/pdb2/sample_plsql_app.sample_proc。ブラウザには次のテキストが表示されます

Hello EXAMPLE_USER1!