You are on page 1of 12

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

Oracle Class Wissem All About


Oracle
Wissem All About Oracle
HOME
BOOKS
ARTICLES
REVIEWS
INTERVIEWS
WEBINAR
FORUM
NOSQL
ABOUT ME
BLOG

Auto Restart Enterprise Manager Cloud Control


Agent 12c;
March 5th, 2012 | Posted in 11gR2, 12c, Blog, enterprise manager, RAC | 3 Comments
Curtir 2 pessoas curtiram isso.

Tweet

34

Introduction:
Oracle Restart is a component added to the 11gR2 in order to improve the high
availability of dierent database resources.
Database instances, listeners are resources that can be automatically restarted
after a hardware or software failure or whenever the server host restarts.
These components can be easily added to the Oracle Restart using the crsctl add
command.
In this article, I am going to show you how to add the Enterprise Manager Agent
12c component to the Oracle Restart.
The following procedure has been tested on 11.2.0.3 RAC environment under
Redhat Enterprise Linux. Apply the following steps on each node of the cluster.

1 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

The procedure:
The Agent cloud control 12c is installed under the /opt/agent12c directory.
The agent can be started / Stopped by running $AGENT_HOME/bin/emctl start
agent , $AGENT_HOME/bin/emctl stop agent commands, where
$AGENT_HOME is /opt/agent12c/agent_inst in my case.
First, login to one of the RAC nodes as a root user, change the directory to
$GRID_HOME/crs/script (or $CRS_HOME/crs/script). Create two scripts
crs_agent12c.sh and agentstartup.sh with the following contents; (Remember to
change the values to reect your environment);
view plain

01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.

2 of 12

copy to clipboard

print

[grid@node1 script]$ cat crs_agent12c.sh


#!/bin/bash
#
# dbcagent.sh - script to start and stop the EMC 12c agent
#
ORACLE_BASE=/opt/app/oracle
ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1
LIBRARY_PATH=$ORACLE_HOME/lib
ORACLE_SID=tstdb1
ORACLE_UNQNAME=tstdb
PATH=$ORACLE_HOME/bin:$PATH
export
export
export
export
export
export

ORACLE_BASE
ORACLE_HOME
LD_LIBRARY_PATH
ORACLE_SID
ORACLE_UNQNAME
PATH

agent_start () {
sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh start
}
agent_stop () {
sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh stop
}
agent_check () {
sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh check
}
case "$1" in
start)
agent_start
;;
stop)
agent_stop
;;
check)
agent_check
;;
clean)

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.

http://www.oracle-class.com/?p=2597

agent_clean $(ps -C emagent -o pid=)


;;
*)
echo $"Usage: `basename $0` {start|stop|status|clean}"
exit 1
esac
[grid@node1 script]$

[grid@node1 script]$ cat agentstartup.sh


#!/bin/bash
#
ORACLE_BASE=/opt/app/oracle
ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1
LIBRARY_PATH=$ORACLE_HOME/lib
ORACLE_SID=tstdb1
ORACLE_UNQNAME=tstdb
AGENT_HOME=/opt/agent12c/agent_inst
export
export
export
export
export
export

ORACLE_BASE
ORACLE_HOME
LD_LIBRARY_PATH
ORACLE_SID
ORACLE_UNQNAME
AGENT_HOME

agent_start () {
$AGENT_HOME/bin/emctl start agent
}
agent_stop () {
$AGENT_HOME/bin/emctl stop agent
}
agent_check () {
$AGENT_HOME/bin/emctl status agent
}
case "$1" in
start)
agent_start
;;
stop)
agent_stop
;;
check)
agent_check
;;
clean)
agent_clean $(ps -C emagent -o pid=)
;;
*)
echo $"Usage: `basename $0` {start|stop|status|clean}"
exit 1
esac
[grid@node1 script]$

Run the following commands:

3 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

01.
02.

http://www.oracle-class.com/?p=2597

[root@node1 ~]# chown -R grid:oinstall $GRID_HOME/crs/script


[root@node1 ~]# chmod 755 $GRID_HOME/crs/script/*

Now, edit the /etc/sudoers le where all the access rules are saved. Per default,
sudo requires authentication through a password. When NOPASSWD is specied
the execution of the commands will not requires a password.
view plain

01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.

copy to clipboard

print

[root@node1 ~]# chmod 640 /etc/sudoers


####Comment out the line (#Defaults

requiretty) in /etc/sudoers files

####Add the following lines to /etc/sudoers where node1 is the hostname.


grid node1 =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh start
grid node1 =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh stop
grid node1 =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh check

[root@node1 ~]# chmod 440 /etc/sudoers

Modify the following les permission;


01.
02.

[root@node1 ~]# chmod 664 /opt/agent12c/agent_inst/sysman/config/emd.properties


[root@node1 ~]# chmod 755 /opt/agent12c/agent_inst/bin/emctl

Now, lets add the resource to Oracle restart;


view plain

01.
02.

03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.

copy to clipboard

print

[root@node1 ~]# su - grid


[grid@node1 ~]$ crsctl add resource crs_agent12c -type local_resource -attr " ACTION_SCRIPT=
/11.2.0/grid/crs/script
/crs_agent12c.sh,DESCRIPTION=Local Ressource for Agent 12c, DEGREE=1, ENABLED=1, AUTO
[grid@node1 ~]$
[grid@node1 ~]$ crsctl start res crs_agent12c
CRS-2672: Attempting to start 'crs_agent12c' on 'node1'
CRS-2676: Start of 'crs_agent12c' on 'node1' succeeded
[grid@node1 ~]$

[grid@node1 ~]$ crsctl status res crs_agent12c


NAME=crs_agent12c
TYPE=local_resource
TARGET=ONLINE
STATE=ONLINE on node1
[grid@node1 ~]$

Hope it helps!,
Wissem

4 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

3 Comments to Auto Restart Enterprise Manager Cloud


Control Agent 12c;
1.

Andreas says:
April 11, 2012 at 9:12 am
Hello Wissem,
thank you for the scripts, they are very helpful! However, there seems to be
a small problem: I cannot nd the denition of agent_clean(), which is
referenced in this command:
agent_clean $(ps -C emagent -o pid=)
Can you add the missing function? The start, stop, and check actions are
easy to understand, but I do not understand yet what the clean() function is
called for.

Reply
2. Auto Restart Enterprise Manager Cloud Control Agent 12c All Things
Oracle says:
May 10, 2012 at 10:25 am
[...] the full article here: Auto Restart Enterprise Manager Cloud Control
Agent 12c; Wissem El [...]
Reply
3.

Joachim Pierre says:


November 20, 2012 at 8:20 pm
I dont understand agent_clean either. Please elaborate.
Reply

Leave a Comment
Name (required)

Mail (will not be published) (required)

5 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

Website

Blog's RSS Feed

Polls
which oracle topic interests you most?
Oracle data guard
Oracle RAC
Oracle performance tuning
Oracle installation
PL/SQL or SQL
Oracle enterprise manager
ASM / Storage
RMAN, backup and recovery

Vote
View Results
Polls Archive

6 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

Oracle Class Tweets

Recent Posts
Packts 2000th Title Campaign
Oracle 12c & Hadoop for better Data Management and Processing
Oracle Flex ASM Espaol (Article in Spanish)
Oracle Database 12c Backup and Recovery Survival Guide
E-books: 50% discount
Book: Oracle Database 12c Backup and Recovery Survival Guide
Oracle Data Guard 11gR2 Administration Beginners Guide
Oracle 12c: Recover tables using RMAN
Oracle 12c: Managing Resources
Oracle 12c: Transport tablespaces across platforms
Oracle 12c: [INS-20802] Oracle Services For Microsoft Transaction Server
failed.
Oracle 12c: Whats New in Oracle Data Guard 12cR1?
Oracle 12c: Managing PDBs using Triggers
Oracle 12c: Managing PDBs using Sql Developer
Oracle 12c: Performing PDB Point-In-Time Recovery
Oracle 12c: Manual container database creation in SQL*Plus
Oracle 12c: NOOPEN option for RMAN duplicate
Oracle Data Guard 11gR2 Administration Beginners Guide
Oracle 12c: Truncate Table Cascade
Oracle 12c: Managing Partitioning
Oracle 12c: DBMS_PART Package: Clean up global indexes on partitioned
tables
Oracle 12c: RMAN restore / recover pluggable database
Oracle 12c: RMAN restore / recover datale
Oracle 12c: Invisible Column
Oracle 12c: ASM New asmcmd commands
Oracle 12c: DBA_HIST_* Tables
Oracle 12c: RMAN Multisection Image Copies & Incremental Backups
Add Oracle Database 12c to Enterprise Manager 12c
Oracle 12c: RMAN recover Table
Oracle 12c ; RMAN supports SELECT statements
Oracle Database 12c available for download
Enterprise Manager Cloud Control 12c: RMAN-06403: could not obtain a
fully authorized session ORA-01034: ORACLE not available
Reinstall Enterprise Manager Cloud Control 12c Agent
7 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

My experience with ORA-07445: exception encountered: core dump


[kglic0()+1086]
Incremental updated backup failed after database restore.
CBO unnests subqueries
Troubeshooting Oracle Backup to Tape Problem;
E-Books Packt Special oers
Revert security conguration changes for 11g
Export Table statistics from one user to another
11g; Sql Plan Management
11gR2; Troubleshooting OHAS error autorun le for ohasd is missing
Troubleshooting ASM error ORA-15063: ASM discovered an insucient
number of disks for diskgroup
Oracle Database 12c New features; Container Database and Pluggable
Database (CDB & PDB)
Data Guard Physical Standby Database Best Practices Part II
Packt Publishing reaches 1000 IT titles and celebrates with their registred
users!
Reallocate Enterprise Manager 11g Master Node in RAC 11gR2 ;
Data Guard Physical Standby Database Best Practices Part I
The Oracle Advanced PL/SQL Developer Professional Guide book review
11gR2; The SQL Performance Analyzer to decide an Index Deletion
My Interview Published In The Oracle Magazine July/August 2012
Oracle Enterprise Manager 12c Cloud Control: Managing Data Center
Chaos Book
Oracle Advanced PL/SQL Developer Professional Guide book review
11gR2; RAC + Clusterware Silent Installation
Packt Publishing Exclusive discounts in March + Upcoming events
Auto Restart Enterprise Manager Cloud Control Agent 12c;
Generate AWR report Automatically
ORA-19685: SPFILE could not be veried
RAC 11gR2; Bug 11807012 really xed with PSU3?
Enterprise Manager 11g; Cluster alert metrics test cases
RAC 11gR2; Guaranteed Restore Points with Flashback Logging Disabled
Enterprise Manager Cloud 12c Installation
Manually Clear Alerts in Oracle Enterprise Manager 11g
11gR2; Silent Installation for Oracle Grid Infrastructure for a Cluster
Nominated an Oracle ACE :)
Recongure Database Control in RAC environment using EMCA
RAC 11gR2; How do I troubleshoot my clusterware startup issue?
11gR2 Clusterware de-installation procedure
11gR2; AWR Reports in RAC
11gR2 RAC: Patch Set Update 3 Install
Interview with Ben Prusinski Oracle ACE and Oracle Expert
11gR2 RAC: add Enterprise Manager Database Control to crs resources for

8 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

automatic restart
Statspack in RAC
Tape datale recover
Interview with Kellyn Potvin Rocky Mountain Oracle User Group Director
of membership and vendors and Oracle Expert
11.2.0.1.3 PSU Oracle Solaris on SPARC (64-bit)
Entrevista con Nelson Calero Presidente del UYOUG y Experto en Oracle
RACEntrevista con Nelson Calero Presidente del UYOUG y Experto en
Oracle RAC
Copy ASM les to le system
Interview with Kai Yu Oracle ACE Director and Oracle Expert
Auto-managing an Oracle database: Fix database alerts automatically
Interview with Fahd Mirza Oracle ACE and Oracle Expert
11gR2; Silent installation in Oracle Solaris 10
Interview with Surachart Opun Oracle ACE and Oracle RAC Expert
Testing RAC Check audit tool
Interview with Debra Lilley Oracle ACE Director and UKOUG President
Interview with Eddie Awad Oracle ACE Director and Oracle Expert
11gR2; Automatic restart of DB Console11gR2; Redmarrer
automatiquement DB Console 11gR2; Reiniciar Automticamente DB
Console
Interview with Kyle Hailey Oracle ACE and Oracle Expert
Oracle 11g R1/R2 Real Application Clusters Essentials Book review
11gR2 ASM Inside story Part 6 (Recreate High available Service and
rename Disk group)11gR2 ASM Inside story Partie 6 (Recrer le service
de haute disponibilt et renommer un group de disques)11gR2 ASM
Inside story Parte 6 (Crear de nuevo el servicio de alta disponibilidad y
renombrar un grupo de discos)
Interview with Hans Forbrich Oracle ACE Director and Oracle
ExpertInterview avec Hans Forbrich Oracle ACE Directeur et Expert
OracleEntrevista con Hans Forbrich Oracle ACE Director y Experto
OracleEntrevista con Hans Forbrich Oracle ACE Director y Experto
Oracle
RAC Database tape Restore to a new server
11gR2; Sqlnet.ora and Oracle Restart
11gR2 ; DB console Policy Violations Directory Objects
Patch 12311357 11.2.0.2.2 Patch Set Update Standalone grid
infrastructure
Trace Materialized views;
RAC 11gR2 ORA-00245: control le backup operation failed
RAC 11.2.0.2 Patch 12311357 11.2.0.2.2 GI Patch Set Update and mutex
patch 4 Nodes on Redhat Linux
11g recongure DB console
11gR2 RMAN incremental updated backup demo

9 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

Oracle 11g R1/R2 Real Application Clusters Essentials Book


RAC 11gR2 ORA-29540 class does not exist error
11gR2 Oracle Restart errors : CRS-0259, CRS-2680, CRS-5802
RMAN backup into more than one location
Datapump; Import using query
11g, Cold backup using RMAN and detached job
11gR2 RAC run ADDM report
11gR2 RAC CRS-2632 Error
NOSQL: Hypertable Installation
11gR2 ASM Inside story Part5 (Read database le from OS)
Active Session History (ASH) tool
11gR2 ASM Inside story Part4 (ASM Preferred Read Failure Group)
11g ASM Inside story Part3 (Export Datapump)
10g vs 11g add a column with not null default value
11gR2 ASM Inside story Part2 (Diskgroup restore)
11gR2 ASM Inside story Part1 (including grid infrastructure installation)
11g Data Recovery Advisor DRA
Oracle Enterprise Manager Grid Control Installation 11g Failed with
SEVERE: Exception: java.net.BindException: Address already in use:
JVM_Bind
11g Oracle Flashback Data Archives
Oracle Enterprise Manager Grid Control Installation 11g Release 1
(11.1.0.1.0) on fedora Linux 14
ORA-00918 ANSI Join Bug in 11.2.0.1 xed in 11.2.0.2
11gR2 Physical Data Guard Setup project, with Active Data Guard
option11gR2 Congurer Data Guard physique, avec loption dActif Data
Guard11gR2 Congurar Data Guard physico, con la opcion de Activo Data
Guard
How to x EXCEPTION in chrow processing code: -14551 msg:
ORA-14551: cannot perform a DML operation inside a query in 11.2.0.1
version
How to x ORA-979: not a GROUP BY expression in 11.2.0.1 version
Managing Resources; Real World Example
Oracle Exchange partition Example
Dealing with block corruption
Duplicate an Oracle 11gR2 Using RMAN
Step by Step clone of an Oracle 11g using RMAN
Analyse this; Learning from the optimizer
Track the row change time
Tip ; DML error capture
Step by Step clone of an Oracle 10g using RMAN
Pl Sql Tips
Oracle Support Audit
Oracle Optimizer; Index hint usage limits

10 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

Incomplete Database Recovery in 10g and 11g Databases


How to manually use Sql Tunning Advisor
How to check available partition
How do I x ORA-01455 error on 11g Release 2 oracle database ?
Find out who is locking my account
Fast delete- Best practice
DBA Sql Tips
DataGuard : Step-by-Step Instructions for Creating a Physical Standby
Database
Data Pump in 11g ; New parameters
Convert money into words using PL SQL function,
Alternative statement, rewrite query

Visit Oracle Community

Recent Comments
Adrian Iriarte: Saludos, Que buen articulo, casi siempre al momento de
querer implementar soluciones para el...
Patricia: Hi Wissem, is there a workaround for this? I mean I want to use
the sqlnet.authentication_services =none,...
Brian: I created the cdb manually using the instruction, but then I tried to
create pdb within in, it failed. have...
Farmer Johnson: Hi Wissem. How did you avoid the error you had
previsouly encountered: sudo opatch auto...
Hctor Moro: Querido Nelson; Despus de entrevistar a mas de 50
profesionales de primer nivel en Uruguay, al n te...
What is NO2 Maximus: I genuinely apreciated your site! You shoul
update it with new info!
Nav: Indeed helpful, to the point article..
Koti: Can you please explain all the sections of AWR report in RAC. I mean
to ask output produced by awrgrpt.sql...
Himanshu: Nice post.can you please comment on this Why RMAN restored
the DATA_REORTING datae to +DATA diskgroup?
Enrique: Great post.
gabriel: what version of sqldeveloper support plugable database?
Kal: Quality thanks

11 of 12

05/03/2014 04:56 PM

Auto Restart Enterprise Manager Cloud Control ...

http://www.oracle-class.com/?p=2597

wissem: Well , like I mentioned in the post, delete service and add service
using IP.
Kelly: were you able to solve this? Thanks!
wissem: Hello, You can buy the book from PakT: http://www.packtpub.com
/oracle -data-guard-11gr2-administr...
goutham: hi i want to buy this book.could you please let me know how can i
buy this book. i am in Malaysia. thanks...
cesar Lopez: Hola me gustaria saber tu punto de vista de MYSQl vs
ORACLE para una sistema de Nomina de unos 1500...
wissem: Check my previous article in English; Oracle 12c: RMAN recover
Table http://www.oracle-class.com/?p =2866
NILESH: Sir, English please
Ramakrishna: I want step by step installation of Hyper-table in windows
and also usage of Hyper-table like data...

Oracle-Class Forums Latest Activity


Callow Protrude by: jodyoy11
May 3, 2014, 08:52

Mature galleries by: gilbertkt60


May 3, 2014, 06:09

New Job by: rachelle11


May 3, 2014, 05:30

Free adult galleries by: gilbertkt60


May 3, 2014, 01:41

Mature purlieus by: rachelle11


May 3, 2014, 01:09

Mature site by: jodyoy11


May 3, 2014, 00:25

Copyright Oracle Class Wissem All About Oracle is proudly powered by -MeWissem EL KHLIFI
Contact

12 of 12

05/03/2014 04:56 PM

You might also like