473,326 Members | 2,061 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,326 software developers and data experts.

Administration script to check DB

Hello,

I want to create a generic script that connects to Oracle databases
(from 7.3.4 to 9.2 version) with a guest user. This script should
return 1 if connection is successful and 0 if not.
My problem is due to the 3 requests for password when the connection
fails. I can't find any option that allows to ask for password only
one time.

Has anyone already written a such script?

Thank you in advance.

Fanny
Jul 19 '05 #1
5 10344
rob

"F. Biguet" <fb*****@yahoo.fr> wrote in message
news:c2**************************@posting.google.c om...
Hello,

I want to create a generic script that connects to Oracle databases
(from 7.3.4 to 9.2 version) with a guest user. This script should
return 1 if connection is successful and 0 if not.
My problem is due to the 3 requests for password when the connection
fails. I can't find any option that allows to ask for password only
one time.

Has anyone already written a such script?

Thank you in advance.

Fanny


You know that 7.3.4 is pre-historic and unsupported for years don't you?
I don't know what you exactly like to achieve but this might give you a
hint.
0 = success
1 = failure
Can't remember if "whenever sqlerror exit failure" exists in 7.3.4

== test.sql
myserver{oracle}# cat test.sql
whenever sqlerror exit failure

connect &1/&2@&3
exit
==
== Connect error ===
myserver{oracle}#sqlplus /nolog @test bla bla mydb

SQL*Plus: Release 8.1.7.0.0 - Production on Tue Sep 14 15:38:00 2004

(c) Copyright 2000 Oracle Corporation. All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied

myserver{oracle}# echo $?
1
==
== Connect succeeds
myserver{oracle}# sqlplus /nolog @test system manager mydb

SQL*Plus: Release 8.1.7.0.0 - Production on Tue Sep 14 15:38:15 2004

(c) Copyright 2000 Oracle Corporation. All rights reserved.

Connected.
Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
dtodbs1{oracle}# echo $?
0
==

Regards,
Rob
Jul 19 '05 #2
fb*****@yahoo.fr (F. Biguet) wrote in message news:<c2**************************@posting.google. com>...
Hello,

I want to create a generic script that connects to Oracle databases
(from 7.3.4 to 9.2 version) with a guest user. This script should
return 1 if connection is successful and 0 if not.
My problem is due to the 3 requests for password when the connection
fails. I can't find any option that allows to ask for password only
one time.

Has anyone already written a such script?

Thank you in advance.

Fanny


Hi Fanny,

Connect to SQL*Plus with the nolog option. This doesn't prompt for a
username/password when it starts. You can then use the connect command
to attempt the connection. This doesn't prompt three times if the
connection fails. E.g.

C:\>sqlplus /nolog

SQL> connect guest/password@sid
ERROR:
ORA-12500: TNS:listener failed to start a dedicated server process
SQL>

Put all your connection tests in a script. E.g For windows.
connect_test.sql:
-----------------------------------------------------
set verify off
set head off

host del &4

connect &1/&2@&3
select 'TEST_WORKED' from dual

spool &4
/

spool off

exit
-----------------------------------------------------
Have another scripts that then runs connect_test.sql and parses the
output, E.g.:

test_con.bat
-----------------------------------------------------
sqlplus /nolog @connect_test.sql user password sid log_file
REM Parse the log_file looking for "TEST_WORKED"
There's probably a neater solution, but the use of nolog is the main
point here I think.

Ben
Jul 19 '05 #3
1. You did not say what OS, so let's assume UNIX. Create a script.

sqlplus -L user/password@oracle_sid << END_SQL
whenever sqlerror exit 1
select sysdate from dual;
END_SQL

if [ $? -eq 0 ]
then
echo Successful
else
echo Failed
fi

NOTE: The return code will be 1 only is logon was successful and
select statement fails. Which happens when the database is closed.

2. You will see a failed message everytime a logon fails.

Wario
Oracle DBA
Jul 19 '05 #4
fb*****@yahoo.fr (F. Biguet) wrote in message news:<c2**************************@posting.google. com>...
Hello,

I want to create a generic script that connects to Oracle databases
(from 7.3.4 to 9.2 version) with a guest user. This script should
return 1 if connection is successful and 0 if not.
My problem is due to the 3 requests for password when the connection
fails. I can't find any option that allows to ask for password only
one time.

Has anyone already written a such script?

Thank you in advance.

Fanny


No need for such a script. Oracle Enterprise Manager deals with this nicely.
and OEM already existed in the stone age.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #5
Thank you very much for all those answers.
I think I will solve my problem soon with all these informations.

I work whit many oracle versions (even oldest one; what client wants,
we do!) on many configuration systems and I must simulate a oracle
connexion from a client PC for a monitoring tool.

Best regards,

Fanny
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Johnny | last post by:
I'm searching for some alternate administration tool (permisions, rights, etc.) on sql server, something not so complicated as default. Does anyone have some info about that? Thanks Pete
2
by: dave | last post by:
I am trying to use the Personal Web Site Starter Kit. I am planning on showing my class how easy it is to create a website in VS 2005. Only I am finding it not to be so easy. I am following the...
16
by: jblankenburg | last post by:
I am trying to deploy a simple web application to my client's production server, but it's not clear to me how MS planned on having the Security users managed without Studio. Certainly someone...
2
by: Hexman | last post by:
Hello All, I'm nearing the end of my current project and the users came up with 2 more requests. I'll talk about the first one in this message. I've developed (with much help from this group)...
8
by: Kirk | last post by:
Hello, I am a somewhat experienced VS 2005 user who is trying to us the ASP.NET Web Site Administration Tool for the first time. I have experimented with it on my local IIS and it seems to be...
3
by: matias.cornejo | last post by:
I have a problem to startup de DB2 Admin. I read meny documentation in internet and nothing work, anybody know something??. I have DB2 UDB V8 fixpack 14 and AIX 5.2 x134 db2admin start SQL4409W...
2
by: takveen | last post by:
Learn Oracle Database Administration in 10 Minutes. No kidding. Check it yourself, http://www.takveen.com Only good analogy makes complex concepts simple!
5
by: F. Biguet | last post by:
Hello, I want to create a generic script that connects to Oracle databases (from 7.3.4 to 9.2 version) with a guest user. This script should return 1 if connection is successful and 0 if not....
0
by: Toralf Kirsten | last post by:
Hi all, we have installed DB2 V9.5 Trial on a Fedora 6 Linux box (32bit). Since the box is included in a NIS we have manually created db2 users db2inst, dasusr and db2fenc on this box (not in the...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.