Grants for APEX user

#!/bin/ksh
# This script assigns the user (CFGADM) that will be used in oracle to access tables in APEX
# M. Culp
# 11/06/2010
# 01/04/2010 Made changes to reflect the LS commands
# 02/03/2010
# This should give access to the user in APEX that this is going against
#
#######################################################################################################

sqlplus -s "/ as sysdba" <<EOF

grant exempt access policy to dba01;
grant sysdba to dba01;
grant select_catalog_role to dba01;
grant create session to dba01;
grant select on DBA_HIST_DATABASE_INSTANCE to dba01;
grant select on DBA_HIST_SNAPSHOT to dba01;
grant select on DBA_HIST_SNAP_ERROR to dba01;
grant select on DBA_HIST_BASELINE to dba01;
grant select on DBA_HIST_WR_CONTROL to dba01;
grant select on DBA_HIST_DATAFILE to dba01;
grant select on DBA_HIST_FILESTATXS to dba01;
grant select on DBA_HIST_TEMPFILE to dba01;
grant select on DBA_HIST_TEMPSTATXS to dba01;
grant select on DBA_HIST_SQLSTAT to dba01;
grant select on DBA_HIST_SQLTEXT to dba01;
grant select on DBA_HIST_SQL_SUMMARY to dba01;
grant select on DBA_HIST_SQL_PLAN to dba01;
grant select on DBA_HIST_SQLBIND to dba01;
grant select on DBA_HIST_OPTIMIZER_ENV to dba01;
grant select on DBA_HIST_EVENT_NAME to dba01;
grant select on DBA_HIST_SYSTEM_EVENT to dba01;
grant select on DBA_HIST_BG_EVENT_SUMMARY to dba01;
grant select on DBA_HIST_WAITSTAT to dba01;
grant select on DBA_HIST_ENQUEUE_STAT to dba01;
grant select on DBA_HIST_LATCH_NAME to dba01;
grant select on DBA_HIST_LATCH to dba01;
grant select on DBA_HIST_LATCH_CHILDREN to dba01;
grant select on DBA_HIST_LATCH_PARENT to dba01;
grant select on DBA_HIST_LATCH_MISSES_SUMMARY to dba01;
grant select on DBA_HIST_LIBRARYCACHE to dba01;
grant select on DBA_HIST_DB_CACHE_ADVICE to dba01;
grant select on DBA_HIST_BUFFER_POOL_STAT to dba01;
grant select on DBA_HIST_ROWCACHE_SUMMARY to dba01;
grant select on DBA_HIST_SGA to dba01;
grant select on DBA_HIST_SGASTAT to dba01;
grant select on DBA_HIST_PGASTAT to dba01;
grant select on DBA_HIST_RESOURCE_LIMIT to dba01;
grant select on DBA_HIST_SHARED_POOL_ADVICE to dba01;
grant select on DBA_HIST_SQL_WORKAREA_HSTGRM to dba01;
grant select on DBA_HIST_PGA_TARGET_ADVICE to dba01;
grant select on DBA_HIST_INSTANCE_RECOVERY to dba01;
grant select on DBA_HIST_JAVA_POOL_ADVICE to dba01;
grant select on DBA_HIST_THREAD to dba01;
grant select on DBA_HIST_STAT_NAME to dba01;
grant select on DBA_HIST_SYSSTAT to dba01;
grant select on DBA_HIST_SYS_TIME_MODEL to dba01;
grant select on DBA_HIST_OSSTAT_NAME to dba01;
grant select on DBA_HIST_OSSTAT to dba01;
grant select on DBA_HIST_PARAMETER_NAME to dba01;
grant select on DBA_HIST_PARAMETER to dba01;
grant select on DBA_HIST_WAITCLASSMET_HISTORY to dba01;
grant select on DBA_HIST_DLM_MISC to dba01;
grant select on DBA_HIST_CR_BLOCK_SERVER to dba01;
grant select on DBA_HIST_CURRENT_BLOCK_SERVER to dba01;
grant select on DBA_HIST_ACTIVE_SESS_HISTORY to dba01;
grant select on DBA_HIST_TABLESPACE_STAT to dba01;
grant select on DBA_HIST_LOG to dba01;
grant select on DBA_HIST_MTTR_TARGET_ADVICE to dba01;
grant select on DBA_HIST_TBSPC_SPACE_USAGE to dba01;
grant select on DBA_HIST_SERVICE_NAME to dba01;
grant select on DBA_HIST_SERVICE_STAT to dba01;
grant select on DBA_HIST_SERVICE_WAIT_CLASS to dba01;
grant select on DBA_HIST_SNAPSHOT to dba01;
grant select on DBA_SEGMENTS to dba01;
grant select on DBA_OUTSTANDING_ALERTS to dba01;
grant select on DICTIONARY to dba01;
grant select on DBA_REGISTRY to dba01;
grant select on DBA_HIST_COMP_IOSTAT to dba01;
grant select on DBA_HIST_UNDOSTAT to dba01;

grant select on DBA_VIEWS to dba01;
grant select on DBA_DB_LINKS to dba01;

grant select on DBA_TABLES to dba01;

grant select on v_\$session to dba01;
grant select on v_\$sqlarea to dba01;
grant select on v_\$sql_plan to dba01;
grant select on v_\$database to dba01;
grant select on v_\$instance to dba01;
grant select on v_\$datafile_copy to dba01;
grant select on v_\$parameter to dba01;
grant select on v_\$spparameter to dba01;
grant select on v_\$asm_disk to dba01;
grant select on v_\$asm_diskgroup to dba01;
grant select on v_\$system_fix_control to dba01;
grant select on gv_\$parameter to dba01;
grant select on gv_\$event_histogram to dba01;
grant select on sysman.BHV_SERVER_DETAILS to dba01;
grant select on sysman.MGMT_TARGETS to dba01;
grant select on sysman.MGMT_TABLE_SIZES to dba01;
grant select on sysman.MGMT_TARGET_CREDENTIALS to dba01;

Leave a Reply

Your email address will not be published.