--MARS-770

set verify off
SET serveroutput ON
--SET TIMING ON
whenever sqlerror exit sql.sqlcode rollback;

column owner format a15
column object_name format a30
column spoolname new_value spoolname 

select 'install_package_MarsGeneralRelease_MARS770_create_user_' || name || '_' ||to_char(sysdate,'YYYYMMDD_HH24MISS')||'.log' spoolname from v$pdbs;
spool '&spoolname'


prompt ##### started at time #####
select systimestamp from dual;
prompt ##### database name #####
select name pdb_name from v$pdbs;

--set echo on
--=============================================================================================================================
-- start install --MARS-770 create user
--=============================================================================================================================


--CREATE USER CT_MRDS IDENTIFIED BY Start_1234567890
--DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
ALTER USER CT_MRDS QUOTA UNLIMITED ON DATA;


EXEC DBMS_CLOUD_ADMIN.ENABLE_RESOURCE_PRINCIPAL(username => 'CT_MRDS');
GRANT EXECUTE ON DBMS_CLOUD TO CT_MRDS; 
GRANT INHERIT PRIVILEGES ON USER ADMIN TO CT_MRDS;
GRANT INHERIT PRIVILEGES ON USER PDBADMIN TO CT_MRDS;
GRANT INHERIT PRIVILEGES ON USER PDBSOFA TO CT_MRDS;
GRANT INHERIT PRIVILEGES ON USER MRDS_LOADER TO CT_MRDS;
