LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-04-2011, 06:03 AM   #31
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12

thx

but i don't need to execute a command, i just need to test if a user can log on the database.
So i've got something like this

Code:
queryresult=`$sqlplus user/pass@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)))'`
but it doesn't do much i know i'm doing something wrong..
i just want to get back one result from that command, so i can test it with an if-statement
 
Old 05-04-2011, 06:09 AM   #32
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
Code:
queryresult=`$sqlplus user/pass@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)))' << EOF
select *;
EOF`
now i come to think about it, it doesn't really matter if i do that 'select' command
it works, and that's the important part
now it shouldn't be that hard for integrating that in Nagios
 
Old 05-04-2011, 06:14 AM   #33
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

There you go...

But if it's just to check connection, now that you know how it works without tnsnames, you could most likely download one of the Nagios plugins and change it to your needs. There are some pretty neat plugins over at NagiosExchange to get a variety of statistics, like real diskspace used and such.

Kind regards,

Eric
 
1 members found this post helpful.
Old 05-04-2011, 06:17 AM   #34
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
thx for the advice ^^
i'll look into that when i've got more time, now it's working in Nagios and that's what i wanted.
Now it's time to get back to my writing...
When everything is written and i've got time , i'll sure take a look !!

Thanks once more my good friend !!!!

 
Old 05-04-2011, 06:54 AM   #35
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

No problem whatsoever! Good to see you've got it up and running the way you needed. Thanks for marking the thread solved and for the reputation given. Have fun with Linux.

Kind regards,

Eric
 
1 members found this post helpful.
Old 05-05-2011, 12:52 AM   #36
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
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:
instantclient_version/

If you got that folder, please do the following commands:
Code:
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:
Code:
sqlplus user/pass@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)))'
Explaination:
- 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:
Code:
SQL*Plus: Release 11.2.0.2.0 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 10.2.0.5.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

SQL>
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

Code:
queryresult=`$sqlplus USER/PASS@TNSNAME <<EOF
command;
EOF`
TO

Code:
queryresult=`$sqlplus user/pass@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)))' << EOF
select *;
EOF`
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

Brownie


Last edited by brownie_cookie; 05-05-2011 at 12:57 AM.
 
Old 05-05-2011, 01:14 AM   #37
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi Björn,

Thanks for the nice words and for the summary how you've got it working. You might want to copy your last post into your blog at LinuxQuestions. It'll be easier to find later on and faster to point to if needed. Great job!

Kind regards,

Eric
 
1 members found this post helpful.
Old 05-05-2011, 01:51 AM   #38
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
Thanks for the great idea

Yeah, my first blog
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need to configure autostart of oracle database and oracle soa suite on linux bootup sumit.tambekar Linux - Newbie 2 01-24-2011 07:35 PM
Oracle database help baks Programming 2 07-23-2007 02:55 AM
LXer: Oracle(R) Database Standard Edition One and Oracle Enterprise Linux on HP Set New World Record for Price Performance with TPC-C Benchmark LXer Syndicated Linux News 0 06-12-2007 05:01 PM
Difference between Oracle Server and Oracle Database ganninu Programming 3 02-27-2007 01:06 AM
Oracle database. chuck77 Linux - General 1 03-02-2006 08:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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