RE: svrmgrl echo v$database in script

2002-10-04 Thread Robertson Lee - lerobe

Heh heh,

Just popped in for a quicky !!!

Regards

Lee

-Original Message-
Sent: 03 October 2002 19:29
To: Multiple recipients of list ORACLE-L


Lee, you're alive.  I'll let the OT list know!  Ruth
- Original Message -
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Sent: Thursday, October 03, 2002 1:33 PM


 Hi,

 This works

 #!/bin/ksh
 export ORACLE_SID=ADW
 export ORACLE_HOME=/usr/app/oracle/product/8.0.5
 export PATH=$ORACLE_HOME/bin:$PATH

 svrmgrl EOF
 connect internal
 select name from v_\$database;
 exit

 EOF

 Just escape the $ sign with a backslash.

 HTH

 Lee

 -Original Message-
 [mailto:[EMAIL PROTECTED]]
 Sent: 03 October 2002 16:43
 To: Multiple recipients of list ORACLE-L


 echo $ORACLE_SID  logfile

 Scott Shafer
 San Antonio, TX
 210.581.6217


  -Original Message-
  From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
  Sent: Wednesday, October 02, 2002 6:28 PM
  To: Multiple recipients of list ORACLE-L
  Subject: svrmgrl echo v$database in script
 
 
  Oracle 8.0.5
  Solaris 2.6
 
  List:
  I've created a script (ksh) called from elsewhere that shuts down the
  database.  I REALLY want to echo the name of the database into my log
file
  before I shut down.While select name from v$database works fine
from
  svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
  is
  screwing it up.  (I can get other commands to work within the script.)
  However, I don't know what to do about it.
 
  Any ideas?
 
  Thx!!!
 
  Barb
 
  $ svrmgrl
 
  SVRMGR connect internal
  Connected.
  SVRMGR select name from v$database;
  NAME
  -
  TADENT
  1 row selected.
 
 
  #!/usr/bin/ksh
  # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
  # Name: stop_db.sh
  # Author:   Barb Baker
  # Purpose:  execute shutdown immediate on current database
  #   (i.e., database pointed to by current value of
ORACLE_SID)
  
  echo Stop oracle instance \${ORACLE_SID}\  at `date` 
 ${ORACLE_HOME}/bin/svrmgrl  EOF
 connect internal
 select name from v_$database;
  EOF
 
 
  $  ./stop_db.sh
  Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
  SVRMGR Connected.
  SVRMGRselect name from v_
*
  ORA-00942: table or view does not exist
  SVRMGR
  Server Manager complete.
 
  --
  Please see the official ORACLE-L FAQ: http://www.orafaq.com
  --
  Author: Baker, Barbara
INET: [EMAIL PROTECTED]
 
  Fat City Network Services-- 858-538-5051 http://www.fatcity.com
  San Diego, California-- Mailing list and web hosting services
  -
  To REMOVE yourself from this mailing list, send an E-Mail message
  to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
  the message BODY, include a line containing: UNSUB ORACLE-L
  (or the name of mailing list you want to be removed from).  You may
  also send the HELP command for other information (like subscribing).
 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author:
   INET: [EMAIL PROTECTED]

 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).




 **
 The information contained in this communication is
 confidential, is intended only for the use of the recipient
 named above, and may be legally privileged.
 If the reader of this message is not the intended
 recipient, you are hereby notified that any dissemination,
 distribution, or copying of this communication is strictly
 prohibited.
 If you have received this communication in error,
 please re-send this communication to the sender and
 delete the original message or any copy of it from your
 computer system. Thank You.

 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author: Robertson Lee - lerobe
   INET: [EMAIL PROTECTED]

 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from

RE: svrmgrl echo v$database in script

2002-10-03 Thread Scott . Shafer

echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: svrmgrl echo v$database in script

2002-10-03 Thread Rachel Carmichael

If fyou want to do it from within a script, you either need to code the
select into a .sql file that you run OR you need to escape the $ with
a \ in your ksh script


--- [EMAIL PROTECTED] wrote:
 echo $ORACLE_SID  logfile
 
 Scott Shafer
 San Antonio, TX
 210.581.6217
 
 
  -Original Message-
  From:   Baker, Barbara [SMTP:[EMAIL PROTECTED]]
  Sent:   Wednesday, October 02, 2002 6:28 PM
  To: Multiple recipients of list ORACLE-L
  Subject:svrmgrl echo v$database in script
  
  
  Oracle 8.0.5
  Solaris 2.6
  
  List:
  I've created a script (ksh) called from elsewhere that shuts down
 the
  database.  I REALLY want to echo the name of the database into my
 log file
  before I shut down.While select name from v$database works
 fine from
  svrmgrl interactively, it throws up in the script.  I'd guess the $
 sign
  is
  screwing it up.  (I can get other commands to work within the
 script.)
  However, I don't know what to do about it.
  
  Any ideas?
  
  Thx!!!
  
  Barb
  
  $ svrmgrl
  
  SVRMGR connect internal
  Connected.
  SVRMGR select name from v$database;
  NAME
  -
  TADENT
  1 row selected.
  
  
  #!/usr/bin/ksh
  # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
  # Name: stop_db.sh
  # Author:   Barb Baker
  # Purpose:  execute shutdown immediate on current database
  #   (i.e., database pointed to by current value of
 ORACLE_SID)
  
  echo Stop oracle instance \${ORACLE_SID}\  at `date` 
 ${ORACLE_HOME}/bin/svrmgrl  EOF
 connect internal
 select name from v_$database;
  EOF
  
  
  $  ./stop_db.sh
  Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
  
  
  SVRMGR Connected.
  SVRMGRselect name from v_
*
  ORA-00942: table or view does not exist
  SVRMGR
  Server Manager complete.
  
  -- 
  Please see the official ORACLE-L FAQ: http://www.orafaq.com
  -- 
  Author: Baker, Barbara
INET: [EMAIL PROTECTED]
  
  Fat City Network Services-- 858-538-5051 http://www.fatcity.com
  San Diego, California-- Mailing list and web hosting
 services
 
 -
  To REMOVE yourself from this mailing list, send an E-Mail message
  to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
  the message BODY, include a line containing: UNSUB ORACLE-L
  (or the name of mailing list you want to be removed from).  You may
  also send the HELP command for other information (like
 subscribing).
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: 
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rachel Carmichael
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: svrmgrl echo v$database in script

2002-10-03 Thread Robertson Lee - lerobe

Hi,

This works

#!/bin/ksh
export ORACLE_SID=ADW
export ORACLE_HOME=/usr/app/oracle/product/8.0.5
export PATH=$ORACLE_HOME/bin:$PATH

svrmgrl EOF
connect internal
select name from v_\$database;
exit

EOF

Just escape the $ sign with a backslash.

HTH

Lee

-Original Message-
[mailto:[EMAIL PROTECTED]]
Sent: 03 October 2002 16:43
To: Multiple recipients of list ORACLE-L


echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




**
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, 
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Robertson Lee - lerobe
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: svrmgrl echo v$database in script

2002-10-03 Thread Deshpande, Kirti

Use \ to escape the $ sign. 

select name from v_\$database;


- Kirti


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Deshpande, Kirti
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: svrmgrl echo v$database in script

2002-10-03 Thread Fink, Dan

What happens if the ORACLE_SID is set to one value and the caller uses
SQL*Net to access a different database? While this is not usually the case
in scripts, it could be a problem if the script is parted of a called
function. 
ORACLE_SID=DEV
sqlplus scott/tiger@PROD  -- I'm not connected to DEV anymore.

I realize this is nit-picking, but I've done far too many recoveries because
someone thought they were in DEV when they actually connected to PROD. I'd
rather know EXACTLY which db I'm connected to, not which one the O/S thinks
I should be in.

My $.02

Dan Fink

-Original Message-
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 9:43 AM
To: Multiple recipients of list ORACLE-L


echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Fink, Dan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: svrmgrl echo v$database in script

2002-10-03 Thread Kevin Lange

In order for the K Shell to let you use a Dollar Sign ($) as a litteral
 you need to use the escape character before it (\)
 
 So, instead of 
   select name from v$database;
 use
   select name from v\$database;

-Original Message-
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 10:43 AM
To: Multiple recipients of list ORACLE-L


echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Kevin Lange
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: svrmgrl echo v$database in script

2002-10-03 Thread Ruth Gramolini

Lee, you're alive.  I'll let the OT list know!  Ruth
- Original Message -
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Sent: Thursday, October 03, 2002 1:33 PM


 Hi,

 This works

 #!/bin/ksh
 export ORACLE_SID=ADW
 export ORACLE_HOME=/usr/app/oracle/product/8.0.5
 export PATH=$ORACLE_HOME/bin:$PATH

 svrmgrl EOF
 connect internal
 select name from v_\$database;
 exit

 EOF

 Just escape the $ sign with a backslash.

 HTH

 Lee

 -Original Message-
 [mailto:[EMAIL PROTECTED]]
 Sent: 03 October 2002 16:43
 To: Multiple recipients of list ORACLE-L


 echo $ORACLE_SID  logfile

 Scott Shafer
 San Antonio, TX
 210.581.6217


  -Original Message-
  From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
  Sent: Wednesday, October 02, 2002 6:28 PM
  To: Multiple recipients of list ORACLE-L
  Subject: svrmgrl echo v$database in script
 
 
  Oracle 8.0.5
  Solaris 2.6
 
  List:
  I've created a script (ksh) called from elsewhere that shuts down the
  database.  I REALLY want to echo the name of the database into my log
file
  before I shut down.While select name from v$database works fine
from
  svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
  is
  screwing it up.  (I can get other commands to work within the script.)
  However, I don't know what to do about it.
 
  Any ideas?
 
  Thx!!!
 
  Barb
 
  $ svrmgrl
 
  SVRMGR connect internal
  Connected.
  SVRMGR select name from v$database;
  NAME
  -
  TADENT
  1 row selected.
 
 
  #!/usr/bin/ksh
  # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
  # Name: stop_db.sh
  # Author:   Barb Baker
  # Purpose:  execute shutdown immediate on current database
  #   (i.e., database pointed to by current value of
ORACLE_SID)
  
  echo Stop oracle instance \${ORACLE_SID}\  at `date` 
 ${ORACLE_HOME}/bin/svrmgrl  EOF
 connect internal
 select name from v_$database;
  EOF
 
 
  $  ./stop_db.sh
  Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
  SVRMGR Connected.
  SVRMGRselect name from v_
*
  ORA-00942: table or view does not exist
  SVRMGR
  Server Manager complete.
 
  --
  Please see the official ORACLE-L FAQ: http://www.orafaq.com
  --
  Author: Baker, Barbara
INET: [EMAIL PROTECTED]
 
  Fat City Network Services-- 858-538-5051 http://www.fatcity.com
  San Diego, California-- Mailing list and web hosting services
  -
  To REMOVE yourself from this mailing list, send an E-Mail message
  to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
  the message BODY, include a line containing: UNSUB ORACLE-L
  (or the name of mailing list you want to be removed from).  You may
  also send the HELP command for other information (like subscribing).
 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author:
   INET: [EMAIL PROTECTED]

 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).




 **
 The information contained in this communication is
 confidential, is intended only for the use of the recipient
 named above, and may be legally privileged.
 If the reader of this message is not the intended
 recipient, you are hereby notified that any dissemination,
 distribution, or copying of this communication is strictly
 prohibited.
 If you have received this communication in error,
 please re-send this communication to the sender and
 delete the original message or any copy of it from your
 computer system. Thank You.

 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author: Robertson Lee - lerobe
   INET: [EMAIL PROTECTED]

 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author

RE: svrmgrl echo v$database in script

2002-10-03 Thread Scott . Shafer

A)  Change your unholy methods to use the light side of the force.
or
B)  Just use a different variable to hold the tnsnames.ora entry of wherever
you happen to be connecting to.  Or initialize the $ORACLE_SID variable to
whatever you want it to be.  This allows you to iterate through a list of
SIDs to perform ops on multiple db's if needed, i.e., 

sqlplus user@current_sid
 ...
 exit
 echo $current_sid  logfile

in your script.

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Fink, Dan [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, October 03, 2002 12:34 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  RE: svrmgrl echo v$database in script
 
 What happens if the ORACLE_SID is set to one value and the caller uses
 SQL*Net to access a different database? While this is not usually the case
 in scripts, it could be a problem if the script is parted of a called
 function. 
 ORACLE_SID=DEV
 sqlplus scott/tiger@PROD  -- I'm not connected to DEV anymore.
 
 I realize this is nit-picking, but I've done far too many recoveries
 because
 someone thought they were in DEV when they actually connected to PROD. I'd
 rather know EXACTLY which db I'm connected to, not which one the O/S
 thinks
 I should be in.
 
 My $.02
 
 Dan Fink
 
 -Original Message-
 [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 03, 2002 9:43 AM
 To: Multiple recipients of list ORACLE-L
 
 
 echo $ORACLE_SID  logfile
 
 Scott Shafer
 San Antonio, TX
 210.581.6217
 
 
  -Original Message-
  From:   Baker, Barbara [SMTP:[EMAIL PROTECTED]]
  Sent:   Wednesday, October 02, 2002 6:28 PM
  To: Multiple recipients of list ORACLE-L
  Subject:svrmgrl echo v$database in script
  
  
  Oracle 8.0.5
  Solaris 2.6
  
  List:
  I've created a script (ksh) called from elsewhere that shuts down the
  database.  I REALLY want to echo the name of the database into my log
 file
  before I shut down.While select name from v$database works fine
 from
  svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
  is
  screwing it up.  (I can get other commands to work within the script.)
  However, I don't know what to do about it.
  
  Any ideas?
  
  Thx!!!
  
  Barb
  
  $ svrmgrl
  
  SVRMGR connect internal
  Connected.
  SVRMGR select name from v$database;
  NAME
  -
  TADENT
  1 row selected.
  
  
  #!/usr/bin/ksh
  # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
  # Name: stop_db.sh
  # Author:   Barb Baker
  # Purpose:  execute shutdown immediate on current database
  #   (i.e., database pointed to by current value of
 ORACLE_SID)
  
  echo Stop oracle instance \${ORACLE_SID}\  at `date` 
 ${ORACLE_HOME}/bin/svrmgrl  EOF
 connect internal
 select name from v_$database;
  EOF
  
  
  $  ./stop_db.sh
  Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
  
  
  SVRMGR Connected.
  SVRMGRselect name from v_
*
  ORA-00942: table or view does not exist
  SVRMGR
  Server Manager complete.
 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re:RE: svrmgrl echo v$database in script

2002-10-03 Thread dgoulet

Dan,

You can use a anonymous PL/SQL block like the following in you login.sql or
script file is necessary, it keeps those errors from happening:

whenever sqlerror exit
declare
  db varchar2(30);
begin
  select global_name into db from global_name;
  if(db not like 'DEV%') then raise_application_error(-20100, Wrong Database);
  end if;
end;
/


Dick Goulet

Reply Separator
Author: Fink; Dan [EMAIL PROTECTED]
Date:   10/3/2002 9:33 AM

What happens if the ORACLE_SID is set to one value and the caller uses
SQL*Net to access a different database? While this is not usually the case
in scripts, it could be a problem if the script is parted of a called
function. 
ORACLE_SID=DEV
sqlplus scott/tiger@PROD  -- I'm not connected to DEV anymore.

I realize this is nit-picking, but I've done far too many recoveries because
someone thought they were in DEV when they actually connected to PROD. I'd
rather know EXACTLY which db I'm connected to, not which one the O/S thinks
I should be in.

My $.02

Dan Fink

-Original Message-
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 9:43 AM
To: Multiple recipients of list ORACLE-L


echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Fink, Dan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http

RE: svrmgrl echo v$database in script

2002-10-03 Thread Scott . Shafer

Or a here document that allows you to iterate through a list of SID's if
necessary.  Env variables don't have to be static on *nix...

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Rachel Carmichael [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, October 03, 2002 12:44 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  RE: svrmgrl echo v$database in script
 
 If fyou want to do it from within a script, you either need to code the
 select into a .sql file that you run OR you need to escape the $ with
 a \ in your ksh script
 
 
 --- [EMAIL PROTECTED] wrote:
  echo $ORACLE_SID  logfile
  
  Scott Shafer
  San Antonio, TX
  210.581.6217
  
  
   -Original Message-
   From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
   Sent: Wednesday, October 02, 2002 6:28 PM
   To:   Multiple recipients of list ORACLE-L
   Subject:  svrmgrl echo v$database in script
   
   
   Oracle 8.0.5
   Solaris 2.6
   
   List:
   I've created a script (ksh) called from elsewhere that shuts down
  the
   database.  I REALLY want to echo the name of the database into my
  log file
   before I shut down.While select name from v$database works
  fine from
   svrmgrl interactively, it throws up in the script.  I'd guess the $
  sign
   is
   screwing it up.  (I can get other commands to work within the
  script.)
   However, I don't know what to do about it.
   
   Any ideas?
   
   Thx!!!
   
   Barb
   
   $ svrmgrl
   
   SVRMGR connect internal
   Connected.
   SVRMGR select name from v$database;
   NAME
   -
   TADENT
   1 row selected.
   
   
   #!/usr/bin/ksh
   # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
   # Name: stop_db.sh
   # Author:   Barb Baker
   # Purpose:  execute shutdown immediate on current database
   #   (i.e., database pointed to by current value of
  ORACLE_SID)
   
   echo Stop oracle instance \${ORACLE_SID}\  at `date` 
  ${ORACLE_HOME}/bin/svrmgrl  EOF
  connect internal
  select name from v_$database;
   EOF
   
   
   $  ./stop_db.sh
   Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
   
   
   SVRMGR Connected.
   SVRMGRselect name from v_
 *
   ORA-00942: table or view does not exist
   SVRMGR
   Server Manager complete.
   
   -- 
   Please see the official ORACLE-L FAQ: http://www.orafaq.com
   -- 
   Author: Baker, Barbara
 INET: [EMAIL PROTECTED]
   
   Fat City Network Services-- 858-538-5051 http://www.fatcity.com
   San Diego, California-- Mailing list and web hosting
  services
  
  -
   To REMOVE yourself from this mailing list, send an E-Mail message
   to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
   the message BODY, include a line containing: UNSUB ORACLE-L
   (or the name of mailing list you want to be removed from).  You may
   also send the HELP command for other information (like
  subscribing).
  -- 
  Please see the official ORACLE-L FAQ: http://www.orafaq.com
  -- 
  Author: 
INET: [EMAIL PROTECTED]
  
  Fat City Network Services-- 858-538-5051 http://www.fatcity.com
  San Diego, California-- Mailing list and web hosting services
  -
  To REMOVE yourself from this mailing list, send an E-Mail message
  to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
  the message BODY, include a line containing: UNSUB ORACLE-L
  (or the name of mailing list you want to be removed from).  You may
  also send the HELP command for other information (like subscribing).
 
 
 __
 Do you Yahoo!?
 New DSL Internet Access from SBC  Yahoo!
 http://sbc.yahoo.com
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Rachel Carmichael
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL

RE: RE: svrmgrl echo v$database in script

2002-10-03 Thread Fink, Dan

Dick,
That is one method. My rule is that all destructive actions are run
from scripts that require the database name as a parameter. If the
$ORACLE_SID and parameter don't match, the script terminates. I realize this
is redundant, but better safe than having to perform a production recovery.
I don't have to code in any database specific values like 'DEV', 'PROD',
etc. so the script can be used for any database. My 'stub' korn shell script
already has this built in, so I don't even have to remember it.
As an aside, one of the problems I have had with putting this kind
of code in login.sql or glogin.sql is that it causes problems if the
database is not open. I recall spending a few hours troubleshooting a
monitoring script. It would work just fine while we were developing and
testing, but it would fail overnight in the cron job. The database was down
and the glogin.sql script was terminating. To this day, I still don't put
any queries inside login.sql and glogin.sql. One of those things that is
probably fixable, but I'd rather work in improving my Buffer Cache Hit
Ratio.

Dan

-Original Message-
Sent: Thursday, October 03, 2002 11:42 AM
To: Fink; Dan; Multiple recipients of list ORACLE-L


Dan,

You can use a anonymous PL/SQL block like the following in you login.sql
or
script file is necessary, it keeps those errors from happening:

whenever sqlerror exit
declare
  db varchar2(30);
begin
  select global_name into db from global_name;
  if(db not like 'DEV%') then raise_application_error(-20100, Wrong
Database);
  end if;
end;
/


Dick Goulet

Reply Separator
Author: Fink; Dan [EMAIL PROTECTED]
Date:   10/3/2002 9:33 AM

What happens if the ORACLE_SID is set to one value and the caller uses
SQL*Net to access a different database? While this is not usually the case
in scripts, it could be a problem if the script is parted of a called
function. 
ORACLE_SID=DEV
sqlplus scott/tiger@PROD  -- I'm not connected to DEV anymore.

I realize this is nit-picking, but I've done far too many recoveries because
someone thought they were in DEV when they actually connected to PROD. I'd
rather know EXACTLY which db I'm connected to, not which one the O/S thinks
I should be in.

My $.02

Dan Fink

-Original Message-
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 9:43 AM
To: Multiple recipients of list ORACLE-L


echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web

Re:RE: RE: svrmgrl echo v$database in script

2002-10-03 Thread dgoulet

Dan,

For the most part I wholeheartedly agree.  But on the same note I do install
stuff like that in scripts that I expect developers to run  I know exactly what
database their suppose to be in.  On top of that, since the developers don't
have the ability to perform an alter database command to change global_name It's
even safer.  Anything to keep a developer from mucking about where they're not
suppose to.

Dick Goulet

Reply Separator
Author: Fink; Dan [EMAIL PROTECTED]
Date:   10/3/2002 11:43 AM

Dick,
That is one method. My rule is that all destructive actions are run
from scripts that require the database name as a parameter. If the
$ORACLE_SID and parameter don't match, the script terminates. I realize this
is redundant, but better safe than having to perform a production recovery.
I don't have to code in any database specific values like 'DEV', 'PROD',
etc. so the script can be used for any database. My 'stub' korn shell script
already has this built in, so I don't even have to remember it.
As an aside, one of the problems I have had with putting this kind
of code in login.sql or glogin.sql is that it causes problems if the
database is not open. I recall spending a few hours troubleshooting a
monitoring script. It would work just fine while we were developing and
testing, but it would fail overnight in the cron job. The database was down
and the glogin.sql script was terminating. To this day, I still don't put
any queries inside login.sql and glogin.sql. One of those things that is
probably fixable, but I'd rather work in improving my Buffer Cache Hit
Ratio.

Dan

-Original Message-
Sent: Thursday, October 03, 2002 11:42 AM
To: Fink; Dan; Multiple recipients of list ORACLE-L


Dan,

You can use a anonymous PL/SQL block like the following in you login.sql
or
script file is necessary, it keeps those errors from happening:

whenever sqlerror exit
declare
  db varchar2(30);
begin
  select global_name into db from global_name;
  if(db not like 'DEV%') then raise_application_error(-20100, Wrong
Database);
  end if;
end;
/


Dick Goulet

Reply Separator
Author: Fink; Dan [EMAIL PROTECTED]
Date:   10/3/2002 9:33 AM

What happens if the ORACLE_SID is set to one value and the caller uses
SQL*Net to access a different database? While this is not usually the case
in scripts, it could be a problem if the script is parted of a called
function. 
ORACLE_SID=DEV
sqlplus scott/tiger@PROD  -- I'm not connected to DEV anymore.

I realize this is nit-picking, but I've done far too many recoveries because
someone thought they were in DEV when they actually connected to PROD. I'd
rather know EXACTLY which db I'm connected to, not which one the O/S thinks
I should be in.

My $.02

Dan Fink

-Original Message-
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 9:43 AM
To: Multiple recipients of list ORACLE-L


echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log file
 before I shut down.While select name from v$database works fine from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services

RE: RE: svrmgrl echo v$database in script

2002-10-03 Thread Jared . Still

Dan,

I've had a similar problem with glogin.sql and login.sql in the past.

Rather than gut my login scripts, I just edited or removed the SQLPATH
environment variable. And set a variable in the korn script to point to
the location of the SQL files.

This variable is then used to locate the needed scripts.

Jared






Fink, Dan [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
 10/03/2002 12:43 PM
 Please respond to ORACLE-L

 
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
cc: 
Subject:RE: RE: svrmgrl echo v$database in script


Dick,
 That is one method. My rule is that all destructive 
actions are run
from scripts that require the database name as a parameter. If the
$ORACLE_SID and parameter don't match, the script terminates. I realize 
this
is redundant, but better safe than having to perform a production 
recovery.
I don't have to code in any database specific values like 'DEV', 'PROD',
etc. so the script can be used for any database. My 'stub' korn shell 
script
already has this built in, so I don't even have to remember it.
 As an aside, one of the problems I have had with putting 
this kind
of code in login.sql or glogin.sql is that it causes problems if the
database is not open. I recall spending a few hours troubleshooting a
monitoring script. It would work just fine while we were developing and
testing, but it would fail overnight in the cron job. The database was 
down
and the glogin.sql script was terminating. To this day, I still don't put
any queries inside login.sql and glogin.sql. One of those things that is
probably fixable, but I'd rather work in improving my Buffer Cache Hit
Ratio.

Dan

-Original Message-
Sent: Thursday, October 03, 2002 11:42 AM
To: Fink; Dan; Multiple recipients of list ORACLE-L


Dan,

You can use a anonymous PL/SQL block like the following in you 
login.sql
or
script file is necessary, it keeps those errors from happening:

whenever sqlerror exit
declare
  db varchar2(30);
begin
  select global_name into db from global_name;
  if(db not like 'DEV%') then raise_application_error(-20100, Wrong
Database);
  end if;
end;
/


Dick Goulet

Reply Separator
Author: Fink; Dan [EMAIL PROTECTED]
Date:   10/3/2002 9:33 AM

What happens if the ORACLE_SID is set to one value and the caller uses
SQL*Net to access a different database? While this is not usually the case
in scripts, it could be a problem if the script is parted of a called
function. 
ORACLE_SID=DEV
sqlplus scott/tiger@PROD  -- I'm not connected to DEV anymore.

I realize this is nit-picking, but I've done far too many recoveries 
because
someone thought they were in DEV when they actually connected to PROD. I'd
rather know EXACTLY which db I'm connected to, not which one the O/S 
thinks
I should be in.

My $.02

Dan Fink

-Original Message-
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 9:43 AM
To: Multiple recipients of list ORACLE-L


echo $ORACLE_SID  logfile

Scott Shafer
San Antonio, TX
210.581.6217


 -Original Message-
 From: Baker, Barbara [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 02, 2002 6:28 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  svrmgrl echo v$database in script
 
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database.  I REALLY want to echo the name of the database into my log 
file
 before I shut down.While select name from v$database works fine 
from
 svrmgrl interactively, it throws up in the script.  I'd guess the $ sign
 is
 screwing it up.  (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 Any ideas?
 
 Thx!!!
 
 Barb
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author:   Barb Baker
 # Purpose:  execute shutdown immediate on current database
 #   (i.e., database pointed to by current value of 
ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\  at `date` 
${ORACLE_HOME}/bin/svrmgrl  EOF
connect internal
select name from v_$database;
 EOF
 
 
 $  ./stop_db.sh
 Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGRselect name from v_
   *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Baker, Barbara
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services

svrmgrl echo v$database in script

2002-10-02 Thread Baker, Barbara


Oracle 8.0.5
Solaris 2.6

List:
I've created a script (ksh) called from elsewhere that shuts down the
database.  I REALLY want to echo the name of the database into my log file
before I shut down.While select name from v$database works fine from
svrmgrl interactively, it throws up in the script.  I'd guess the $ sign is
screwing it up.  (I can get other commands to work within the script.)
However, I don't know what to do about it.

Any ideas?

Thx!!!

Barb

$ svrmgrl

SVRMGR connect internal
Connected.
SVRMGR select name from v$database;
NAME
-
TADENT
1 row selected.


#!/usr/bin/ksh
# $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
# Name: stop_db.sh
# Author:   Barb Baker
# Purpose:  execute shutdown immediate on current database
#   (i.e., database pointed to by current value of ORACLE_SID)

echo Stop oracle instance \${ORACLE_SID}\  at `date` 
   ${ORACLE_HOME}/bin/svrmgrl  EOF
   connect internal
   select name from v_$database;
EOF


$  ./stop_db.sh
Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002


SVRMGR Connected.
SVRMGRselect name from v_
  *
ORA-00942: table or view does not exist
SVRMGR
Server Manager complete.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Baker, Barbara
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: svrmgrl echo v$database in script

2002-10-02 Thread Ron Thomas


Sounds like you svrmgrl commands are in a where document.  You need to escape the $, 
ie

select name from v\$database ;



Ron Thomas
Hypercom, Inc
[EMAIL PROTECTED]
Each new user of a new system uncovers a new class of bugs. -- Kernighan


   

  [EMAIL PROTECTED] 

   To:   [EMAIL PROTECTED]  

  10/02/02 04:28 PMcc: 

  Please respond toSubject:  svrmgrl echo v$database in 
script 
  ORACLE-L 

   

   






Oracle 8.0.5
Solaris 2.6

List:
I've created a script (ksh) called from elsewhere that shuts down the
database.  I REALLY want to echo the name of the database into my log file
before I shut down.While select name from v$database works fine from
svrmgrl interactively, it throws up in the script.  I'd guess the $ sign is
screwing it up.  (I can get other commands to work within the script.)
However, I don't know what to do about it.

Any ideas?

Thx!!!

Barb

$ svrmgrl

SVRMGR connect internal
Connected.
SVRMGR select name from v$database;
NAME
-
TADENT
1 row selected.


#!/usr/bin/ksh
# $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
# Name: stop_db.sh
# Author:   Barb Baker
# Purpose:  execute shutdown immediate on current database
#   (i.e., database pointed to by current value of ORACLE_SID)

echo Stop oracle instance \${ORACLE_SID}\  at `date` 
   ${ORACLE_HOME}/bin/svrmgrl  EOF
   connect internal
   select name from v_$database;
EOF


$  ./stop_db.sh
Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002


SVRMGR Connected.
SVRMGRselect name from v_
  *
ORA-00942: table or view does not exist
SVRMGR
Server Manager complete.

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Baker, Barbara
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Ron Thomas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: svrmgrl echo v$database in script

2002-10-02 Thread Sujatha Madan

Hi Barbara!

Try using a  \ before the $.

So your script should read: 

echo Stop oracle instance \${ORACLE_SID}\  at `date` 
   ${ORACLE_HOME}/bin/svrmgrl  EOF
   connect internal
   select name from v\$database;
EOF

Cheers
Suji



-Original Message-
Sent: Thursday, 3 October 2002 9:28 AM
To: Multiple recipients of list ORACLE-L



Oracle 8.0.5
Solaris 2.6

List:
I've created a script (ksh) called from elsewhere that shuts down the
database.  I REALLY want to echo the name of the database into my log file
before I shut down.While select name from v$database works fine from
svrmgrl interactively, it throws up in the script.  I'd guess the $ sign is
screwing it up.  (I can get other commands to work within the script.)
However, I don't know what to do about it.

Any ideas?

Thx!!!

Barb

$ svrmgrl

SVRMGR connect internal
Connected.
SVRMGR select name from v$database;
NAME
-
TADENT
1 row selected.


#!/usr/bin/ksh
# $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
# Name: stop_db.sh
# Author:   Barb Baker
# Purpose:  execute shutdown immediate on current database
#   (i.e., database pointed to by current value of ORACLE_SID)

echo Stop oracle instance \${ORACLE_SID}\  at `date` 
   ${ORACLE_HOME}/bin/svrmgrl  EOF
   connect internal
   select name from v_$database;
EOF


$  ./stop_db.sh
Stop oracle instance tadent  at Wed Oct  2 16:24:59 MDT 2002


SVRMGR Connected.
SVRMGRselect name from v_
  *
ORA-00942: table or view does not exist
SVRMGR
Server Manager complete.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Baker, Barbara
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Sujatha Madan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: svrmgrl echo v$database in script

2002-10-02 Thread Jacques Kilchoer
Title: RE: svrmgrl echo v$database in script





The shell thinks that $database is an environment variable.
Try instead select name from v\$database


 -Original Message-
 From: Baker, Barbara [mailto:[EMAIL PROTECTED]]
 
 Oracle 8.0.5
 Solaris 2.6
 
 List:
 I've created a script (ksh) called from elsewhere that shuts down the
 database. I REALLY want to echo the name of the database 
 into my log file
 before I shut down. While select name from v$database 
 works fine from
 svrmgrl interactively, it throws up in the script. I'd guess 
 the $ sign is
 screwing it up. (I can get other commands to work within the script.)
 However, I don't know what to do about it.
 
 $ svrmgrl
 
 SVRMGR connect internal
 Connected.
 SVRMGR select name from v$database;
 NAME
 -
 TADENT
 1 row selected.
 
 
 #!/usr/bin/ksh
 # $Id: stop_db.sh ver.1 10/02/2002 B.Baker Exp $
 # Name: stop_db.sh
 # Author: Barb Baker
 # Purpose: execute shutdown immediate on current database
 # (i.e., database pointed to by current value 
 of ORACLE_SID)
 
 echo Stop oracle instance \${ORACLE_SID}\ at `date` 
 ${ORACLE_HOME}/bin/svrmgrl  EOF
 connect internal
 select name from v_$database;
 EOF
 
 
 $ ./stop_db.sh
 Stop oracle instance tadent at Wed Oct 2 16:24:59 MDT 2002
 
 
 SVRMGR Connected.
 SVRMGR select name from v_
 *
 ORA-00942: table or view does not exist
 SVRMGR
 Server Manager complete.