- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to place command line statements into a sq...
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
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
тАО03-29-2004 04:46 AM
тАО03-29-2004 04:46 AM
Oracle 8.1.7.4, HP-UX 11.0
I am a newbie to Oracle so please forgive my
basic question.
I have a six lines of svrmgrl statements that I would like to convert into a sql script.
We want to run this from a cron job.
SVRMGR> connect internal
Connected.
SVRMGR> select name,
2> trunc(sgasize/(1024*1024))"Allocated (M)",
3> trunc(bytes/1024) "Free (K)",
4> round(bytes/sgasize*100,2) "% Free"
5> from (select sum(bytes) sgasize from sys.v_$sgastat) s,sys.v_$sgastat f
6> where f.name = 'free memory';
10 points to any good answer.
TIA, Gino
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2004 04:59 AM
тАО03-29-2004 04:59 AM
Solutionconnect internal
trunc(sgasize/(1024*1024))"Allocated (M)",
trunc(bytes/1024) "Free (K)",
round(bytes/sgasize*100,2) "% Free"
from (select sum(bytes) sgasize from sys.v_$sgastat) s,sys.v_$sgastat f
where f.name = 'free memory';
EOF
some adjustment may be required.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2004 07:06 PM
тАО03-29-2004 07:06 PM
Re: How to place command line statements into a sql script?
If you are doing some sort of monitoring, you may also wish to schedule STATSPACK snaps at reqular intervals. Then run the spreport.sql script to generate the desired reports.
regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 04:40 AM
тАО03-30-2004 04:40 AM
Re: How to place command line statements into a sql script?
Yogeeraj is quite correct in observing that if you choose to gather Oracle stats similar to your example then you may want to aim higher and get it all: Statspack.
Mind you, generating the snaps (automatically) is trivial. Generating the actual reports a little more tricky due to the interactive nature of spreport and the variable snap numbers.
Anyway... my personal prefence in using scripted sql reports is to stick them into a .sql file and feed that to sqlplus. The main advantages I see for this is
- able to use same script interactively if/when desired
- easier testing/debugging/expanding of script through interactve sqlplus session
- easier to change later, leaving job in place just making it execute better code.
So the job you would actually run might be:
su - oracle -c sqlplus -s "x/y@z" @daily
or
cat daily.sql | sqlplus ....
or sqlplus .... < daily.sql > daily.log
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 12:35 PM
тАО03-30-2004 12:35 PM
Re: How to place command line statements into a sql script?
If you wanted to run as a crn job then you just save the above line as a script with the line at the top and bottom as Steven specified.
svrmgrl <
connect internal
@
exit
EOF
And as Yogeeraj mentioned, for monitoring, if you are trying to generate the Statspack
Performance Report you need to run spreport.sql($OH/rdbms/admin) and choose the Begin and End snapshot ID's, between which the report will be generated.
Note: But, when the script spreport.sql is run, the column SnapId is displayed as
#####. So change the column formatting options for the snap_id column in the
spreport.sql script to a higher value.
Indira A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 02:10 PM
тАО03-30-2004 02:10 PM
Re: How to place command line statements into a sql script?
Oracle yanked svrmgr with Oracle 9i. You have to use sqlplus and they yanked out sqlplus internal with 9i as well.
Still the technique works just fine.
I for one would not mind seeing an example or elaboration on the second post to this thread.
Good Luck,
Steve
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com