- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to get the correct dbase name in UNIX
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2004 10:36 PM
тАО06-05-2004 10:36 PM
How to get the correct dbase name in UNIX
for example
box name : HPUX1
dbase1: dev1
dbase2:dev2
dbase3:dev3
dbase4:qa1
dbase5:qa2
dbase6:qa3
I have to promote a shell script which basically tests whether the dev database is up if it is being executed with dev env file
if the script is being executed with qa env file it has to check for qa databases.
Presently I have hardcoded the dbase name in my script for examplce:
dbase1=dev1
dbase2=dev2
dbase3=dev3
but my concern is if this script gets promoted and someone wants to execute it with qa environments then it will still check for the dev baseses dev1, dev2, dev3. How do I dynamically change these parameters if thescript is being executed in qa to qa1, qa2, qa3.
Thank You very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2004 10:55 PM
тАО06-05-2004 10:55 PM
Re: How to get the correct dbase name in UNIX
Something like , hv a /std/local/DBS/env which has these and script looks for this file on every node.
Regds,
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2004 03:26 AM
тАО06-06-2004 03:26 AM
Re: How to get the correct dbase name in UNIX
Try with ps -ef |grep -i pmon ,
then use awk to cut the db name .
BYE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2004 03:42 AM
тАО06-06-2004 03:42 AM
Re: How to get the correct dbase name in UNIX
According to Oracle rules, the DBs which work on a computer, should be written to a file called /etc/oratab.
The format of each entry of the file is:
SID:ORACLE_HOME:Y
for the DB, which should be started by dbstart, or
SID:ORACLE_HOME:N
if you don't want to start the DB by dbstart.
e.g.:
QA1:/home/oraprod/ORA8174:Y
QA2:/home/oraprod/ORA9i:N
Reading /etc/oratab file, you can obtain all SIDs and check the DB status with
ps -fuoracle|grep ora_pmon_$SID
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2004 07:55 PM
тАО06-06-2004 07:55 PM
Re: How to get the correct dbase name in UNIX
for OraSid in $(grep -E -v "^#|^$" /etc/oratab|cut -d: -f1);do
# setup the rigth Oracle environment
export ORACLE_SID=$OraSid
ORAENV_ASK=NO; . oraenv
# put your checks here
done
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2004 08:54 AM
тАО06-07-2004 08:54 AM
Re: How to get the correct dbase name in UNIX
Setup the config file so it exists on all the boxes that you run DB's on - then NFS mount it (if you use NFS) so you only have to maintain and publish one copy.
You can even call the script from within the .profile (at login) of any user that is used to administer a single DB. If your admin user is used to administer multiple DBs (such as is typical on ORACLE and INGRES) then you can still just call it from the command line each time you login to adminsiter a set of DB's.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2004 07:06 PM
тАО06-14-2004 07:06 PM
Re: How to get the correct dbase name in UNIX
cat /etc/oratab | while read LINE
do
case $LINE in
\#*) ;; #comment-line in oratab
*)
# Proceed only if third field is 'Y'.
if [ "`echo $LINE | awk -F: '{print $3}' -`" = "Y" ] && [ "${Db_Name}" = "none" ]
then
ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
oracle_sid=`echo $ORACLE_SID|tr "[A-Z]" "[a-z]"`
.....
Rgds
Alexander M. Ermes