Tuesday, December 23, 2014

Recreate or reconfigure the Enterprise Manager (EM) console or Database Control in oracle 11g

If you use EM for managing your Oracle databases, you may face lots of problem with EM like sometimes EM will not starting up, sometimes it will start but not able to connect with database and listener and agent etc.

So, here are some basic things related to EM, you can reduce your EM related problem by following these.

Sample URL for EM in 11g R2 : https://your_host_name:1158/em  (just an idea)


Prerequisite for EM:



1) Make sure the "/etc/hosts" file contains at least the loopback address and preferably the machine definition also.

    127.0.0.1       localhost.localdomain  localhost
    192.168.1.101  your_server_name.localdomain   your_server_name


2) make sure the ORACLE_HOSTNAME and ORACLE_UNQNAME environment variables are set correctly.

    ----in windows

    cmd> set ORACLE_HOSTNAME=your_server_name.localdomain;
    cmd> set ORACLE_UNQNAME=orcl;

3) Check the listener is running correctly with the same IP/your_server_name and port ;


    cmd> lsnrctl status  ---run cmd as a adminstrator

B)  Enterprise Manager service check/start/stop .



        cmd> set ORACLE_HOSTNAME=your_server_name; --your host_name

        cmd> set ORACLE_UNQNAME=orcl;  --your database name or sid name

        cmd> emctl status dbconsole

        cmd> emctl start dbconsole

        cmd> emctl stop dbconsole


C) If EM fails to start or running but not working properly then you can recreate it with EMCA utility .



         [note: you need following information's before recreate

         1. Listener should be up, running and registerd with database.
         2. Database SID name
         3. Listener port number: 1521
         4. Password for SYS user: 
         5. Password for DBSNMP user: 
         6. Password for SYSMAN user:   
         ]
Then run following commands

       cmd> set ORACLE_HOSTNAME=your_server_name; --your host_name

       cmd> set ORACLE_UNQNAME=orcl;  --your database name or sid name

       cmd> emca -config dbcontrol db -repos recreate


D) if above recreate command fails, you drop the EM first and create by following commands



        cmd> set ORACLE_HOSTNAME=your_server_name; -----your host_name

        cmd> set ORACLE_UNQNAME=orcl;  -----your database name or sid name

        cmd> emca -deconfig dbcontrol db -repos drop

        cmd> emca -config dbcontrol db -repos create


---I hope it will reduce your EM related problem. cheers!!


Example log:-

Invoke the CMD with as a Administrator:- 

 

 Microsoft Windows [Version 6.1.7601]  
 Copyright (c) 2009 Microsoft Corporation. All rights reserved.  
 C:\Windows\system32>set ORACLE_HOSTNAME=my-PC  
 C:\Windows\system32>set ORACLE_UNQNAME=halimdb  
 C:\Windows\system32>  
 C:\Windows\system32>lsnrctl  
 LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 13-JUN-2015 12:17  
 :46  
 Copyright (c) 1991, 2010, Oracle. All rights reserved.  
 Welcome to LSNRCTL, type "help" for information.  
 LSNRCTL> status  
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=my-PC)(PORT=1521)))  
 STATUS of the LISTENER  
 ------------------------  
 Alias           LISTENER  
 Version          TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Produ  
 ction  
 Start Date        13-JUN-2015 11:49:34  
 Uptime          0 days 0 hr. 28 min. 20 sec  
 Trace Level        off  
 Security         ON: Local OS Authentication  
 SNMP           OFF  
 Listener Parameter File  C:\app\product\11.2.0\db_1\network\admin\listener.ora  
 Listener Log File     c:\app\diag\tnslsnr\my-PC\listener\alert\log.xml  
 Listening Endpoints Summary...  
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=my-PC)(PORT=1521)))  
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))  
 Services Summary...  
 Service "CLRExtProc" has 1 instance(s).  
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...  
 The command completed successfully  
 LSNRCTL>  
 LSNRCTL>  
 LSNRCTL> exit  
 C:\Windows\system32>  
 C:\Windows\system32>  
 C:\Windows\system32>  
 C:\Windows\system32>emca -config dbcontrol db -repos recreate  
 STARTED EMCA at Jun 13, 2015 12:19:51 PM  
 EM Configuration Assistant, Version 11.2.0.0.2 Production  
 Copyright (c) 2003, 2005, Oracle. All rights reserved.  
 Enter the following information:  
 Database SID: halimdb  
 Listener port number: 1521  
 Listener ORACLE_HOME [ C:\app\product\11.2.0\db_1 ]:  
 Password for SYS user:  
 Password for DBSNMP user:  
 Password for SYSMAN 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 ................ C:\app\product\11.2.0\db_1  
 Local hostname ................ my-PC  
 Listener ORACLE_HOME ................ C:\app\product\11.2.0\db_1  
 Listener port number ................ 1521  
 Database SID ................ halimdb  
 Email address for notifications ...............  
 Outgoing Mail (SMTP) server for notifications ...............  
 -----------------------------------------------------------------  
 Do you wish to continue? [yes(Y)/no(N)]: yes  
 Jun 13, 2015 12:20:22 PM oracle.sysman.emcp.EMConfig perform  
 INFO: This operation is being logged at C:\app\cfgtoollogs\emca\halimdb\emca_201  
 5_06_13_12_19_51.log.  
 Jun 13, 2015 12:20:23 PM oracle.sysman.emcp.EMReposConfig invoke  
 INFO: Dropping the EM repository (this may take a while) ...  
 Jun 13, 2015 12:21:39 PM oracle.sysman.emcp.EMReposConfig invoke  
 INFO: Repository successfully dropped  
 Jun 13, 2015 12:21:39 PM oracle.sysman.emcp.EMReposConfig createRepository  
 INFO: Creating the EM repository (this may take a while) ...  
 Jun 13, 2015 12:24:25 PM oracle.sysman.emcp.EMReposConfig invoke  
 INFO: Repository successfully created  
 Jun 13, 2015 12:24:28 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepo  
 sitory  
 INFO: Uploading configuration data to EM repository (this may take a while) ...  
 Jun 13, 2015 12:24:51 PM oracle.sysman.emcp.EMReposConfig invoke  
 INFO: Uploaded configuration data successfully  
 Jun 13, 2015 12:24:56 PM oracle.sysman.emcp.util.DBControlUtil configureSoftware  
 Lib  
 INFO: Software library configured successfully.  
 Jun 13, 2015 12:24:56 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibr  
 ary  
 INFO: Deploying Provisioning archives ...  
 Jun 13, 2015 12:25:14 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibr  
 ary  
 INFO: Provisioning archives deployed successfully.  
 Jun 13, 2015 12:25:14 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole  
 INFO: Securing Database Control (this may take a while) ...  
 Jun 13, 2015 12:25:20 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole  
 INFO: Database Control secured successfully.  
 Jun 13, 2015 12:25:20 PM oracle.sysman.emcp.util.DBControlUtil startOMS  
 INFO: Starting Database Control (this may take a while) ...  
 Jun 13, 2015 12:26:06 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration  
 INFO: Database Control started successfully  
 Jun 13, 2015 12:26:07 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration  
 INFO: >>>>>>>>>>> The Database Control URL is https://my-PC:1158/em <<<<<<<<<<<  
 Jun 13, 2015 12:26:08 PM oracle.sysman.emcp.EMDBPostConfig invoke  
 WARNING:  
 ************************ WARNING ************************  
 Management Repository has been placed in secure mode wherein Enterprise Manager  
 data will be encrypted. The encryption key has been placed in the file: C:/app/  
 product/11.2.0/db_1/my-PC_halimdb/sysman/config/emkey.ora.  Please ensure this  
 file is backed up as the encrypted data will become unusable if this file is los  
 t.  
 ***********************************************************  
 Enterprise Manager configuration completed successfully  
 FINISHED EMCA at Jun 13, 2015 12:26:08 PM  
 C:\Windows\system32>  
 C:\Windows\system32>