473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Connecting to multiple oracle databases from unix

Hi all,
I need to write a script that logs into several oracle databases in a sequential manner from a unix box using different login and password e.g sqlplus found/duckl@dnd007 and many more databases to check the logon details work and database is up. At the moment i've got it all hardcoded in a script e.g
echo 'testing xxx'
sqlplus xxx/yyy@xxx
.
.
.
echo 'testing aaa'
sqlplus aa/yyy@aaa

but the problem is i have to type exit at the sqlplus prompt all the time and this can be pretty boring as i've got a long list.
Thanks for the help.
Cheers.
Feb 20 '08 #1
1 3085
osuri
3
Here is the code (I put it in a script called check_mult_db_status.sh) that you are looking for:
Expand|Select|Wrap|Line Numbers
  1. echo Testing db1
  2. sqlplus -s u1/p1@db1<< EOF
  3. quit
  4. EOF
  5. echo Testing non-existent db2
  6. sqlplus -s u2/p2@db2<< EOF
  7. quit
  8. EOF
  9. echo Testing db1
  10. sqlplus -s u1/p1@db1<< EOF
  11. quit
  12. EOF
When you execute this script, you will see less visual noise (as a result of the -s parameter) and will still see errors at the appropriate place, as you will see below in the execution dialog:

$ ./check_mult_db_status.sh
Testing db1
Testing non-existent db2
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified



ERROR:
ORA-01005: null password given; logon denied


Testing db1
$
Feb 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

100
by: Peter | last post by:
Company thought DB2 will be better than Oracle. The bottom line is when you do select, the system crash. I think it may take 4-5 years for DB2 to reach Oracle standard. Peter
5
by: Girish | last post by:
Hi, How will know whether oracle is installed or not in the unix box? The unix box is used as the APP server. Regards
1
by: Wayne Happ | last post by:
I have Oracle 9 running on a Linux RedHat Box V9.0. But I'm having trouble connecting from a windows machine via PL/SQL Develover. When I startup the application the instance name appears but...
0
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong...
3
by: Rob | last post by:
Does anyone know if there are any good comparisons between Windows and Unix performance? Or does anyone have examples of Oracle databases running large numbers (200+) of concurrent users. I am...
125
by: Rhino | last post by:
One of my friends, Scott, is a consultant who doesn't currently have newsgroup access so I am asking these questions for him. I'll be telling him how to monitor the answers via Google Newsgroup...
10
by: Andrea M. Segovia | last post by:
Hello, I am a newbie to Oracle databases.... We have a visualization front-end tool connected to an Oracle back-end database on a Tru64 UNIX server. We also have clients with MS access...
13
by: BigDaDDY | last post by:
Um yeah....In case you haven't figured it out, Microsoft sucks. I'm going to be kicked back in my chair eating popcorn and watching football 10 years from now, while all you clowns are scrambling...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.