/*****************************************************************************
*
* Filename         - $Workfile:   build_users.sql  $
*
* Author           - Ian Byass
*
* Project Name     - UltraTrak Core 
*
* Source Code
* Identifier       - Database
*
* Design Spec
* Section          - 
*
* Contents         - SQL*Plus script to create the database role and users
*
* Language         - Oracle SQL script      
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2006
*
*****************************************************************************/

-- ==========================================================================
-- UltraTrak Database Role
-- ==========================================================================
CREATE ROLE tagtrak_schema;

GRANT ALTER SESSION         TO tagtrak_schema;
GRANT CREATE CLUSTER        TO tagtrak_schema;
GRANT CREATE DATABASE LINK  TO tagtrak_schema;
GRANT CREATE SEQUENCE       TO tagtrak_schema;
GRANT CREATE SESSION        TO tagtrak_schema;
GRANT CREATE SYNONYM        TO tagtrak_schema;
GRANT CREATE TABLE          TO tagtrak_schema;
GRANT CREATE VIEW           TO tagtrak_schema;
GRANT CREATE PROCEDURE      TO tagtrak_schema;
GRANT CREATE TRIGGER        TO tagtrak_schema;
GRANT SELECT ANY TABLE      TO tagtrak_schema;
GRANT INSERT ANY TABLE      TO tagtrak_schema;
GRANT CREATE TYPE           TO tagtrak_schema;
GRANT CREATE LIBRARY        TO tagtrak_schema;

GRANT ALL ON dba_jobs       TO tagtrak_schema;
GRANT SELECT ON dba_objects TO tagtrak_schema;
GRANT SELECT ON v_$instance TO tagtrak_schema;
GRANT SELECT ON v_$database TO tagtrak_schema;

-- ==========================================================================
-- UltraTrak User LIVE
-- ==========================================================================
CREATE USER live IDENTIFIED BY live DEFAULT TABLESPACE live_tables;
GRANT EXECUTE ON dbms_alert TO live;
GRANT tagtrak_schema        TO live;
GRANT SELECT ON v_$session  TO live;
GRANT UNLIMITED TABLESPACE  TO live;
ALTER USER live TEMPORARY TABLESPACE temp;


-- ==========================================================================
-- UltraTrak User ARCH
-- ==========================================================================
CREATE USER arch IDENTIFIED BY arch DEFAULT TABLESPACE arch_tables;
GRANT EXECUTE ON dbms_alert TO arch;
GRANT tagtrak_schema        TO arch;
GRANT SELECT ON v_$session  TO arch;
GRANT UNLIMITED TABLESPACE  TO arch;
ALTER USER arch TEMPORARY TABLESPACE temp;

-- ==========================================================================
-- UltraTrak User TEMP
-- ==========================================================================
CREATE USER temp IDENTIFIED BY temp DEFAULT TABLESPACE temp_tables;
GRANT EXECUTE ON dbms_alert TO temp;
GRANT tagtrak_schema        TO temp;
GRANT UNLIMITED TABLESPACE  TO temp;
ALTER USER temp TEMPORARY TABLESPACE temp;

