Sponsored Content
Full Discussion: Checking SQL DB Availability
Top Forums Shell Programming and Scripting Checking SQL DB Availability Post 302888292 by SeaSoul on Thursday 13th of February 2014 04:20:32 PM
Old 02-13-2014
Checking SQL DB Availability

Hello everybody. I have a little question. Im creating a script for checking the status of different servers, and everything is running fine except for one thing. I have to check if certain DBs are connectables, I dont care anything else, nor running querys nor updating tables, the only thing I need to know is if the DB is connectable. It should be an easy task but frankly Im not very sure how to do it, so I tried the code below. And the problem I got with it is an "sqlplus : not found" from the unix shell. If anyone could help me itd be great. Thanks in advance.

Here goes what I have until now. If anyone knows another way thats great, I really dont care HOW to do it, just that it works. Smilie

#!/bin/bash
dbconnection=1
echo "Setting environment"
ssh -l myuser UNIXSERVER ". /apps/Ascential/DataStage/DSEngine/dsenv"
echo "Connecting to SQL"
dbcoonection=$(ssh -l myuser UNIXSERVER "sqlplus ????@????/????")
dbconnection=$?
echo "Status = $dbconnection"

if [ "$dbconnection" -lt "1" ]; then
echo "Connected"
else
echo "Not connected"
fi
 

10 More Discussions You Might Find Interesting

1. IP Networking

Checking for availability of remote server

Hi. In my KSH script I'm running a command on a remote server. I want to know how I can test to see if the remote server is available (accessible) prior to running the command. Any ideas? My command looks like: `ssh $USER@$TARGET_SERVER_DNS ls -l $REMOTE_FOLDER ` This check should be... (1 Reply)
Discussion started by: dylanmilks
1 Replies

2. Shell Programming and Scripting

Checking for availability of remote server

Hi. In my KSH script I'm running a command on a remote server. I want to know how I can test to see if the remote server is available (accessible) prior to running the command. Any ideas? My command looks like: `ssh $USER@$TARGET_SERVER_DNS ls -l $REMOTE_FOLDER ` This check should be... (4 Replies)
Discussion started by: dylanmilks
4 Replies

3. Shell Programming and Scripting

Checking availability of Web pages through Unix script

Hi Guru's, I need to check the availability of a web page for every one hour through a script. Following is the requirement. 1. Go to http://vsn.srivsn.com 2. If any error encountered in openeing the home page, it should trigger an email with the appropriate error message. 3. If page opens... (6 Replies)
Discussion started by: srivsn
6 Replies

4. Solaris

Printer availability

Hi, Im new in shell programming. I need to know the availability for specific printers. We send requests from solaris to printers located at an NT server. My idea is creating a shell that will monitor availbaility and send an email when something is wrong. I have a file with printers and its... (2 Replies)
Discussion started by: agsarm1971
2 Replies

5. Shell Programming and Scripting

checking sql connectivity in unix

hi, i am using a sqlplus connection in one of my shell scripts. i want to check if the connection is set properly or not.. can i use '$?' to check the status of the sql connectivity..? or is there any other option to do that..? thanks, (1 Reply)
Discussion started by: kripssmart
1 Replies

6. Shell Programming and Scripting

Checking availability of service

HI CAN ANY ONE HELP ME FOR BELOW QUESTION CHECKING AVAILABILITY OF SERVICE IN LINUX (2 Replies)
Discussion started by: satheeshkr_cse
2 Replies

7. Programming

Checking columns in SQL, comparing user input and sizes.

I'm writing a KSH shell script that's using SQL though DB2. If I have a table defined and populated db2 "create table tb(num int,letter char(4))" db2 "insert into tb values(111,a) db2 "insert into tb values(112,b) db2 "insert into tb values(111,c) How can I check if a letter user... (0 Replies)
Discussion started by: busdude
0 Replies

8. Shell Programming and Scripting

Script should keep checking for availability of files.

Hi, I want my script to check for availability of few files contineously for some time. Lets say from 10:00 AM to 10:30 AM script should keep checking on a particular location for each file one by one. If all the files are available then only it should complete the next processing part, else... (2 Replies)
Discussion started by: amit.mathur08
2 Replies

9. SCO

Stop boot system at "Checking protected password and checking subsystem databases"

Hi, (i'm sorry for my english) I'm a problem on boot sco unix 5.0.5 open server. this stop at "Checking protected password and checking subsystem databases" (See this image ) I'm try this: 1) http://www.digipedia.pl/usenet/thread/50/37093/#post37094 2) SCO: SCO Unix - Server hangs... (9 Replies)
Discussion started by: buji
9 Replies

10. Programming

Dynamically checking rules in database tables using SQL

I want to check for rows in a table where all values (except the key) is empty. I am using MySQL 5.5. I plan to do this mechanically, so the approach should work for any table in my database schema. Suppose for illustration purposes I start with the following table: CREATE TABLE `sources` ( ... (4 Replies)
Discussion started by: figaro
4 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 10:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy