Bash/SQLPlus/Input/Redirect

From Chorke Wiki
Jump to navigation Jump to search
# any where of the bash file can be placed this script
SYSPWD=oracle;\
echo "Oracle SQLPlus Multi-Line Input";\
(cat<<EOF
drop user academia_dev cascade;
create user academia_dev identified by academia_dev;
grant connect, resource, dba to academia_dev;
exit;
EOF
)|sqlplus -s sys/$SYSPWD as sysdba;\
ls -la;\
pwd
# only at the end of bash file can be place this script
SYSPWD=oracle;\
echo "Oracle SQLPlus Multi-Line Input";\
sqlplus -s sys/$SYSPWD as sysdba <<EOF
drop user academia_dev cascade;
create user academia_dev identified by academia_dev;
grant connect, resource, dba to academia_dev;
exit;
EOF