Please let me know what i am missing in the following code (part of my script)
Schemas=(AWQM WFCONTROLLER PROVCO PRISM)
for s in "${Schemas[@]}"
do
sch="${s}_$tol"
if [ $tol == AD ] || [ $tol == TD ];then
echo "This is AD or TD region"
sqlplus -s $sch/$tpwd@$ttns <<EOF
set feedback off;
set pagesize 0;
set linesize 500;
set trimspool on;
spool run_$sch_drops.sql
select 'set echo on'||chr(59) from dual;
select 'spool run_'${sch}'_drops.log'||chr(59) from dual;
select 'show user'||chr(59) from dual;
select '' from dual;
select 'drop table "'||table_name||'" cascade constraints purge'||chr(59) from all_tables where owner = '${sch}';
select '' from dual;
select 'drop synonym "'||synonym_name||'"'||chr(59) from all_synonyms where owner = '${sch}';
select '' from dual;
select 'Drop TYPE "'||OBJECT_NAME||'" Force'||chr(59) from all_objects where object_type='TYPE' and owner='${sch}';
select 'quit'||chr(59) from dual;
quit;
EOF
else
echo "This is Other Env"
fi
done
I am getting error syntax error: unexpected end of file when i run my script.
You might get away with indenting the EOF line with tabs, but only tabs. Copy and paste will normally replace it with spaces, so you have to be very careful.
For safety, you might need to end up with something that looks a bit odd like this:-
:
:
:
select 'drop synonym "'||synonym_name||'"'||chr(59) from all_synonyms where owner = '${sch}';
select '' from dual;
select 'Drop TYPE "'||OBJECT_NAME||'" Force'||chr(59) from all_objects where object_type='TYPE' and owner='${sch}';
select 'quit'||chr(59) from dual;
quit;
EOF
else
echo "This is Other Env"
:
:
:
Yes I will do....I am writing the script for env refresh and doing the testing parallel....It will not go to PROD...but anyway i will do that once i am done with the clean up module... Thanks alot