Friday, August 2, 2013

Troubleshoot & Re-create Oracle Enterprise Manager Repository on MS Windows Server

Remove the following directories from your filesystem:

<ORACLE_HOME>\<hostname>_<db_unique_name>
<ORACLE_HOME>\oc4j\j2ee\OC4J_DBConsole_<hostname>_<db_unique_name>

$ sc delete DbConsoleOEM

$ cd <ORACLE_HOME>\bin
$ emca -repos drop or we can drop the Repository manually as follows.

Delete DBControl Repository Objects Manually:

Logon to SQL*PLUS as SYS user and execute the following:

SQL> exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE);

SQL> DECLARE
CURSOR c1 IS
SELECT owner, synonym_name name
FROM dba_synonyms
WHERE table_owner = 'SYSMAN';
BEGIN
FOR r1 IN c1 LOOP
IF r1.owner = 'PUBLIC' THEN
EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
ELSE
EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
END IF;
END LOOP;
END;
/

SQL> DROP USER mgmt_view CASCADE;
SQL> DROP ROLE mgmt_user;
SQL> DROP USER sysman CASCADE;

Create the DBControl Repository Objects and Configuration Files:

Set your environment variables:

$ set ORACLE_HOME=D:\app\Administrator\product\11.2.0\dbhome_1
$ set ORACLE_SID=OEM
$ set ORACLE_UNQNAME=<database unique name> --> you can get this value from SQL query (SQL> show parameter db_unique_name)
$ set ORACLE_HOSTNAME

$ emca -config dbcontrol db -respos create

Edit <ORACLE_HOME>/sysman/admin/supported.tz file  i.e added Asia/Colombo under +5:30 GMT

Edit  <ORACLE_HOME>/<Hostname_DB>/sysman/config/emd.properties file to Asia/Colombo

$ set TZ=Asia/Colombo
$ emctl config agent getTZ
$ emctl config agent updateTZ
$ emctl resetTZ agent
$ emctl stop dbconsole
$ emctl start dbconsole

No comments:

Post a Comment