-1

I've tried to create a bash script for connecting to my Oracle 19C database using sqlplus, I added the following code (which works also) :

#! /bin/sh.
connectsqlplus(){
    sqlplus "'"sys/mypassword as sysdba"'" 
EOF 
}
connectsqlplus

The main problem is that I want to use this bash script to start the database, what I've created seems to only let me open the sqlplus terminal, I just want to add the SQL> startup so that the database starts but I'm not really sure how to add this command in the SQL terminal by using bash scripting.

Any help would be much appreciated ! Thank you .

3

1 Answer 1

3
#start_oracle_db.sh
ORACLE_SID=nameofyourdatabaseasrecordedinoratabfile
ORAENV_ASK=NO
source oraenv
sqlplus << EOF
connect / as sysdba
startup
exit
EOF
Sign up to request clarification or add additional context in comments.

1 Comment

Appreciate it "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.