How to Script Workspace Provisioning on Oracle Autonomous Database
apex-podman-setup % sql sys/oracle@********/freepdb1 as sysdba @create_workspace APEXDEV APEXDEV Welcome_1 noreply@oracle.com
SQLcl: 水 10月 23 10:32:52 2024のリリース23.4 Production
Copyright (c) 1982, 2024, Oracle. All rights reserved.
接続先:
Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.5.0.24.07
SQL>
SQL> define WKSPNAME = &1
SQL> define ADMINNAME = &2
SQL> define ADMINPASS = &3
SQL> define ADMINMAIL = &4
SQL>
SQL> -- create default parsing shema for worksapce apexdev.
SQL> create user wksp_&WKSPNAME default tablespace users temporary tablespace temp quota unlimited on users;
旧:create user wksp_&WKSPNAME default tablespace users temporary tablespace temp quota unlimited on users
新:create user wksp_APEXDEV default tablespace users temporary tablespace temp quota unlimited on users
User WKSP_APEXDEVは作成されました。
SQL>
SQL> begin
2
3 for c1 in (
4 select privilege from sys.dba_sys_privs
5 where grantee = 'APEX_GRANTS_FOR_NEW_USERS_ROLE'
6 )
7 loop
8 execute immediate 'grant ' || c1.privilege || ' to wksp_&WKSPNAME';
9 end loop;
10
11 apex_instance_admin.add_workspace(
12 p_workspace => '&WKSPNAME',
13 p_primary_schema => 'WKSP_&WKSPNAME'
14 );
15
16 apex_util.set_workspace('&WKSPNAME');
17
18 apex_util.create_user(
19 p_user_name => '&ADMINNAME',
20 p_web_password => '&ADMINPASS',
21 p_developer_privs => 'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL',
22 p_email_address => '&ADMINMAIL',
23 p_default_schema => 'WKSP_&WKSPNAME',
24 p_change_password_on_first_use => 'N'
25 );
26 end;
27 /
旧:begin
for c1 in (
select privilege from sys.dba_sys_privs
where grantee = 'APEX_GRANTS_FOR_NEW_USERS_ROLE'
)
loop
execute immediate 'grant ' || c1.privilege || ' to wksp_&WKSPNAME';
end loop;
apex_instance_admin.add_workspace(
p_workspace => '&WKSPNAME',
p_primary_schema => 'WKSP_&WKSPNAME'
);
apex_util.set_workspace('&WKSPNAME');
apex_util.create_user(
p_user_name => '&ADMINNAME',
p_web_password => '&ADMINPASS',
p_developer_privs => 'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL',
p_email_address => '&ADMINMAIL',
p_default_schema => 'WKSP_&WKSPNAME',
p_change_password_on_first_use => 'N'
);
end;
新:begin
for c1 in (
select privilege from sys.dba_sys_privs
where grantee = 'APEX_GRANTS_FOR_NEW_USERS_ROLE'
)
loop
execute immediate 'grant ' || c1.privilege || ' to wksp_APEXDEV';
end loop;
apex_instance_admin.add_workspace(
p_workspace => 'APEXDEV',
p_primary_schema => 'WKSP_APEXDEV'
);
apex_util.set_workspace('APEXDEV');
apex_util.create_user(
p_user_name => 'APEXDEV',
p_web_password => 'Welcome_1',
p_developer_privs => 'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL',
p_email_address => 'noreply@oracle.com',
p_default_schema => 'WKSP_APEXDEV',
p_change_password_on_first_use => 'N'
);
end;
PL/SQLプロシージャが正常に完了しました。
SQL> commit;
コミットが完了しました。
SQL> exit;
Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.5.0.24.07から切断されました
apex-podman-setup %