regress
#! /bin/ksh
############### ### UAT ### ###############
export ENVS=/test/change/env/env_test.sql
export SCHEMA_HOME=/test/change/schema/test/2015_11_20_test_1.1
export SCHEMA_HOME_test=${SCHEMA_HOME}/2015_11_20_test
################ ### PROD ### ################
#export ENVS=
#export SCHEMA_HOME=
#export SCHEMA_HOME_test=
##################################### # Check DB connection is correct #####################################
sqlplus /nolog <<EOF
set pagesize 500
set linesize 200
@${ENVS}
connect &v_system_un/&v_system_pw@&v_conn_str
show user prompt &v_conn_str
select * from v\$instance;
EOF
echo Press any key to continue
read ANS
############################################ # Check invalid objects (before)
############################################
cd $SCHEMA_HOME
sqlplus /nolog << EOF
@${ENVS}
connect &v_system_un/&v_system_pw@&v_conn_str
set pages 1000
set lines 150
col owner for a15
col object_name for a35
col object_type for a20
col last_ddl_time for a20
alter session set nls_date_format = 'YYYY-MON-DD HH24:MI:SS';
spool invalid_obj_before_regress.lst
select owner,object_name,object_type,last_ddl_time from dba_objects where status='INVALID';
spool off
EOF
############################################ banner 'SMAS' ############################################
date
echo Press any key to continue
read ANS
cd $SCHEMA_HOME_SMAS/
sqlplus /nolog << EOF
set pagesize 500
set linesize 200
@${ENVS}
connect &v_system_un/&v_system_pw@&v_conn_str
show user
select * from v\$instance;
select to_char(sysdate,'YYYY-MON-DD HH24:MI:SS') from dual;
@01_change_regress.sql
EOF
date
echo Press any key to continue
read ANS
############################################ # Check invalid objects (after) ############################################
cd $SCHEMA_HOME
sqlplus /nolog << EOF
@${ENVS}
connect &v_system_un/&v_system_pw@&v_conn_str
set pages 1000
set lines 150
col owner for a15
col object_name for a35
col last_ddl_time for a20
alter session set nls_date_format = 'YYYY-MON-DD HH24:MI:SS';
spool invalid_obj_after_regress.lst
select owner,object_name,object_type,last_ddl_time from dba_objects where status='INVALID';
spool off
EOF