connect to DB from sqlplus using script
i am looking for a script that can be run from sqlplus to connect to multiple databases.
where the script has service name as variable and can prompt me to enter service name everytime i run the script.
i have installed oracle client on the windows machine which is using the tnsnames.ora to connect to the DB's which are on linux.
This task can be achived by typing
sql> conn system/password@testdb
but i am looking for something like this
Enter DB_NAME : testdb (or whatever the DB i am trying to connect)
is there a way this can be acheived.
Yes, it can be achieved.
Having said that, would that mean that conn.sql script would have the account and password hardcoded? the same for all databases?
That's a very, very bad idea.
Pablo (Paul) Berzukov
Author of Understanding Database Administration
available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Thanks for the hint Pablo..
i got it like this
and it does what i want.
Click Here to Expand Forum to Full Width