Showing posts with label Fun. Show all posts
Showing posts with label Fun. Show all posts

Wednesday, August 7, 2013

Oracle Enterprise Manager 12c Windows Agent Deployments Made Easy

As of late, I've had to do a few Windows OS Agent Deployments. As we all know, if you want to auto deploy to a Windows OS, you need to have CygWin installed (on each target host) first.

The alternative, via Silent Install, is illustrated by my good friend Bobby Curtis here. However, for large scale quicker deployments, I came up with an a solution which worked quite well.

Assuming you have already download the agent binaries from the OMS server, copy them to a centralized location accessible to all target hosts. In my case, I used \\slave\software\oracle\oem\12.1.0.3.0\agent

The important thing here is the content of the agent.rsp file. Mine looks like this. I did not keep the ORACLE_HOSTNAME parameter within the response file (agent.rsp)
####################################################################
## copyright (c) 1999, 2012 Oracle. All rights reserved. ##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## identifies the variable type. ##
## ##
## Please specify the values in the following format: ##
## ##
## Type Example ##
## String "Sample Value" ##
## Boolean True or False ##
## Number 1000 ##
## StringList {"String value 1","String Value 2"} ##
## ##
## The values that are given as  need to be ##
## specified for a silent installation to be successful. ##
## ##
## ##
## This response file is generated by Oracle Software ##
## Packager. ##
###################################################################
 
RESPONSEFILE_VERSION=2.2.1.0.0
 
#-------------------------------------------------------------------------------
#OMS_HOST: OMS host info required to connect to OMS
#EM_UPLOAD_PORT: OMS port info required to connect to OMS
#AGENT_REGISTRATION_PASSWORD: Agent Registration Password needed to
# establish a secure connection to the OMS.
#AGENT_INSTANCE_HOME: Agent instance home is the location of agent state directory.
#AGENT_PORT: Agent port on which the agent process should be started.
#b_startAgent: Agent will not be started after configuration if the value specified is false.
#ORACLE_HOSTNAME: Fully qualified domain name of host where is the agent is deployed.
#s_agentHomeName:Customized Oracle home name for the agent home. Example: s_agentHomeName="agent12gR1"
#-------------------------------------------------------------------------------
OMS_HOST=cruiser.missile.com
EM_UPLOAD_PORT=4899
AGENT_REGISTRATION_PASSWORD=you_havent_changed_the_sysman_password
AGENT_INSTANCE_HOME=D:\oracle\app\product\12.1\agent
AGENT_PORT=3875
b_startAgent=true
s_agentHomeName=agent12c_home1
#-------------------------------------------------------------------------------
#s_agentServiceName: Sets the agent Service Name and this variable can be
# used to overrite the agent service name calculated by the install. This is
# required for only Windows.
# Example:
# s_agentServiceName = "Oracleagent12gAgent" ; default value
# s_agentServiceName = "GridAgent" ; User specified value
#-------------------------------------------------------------------------------
s_agentServiceName="Oracleagent12cAgent"
 
####################################################################################
#Please Don't change the values of these variables
####################################################################################
#-------------------------------------------------------------------------------
#EM_INSTALL_TYPE: install type
#-------------------------------------------------------------------------------
EM_INSTALL_TYPE="AGENT"
I then created a wrapper install script. Since I was deploying on windows, the script looked like
c:\> view DeployTheAgent.bat
\\slave\software\oracle\oem\12.1.0.3.0\agent\agentDeploy.bat AGENT_BASE_DIR=D:\Oracle\app\product\12.1 RESPONSE_FILE=\\slave\software\oracle\oem\12.1.0.3.0\agent\agent.rsp ORACLE_HOSTNAME=%COMPUTERNAME%.%USERDNSDOMAIN% 
The linux version of this might look something like
$ cat
DeployTheAgent.sh
\\slave\software\oracle\oem\12.1.0.3.0\agent\agentDeploy.sh AGENT_BASE_DIR=/u01/app/oracle/product/12.1 RESPONSE_FILE=<path to mounted drive>\<agent software directory>\agent.rsp ORACLE_HOSTNAME=hostname.domainname
From here, its a simple as invoking the script from the target host:
c:\>\\slave\software\oracle\oem\12.1.0.3.0\agent\DeployTheAgent.bat
\\slave\software\oracle\oem\12.1.0.3.0\agent\agentDeploy.bat AGENT_BASE_DIR=D:\Oracle\app\product\12.1 RESPONSE_FILE=\\slave\software\oracle\oem\12.1.0.3.0\agent\agent.rsp ORACLE_HOSTNAME=javelin.missile.com
\\slave\software\oracle\oem\12.1.0.3.0\agent
Present working directory:\\slave\software\oracle\oem\12.1.0.3.0\agent
Archive location:\\slave\software\oracle\oem\12.1.0.3.0\agent directory
AGENT_BASE_DIR
AGENT_BASE_DIR
D:\Oracle\app\product\12.1
Agent base directory:D:\Oracle\app\product\12.1
D:\Oracle\app\product\12.1
RESPONSE_FILE
\\slave\software\oracle\oem\12.1.0.3.0\agent\agent.rspORACLE_HOSTNAME
javelin.missile.com
Agent base directory:D:\Oracle\app\product\12.1
OMS Host:
Agent image loc : "\\slave\software\oracle\oem\12.1.0.3.0\agent"
D:\Oracle\app\product\12.1 configonlyfalse
Reading the properties file: "\\slave\software\oracle\oem\12.1.0.3.0\agent"\agentimage.properties
1 file(s) copied.
This is the version 12.1.0.2.0
This is the type core
This is the aru id 233
The installer takes a few minutes and I'd rather not bore you with the contents of the log files. You know what you are doing :)

So, for any new target host, simply invoke the DeployAgent.bat or DeployAgent.sh script and relax! Assuming that your paths are correct and, network ports are accessible, the installation should go through without any glitches.

Reference:

Oracle Documentation: Installing Oracle Management Agent in Silent Mode
continue reading "Oracle Enterprise Manager 12c Windows Agent Deployments Made Easy"

Friday, August 2, 2013

An Alternative to Oracle Enterprise Managers GoldenGate Plugin

If you've arrived at this page then, most likely you're a victim of the JAGENT :) Not to be confused with Agent J.

I can't tell you how many times I've been burned by it when using it for OEM monitoring. The symptoms, if you care to read, include:

  1. Hanging Extract and Pumps
  2. BDB datastore corruptions
The solution, most times, to the above problems was to either rebuild the datastore or remove the JAGENT completely.

After banging my head against the wall with MOS, who told me that they're getting a lot reports from customers regarding JAGENTs, I decided to take things into my own hands. Fortunately, I am savvy enough with OEM and its Metric Extension architecture to build my own "plugin".

As a disclaimer to all perl guru's, the attached script is my first attempt at writing in the language. I consider myself quite humle and wide open to improvements and suggestions.


If you're like me, then you want to consolidate your work into concise folder. I chose the GoldenGate installation directory.


Copy monitor_gg.pl and ggsci_syntax.txt into this directory.

The key parameters to consider are at the beginning of the script.

Reset the directory variables to your respective environment (by the way, the script works on Windows as well as long as you point it to perl binaries).

Give it a test to make sure that it works. My output looks is the following:


It is concatenating the strings to represet the current object type, status, lag at checkpoint (seconds), and time since last check point (seconds) values.

Here on, you simply need to create a Metric Extension (for a Host Target Type) within OEM and configure your incident rule sets accordingly. If I had more time, I would show you how I set up mine but I didn't capture any screenshots. The documentation for it pretty straightforward and the GUI itself is intuitive.


On my "All Metrics" for the host, I see the following:





There's plenty to improve on in the script. Since I have an active ticket with Oracle Support, unless they come back with a solution quickly, I will continue to improve on the attached script.

Hope this was helpful for at least some of you :)
continue reading "An Alternative to Oracle Enterprise Managers GoldenGate Plugin"

Thursday, July 4, 2013

Fun with DB 12cR1 Upgrade

It’s 5 AM and its pouring outside – couldn’t be a worse start to a July 4th holiday in the summer! I woke up (for some reason) and can’t fall back asleep and figured I might try my luck at a database upgrade with 12.1.0.1 :)

Many of us have already posted blogs about their respective experience. I thought I’d try to upgrade an OEM 12.1.0.2.0 environments 11.2.0.1 Database with the latest version.

Here goes.

VirtualBox: 4.2.12
OS: OEL 6.3 64bit
Database: 11.2.0.1 64bit


[oracle@spoon database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 22621 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4051 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-07-04_06-09-58AM. 
Please wait ...

















[root@spoon ~]# /u01/app/oracle/product/12.1.0.1/dbhome_1/root.sh
Performing root user operation for Oracle 12c

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/12.1.0.1/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

Okay, now we get to the fun part :)

[oracle@spoon ~]$ dbua 





Interesting – there are some errors:


I want to let the Upgrade Assistance fix the errors now.


 The immediate errors are fixed.






Since this is an OEM Repository database, I will not configure Database Express.




The installer wouldn’t let me pick any port even though the previous version listener was not running. I went back to this later and found that my /etc/hosts (wrong IP Address for the host) wasn’t configured properly which caused the issue.





Go speed-racer Go!!




I sincerely appreciate the Activity Log option – its nice to feel warm and fuzzy that “something” is happening.




Very nice. All done!


Great! The easy part is done.


Let’s start OMS now.

It took a while but it came up!

[oracle@spoon ~]$ . oraenv
ORACLE_SID = [monster] ? OEM
The Oracle base for ORACLE_HOME=/u01/app/oracle/middelware/oms is /u01/app/oracle
[oracle@spoon ~]$ emctl status oms
Oracle Enterprise Manager Cloud Control 12c Release 2 
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
WebTier is Down
Oracle Management Server is Down
[oracle@spoon ~]$ emctl start oms
Oracle Enterprise Manager Cloud Control 12c Release 2 
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
Starting Oracle Management Server...
Starting WebTier...
WebTier Successfully Started
Oracle Management Server Successfully Started
Oracle Management Server is Up

Interesting, status Unknown for all Targets!




Turns out, the Agent is unreachable. I’ll probably try to fix this later today. Time to feed the little munchkin and get the meat ready for the afternoon grill!

Edit: I got time to finally sit and figure this one out. I did the following and now all targets are available. Prior to issuing a clearstate, I cleaned the directories under $AGENT_HOME/sysman/emd - for example, here.


[oracle@spoon ~]$ . oraenv
ORACLE_SID = [OEM] ? AGENT
ORACLE_BASE environment variable is not being set since this
information is not available for the current user ID oracle.
You can set ORACLE_BASE manually if it is required.
[oracle@spoon ~]$ emctl stop agent
[oracle@spoon ~]$ emctl clearstate agent
[oracle@spoon ~]$ emctl secure agent
[oracle@spoon ~]$ emctl start agent

[oracle@spoon ~]$ emctl status agent
Oracle Enterprise Manager Cloud Control 12c Release 2  
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 12.1.0.2.0
OMS Version       : 12.1.0.2.0
Protocol Version  : 12.1.0.1.0
Agent Home        : /u01/app/oracle/agent/agent_inst
Agent Binaries    : /u01/app/oracle/agent/core/12.1.0.2.0
Agent Process ID  : 17356
Parent Process ID : 17307
Agent URL         : https://spoon.song:3872/emd/main/
Repository URL    : https://spoon.song:4903/empbs/upload
Started at        : 2013-07-04 11:47:47
Started by user   : oracle
Last Reload       : (none)
Last successful upload                       : 2013-07-04 15:25:45
Last attempted upload                        : 2013-07-04 15:25:45
Total Megabytes of XML files uploaded so far : 2.66
Number of XML files pending upload           : 0
Size of XML files pending upload(MB)         : 0
Available disk space on upload filesystem    : 28.48%
Collection Status                            : Collections enabled
Heartbeat Status                             : Ok
Last attempted heartbeat to OMS              : 2013-07-04 15:28:09
Last successful heartbeat to OMS             : 2013-07-04 15:28:09
Next scheduled heartbeat to OMS              : 2013-07-04 15:29:09

---------------------------------------------------------------
Agent is Running and Ready




Happy July 4th!!
continue reading "Fun with DB 12cR1 Upgrade"