Monitoring script
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.
Similar Messages
-
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 -
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 -
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 -
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 -
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 -
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. -
Data Guard Gap Monitoring script
Hello,
Can anyone please provide me data guard gap monitoring script for databases(primary,standby) on RAC.
Oracle RDBMS 11.2.0.2(4-node RAC) on RHEL 5.6.
Thanks
Edited by: 951368 on Dec 26, 2012 9:21 AM951368 wrote:
Hello,
Can anyone please provide me data guard gap monitoring script for databases(primary,standby) on RAC.
Oracle RDBMS 11.2.0.2(4-node RAC) on RHEL 5.6.
Thanks
Edited by: 951368 on Dec 26, 2012 9:21 AMUse the script of MSeberg, Modify v$instance as gv$instance for RAC -
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 -
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. -
Oracle 9i dataguard time lag monitoring script
In 10g we can run below script on Standby to find out time lag between Primary and standby .
select name, 'ALL', substr(value,1,12) from v$dataguard_stats where name = 'apply lag' ;
select name, 'Seconds', to_number(substr(value,11,2)) from v$dataguard_stats where name = 'apply lag' ;
select name, 'Minutes', to_number(substr(value,8,2)) from v$dataguard_stats where name = 'apply lag' ;
select name, 'Hours', to_number(substr(value,5,2)) from v$dataguard_stats where name = 'apply lag' ;
select name, 'Days', to_number(substr(value,2,2)) from v$dataguard_stats where name = 'apply lag' ;
But while running same script in oracle 9i stanby database i am getting below error;
ORA-01219: database not open: queries allowed on fixed tables/views only
Can i know which command i should use to monitor time lag between priamry and standby in oracle 9i?Hi,
You can Query from v$archive_gap :Dynamic Performance (V$) Views, 9 of 238
select * from v$archive_gap;
HTH -
Linux Performance Monitoring Scripts
Hi Friends,
My boss ask me to give weekly reports about the performance of the server.
He wants the report in excel formant.
I heard about vmstat, iostat,sar
Are these the only command I need to monitor the performance of linux?
Can you share me some scripts about monitoring linux performance that save data into txt file? and
is being gathered (stats) every hour on top of the hour?
Thanks a lot,
MsKThanks gentlemen,
But I can not grasp either the ideas that you are explaining. :(
It is not helpful that at some point or at all points, the report said that all the CPU and MEMORY were 100% used?
At least there is a trigger or reason to start investigating was is running on the server.
For example
[root@oracleprod ~]# vmstat 5 10
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
3 0 215040 21612 18548 8042292 3 4 406 129 12 13 14 1 82 3
2 0 215040 25484 18480 8037940 0 0 2 192 1037 522 21 4 74 0
1 0 215040 25476 18496 8037924 0 0 0 32 1013 443 21 5 75 0
1 0 215040 25156 18512 8037908 0 0 0 58 1010 452 21 5 74 0
1 0 215040 24772 18532 8038148 0 0 24 46 1008 482 21 5 74 0
1 0 215040 24540 18548 8038132 0 0 0 45 1006 501 21 5 74 0
1 0 215040 24540 18564 8038116 0 0 0 23 1006 439 22 3 75 0
1 0 215040 24156 18580 8038100 0 0 0 302 1061 558 22 4 74 0
2 0 215040 24028 18596 8038084 0 0 0 56 1014 449 24 1 74 0
1 0 215040 23772 18604 8038076 0 0 2 22 1020 636 26 1 73 0Does vmstat not telling whats happening to system? or at these statistics useless :(
Thanks a again -
Solution Manager 7.1 - Monitor scripts which runs as cron job at OS level ?
Hi All,
We have Solution Manager 7.1 in our landscape and we have configured RCA, Monitoring.. Is it possible to Monitor the scripts running as Cron Job at the OS level?
If in case, the script stops due to an issue, we need to get the alert in Solution Manager.
Also can you please let us know whether it is possible to monitor jobs scheduled through external job scheduling tool.
Thanks & Regards,
Vaishali.KHi,
How to Schedule the background Job at the OS level:
Invoke a sapevent using a OS script and then have a SAP background job set to run on a sapevent. I say this assuming Unix and a job in crontab. I would guess the same thing could be done on a Windows system.
sapevt TRIGGER_NAME -t
pf=d:usrsapDEVsysprofileDEV_DVEBMGS00_SVRNAME nr
Kindly go through the links,hope this will help you out
[Steps to configure RCA and Monitoring in SolMan;
[http://help.sap.com/saphelp_45b/helpdata/en/c4/3a7ef8505211d189550000e829fbbd/content.htm]
Thanks & Regards
Ajitabh -
Hi Gurus,
I need a whole bunch of SQL monitoring SQLs in other words some data dictionary SQL scripts to monitor SQLs like following
--Top 5 worst sqls
select c.*
from (select disk_reads, buffer_gets, rows_processed, executions,
-- address,
-- hash_value,
first_load_time, sql_text
from v$sqlarea
where parsing_user_id !=0
order by buffer_gets/decode(executions,null,1,0,1,executions) desc ) c
where rownum <= 5
order by disk_reads desc;
Thanks
Amitava.Just look at the AWR data / run an AWR report.
See DBA_HIST_SQLSTAT. -
Golden gate monitoring script for struck processess
Hi Folks,
The requirement is to get an email if any of the golden gate process struck on particular RBA for long time, even there are many tails file to be replicated.
The status of the process is running and there is no lag.
Thanks,
Anand T.1005886 wrote:
Hi Folks,
The requirement is to get an email if any of the golden gate process struck on particular RBA for long time, even there are many tails file to be replicated.
The status of the process is running and there is no lag.
Thanks,
Anand T.
Of course, you can use GoldenGate "monitor" (part of the GG "management pack"), which has this functionality. Optionally, if you're already using EM, use GG monitor + EM integration. See: Management Pack for Oracle GoldenGate
Otherwise, you have other options: query the status of running processes using ggsci; or, configure GG to write reports (to dirrpt/{name}.rpt) with the info you need; and/or generate warning messages (to ggserr.log), and periodically parse these files for the relevant info. See the GG Admin guide, "Monitoring Oracle GoldenGate Processing".
As an example using ggsci from a script:
$ echo 'info myextr showch' | ./ggsci | egrep 'Checkpoint|RBA'
Checkpoint Lag 1:24:07 (updated 00:00:07 ago)
Log Read Checkpoint File dirdat/tc000000
2014-01-23 06:14:41.000000 RBA 4338
Current Checkpoint Detail:
Read Checkpoint #1
Startup Checkpoint (starting position in the data source):
RBA: 0
Current Checkpoint (position of last record read in the data source):
RBA: 4338
Although, configuring GG to report lag warnings, and then using scripts to monitor ggserr.log would be simpler & more flexible.
Maybe you are looking for
-
DVD burning - all files do not copy
I have been having a burning problem with the system burning DVDs. When I burn a disc not all the files copy. Sometimes one whole folder of many does not get copied; sometimes just the materials within a specific folder does not get burned. No error
-
Deletions for external delta management...
Hi experts, We have a process loading data from an external system with customer info into a DSO in BW (7.0). Since the data sometimes takes around 10 days to settle down, we have a process in place that: - deletes the past 10 days of data from th
-
ITunes 2 Slow that freezes.
Hello there again. I Been trying to deal with this itunes thing.. i honestly don't like it cuz it always been slow to me and my friends. but today im trying to load some songs to the library so i can transfer to my ipod. i added a folder. with like 1
-
Validation Rules: create a dummy account with constant value 0
Hi, I need to define a control like the following: TA00000 >= 0 I think that I need to create a dummy account with constant value 0 and compare TA00000 against it. I need help to create the dummy account because I'm not sure if I have to use a script
-
what is the viewable image area/screen size (length x width) on the 2014 21.5" and 27" imacs? i have an older 24" and am trying to determine if i need to go up or if 21.5" will be adequate. Thanks!