Geeks With Blogs

@scottvanvliet
  • scottvanvliet Tonight is my first show in 10 years, guest bass for The Toys! Learned 30+ songs in 4 weeks. Might get ugly but going to be fun! Thx @TKilp about 563 days ago

Scott Van Vliet Once a Developer, Always a Developer

So I realize it seems like I'm posting a bunch of stuff on Oracle and little on .NET, but it's all related to a large Smart Client application we're developing for our client, using Oracle 10g; thus, it's relative J

In a geographically-diverse team structure, it can be quite difficult to manage the development environment used by each team member (especially when you have little control over the workstation configuration of your offshore team.) Thus, for many of our engagements we heavily leverage virtualization – specifically Virtual PC 2007 – to help minimize the cost of environment setup and configuration.

One of the challenges we've faced with leveraging Virtual PC, specifically a shared image, is the unique naming of virtual machines. Now, in many cases it is acceptable to keep the virtual machine name the same across developer environments; however, for our purposes, unique machine names are required based on the following:

  • TFS Workspace names rely on machine name for unique naming (in combination with username)
  • Using our host VPN connection and Internet Connection Sharing (ICS), we provide our guest VPN access; although through NAT, the machine name (NetBIOS) still passes through when accessing corporate network resources, thus causing issues with the same
  • When using local network access directly on the guest, name conflicts occur; furthermore, two guest machines have issues accessing each other due to similar NetBIOS naming issues as outlined above (we often communicate guest-to-guest from different developer environments)

For all intents and purposes, this is a trivial matter. However, when dealing with Oracle, reliance on the installation-time hostname – at least from my experience and research – is critical. Thus, changing the hostname can cause problems.

Consequently, we've learned to deal with this process by following the steps outlined below.

Step 1 – Create Hosts Entry for Old Hostname

Locate your hosts file, typically located at %WINDIR%\system32\drivers\etc\hosts and add an entry for the old (current) hostname.

#
# HOSTS file
#

win2k3r2    172.16.10.10


Note the IP address – this is the address of a Loopback Adapter installed on the guest machine. As outlined by the Oracle Installer, a Loopback Adapter is required on systems that do not have a static IP address (as do virtual machines using NAT, etc.)

Step 2 – Uninstall Enterprise Manager Console

Because there are configuration settings stored with Enterprise Manager Console that reference the hostname, the same must be uninstalled.

emca -deconfig dbcontrol db -repos drop


Note, before executing this command, ensure that the Oracle instance is running – it has to be in order for Enterprise Manager Configuration Assistance to drop the repository and de-configure the Console.

Step 3 – Stop All Oracle Services

Once the uninstall of Enterprise Manage Console has completed, stop all Oracle Services on the guest machine.

  • iSQL*Plus Service – typically named Oracle<OracleHomeName>iSQL*Plus
  • Oracle Listener Service – typically named Oracle<OracleHomeName>TNSListener
  • Oracle Database Instance Service – typically named OracleServer<SID>

Step 4 – Update listener.ora and tnsnames.ora

Once all the Oracle services have stopped, update the listener.ora and tnsnames.ora files, located in %ORACLE_HOME%\network\admin to reflect the desired (new) hostname.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = win2k3r2)(PORT = 1521))
)
)

DEVBOX =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = win2k3r2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = devbox)
)
)

Step 5 – Rename Host and Restart

Now, rename the computer and restart the guest machine.

Step 6 – Ensure Oracle Instance is Running

Once the guest machine has started up, log in and ensure the Oracle instance is running using the following command line (typically required, unless the instance, not the Windows Service, is configured to auto-start.)

oradim -startup –sid devbox

Step 7 – Reinstall Enterprise Manager Console

After ensuring the Oracle instance is running, reinstall Enterprise Manager Console using the following command line:

emca -config dbcontrol db -repos create

Step 8 – Validate Enterprise Manager Console Installation

Lastly, after the successful installation of Enterprise Manager Console, validate the installation by navigating to the logon page – typically http://<hostname>:1158/em/.

At this point, you should be crankin' away with your Oracle instance running as it should! We spent a lot of time working on this issue, so hopefully this post helps you out in some way – I wished there was an article like this when I was scouring OTN with no results!

Thanks to Mike Huffine for the initial pointers.

Posted on Tuesday, April 3, 2007 8:41 PM Oracle | Back to top


Comments on this post: How-to: Change Windows Hostname and Keep Oracle 10g Running

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
thanks for give me solution you Release my tention
thanks......................................
Left by dinesh singh on Nov 24, 2007 9:40 AM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
Supreb !!
Left by Mirza on Feb 28, 2008 7:58 AM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
Thank man, this works for 11g too. I am going to write a short article to link this from my blog ;-)
Left by Ming Man on Apr 16, 2008 2:20 PM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
what about SUN SOLARIS ?
can u email me on khalidmehmoodawan@gmail.com
Left by khalid on Sep 28, 2009 6:56 AM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
nice one! basically followed this for open suse and oracle 10g and it worked :-)
Left by simon on Dec 02, 2009 1:21 PM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
When I Reinstalled the Enterprise Manager Console, I ran into a "SEVERE" error. I also noticed that a new Oracle service was installed and set to Automatically start on bootup. "OracleDBConsolesid1" I'm wondering if it is trying to install something, that I actually didn't have configured before the change of the hostname. I wasn't able to follow your instructions to the letter, as I came to this page with my hostname already changed. Could that also explain the problem I encountered?

1-May-2011 14:34:32 oracle.sysman.emcp.EMConfig perform
SEVERE: Error starting Database Control
Refer to the log file at C:\oracle\product\10.2.0\db_1\cfgtoollogs\emca\sid1\emca_2011-05-11_02-20-35-PM.log for more details.
11-May-2011 14:34:33 oracle.sysman.emcp.EMConfig perform
CONFIG: Stack Trace:
oracle.sysman.emcp.exception.EMConfigException: Error starting Database Control
at oracle.sysman.emcp.EMDBPostConfig.performConfiguration(EMDBPostConfig.java:646)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:224)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:193)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:184)
at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:486)
at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1142)
at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:470)
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:419)
Left by JamesA on May 11, 2011 12:45 PM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
When i tried this for the first time - i did not realized what sense the entry in the hosts-file make. In step 7 on reinstalling the Manager Console - Oracle told me that the host is the old machine name - which is definitely false. In my case it worked when entering the new host in the hosts file.

I worked with Oracle 11g under Windows 7x64.
Left by david on May 23, 2011 2:02 AM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
At Step 7, I get a Java exception because emca appears to be expecting the old host name. Should I just ignore this and continue with the reinstall of Enterprise Manager Console?
Left by Matt on Jun 08, 2012 3:48 AM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
Great work yaar thanks a lot....
Left by bhaskar on Apr 08, 2013 10:15 AM

# re: How-to: Change Windows Hostname and Keep Oracle 10g Running
Requesting Gravatar...
I hope this works on systems that are replicated using a cloning software where the original(source) was syspreped as required
Left by Rolando on May 01, 2014 1:24 AM

Your comment:
 (will show your gravatar)


Copyright © svanvliet | Powered by: GeeksWithBlogs.net | Join free