473,791 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10390
rob

"F. Biguet" <fb*****@yahoo. fr> wrote in message
news:c2******** *************** ***@posting.goo gle.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


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.f r (F. Biguet) wrote in message news:<c2******* *************** ****@posting.go ogle.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.sq l:
-----------------------------------------------------
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.sq l and parses the
output, E.g.:

test_con.bat
-----------------------------------------------------
sqlplus /nolog @connect_test.s ql user password sid log_file
REM Parse the log_file looking for "TEST_WORKE D"
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.f r (F. Biguet) wrote in message news:<c2******* *************** ****@posting.go ogle.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
1254
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
6481
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 instructions on the default.aspx page and they are as follows. Creating an Administrative User The first step you must take is to create an administrative user. The administrative user has permission to upload photos and create albums. To...
16
15986
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 has run into this issue. How do you manage users (the ones you would normally manage with the Web Site Administration Tool) without Studio to get you to the Web Site Administration Tool ? Thanks for your help!
2
1490
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) a vb.net app and is being put into the users hands this week. I am using Crystal Report X to produce reports. The users now, rather than printing, want them emailed and produced in .pdf format also. So rather than me re-inventing the wheel, I'm...
8
2017
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 an excellent tool for security administration. However, I have some long term questions. Where does the W.S.A.T. store its information? In my local SQL Server 2000, I can see a database called "aspnetdb" - however none of the
3
9319
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 The DB2 Administration Server is already active. x134 db2admin start SQL4409W The DB2 Administration Server is already active. x134 db2admin start SQL4409W The DB2 Administration Server is already active.
2
2706
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
835
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. 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?
0
3960
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 NIS). The installation process is carried out by using the root user (as root, not using sudo or something else). We selected the custom installation and de-selected the SA MP option but enabled the option to build the TOOLSDB (catalog db as I...
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.