Forum Stats

  • 3,770,408 Users
  • 2,253,104 Discussions
  • 7,875,445 Comments

Discussions

Oracle Database SQL command without input prompt

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!

Best Answer

  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,601 Red Diamond
    Accepted 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.

Answers