sqlplus / as sysdba <<!It's called heredoc but trying to do the same in DOS was slightly different and took a while to figure out...
shutdown immediate
startup
@?/rdbms/admin/utlrp
!
( echo shutdown immediateTo explain the () allows me to enter a number of lines before executing them and returning me to the command prompt.
echo startup
echo @?/rdbms/admin/utlrp
) | sqlplus / as sysdba
I need these new lines as SQL*Plus expects them as delimiters to seperate commands.
So the above commands echo's a number of commands and pipes the results to SQL*Plus.
To embed brackets you need to escape the bracket using ^^^( and ^^^) like this...
( echo shutdown immediateTo do the same in PowerShell do the following...
echo Starting database ^^^(normally^^^)
echo startup
echo @?/rdbms/admin/utlrp
) | sqlplus / as sysdba
@' echo shutdown immediateThe closing '@ must be at the beginning of the line with no preceeding spaces, otherwise it will fail.
echo startup
echo @?/rdbms/admin/utlrp
'@ | sqlplus / as sysdba
No comments:
Post a comment