Monday, January 9, 2012

How to Reconfigure OEM in Oracle 10g on Linux


We generally find that the OEM is not working due to the various reason . The best approach to solve this issue is to drop the OEM and reconfigure it . OEM may not work for various reason . In my case , I have install the oracle 10g on my system and then changed the computer host name . This leads  the OEM not working . The following are the steps to configure the OEM  : 

Step 1 :  Change IP to Machine name : 

i.)  Change the $ORACLE_HOME/network/admin/listener.ora file from an IP number to machine name.
ii.) Change the $ORACLE_HOME/network/admin/tnsnames.ora file from an IP number to a machine name.

Step 2 : Change the computer name : 
Open the network file and replace with new HOSTNAME . (in my case, I have changed from localhost to Ramtech.com) . 

[root@Ramtech ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=Ramtech.com


save the changes and exit vi. Now edit the /etc/hosts file and set new host name . In hosts file edit the line and replace it with new one as
[root@Ramtech ~]# vi /etc/hosts
127.0.0.1          localhost
192.168.80.131   Ramtech.com

save and exit vi. The changes to /etc/hosts and /etc/sysconfig/network are necessary to make our changes persistent . Finally, we will restart the network to apply the changes we made to above file .

[root@Ramtech ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                       [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                   [  OK  ]

Now we use the hostname command to check the changes :
[root@Ramtech ~]# hostname
Ramtech.com

Step 3 : Drop the em configuration : 
First , we will drop the existing console and repository .

[oracle@Ramtech ~]$ export ORACLE_SID=noida
[oracle@Ramtech ~]$ emca  -deconfig  dbcontrol  db  -repos  drop

STARTED EMCA at Jan 8, 2012
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: noida
Listener port number: 1521
Password for SYS user:
Password for SYS user:

Do you wish to continue? [yes(Y)/no(N)] :  y 
 oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /home/oracle/product/10.2.0/db_1/cfgtoollogs/emca/noida/emca_2012-01-08_05-52-43-PM.log.
Jan 8, 2012 5:55:32 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration

WARNING: EM is not configured for this database. No EM-specific actions can be performed.
Jan 8, 2012 5:55:33 PM oracle.sysman.emcp.EMReposConfig dropRepository
INFO: Dropping the EM repository (this may take a while) ...
Jan 8, 2012 5:56:52 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Jan 8, 2012 5:56:59 PM

Step 4 :  Drop the user and dependent :
If any of the below objects exists ,then we will face error , so before creating the OEM drop the following :

SQL> drop  user  SYSMAN   cascade; 
SQL> drop  user  MGMT_VIEW ; 
SQL> drop  role MGMT_USER ; 


and finally drop all the dependent synonyms of  "sysman" schema .

SQL> spool drop_synonym.sql 
SQL> SELECT  'drop public synonym '  || synonym_name || ';'   FROM dba_synonyms  WHERE    table_owner = 'SYSMAN';
SQL> @drop_synonym.sql 

Step 5 : Re-create the OEM : 

[oracle@Ramtech ~]$ export ORACLE_SID=noida
[oracle@Ramtech ~]$ emca -config dbcontrol db -repos create

STARTED EMCA at Jan 8, 2012 5:58:50 PM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: noida
Listener port number: 1521
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /home/oracle/product/10.2.0/db_1
Database hostname ................ Ramtech.com
Listener port number ................ 1521
Database SID ................ noida
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]:
Jan 8, 2012 5:59:31 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /home/oracle/product/10.2.0/db_1/cfgtoollogs/emca/noida/emca_2012-01-08_05-58-49-PM.log.
Jan 08, 2012 06:01:30 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Jan 08, 2012 06:17:38 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Jan 08, 2012 06:18:50 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Jan 08, 2012 06:23:01 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Jan 08, 2012 06:23:02 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://Ramtech.com:5500/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Jan 08, 2012 06:23:02 PM

Step 6 :  Start and stop the dbconsole : 

$ emctl start dbconsole
$ emctl stop dbconsole
$ emctl status dbconsole

Note :  The same steps are used in window also. Sometimes we cannot able to recreate the oem(in case of window) in such case delete the  instance(using oradim) and again create the instance (using oradim) and then try to configure the OEM .


Enjoy     J J J


5 comments:

Anonymous said...

If the user sysman is dropped before recreating the repository then how the use can be again created? because recreation of OEM needs the passwd for sysman user.

NEERAJ VISHEN said...

Hi

when you create the repository , firstly, oracle creates user "sysman" and prompt us to set the password . Once the user is created then only repository is created .

Regards

Amar said...

Thanks a lot Neeraj for these info....

NEERAJ VISHEN said...

most welcome Amar .....
Enjoy :-)

CT said...

Hi Neeraj,
Thank you for nice blog and informations.

I did the work around for TNS listener poison attack as per metalink note 1453883.1 by adding

SECURE_REGISTER_LISTENER = (IPC) and
updated the parameter

alter system set local_listener='(DESCRIPTION=(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)))' scope = both;

Database version is 10.2.0.3. Now Enterprise Manager is not working , I tried to start and am getting an error message.

I am wondering have you come across this , if so what is the solution.

Any help on this is Highly appreciated.

Thank you
CT