473,385 Members | 2,274 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,385 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 10354
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.