i have a problem with sqlplus on windows batch. I have SQLPLUS 10.2
i'm trying to connect to a database through a windows script.cmd
script.cmd only launches : sqlplus test/Test@mydatabase @script.sql
The problem is when the database is not available, the sqlplus says
ERROR:
ORA-12541: TNS:no listener
Enter user-name :
and waits for input .. and blocks the .cmd
How can i adapt the script to stop immediately when the database is not avaliable or just to avoid waiting for user prompts ?
Thanks
You can do sqlplus -l test/Test@mydatabase @script.sql
; the -l
flag means it will only try to connect once, and if it fails for any reason will exit instead of prompting. Look at the output of sqlplus -?
, or see the documentation.