- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Embed svrmgl in shell script !
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
тАО07-06-2002 04:24 AM
тАО07-06-2002 04:24 AM
Embed svrmgl in shell script !
I have problem to run svrmgl in batch mode in shutting and starting up the database when I put the below quote code within if-then-else clause. However, I am able to execute it successfully without the if-then-else clause. Anyone can help ??
Quote 1: This example works fine !!
su oracle "-c $ORACLE_BIN/svrmgrl" <
shutdown immediate;
exit;
EOF
Unquote 1
Quote 2: This example doesn't work
if [[ `ps -ef |grep -v grep |grep pmon |wc -l` -gt 1 ]]
then
su oracle "-c $ORACLE_BIN/svrmgrl" <
shutdown immediate;
exit;
EOF
fi
Unquote 2
The strange thing is the Shell return me syntax error for the redirect symbol "<".
Many thanks,
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-06-2002 05:03 AM
тАО07-06-2002 05:03 AM
Re: Embed svrmgl in shell script !
The redirect symbol is because the shell is basically telling you that your command is incomplete.
Try single [ around your if statement
also
Your su comment
try
su oracle -c 'ORACLE_BIN/svrmgrl' <
Hope this helps
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-06-2002 05:18 AM
тАО07-06-2002 05:18 AM
Re: Embed svrmgl in shell script !
Have been speaking with our dba who advised that your shutdown method is a little dirty
If you have client server applications that connect you should really stop the listener first so that new users can't connect, then kill user processes then perform a shutdown
HTH
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-06-2002 02:41 PM
тАО07-06-2002 02:41 PM
Re: Embed svrmgl in shell script !
your quoting is the problem:
su oracle -c "$ORACLE_BIN/svrmgrl" <
is what it should look like...
Just my $0.02,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-06-2002 04:08 PM
тАО07-06-2002 04:08 PM
Re: Embed svrmgl in shell script !
if [[ `ps -ef |grep -v grep |grep pmon |wc -l` -gt 1 ]]
Whenever you see ps and grep together, you've got big problems. The above string comparison will find totally unrelated processes!!! That's necause grep matches anything on the line and that is definitely not what you want. ps has 100x better search capability built in. The following will do what you want to accomplish:
if [ $(UNIX95= ps -C pmon | wc -l) > 1 ]
then
UNIX95 is a special variable that should be used in the above method (temp assignment, don't export it) and turns on many new features in ps including an exact process name match. The above -C pmon will never find processes such as pmon1 or upmon or processes with pmon on the command line or users with pmon in their name.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-08-2002 12:54 PM
тАО07-08-2002 12:54 PM
Re: Embed svrmgl in shell script !
The following commands to connect are good from 8.0 thru 9i.
oracle$ sqlplus /nolog
SQL> connect / as sysdba
You will need an orapwd file to allow the sysdba connection.
If you only have 1 db, or plan on using this to shutdown all the databases prior to system shutdown/reboot, oracle still supports the $ORACLE_HOME/bin/dbshut commands that will cycle through the oratab and shutdown all the databases indicated with a "Y". (There were some problems with dbshut/dbstart in 8i, but the fixes are readily available on Metalink for this.
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-08-2002 10:32 PM
тАО07-08-2002 10:32 PM
Re: Embed svrmgl in shell script !
Since I didn't see any answer rated above 5, I presume you still haven't solved your problem ? All the above information is excellent, but one thing didn't get mentioned. The EOF should / must / has to start in the first position. Your script doesn't show indentation, so probably this is a moot point, but often "what you paste isn't what you get", so I thought I'd mention it. I've often made the mistake myself of putting blanks before the EOF (making the if statement clearer) and then wondering what happened ... :-)
Regards,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2002 07:16 AM
тАО07-09-2002 07:16 AM
Re: Embed svrmgl in shell script !
Thanks for all your suggestions. I've used a work around solution to put the svrmgl block to another script and embed a system call to the svrgmrl script within the if - then - else routine and it works.
Cheers,
Chris,