Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle Database SQL command without input prompt

User_MV0PWAug 20 2021

In Oracle Database I need to execute SQL command RECOVER DATABASE UNTIL CANCEL BACKUP CONTROLFILE;. After that I got input prompt. I should enter CANCEL. Is there a way to enter only one command with automatic CANCEL substitution? Thank you for your answers!

This post has been answered by Billy Verreynne on Aug 24 2021
Jump to Answer

Comments

spajdy

I'm not sure that CANCEL is valid command, but anyway create a simple text file <name>.sql and write all commands you want to run there. <name> - replace by any meaningful name Then run SQL*Plus log in and run you script file by @<name>

User_MV0PW

"CANCEL" is not a command, it's a response for "RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE;" command. I enter "RECOVER ..." command, I got a question "Specify log: {<RET>=suggested | filename | AUTO | CANCEL}", I should enter "CANCEL" as an answer for that question, but not as a command.

Billy Verreynne
Answer

You can try redirecting stdin (standard input) to your bash process.
E.g.

sqlplus "/ as sysdba" <<EOF
  recover ...
  cancel
  exit
EOF

EOF is simply a text token used to mark where stdin redirection need to cease.

Marked as Answer by User_MV0PW · Aug 24 2021
User_MV0PW

THANK YOU VERY MUCH!!! IT WORKS!!!

1 - 4

Post Details

Added on Aug 20 2021
4 comments
305 views