CREATE USER ODS IDENTIFIED BY "slIgjdr938403$#$";
GRANT CONNECT, CREATE TABLE TO ODS;
GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO ODS;
GRANT EXECUTE ON DBMS_CLOUD TO ODS;
EXEC DBMS_CLOUD_ADMIN.ENABLE_RESOURCE_PRINCIPAL(username => 'ODS');
GRANT EXECUTE ON CT_MRDS.FILE_MANAGER TO ODS;

-- Granular table-level privileges for specific CT_MRDS tables
GRANT SELECT, DELETE, INSERT, UPDATE ON  "CT_MRDS"."A_SOURCE_FILE_TYPES" TO ODS;   
GRANT SELECT, DELETE, INSERT, UPDATE ON  "CT_MRDS"."A_SOURCE_FILES_RECEIVED" TO ODS;  
GRANT SELECT, DELETE, INSERT, UPDATE ON  "CT_MRDS"."A_PROCESS_LOG" TO ODS;  
GRANT SELECT ON "CT_MRDS"."A_SOURCE_FILES_RECEIVED_KEY_SEQ" TO ODS;

-- Broad ANY privileges required for FILE_MANAGER_ODS package operations (MARS-770)
-- These are needed for external table creation and cross-schema operations
GRANT SELECT ANY TABLE TO ODS;
GRANT DELETE ANY TABLE TO ODS;
GRANT INSERT ANY TABLE TO ODS;
GRANT UPDATE ANY TABLE TO ODS;
GRANT EXECUTE ANY PROCEDURE TO ODS;
GRANT SELECT_CATALOG_ROLE TO ODS;
