Monitoring scripts - Crontab - how to ?
HI Gurus,
I`m very interesting how can I execute monitoring scripts in Oracle ?
Let say that I would like to have a script which will monitor Sessions and Queries every few minutes. Does Oracle have any internal crontab ?
In OS crontab script should include system user password to be executed, how to do it without password ? Is there any good way ?
Dlugasx wrote:
HI Gurus,
I`m very interesting how can I execute monitoring scripts in Oracle ?
Let say that I would like to have a script which will monitor Sessions and Queries every few minutes. Does Oracle have any internal crontab ?
In OS crontab script should include system user password to be executed, how to do it without password ? Is there any good way ?You can go for DBMS_SCHEDULER package, this is oracle internal job scheduler.
refer this link
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_sched.htm
Similar Messages
-
I created a monitoring script which would run from crontab....Would anyone tell me how I would export Oracle SID in crontab script instead of hard coded it. Thanks.
I do some simple checks for correct number of arguments using "if [[ $# -lt 1 ]]; then..."
This is very simple and doesn't confirm that the arguments are valid.
Example:
if [[ $# -lt 1 ]]; then
print "\n ERROR: You did not specify an Oracle SID."
print "\n Please enter which Oracle SID to import into. \n"
exit 1
else
echo "\n ORACLE_SID = $1 \n"
echo "Do you wish to continue? \n "
read REPLY
case $REPLY in
y|Y) echo "\n test good \n";;
n|N) echo "\n exiting... \n"; return 1;;
echo "Invalid response (Bozo). Exiting..."
echo ""
return 2;
esac
fiBut my point was to show a quick and easy solution to the OP for his purposes.
Using "echo $1 |. oraenv" passes the variable to oraenv and sets everything he needs for his purposes.
From the sounds of the OP's question, it didn't seem to have the skills to develop more complex scripts.
Personally, I like to use a special file that I keep updated on all servers.
I call the file 'localsids' and place it in the /var/opt/oracle directory.
I have a similar file called 'allsids', which contains a list of all sids on all servers for when I want to check all databases (e.g., such as for users having DBA role, or something like that).
Then, I check for validity (and can add and remove SIDs from the file at will, (depending on purposes such as blackouts).
I like using a loop for this purpose (SIDFILE='var/opt/oracle/localsids' cat $SIDFILE |while read SID... do....)
Example:
# ==================================================
# check input given against valid sids on this machine
# ==================================================
export SIDFILE='/var/opt/oracle/localsids'
SID=`grep $1 $SIDFILE`
if [ "$SID" = "$1" ]; then
print "\n \"$SID\" verified... \n"
else
print "\n ERROR... \"$1\" is not a valid SID for this machine. \n"
exit 1
fiI have a couple other variations as well.
I think it would be nice if OTN had a more appropriate forum for people like us who like scripting and/or what to share unix skills. -
Tablespace growth monitoring script
Hi,
I am done with tablespace growth monitoring script.
But I doesnot know how to configure it in WINDOWS to send alert MAIL.
Is there any utility for mail configuration in windows.
Please suggest any solution ASAP.
Regards,
ThiruIt is called OEM alerts. I think we can have configuration in oracle eneterprise manager grid control for automated warnings for tablespace growth. You just have to read below link :
http://download.oracle.com/docs/cd/B19306_01/server.102/b25159/monitor.htm#i1007180
Something near to :
Enterprise Manager Configuration--Management Services and Repository--Agent
Regards
Girish Sharma -
Database uptime monitoring by either snmp or active monitor script anyone?
Hi,
Has anyone previously setup any type of active monitoring script through whats up gold or an snmp informant type of monitoring script to advise when a database is down or specific process is down?
An example would be like ORACLE_PKG1, and the process is named ora_smon_hrprd88.
This is what the HP-UX “ps” shows:
tpadb01:/# ps -ef | grep -i ora_smon
oracle 13207 1 0 Jan 1 ? 0:29 ora_smon_epprd88
oracle 13281 1 0 Jan 1 ? 1:31 ora_smon_hrprd88
oracle 13635 1 0 Jan 1 ? 1:03 ora_smon_fsprd84
oracle 3620 1 0 Jan 2 ? 0:18 ora_smon_mtprd04
oracle 14586 1 0 Jan 1 ? 0:23 ora_smon_mtprd05
oracle 15223 1 0 Jan 1 ? 0:26 ora_smon_inprd88
oracle 15879 1 0 Jan 1 ? 0:25 ora_smon_epsal88
oracle 16769 1 0 Jan 1 ? 0:52 ora_smon_hrsal88
root 17976 22609 0 10:46:39 ttyp2 0:00 grep -i ora_smon
tpadb01:/#
Not sure if the extra info helps, but you never know. We can set it up to send us database up alerts, but the problem I have is when the listener service is down I can't get my script to finish no matter how I change the values of my script around. I can provide my script if that would help as well. If someone has already done this and is willing to share great!
HarveyI would suggest you install OEM Grid Control to monitor your databases. For basic monitoring function it's free. OEM GC works great, it's a little overweight though. It's also use SNMP.
Or you can choose any third party tool like
Monitoring Oracle Enterprise with Cricket
http://www.mikehan.com/cricket/oracle.html
or some commercial one like Quest Software. -
Hello, I am looking for some good monitoring scripts with good instructions on how to use them and what to look for. I would especially like one for monitoring Library cache.
Thank you,
DavidI would especially like one for monitoring
Library cache.--Check GETHITRATIO in V$LIBRARYCACHE:
--This ratio should be in the high 90s. If not, there is probably room to improve the efficiency of your applicationcode.
SQL> col gethitratio form 90.999
SQL> select gethitratio,
2 case
3 when gethitratio<0.9 then 'improve applicationcode!!(>=0.9)'
4 else null
5 end as " ****** Advice ****** "
6 from v$librarycache where namespace = 'SQL AREA' ;
GETHITRATIO ****** Advice ******
0.984
1 row selected. -
Folder level script? How can I use field value as a pdf filename in save as dialog box
I read somewhere that if you use a folder level script, you can do things like save a pdf with a specific filename - possibly based on a field name.
How would one set up a folder level script?
How do you execute a script from the PDF?
What code would you use to change the PDF name to the contents of the fFieldName text field?
Or, is this really just impossible to do?The article is interesting. It suggests you place code like this:
// Page Replacement Function
var ReplaceLastPage = app.trustedFunction( function(cPath) {
app.beginPriv();
this.replacePages(this.numPages-1, cPath); app.endPriv();
In the trusted folder. What is the path of the trusted function(s) that get automatically loaded into Acrobat?
I assume in the example above, function(cPath) is a function inside of the PDF... -
We've been getting the following error for some time now.
An error occurred on line 105 while executing script 'MOM Backward Compatibility Service State Monitoring Script'
Source: Microsoft VBScript runtime error
Description: The remote server machine does not exist or is unavailable: 'GetObject'
One or more workflows were affected by this.
Workflow name: System.Mom.BackwardCompatibility.ServiceStateMonitoring
Instance name: server.domain.local
Instance ID: {INSTANCE}
Management group: GROUP
Unfortunately the instance in question has since been decommissioned and simply does not exist any more.
We're currently on a repeat count of over 350,000 and I would REALLY like to get it stopped. I've had a look at adding an override but that points to the management server rather than the instance itself.
Does anyone have any suggestions?
thanks in advance!Hi Steven,
There are for option for us to override a monitor ot rule:
For all objects of class:
Class
When you select this option for your override, the override settings apply to all objects in the class at which the rule or monitor is targeted.
For a group
When you select this option for your override, the override settings apply only to members of the group. The rule or monitor without the override settings continues to apply to all objects in the targeted class except for those objects that are also members
of the group used for the override.
When you create a group, you save it to an unsealed management pack. However, an element in an unsealed management pack, such as an override, cannot reference an element in a different unsealed management pack, such as a group. If you are going to use a group
to limit the application of an override, you must either save the group to the same unsealed management pack as the override, or you must seal the management pack that contains the group.
For a specific object of class:
Class
When you select this option for your override, the override settings apply only to the specified object. The rule or monitor without the override settings continues to apply to all other objects in the targeted class.
For all objects of another class
When you select this option for your override, the override settings apply only to objects of a class other than the targeted class. The rule or monitor without the override settings continues to apply to all objects in the targeted class.
Did you try to override it for a specific object of class?
Regards,
Yan Li
Regards, Yan Li -
using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?
Thanks for your swift response.
That sounds like a good solution, but the code I have on frame 2 is this
timer = 0;
countup = function(){
timer++;
countupInterval = setInterval(countup,100);
If I added the same actionscript to frame 3 which has a dynamic textbox with a variable timer attached wouldn't it just put the timer back to 0? What I want is the last known value that was given when it was in frame 2.
I am thinking of temple run here, I am trying to caculate the total distance(set in the timer variable) from the previous try.
Hope this makes sense.
Chazwick -
Oracle 9i monitoring scripts in HACMP 5.4
Hi,
I have installed Oracle 9.2.0.8 on AIX 5.3 (HACMP 5.4) in active passive cluster.
I have made startup and shutdown scripts for Oracle.
Can anyone please guide me or point me to some link for the monitoring scripts for Oracle in HACMP so that failover can happen automaticaly.
Regards,
Amit EHave you tried changing the /etc/redhat-release file? Change the "release 5" to "release 4" and see what happens. Make sure you change it back after the install.
Tom -
I get slow script message how do stop this ?
I get a slow script message how do I stop this ? I read to open terminal app. in utilities folder then cut and paste message to add debug but can't figure how to do that
Welcome to Apple Support Communities. We're users here and don't speak for "Apple Inc."
If you haven't already tried again and been able to successfully connnect, try again. If necessary, Quit Mail, and re-open it.
Some errors aren't caused by anything we're doing wrong, or problems with our equipment.
Major web service providers like Yahoo! experience 'downtime' now and then, sometimes planned, sometimes unplanned.
During the time you posted your question (about 18 hours before I post this message with the chart) Yahoo was 'down' as indicated by end-user reports, and illustrated by the colorful bands in the chart below.
www.downrightnow.com is just one of several places where the downtime of popular internet destinations is tracked. -
If i got incorrect characters in the output of sap script? HOW TO CORRECT I
If i got incorrect characters in the output of sap script? HOW TO CORRECT IT?
Hi Sunil,
Debug the script and check where exactly those are getting populated. Definately you will get it. Check the conversion parts means character to numeric conversion.
If your version is 4.7E then select unicode check box in the reports attributes. It will display the error message so that we can solve very easily.Hope this helps you, reply for queries, Shall post you the updates.
Regards.
Kumar. . -
What is java script and how do I enable it?
What is java script and how do I enable it
JavaScript is enabled by default for Adobe Reader for iOS, and I don't see that there's a way to disable it. It is currently used within a document to control the behavior of form fields, such as automatic formatting and calculations. Only a small subset of what's available in the desktop version is available in the mobile versions.
-
Modifying existing script - modifying how data is written out to csv
I have an existing script written in Powershell 3.0 that gathers data from my virtual machines. It's working to give me the data, but I'd like to modify how it writes it out. Currently the data looks as follows:
I would prefer the output to be all one one line as follows:
Here is my script. How would I modify this to give me the .csv file with all data for each server on one line?
#param (
$inputFile = "C:\Apps\Powershell\IP_Mac\testlist.txt"
$csvFile = "C:\Apps\Powershell\IP_Mac\results.csv"
$report = @()
foreach($Computer in (gc -Path $inputFile)){
get-wmiobject -computer $Computer win32_logicaldisk -filter "drivetype=3" | ForEach-Object {
$device = $_.deviceid
$freespce = ($_.freespace/1GB).tostring("0.00")+"GB"
$Totalspce = ($_.size/1GB).tostring("0.00")+"GB"
if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
$Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer | ? {$_.IPEnabled}
foreach ($Network in $Networks) {
$IPAddress = $Network.IpAddress[0]
$SubnetMask = $Network.IPSubnet[0]
$DefaultGateway = $Network.DefaultIPGateway
$DNSServers = $Network.DNSServerSearchOrder
$MACAddress = $Network.MACAddress
$OutputObj = New-Object -Type PSObject
$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
$OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
$OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
$OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value ($DefaultGateway -join “,”)
$OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value ($DNSServers -join ",")
$OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
$OutputObj | Add-Member -MemberType NoteProperty -Name device -Value $device
$OutputObj | Add-Member -MemberType NoteProperty -Name Totalspce -Value $Totalspce
$OutputObj | Add-Member -MemberType NoteProperty -Name freespce -Value $freespce
#$OutputObj
$report += $OutputObj
Write-Output $report
$report | Select-Object -Property $properties | Export-Csv -Path $csvFile -NoTypeInformation
Thank you.Try it like this:
#param (
$inputFile = "C:\Apps\Powershell\IP_Mac\testlist.txt"
$csvFile = "C:\Apps\Powershell\IP_Mac\results.csv"
$report = foreach($Computer in (gc -Path $inputFile)){
$devices = get-wmiobject -computer $Computer win32_logicaldisk -filter "drivetype=3" | ForEach-Object {
$device = $_.deviceid
$freespce = ($_.freespace/1GB).tostring("0.00")+"GB"
$Totalspce = ($_.size/1GB).tostring("0.00")+"GB"
New-Object PSObject -property @{device=$device;freespce=$freespce;Totalspce=$Totalspce}
if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
$Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer | ? {$_.IPEnabled}
foreach ($Network in $Networks) {
$IPAddress = $Network.IpAddress[0]
$SubnetMask = $Network.IPSubnet[0]
$DefaultGateway = $Network.DefaultIPGateway
$DNSServers = $Network.DNSServerSearchOrder
$MACAddress = $Network.MACAddress
$OutputObj = New-Object -Type PSObject
$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
$OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
$OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
$OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value ($DefaultGateway -join “,”)
$OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value ($DNSServers -join ",")
$OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
$i = 0
Foreach ($dev in $devices) {
$OutputObj | Add-Member -MemberType NoteProperty -Name device$i -Value $dev.device
$OutputObj | Add-Member -MemberType NoteProperty -Name Totalspce$i -Value $dev.Totalspce
$OutputObj | Add-Member -MemberType NoteProperty -Name freespce$i -Value $dev.freespce
$i ++
$OutputObj
Write-Output $report
$report | Select-Object -Property $properties | Export-Csv -Path $csvFile -NoTypeInformation
You were writing a row for each drive, I basically just wrote the drive information to an array and looped through that array when adding members. I tested this and it worked for me. Note that you can't have the same value names when you add-member
so I appended a numeral to differentiate them.
I hope this post has helped! -
Oracle 9i database monitoring scripts
Hi Friends,
I am asked by my boss to submit weekly reports about the database status.
She wanted something in excel format.
Can you suggest me what reports do I submit?
I found the following monitoring scripts from google:
Are these scripts still relevant ,or applicable, or obsolete?
PURPOSE
This article contains a few ready-made queries on V$SQLAREA
for identifying the top 10 most resource-consuming SQL statements
with a variety of criteria.
The thresholds used are the same as used by default in Statspack:
Buffer Gets : 10,000
Physical Reads : 1,000
Executions : 100
Parse Calls : 1,000
Sharable Memory : 1,048576
Version Count : 20
Top 10 by Buffer Gets:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
buffer_gets, executions, buffer_gets/executions "Gets/Exec",
hash_value,address
FROM V$SQLAREA
WHERE buffer_gets > 10000
ORDER BY buffer_gets DESC)
WHERE rownum <= 10
Rem Top 10 by Physical Reads:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
disk_reads, executions, disk_reads/executions "Reads/Exec",
hash_value,address
FROM V$SQLAREA
WHERE disk_reads > 1000
ORDER BY disk_reads DESC)
WHERE rownum <= 10
Rem Top 10 by Executions:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
executions, rows_processed, rows_processed/executions "Rows/Exec",
hash_value,address
FROM V$SQLAREA
WHERE executions > 100
ORDER BY executions DESC)
WHERE rownum <= 10
Rem Top 10 by Parse Calls:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
parse_calls, executions, hash_value,address
FROM V$SQLAREA
WHERE parse_calls > 1000
ORDER BY parse_calls DESC)
WHERE rownum <= 10
Top 10 by Sharable Memory:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
sharable_mem, executions, hash_value,address
FROM V$SQLAREA
WHERE sharable_mem > 1048576
ORDER BY sharable_mem DESC)
WHERE rownum <= 10
Top 10 by Version Count:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
version_count, executions, hash_value,address
FROM V$SQLAREA
WHERE version_count > 20
ORDER BY version_count DESC)
WHERE rownum <= 10
;I just feel the above reports not really meaningful :(
Can you give me some other scripts that u have?
Thanks a lot,
MsKThanks all :-*
@sybrand
Oracle 9i comes with Oracle Enterprise Manager. This includes a reporting website with monitoring scripts.
Why write them yourself?My boss want a cumulative report over time, for example : what happened @ 1am,2am,3am on tuesday last week, why is the server so slow that the batch job did not complete as expected? Why was an error occured about a table that can not extend? Ora 1635. I mean you can see in the report that at this certain hour a certain tablespace was full.
oops maybe tablespace sample is not logical :D
say every day I can have excel reports of tablespace space status like:
tablespace_name used free date
TS_DATA 1000K 5000k 1-Oct-2010
TS_DATA 2000K 4000k 2-Oct-2010
TS_DATA 3000K 3000k 3-Oct-2010
TS_DATA 4000K 2000k 4-Oct-2010
TS_DATA 5000K 1000k 5-Oct-2010
TS_DATA 5000K 0k 6-Oct-2010Does Statspack can hold historical data for analysis? say for the last 24 hrs?
Thanks a lot -
Monitoring scripts for AlwaysOn Availability Group
Does anyone have any any monitoring scripts for AlwaysOn AG using Transact SQL or stored procedures? I'm not a strong coder and don't know Powershell at all. But if there are some Powershell scripts we may be able to use them. I've
seen the dashboard but that's only good if you're logged onto it.
I'm looking for things like monitoring when a database is suspended, send an alert to us but also tries to do the resume.
Thanks for any info.Start with this list
http://technet.microsoft.com/en-us/library/ff877954.aspx
Automating the issue resolution has to conform to your operational standards. For example, if you use a file share witness for your quorum configuration and your monitoring tells you that it is offline, do you automate bringing it online or do you escalate
to your infrastructure team so that they can look into it? If the database is suspended or the Availability Group in offline state, do you just bring it online or do you check other dependencies like the quorum configuration and instead perform a forced quorum?
I'm a big fan of automation but make sure you define your process first so that you don't cause more issues as a result.
Edwin Sarmiento SQL Server MVP | Microsoft Certified Master
Blog |
Twitter | LinkedIn
SQL Server High Availability and Disaster Recover Deep Dive Course
Maybe you are looking for
-
Cannot edit, now cannot open a document in Pages 5.2
I have Pages version 5.2, running on Mavericks. I have been working on a second edition of my book. (First edition was done using an earlier version of Pages, either '09 or the next one thereafter in 2011.) Pages has been regularly updated on an ongo
-
Short dump issue while loading data
Hello All, We are trying to load the data to the cube , but every time it is throwing us a short dump with the below error. We have found a SAP Note as well for the below error , Please suggest, how to implement the same. Error: Runtime Errors
-
Uploaded iso 11.1 and now no bookmarks. how to get them back now
how to get book marks on iphone 5 off pc.
-
I want to forward an email to multiple recipients, but instead of putting them all in BCC:, I want all the recipients to get the forward addressed just to them so it looks personalized. Any way to do this?
-
What happened to all the white balance presets (cloudy, shade, tungsten, etc)? I just installed LR2 (on Win XP SP2) and the only presets available on the drop down menu are As Shot, Auto and Custom. Have the others been eliminated in LR2?