Share your knowledge at the LQ Wiki.
Go Back > Blogs > brownie_cookie
User Name


Rate this Entry

Checking Oracle Database without using

Posted 05-05-2011 at 01:52 AM by brownie_cookie

Let me write a small HOW-TO for checking your Oracle Database without using the tnsnames.ora file

This is written thanks to the help of my good friend EricTRA.
He provided me helpfull links and helped me for getting the solution.

This being said, here is the link which guided me : Helpfull Link !!

So, I'm going to write this HOW-TO regarding the link and a plugin for Nagios and if you have an Oracle Database, this is the place you want to be.
With Nagios comes a server which we call a MONITORING SERVER. On this server Nagios is installed.
If you got that, you need to download certain zip-files to your monitoring server from the Oracle website
Link to instantclients that you'll need
But be aware, be sure what kind of OS you have (32-64 bit) because there a lot to choose from.
When you know the specific OS that you use, choose the most relevant of the link provided.

Then download the following:
  1. instantclient-basic-linux
  2. instantclient-sdk-linux
  3. instantclient-sqlplus-linux
It doesn't really matter what version you download, but preferable the newest (stable) version.

When you've downloaded that, you have to unzip them. I've selected them at the same time and the unzipped them. Eventually you need to get 1 folder, named:

If you got that folder, please do the following commands:
sudo cp instantclient_version/sdk/include/*.h /usr/include
sudo cp instantclient_version/sqlplus /usr/bin
sudo cp instantclient_version/*.so* /usr/lib
Now, if this has been successfull, it's time to test some things. You'll see in the link i've followed he copies a file. But because I didn't had access to that specific file, I had to do it on a different way. Here is how i did it.
I've used following command:
- user : the name of the user which must log on
- pass : the password of that user
- host : the hostname of the host where your database is located on
- PORT : default 1521, but can be changed if needed
- sid : the SID of your database (System ID)

When you've used this command (please check your '(' and ')' ) it should work and you probably get something like:
SQL*Plus: Release Production on Thu May 5 07:49:12 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

If you get something like that, you'll be fine.
Now when this is working and you want to put this in a plugin for Nagios.
My good friend EricTRA has provided me a very usefull plugin he had written and actually I only needed to change one thing

queryresult=`$sqlplus USER/PASS@TNSNAME <<EOF

queryresult=`$sqlplus user/pass@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)))' << EOF
select *;
So it's not a major thing when you test and run it, you should be fine !!

When you have questions about this, feel free to post me a PM !!

I was glad EricTRA have helped me once more and hopefully someday this will be helpfull for someone else !!

Kind regards


Posted in Uncategorized
Views 1404 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 10:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration