Saturday, December 29, 2012

Oratop-light,simple DB monitoring tool for Linux

This tool probably useful for system administrators, or like synopsis overview for DBA. This Oracle tool is really easy-to-use, very lightweight and simple for cursory Database performance overview. It can be downloaded from MOS [ID 1500864.1]. This tool made for Linux(x32 and x64) and 11gR2 only. Just run it authorizing with some privileged user:
[oracle@dbtest oratop]$ ./oratop 




oratop - utility for near real-time monitoring of databases, RAC and Single Instance [ID 1500864.1]

Active Data Guard SLA pursuit

When your business users runs read only report from ADG (physical standby database opened READ ONLY) there may unacceptable lag between primary and standby databases.Since 11.2 there is a nice view to see this lag.

SQL> SELECT * FROM V$STANDBY_EVENT_HISTOGRAM WHERE NAME = 'apply lag' AND COUNT > 0 and last_time_updated like '%12/29/2012%';

NAME         TIME UNIT          COUNT LAST_TIME_UPDATED
------------ ---- ---------- -------- --------------------
apply lag       0 seconds     3780291 12/29/2012 09:54:04
apply lag       1 seconds      319929 12/29/2012 09:52:32
apply lag       2 seconds        6509 12/29/2012 07:10:20
apply lag       3 seconds        3868 12/29/2012 05:52:06
apply lag       4 seconds        2956 12/29/2012 05:52:07
apply lag       5 seconds        2223 12/29/2012 05:46:56
apply lag       6 seconds        1344 12/29/2012 05:46:57
apply lag       7 seconds        1118 12/29/2012 05:46:58
apply lag       8 seconds        1144 12/29/2012 05:33:56
apply lag       9 seconds        1094 12/29/2012 05:33:57
apply lag      10 seconds        1098 12/29/2012 05:33:58
apply lag      11 seconds        1001 12/29/2012 05:33:59
apply lag       2 minutes        6363 12/29/2012 02:34:41
apply lag       3 minutes        1786 12/29/2012 02:35:54

61 rows selected

So, in my environment 2-3 minutes lag - unacceptable. Of course the best way - is tuning apply speed, but it's not always possible, for network limits for example. But we may guarantee users some SLA, via this kind of trigger,violation of which will lead to "ORA-03172: STANDBY_MAX_DATA_DELAY of 60 seconds exceeded". Run this trigger on primary, then it will by applied on standby. Here is simple Oracle example:

SQL> CREATE OR REPLACE TRIGGER LOGON_TO_STANDBY_TRIGGER
AFTER LOGON ON some.schema
BEGIN
IF (SYS_CONTEXT('USERENV','DATABASE_ROLE')
IN ('PHYSICAL STANDBY'))
THEN execute immediate 'ALTER SESSION SET STANDBY_MAX_DATA_DELAY=60;'
END IF;
END;



Friday, December 28, 2012

Golden Gate plugin for EM Cloud Control 12c

Today I'd like to tell how to monitor Golden Gate infrastructure in EM Cloud Control 12c.
Requirements:
- Oracle GoldenGate release 11.2.1.0.1 or later ( I used  version 11.2.1.0.3)
- Oracle EM Cloud Control 12c Bundle Patch 1 (12.1.0.1) or later ( I used  Bundle Patch 2, i.e. 12.1.0.2)
- Any release of JDK 1.6 (not JRE). I used latest for today 1.6.0_38. Check java version:

[oracle@dbtest ~]$ $JAVA_HOME/bin/java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)

- Any OS where GG can run except : HP NonStop, IBM iSeries, and IBM z/OS. I used OEL Linux 5.6
- I assume EM CC12c and agents 12c are deployed on all required targets.

Steps:
- Configure plug-in and java
- Download plugin via EM CC12c. Setup->Extensibility->Plug-ins->Middleware->Oracle GoldenGate 
- Deploy plugin on Management Service.(right click, it will freeze EM for few minutes and restart oms)
- Deploy plugin on all EM Agents 12c (right click)
For some security restriction reasons, you may want to download plugin from https://edelivery.oracle.com/ and manualy import plug-in to OMS.
- Update java tzdata. Theres is an issue in EM 12c.I have no idea why 12.1.0.2 packed with ancient JDK1.6.0_24, where there is an old time offset for Moscow +3. Current offset is +4. So, if You want to have correct time in EM and no time related issues - you should update java tzdata in all 12c agents and OMS. Download timezone updater tool with latest tzdata file included here: http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html
 As workaround you may run java processes with some key like -Duser.timezone=GMT+4 (correct for you country), or\and correct $AGENT_HOME/sysman/config/emd.properties for agents, and choose wrong country - in EM. But i think it's not best practice.
- Install JDK on every planned to observe host target (http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html)

- Configure Golden Gate targets
  - add ENABLEMONITORING to GLOBALS parameter file an save it:

[oracle@test ~]$ cd $GG_HOME
[oracle@dbtest gg]$ ggsci
GGSCI (test.local) 1> edit params ./GLOBALS
CHECKPOINTTABLE GGS_CHECKPOINT
GGSCHEMA gguser
ENABLEMONITORING


- configure password for java agent

[oracle@dbtest gg]$ ./pw_agent_util.sh -jagentonly
Please create a password for Java Agent:

- configure jagent parameters in $GG_HOME/cfg/Config.properties

agent.type.enabled=OEM
jagent.rmi.port=5559
jagent.host=test.local
jagent.jmx.port=5555
jagent.username=user_name


-  create jagent datastore( Berkley DB) to store monitoring data and restart manager process:

[oracle@test ~]$ cd $GG_HOME
[oracle@dbtest gg]$ ggsci
GGSCI (dbtest.local) 1> create datastore
GGSCI (dbtest.local) 2> stop mgr
GGSCI (dbtest.local) 3> start mgr
GGSCI (dbtest.local) 4> start jagent


GGSCI (dbtest.local) 1> info all
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING
JAGENT      RUNNING
REPLICAT    RUNNING     RQIWIE      00:00:00      00:00:01
REPLICAT    RUNNING     RQIWIM      00:00:00      00:00:00
REPLICAT    RUNNING     RQIWITX     00:00:00      00:00:02

- Add Golden Gate instance to monitoring:

 -Setup->Add Target->Configure Auto Discovery->Edit Parameters.  Add JAgent Username,password and Jagent RMI Port=5559,which was previously specified in config.properties file on targets.
- Add target Setup->Add Target->Auto Discovery Results-> Choose Golden Gate and promote it.
- Done. You can see pictures like this:


Oracle Install Guide
Oracle® Enterprise Manager Oracle GoldenGate System Monitoring Plug-In Installation GuideRelease 12.1.0.1.1