When running lots of VirtualBox VM’s I often find that during some reconfig the database Enterprise Manager gets in a confused state. This is usually due to network changes, and most people end up re-installing Oracle. One solution is to keep snapshots of a working Database set-up but I find I run out of space pretty quickly on my laptop.
I was therefore delighted to find a simple solution at a blog by Mclaughlin Software (http://blog.mclaughlinsoftware.com/oracle-architecture-configuration/changing-windows-hostname-and-oracle-enterprise-manager/) which showed how to get a New EM installation.
As I use it often I have copied in the steps here:
These are the steps:
1. Change the %ORACLE_HOME%networkadminlistener.ora file from an IP number to machine name.
2. Change the %ORACLE_HOME%networkadmintnsnames.ora file from an IP number to a machine name.
3. Change the C:WINDOWSSystem32driversetchosts file by adding this line beneath the default localhost line (for the new Hostname value):
127.0.0.1 localhost
172.16.113.128 mclaughlin11g mclaughlin11g.techtinker.com
4. Change the Windows hostname by navigating: Start > Control Panel > System (classic view) from the random assignment of VMWare Fusion.
5. Reboot the machine, and then drop the em configuration with the following commands:
C:Data> set ORACLE_SID=orcl
C:Data> emca -deconfig dbcontrol db -repos drop
6. You’ll receive the following prompts, enter the Oracle SID and Port number without double quotes but you must enter all passwords with double quotes (at least in Oracle Database 11g):
STARTED EMCA at Jul 13, 2008 8:26:42 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 SYSMAN user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: y
7. You should then drop the SYSMAN user manually because it doesn’t happen without your assistance (or, it didn’t happen when I did it). If you don’t drop the SYSMAN schema, you’ll raise an error when you try to recreate it.
DROP USER sysman CASCADE;
DROP PUBLIC SYNONYM setemviewusercontext;
DROP ROLE mgmt_user;
DROP PUBLIC SYNONYM mgmt_target_blackouts;
DROP USER mgmt_view;
8. You can then create the em environment with the following syntax:
C:Data> emca -config dbcontrol db -repos create
9. Again, you’ll receive the following prompts, enter the Oracle SID and Port number without double quotes but you must enter all passwords with double quotes (at least in Oracle Database 11g):
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 ................ C:appAdministratorproduct11.1.0db_1
LOCAL hostname ................ mclaughlin11g
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
Once again, thanks to http://blog.mclaughlinsoftware.com
Also, http://www.akadia.com/services/ora_dbconsole.html
@ddi