Tuesday, June 4, 2013

Oracle: Reconfigure EM after hostname changed.

If the machine name has already been changed

When the ipaddress or hostname of the machine running dbconsole has already been changed, it is necessary to drop the dbconsole manually and create it again afresh using the following steps:-

1) drop the dbconsole repository schema manually following the steps in note:278100.1.  Follow Section A, option 4 "Delete DB Control Repository Objects Manually"

Delete DB Control Repository Objects Manually


Method 1: Drop AQ related objects and DB Console repository object from the SYSMAN schema in quiesce mode:

Run from SQLPLUS as user SYS (as SYSDBA):
SQL> exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force =>TRUE);
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP RESTRICT;
SQL> EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
SQL> EXEC sysman.setEMUserContext('',5);
SQL> REVOKE dba FROM sysman;
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;
SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;

Note 1: On some versions (11.1 +), the SYSDBA role is no longer granted to SYSMAN account, so the respective statement may fail. This is not an issue and can be ignored.



2) Delete the dbconsole configuration files manually following the steps in note:278100.1.  Follow Section A, option 2 "Delete DB Control Configuration Files Manually"



Delete DB Control Configuration Files Manually

Remove the following directories from your filesystem:
<ORACLE_HOME>/<hostname_sid>
<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>

If the database was upgraded, (for example from 10.2.0.3 to 10.2.0.4) then the following directory also needs to be removed from the file system:
<ORACLE_HOME>/<hostname_sid>.upgrade
<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>.upgrade

3) Ensure that the listener has the correct new hostname/ipaddress
4) Ensure that the hosts file has the correct new hostname/ipaddress
5) Create dbconsole using

emca -config dbcontrol db -repos create.

No comments:

Post a Comment