473,395 Members | 1,386 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,395 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 3086
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.