20.7.1 DBMS_CLOUDのためのユーザーまたはロールへの最小権限の付与

DBMS_CLOUD機能を使用するユーザーまたはロールには、少なくとも最小アクセス権を付与する必要があります。

次の例で示す権限は、DBMS_CLOUD機能を使用するユーザーまたはロールに必要です。複数のユーザーがいる場合に必須権限を管理しやすくなるように、ロールを介して必須権限を付与することをお薦めします。

例20-2 ローカル・ロールの使用による権限の付与

このスクリプト例では、ローカル・ロールCLOUD_USER_ROLEを使用し、ローカル・ユーザーSCOTTに権限を付与します。このスクリプトを、ご使用のPDB環境用に必要に応じて変更し、プラガブル・データベース内で特権管理者(SYSSYSTEMなど)として実行できます。

set verify off
 
-- target example role
define userrole='CLOUD_USER_ROLL'
 
-- target sample user
define username='SCOTT'
 
create role &userrole;
grant &userrole to &username;
 
REM the following are minimal privileges to use DBMS_CLOUD
REM - this script assumes core privileges
REM - CREATE SESSION
REM - Tablespace quota on the default tablespace for a user
 
REM for creation of external tables, e.g. DBMS_CLOUD.CREATE_EXTERNAL_TABLE()
grant CREATE TABLE to &userrole;
 
REM for using COPY_DATA()
REM - Any log and bad file information is written into this directory
grant read, write on directory DATA_PUMP_DIR to &userrole;
 
REM grant as you see fit
grant EXECUTE on dbms_cloud to &userrole;
grant EXECUTE on dbms_cloud_pipeline to &userrole;
grant EXECUTE on dbms_cloud_repo to &userrole;
grant EXECUTE on dbms_cloud_notification to &userrole;

例20-3 個別ユーザーへの権限の付与

個別のユーザーにDBMS_CLOUD権限を付与することもできます。このスクリプト例では、権限をローカル・ユーザーSCOTTに付与しています。このスクリプトは、ご使用のPDB環境用に、必要に応じて変更できます。

set verify off
 
-- target sample user
define username='SCOTT'
 
REM the following are minimal privileges to use DBMS_CLOUD
REM - this script assumes core privileges
REM - CREATE SESSIONREM - Tablespace quota on the default tablespace for a user
 
REM for creation of external tables, e.g. DBMS_CLOUD.CREATE_EXTERNAL_TABLE()
grant CREATE TABLE to &username;
 
REM for using COPY_DATA()
REM - Any log and bad file information is written into this directory
grant read, write on directory DATA_PUMP_DIR to &username;
 
REM grant as you see fit
grant EXECUTE on dbms_cloud to &username;
grant EXECUTE on dbms_cloud_pipeline to &username;
grant EXECUTE on dbms_cloud_repo to &username;
grant EXECUTE on dbms_cloud_notification to &username;