LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   carriage return (https://www.linuxquestions.org/questions/linux-newbie-8/carriage-return-761877/)

mike2008 10-14-2009 12:14 PM

carriage return
 
Hi there,

I'm writing a script that logs into the oracle db, execute a command "recover standby database;", then the command prompts the user to enter a value such as "auto" before the command can be executed.

Below is my script, but it is not performing the actions I wanted. Thanks in advance

#!/bin/bash
sqlplus / as sysdba <<CMD
recover standby database;
auto <<EOF
exit;
EOF
CMD

ikem 10-14-2009 12:32 PM

Hmm.. I guess you can't nest files in files.

lutusp 10-14-2009 04:31 PM

Quote:

Originally Posted by mike2008 (Post 3719118)
Hi there,

I'm writing a script that logs into the oracle db, execute a command "recover standby database;", then the command prompts the user to enter a value such as "auto" before the command can be executed.

Below is my script, but it is not performing the actions I wanted. Thanks in advance

#!/bin/bash
sqlplus / as sysdba <<CMD
recover standby database;
auto <<EOF
exit;
EOF
CMD

What actions do you want the script to do? Can you type the desired actions at a keyboard? Why not write a script that performs the same actions you would perform if you were at a keyboard?

The script you are writing hasn't the remotest chance of giving you what you want, regardless of what you want, which you don't specify.

shahkent 10-15-2009 12:03 AM

Try the following:

1. Create a file called cmd.sql and add the following lines:

recover automatic standby database until cancel;
exit;

2. Modify your Bash shell script to read as follows:

#!/bin/bash
sqlplus / as sysdba @cmd.sql

I hope that this does the trick for you. Good luck.

Shahriar.


All times are GMT -5. The time now is 05:29 AM.