/****************************************************************************************************
 * ★★★★★ IMPORTANT WARNING ★★★★★
 * PLEASE REVIEW AND UPDATE ALL USERS, ROLES, AND PATHS ACCORDING TO YOUR ENVIRONMENT.
 * This sample script is provided as a template. BEFORE EXECUTION, ensure that you modify the
 * user names, role definitions, and file paths to match your specific requirements and
 * security policies.
 ****************************************************************************************************/
-- Note make sure replace the <replace-with-user> and <replace-with-user-password> with your database connect user and password
CREATE USER <replace-with-user> 
	IDENTIFIED BY <replace-with-user-password> 
	DEFAULT TABLESPACE USERS 
	TEMPORARY TABLESPACE TEMP; 


--------------------------------------------------------------
-- SETUP for schema RELEASE
--------------------------------------------------------------
CREATE USER release 
	IDENTIFIED BY <replace-with-user-password> 
	DEFAULT TABLESPACE USERS 
	TEMPORARY TABLESPACE TEMP; 
        
        
GRANT UNLIMITED TABLESPACE TO release;   
        
CREATE ROLE WP_BASE_CONFIG_USERS NOT IDENTIFIED;
GRANT ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE,
	CREATE ANY INDEX, DROP ANY INDEX,
	INSERT ANY TABLE, UPDATE ANY TABLE, SELECT ANY TABLE, DELETE ANY TABLE,
	CREATE SESSION
	TO WP_BASE_CONFIG_USERS;
      
      
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_BASE_CONFIG_USERS;
GRANT WP_BASE_CONFIG_USERS TO <replace-with-user>;
    
    
CREATE ROLE WP_BASE_RUNTIME_USERS NOT IDENTIFIED;
GRANT CREATE SESSION TO WP_BASE_RUNTIME_USERS;
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_BASE_RUNTIME_USERS;
GRANT WP_BASE_RUNTIME_USERS TO <replace-with-user>;
 
--------------------------------------------------------------
-- SETUP for schema COMMUNITY
--------------------------------------------------------------
CREATE USER community 
	IDENTIFIED BY <replace-with-user-password> 
	DEFAULT TABLESPACE USERS 
	TEMPORARY TABLESPACE TEMP; 
        
        
GRANT UNLIMITED TABLESPACE TO community;   
        
GRANT ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE,
	CREATE ANY INDEX, DROP ANY INDEX,
	INSERT ANY TABLE, UPDATE ANY TABLE, SELECT ANY TABLE, DELETE ANY TABLE,
	CREATE SESSION
	TO WP_BASE_CONFIG_USERS;
      
      
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_BASE_CONFIG_USERS;
GRANT WP_BASE_CONFIG_USERS TO <replace-with-user>;
    
    
GRANT CREATE SESSION TO WP_BASE_RUNTIME_USERS;
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_BASE_RUNTIME_USERS;
GRANT WP_BASE_RUNTIME_USERS TO <replace-with-user>;
 
--------------------------------------------------------------
-- SETUP for schema CUSTOMIZATION
--------------------------------------------------------------
CREATE USER customization 
	IDENTIFIED BY <replace-with-user-password> 
	DEFAULT TABLESPACE USERS 
	TEMPORARY TABLESPACE TEMP; 
        
        
GRANT UNLIMITED TABLESPACE TO customization;   
        
GRANT ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE,
	CREATE ANY INDEX, DROP ANY INDEX,
	INSERT ANY TABLE, UPDATE ANY TABLE, SELECT ANY TABLE, DELETE ANY TABLE,
	CREATE SESSION
	TO WP_BASE_CONFIG_USERS;
      
      
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_BASE_CONFIG_USERS;
GRANT WP_BASE_CONFIG_USERS TO <replace-with-user>;
    
    
GRANT CREATE SESSION TO WP_BASE_RUNTIME_USERS;
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_BASE_RUNTIME_USERS;
GRANT WP_BASE_RUNTIME_USERS TO <replace-with-user>;
 
--------------------------------------------------------------
-- SETUP for schema JCR
--------------------------------------------------------------
CREATE USER jcr 
	IDENTIFIED BY <replace-with-user-password> 
	DEFAULT TABLESPACE USERS 
	TEMPORARY TABLESPACE TEMP; 
        
        
GRANT UNLIMITED TABLESPACE TO jcr;   
        
CREATE ROLE WP_JCR_CONFIG_USERS NOT IDENTIFIED;
GRANT ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE,
	CREATE ANY INDEX, DROP ANY INDEX,
	INSERT ANY TABLE, UPDATE ANY TABLE, SELECT ANY TABLE, DELETE ANY TABLE,
	CREATE SESSION
	TO WP_JCR_CONFIG_USERS;
      
GRANT CREATE TABLESPACE, DROP TABLESPACE,
	CREATE ANY SEQUENCE, DROP ANY SEQUENCE,
	CREATE ANY TRIGGER, DROP ANY TRIGGER,
	CREATE ANY TYPE, DROP ANY TYPE, EXECUTE ANY TYPE,
	CREATE ANY VIEW, DROP ANY VIEW
	TO WP_JCR_CONFIG_USERS;
        
GRANT SELECT ON DBA_IND_COLUMNS to WP_JCR_CONFIG_USERS;
GRANT SELECT ON DBA_INDEXES to WP_JCR_CONFIG_USERS;
      
      
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_JCR_CONFIG_USERS;
GRANT WP_JCR_CONFIG_USERS TO <replace-with-user>;
    
    
CREATE ROLE WP_JCR_RUNTIME_USERS NOT IDENTIFIED;
GRANT CREATE SESSION TO WP_JCR_RUNTIME_USERS;
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_JCR_RUNTIME_USERS;
GRANT WP_JCR_RUNTIME_USERS TO <replace-with-user>;
 
--------------------------------------------------------------
-- SETUP for schema FEEDBACK
--------------------------------------------------------------
CREATE USER feedback 
	IDENTIFIED BY <replace-with-user-password> 
	DEFAULT TABLESPACE USERS 
	TEMPORARY TABLESPACE TEMP; 
        
        
GRANT UNLIMITED TABLESPACE TO feedback;   
        
CREATE ROLE WP_PZN_CONFIG_USERS NOT IDENTIFIED;
GRANT ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE,
	CREATE ANY INDEX, DROP ANY INDEX,
	INSERT ANY TABLE, UPDATE ANY TABLE, SELECT ANY TABLE, DELETE ANY TABLE,
	CREATE SESSION
	TO WP_PZN_CONFIG_USERS;
      
      
GRANT CREATE ANY SEQUENCE, DROP ANY SEQUENCE TO WP_PZN_CONFIG_USERS;
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_PZN_CONFIG_USERS;
GRANT WP_PZN_CONFIG_USERS TO <replace-with-user>;
    
    
CREATE ROLE WP_PZN_RUNTIME_USERS NOT IDENTIFIED;
GRANT CREATE SESSION TO WP_PZN_RUNTIME_USERS;
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_PZN_RUNTIME_USERS;
GRANT WP_PZN_RUNTIME_USERS TO <replace-with-user>;
 
--------------------------------------------------------------
-- SETUP for schema LIKEMINDS
--------------------------------------------------------------
CREATE USER likeminds 
	IDENTIFIED BY <replace-with-user-password> 
	DEFAULT TABLESPACE USERS 
	TEMPORARY TABLESPACE TEMP; 
        
        
GRANT UNLIMITED TABLESPACE TO likeminds;   
        
GRANT ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE,
	CREATE ANY INDEX, DROP ANY INDEX,
	INSERT ANY TABLE, UPDATE ANY TABLE, SELECT ANY TABLE, DELETE ANY TABLE,
	CREATE SESSION
	TO WP_PZN_CONFIG_USERS;
      
      
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_PZN_CONFIG_USERS;
GRANT WP_PZN_CONFIG_USERS TO <replace-with-user>;
    
    
GRANT CREATE SESSION TO WP_PZN_RUNTIME_USERS;
GRANT SELECT ON DBA_PENDING_TRANSACTIONS TO WP_PZN_RUNTIME_USERS;
GRANT WP_PZN_RUNTIME_USERS TO <replace-with-user>;

--------------------------------------------------------------
-- TABLESPACE CREATION
--------------------------------------------------------------
-- Create a TABLESPACE
-- Might need to Update the database directory path for your Oracle version.
CREATE TABLESPACE ICMLFQ32 
    DATAFILE SIZE 300M 
    AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED 
    EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

CREATE TABLESPACE ICMLNF32 
    DATAFILE SIZE 25M 
    AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED 
    EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

CREATE TABLESPACE ICMVFQ04 
    DATAFILE SIZE 25M 
    AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED 
    EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

CREATE TABLESPACE ICMSFQ04 
    DATAFILE SIZE 150M 
    AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED 
    EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

CREATE TABLESPACE ICMLSNDX 
    DATAFILE SIZE 10M 
    AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED 
    EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

--------------------------------------------------------------
-- For timer tables
--------------------------------------------------------------
GRANT DBA TO <replace-with-user>;
GRANT SELECT ANY SEQUENCE, DROP ANY SEQUENCE TO WP_BASE_CONFIG_USERS; 
GRANT SELECT ANY SEQUENCE, DROP ANY SEQUENCE TO WP_BASE_RUNTIME_USERS; 
