After having performed this operation a number of times I now feel I'm ready to blog on the topic. Thanks goes to all those who have posted on this topic before me.
In this post I refer to the server that you are copying as the 'Source', and the new server as the 'Clone'.
(Also note that I am obviously working in a Windows environment.)
Step 1: Clone the VM
The easiest way to do this with an ESXi host is to shutdown the source server and copy the .vmx and .vmdk files using the 'Browse Datastore' dialog in vSphere Client.
In vSpehere Client, select root node on left, go to 'Configuration' tab, select 'Storage', right-click on Datastore and select 'Browse Datastore…'
- Shutdown the source VM
- Copy the .vmx file and all .vmdk files.
- Create a new folder.
- Paste in the copied files.
- Right-click on the pasted .vmx file and select 'Add to Inventory…'
Step 2: Startup the Clone (but keep the Source server off)
Startup the Clone server and when vSphere Client prompts, select 'I copied it'.
Step 3: Uninstall Enterprise Manager Console
emca -deconfig dbcontrol db -repos drop |
Make sure you run this as a user that is a member of the local group ora_dba.
Step 4: Edit listener.ora
Change occurrences of the old hostname in listener.ora to the intended new hostname. You might like to update tnsnames.ora now too.
Step 5: Disconnect the Clone's network interface
The servers that I have been cloning are joined to a domain, so if your server is not an Active Directory member, you can skip this step.
Disconnecting from the network ensures that the disjoin operation in Windows doesn't delete the Source server's computer account from Active Directory.
In vSphere Client click on 'Edit virtual machine settings' select the network adapter and untick 'Connected'.
Step 6: Rename and Restart
Change the hostname in Windows, but regardless of whether you intend this machine to join a domain, for now choose the 'Workgroup' option.
Step 7: Re-connect Network and Join Domain
If you skipped step 5, then you can skip this step too.
Edit the virtual machine settings and reconnect the network.
Once the network is connected, open the Computer Name dialog in Windows again and this time choose the domain option. Provide your AD credentials to join the server and restart when prompted.
Step 8: Re-install Oracle Enterprise Manager
I've never had any luck re-installing EM using the command line, so my recommendation is to use the Oracle 'Database Configuration Assistant' tool. Note '…Step 1 of 6…' in the dialog title:
If step 3 was successful, you should see Step 3 of 6 in the DBCA tool as follows.
Ensure 'Configure Enterprise Manager' is ticked (it might be already), and proceed to the end of the tool to complete the install.
That's it – you should now a functioning clone server with an updated shortcut in the start menu to Oracle Enterprise Manager.