10

Can I convert this into 1 command line on bash in sqlplus? cause i want to automate it.

sqlplus / as sysdba
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
exit
1

4 Answers 4

16

You won't need the exit with automation because it should exit on end of file anyway. So on one line you could do:

echo 'EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);' | sqlplus / as sysdba
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. this would be the best answer as i don't want to create additional .sh or .sql at all
I try this command with select query but nothing happened. It just login and then disconnect. What should I do?
Sounds like you're missing a ; or / (on a line of its own) to actually run the command. Just a guess, you'll need to provide more details for a better answer
6
sqlplus user/password@host @file.sql

Comments

3

you can wirite by follow in a shell

#!/bin/bash
sqlplus / as sysdba <<EOF
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
exit
EOF

or you can put this commond into a procedure

Comments

0

sqlplus /nolog @your_script.sql

2 Comments

That won't work, since /nolog prevents SQL*Plus from logging on to the database.
Of course it won't - without putting the connect command into the script.

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.