Zahid Karim
Recent Posts
1.Draw plus and cross sign into PDF via PLSQL using PL_FPDF
2.Draw Triangle directly into PDF via PLSQL using PL_FPDF
3.Write fast and efficient PLSQL - DBMS_PROFILER
4.Fix physically corrupt data blocks using PLSQL - DBMS_REPAIR
5.Encrypt or Decrypt sensitive data using PLSQL - DBMS_CRYPTO
Find me on
How to extract user sql statements from Oracle Trace Files How to read or analyze redo log files using LogMiner

Add ASM Instance into Enterprise Manager

Posted by Zahid on May 12, 2010.

When a non ASM database is migrated to ASM storage the dbcontrol (Oracle Enterprise Manager) may not discover the newly created ASM instance and does not display anything for the ASM instance on its home page. Please see the screen shot below which was taken after installing the ASM instance and migrating database to ASM storage.

EM Home Page without ASM Instance Link

Add ASM instance as a target to Enterprise Manager:

Now we need to add this newly created ASM instance as a target to the Enterprise Manager agent.

/* 
  Create an xml file with any name at any location.
  What I usually do is create a file named asmTarget.xml at the 
  location "$ORACLE_HOME/ora10.home.com_ora10g/sysman/emd/" , which 
  is the location for target.xml where all EM targets are configured.  
  ora10.home.com is my host name and ora10g is the sid for my Oracle 
  RDBMS instance. You should have a similar directory in your machine
  with a name of your host and your oracle SID.
*/
$ cd $ORACLE_HOME/ora10.home.com_ora10g/sysman/emd/
$ ll
total 28
-rw-r----- 1 oracle oinstall   56 May 12 09:16 agntstmp.txt
drwxr----- 2 oracle oinstall 4096 Apr 29 07:01 collection
-rw-r----- 1 oracle oinstall 3809 May 12 09:14 lastupld.xml
-rw-r----- 1 oracle oinstall   80 May 12 08:53 protocol.ini
drwxr----- 2 oracle oinstall 4096 May 12 09:16 state
-rw-r----- 1 oracle oinstall  950 May 12 08:54 targets.xml
drwxr----- 2 oracle oinstall 4096 May 12 09:16 upload

/* 
 create new file asmTarget.xml and put the following text into it.
*/

<Target TYPE="osm_instance" NAME="+ASM_ora10.home.com">
 <Property NAME="SID" VALUE="+ASM" />
 <Property NAME="MachineName" VALUE="ora10.home.com" />
 <Property NAME="OracleHome" VALUE="/u01/app/oracle/product/10.2.0/db_1" />
 <Property NAME="UserName" VALUE="sys" />
 <Property NAME="password" VALUE="system" ENCRYPTED="FALSE"/>
 <Property NAME="Role" VALUE="sysdba" />
 <Property NAME="Port" VALUE="1521" />
</Target>

/*
  SID is the sid for your ASM instance.
  MachineName is the hostname where ASM instance is running.
  OracleHome is the ASM instance home.
  UserName is the user who can connect with ASM instance.
  Password is the password of the user.
  Role is the administrative level.
  Port is the port where Oracle Listener is listening for the ASM
  instance.
*/

Now run the following command to add this new target to EM targets.

$ emctl config agent addtarget \
> $ORACLE_HOME/ora10.home.com_ora10g/sysman/emd/asmTarget.xml
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0  
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

After the command is executed successfully, you should see these lines in the target.xml file where all EM targets are configured. Notice the encrypted password. This was done during the "emctl config agent addtarget" command.

$ tail -10 targets.xml 
<Target TYPE="osm_instance" NAME="+ASM_ora10.home.com">
 <Property NAME="SID" VALUE="+ASM"/>
 <Property NAME="MachineName" VALUE="ora10.home.com"/>
 <Property NAME="OracleHome" VALUE="/u01/app/oracle/product/10.2.0/db_1"/>
 <Property NAME="UserName" VALUE="sys"/>
 <Property NAME="password" VALUE="499f8610be848dc6" ENCRYPTED="TRUE"/>
 <Property NAME="Role" VALUE="sysdba"/>
 <Property NAME="Port" VALUE="1521"/>
</Target>
</Targets>

Now restart the dbconsole.

$ emctl stop dbconsole
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0  
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://ora10.home.com:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ... 
 ...  Stopped. 

$ emctl start dbconsole
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0  
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://ora10.home.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control
 ........................... started. 
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0
/db_1/ora10.home.com_ora10g/sysman/log

After the dbconsole is restarted open enterprise manager and now you should see your ASM instance link in the "General" section of your EM home page.

EM Home Page with ASM Instance Link

Click on the ASM instance link and you should be transfered to the ASM instance home page.

ASM instance Home Page

Some times you will not see the ASM link on your EM Home page. In my experience this happens when you just have created the ASM instance and haven't yet migrated a bit of your Database to ASM, so ASM and RDBMS instances are running in parallel on your machine but they don't have any link to each other or they are not talking to each other in anyway. The dbcontrol is configured for your RDBMS instance so ideally it should not show the ASM instnace link on the dbcontrol home page in the situation I just described.

But still the target is configured in the EM and you can see it in this way.

Home target in EM

In the general section of the EM home page you will see a link as "Host". Click the link and open the "targets" tab.

EM Targets

See also:
How to install ASM instance on a non-asm Oracle database
How to configure Raw Disks in RHEL 5
How to migrate Oracle datafiles to ASM storage via RMAN
How to Configure ASM disks using ASMLib or Raw Disks
How to migrate online redo logs to Oracle ASM storage
Migrate Oracle Flash Recovery Area to ASM storage via RMAN