Virtual machines are used in many organizations due to the simplicity of administration, especially in development environments.
One popular use of virtualization, is creating a MASTER image of one virtual machine and then copy it when necessary.
But, what do we do when we need an Oracle Database on this machine. How can we replicate the machine and work with the database.
Moreover, will the Database itself and the Database Control (Oracle Enterprise Manager) work on the new machine?
Below are the steps to configure the database and the Database control in the new machine.
The following steps were performed on Oracle Database 10g Release 2 (10.2.0.4) 64-bit, on CentOS 5 (64-bit) virtual machine :
Database:
- Change the hostname in the file $ORACLE_HOME/network/admin/listener.ora
for example:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = NEW_HOSTNAME)(PORT = 1521))
)
)
- Change the hostname in the file $ORACLE_HOME/network/admin/tnsnames.ora
Please change the hostname in all the relevant entries.
for example:
ORCL1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = NEW_HOSTNAME)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl1)
)
)
Database Control:
Recreating the Database control repository is needed. without it, the Database Control won’t start.
In order to recreate the DB control run following commands:
- Dropping the current DB control’s settings.
In the <NEW HOSTNAME> please make sure to write the new hostname.
$ emca -deconfig dbcontrol db -repos drop -ORACLE_HOSTNAME <NEW HOSTNAME> -SID <ORACLE_SID> -PORT <Listener's Port> -SYSMAN_PWD <SYSMAN password> -SYS_PWD <SYS password></pre>
Information in regards the different ‘emca’ attributes can be acquire by running ‘emca’ without any attribute from the CMD.
$ emca -deconfig dbcontrol db -repos drop -ORACLE_HOSTNAME ORCLSERVER -SID orcl1 -PORT 1521 -SYSMAN_PWD **** -SYS_PWD **** STARTED EMCA at Jun 17, 2010 7:54:31 PM EM Configuration Assistant, Version 11.2.0.0.2 Production Copyright (c) 2003, 2005, Oracle. All rights reserved. Do you wish to continue? [yes(Y)/no(N)]: y Jun 17, 2010 7:54:49 PM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2010_06_17_19_54_31.log. Jun 17, 2010 7:54:50 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration WARNING: EM is not configured for this database. No EM-specific actions can be performed. Jun 17, 2010 7:54:50 PM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl WARNING: Error initializing SQL connection. SQL operations cannot be performed Jun 17, 2010 7:54:50 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Dropping the EM repository (this may take a while) ... Jun 17, 2010 7:54:50 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Repository successfully dropped Enterprise Manager configuration completed successfully FINISHED EMCA at Jun 17, 2010 7:54:50 PM
- Recreating the DB control’s repository.
In the <NEW HOSTNAME> please make sure to write the new hostname.
$emca -config dbcontrol db -ORACLE_HOSTNAME <NEW HOSTNAME> -SID <ORACLE_SID> -PORT <Listener's Port> -SYS_PWD <SYSMAN password> -SYSMAN_PWD <SYSMAN password> -DBSNMP_PWD <DBSNMP password>
After this step the Database Control’s repository will be recreated and you will able to connect the Database control’s URL.
$ emca -config dbcontrol db -ORACLE_HOSTNAME ORCLSERVER -SID orcl1 -PORT 1521 -SYS_PWD **** -SYSMAN_PWD **** -DBSNMP_PWD **** STARTED EMCA at Jun 17, 2010 8:04:27 PM EM Configuration Assistant, Version 11.2.0.0.2 Production Copyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information: 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 ................ <HOSTNAME> Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1 Listener port number ................ 1521 Database SID ................ orcl1 Email address for notifications ............... Outgoing Mail (SMTP) server for notifications ............... ----------------------------------------------------------------- Do you wish to continue? [yes(Y)/no(N)]: y Jun 17, 2010 8:04:44 PM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl2/emca_2010_06_17_20_04_27.log . Jun 17, 2010 8:04:45 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository INFO: Uploading configuration data to EM repository (this may take a while) ... Jun 17, 2010 8:05:43 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Uploaded configuration data successfully Jun 17, 2010 8:05:44 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib INFO: Software library is already configured. Jun 17, 2010 8:05:44 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib INFO: EM_SWLIB_STAGE_LOC (value) will be ignored. Jun 17, 2010 8:05:44 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary INFO: Deploying Provisioning archives ... Jun 17, 2010 8:06:09 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary INFO: Provisioning archives deployed successfully. Jun 17, 2010 8:06:09 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole INFO: Securing Database Control (this may take a while) ... Jun 17, 2010 8:06:34 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole INFO: Database Control secured successfully. Jun 17, 2010 8:06:34 PM oracle.sysman.emcp.util.DBControlUtil startOMS INFO: Starting Database Control (this may take a while) ... Jun 17, 2010 8:07:28 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: Database Control started successfully Jun 17, 2010 8:07:28 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: >>>>>>>>>>> The Database Control URL is https://HOSTNAME:1158/em <<<<<<<<<<< Jun 17, 2010 8:07:36 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: /u01/app/oracle/product/11.2.0/db_1/HOSTNAME_orcl2/sysman/config/emkey.ora. Please ensure this file is backed up as the encrypted data will become unusable if this file is lost. *********************************************************** Enterprise Manager configuration completed successfully FINISHED EMCA at Jun 17, 2010 8:07:36 PM
Known Issues:
In case no new hostname is provided in the attribute ‘–ORACLE_HOSTNAME’ of the emca command, the utility will use the old hostname and the drop/create operation will fail.
For more information in regards to Drop, Create And Recreate DB Control, please refer to Metalink note: 278100.1






