Wednesday, 6 November 2013

How To Re-create Oracle Database 11g Enterprise Control Manager

HOW TO RE-CREATE ORACLE DATABASE 11G ENTERPRISE CONTROL MANAGER

Steps are:


Drop the user and dependent on version a few other objects, like:



SQL>DROP USER sysman CASCADE;
SQL>DROP PUBLIC SYNONYM setemviewusercontext;
SQL>DROP ROLE mgmt_user;
SQL>DROP PUBLIC SYNONYM mgmt_target_blackouts;
SQL>DROP USER mgmt_view;

It will take some time for droping the user
and after dropping user and their role drop all the public synonym which are invalid after dropping the above users.
Save the below query result as a text file invalid_synonym.txt

SQL>SELECT 'drop public synonym ' || a.object_name || ';'
FROM all_objects a
WHERE a.object_type='SYNONYM'
AND a.owner = 'PUBLIC'
AND a.STATUS = 'INVALID'

And run it in sqlplus command prompt as

SQL> @ADDRESS_OF_FILE/invalid_synonym.txt;

and then issue the below command on linux prompt and follow the instructions

STARTED EMCA at Jul 13, 2008 8:28:48 AM
EM Configuration Assistant, Version 11.1.0.5.0 Production
Copyright (c) 2003, 2005, Oracle.  ALL rights reserved.
 
Enter the following information:
DATABASE SID: orcl
Listener port NUMBER: 1521
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 ................ /u01/app/oracle/product/11.2.0/db_1

LOCAL hostname ................ ora
Listener port NUMBER ................ 1521
DATABASE SID ................ orcl
Email address FOR notifications ...............


Outgoing Mail (SMTP) server FOR notifications ...............

-----------------------------------------------------------------

Do you wish TO continue? [yes(Y)/no(N)]: y
and it will take some time to create enterprise manager


important commands

for creation of enterprise manager in linux on oracle 11g

emca -config dbcontrol db -repos create
for Dropping of enterprise manager in linux on oracle 11g
emca -config dbcontrol db -repos DROP
for status of enterprise manager in linux on oracle 11g
emca -config dbcontrol db -repos STATUS