-
connect to DB from sqlplus using script
Hi DBA's
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
sql> conn.sql
Enter DB_NAME : testdb (or whatever the DB i am trying to connect)
is there a way this can be acheived.
Thanks
-
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
conn system/password@&SID
and it does what i want.
Thanks much
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|