Archive for August 2014

Cloning SQL Server 2005 in VMware 5.5

double

Understanding Clones

A clone is a copy of an existing virtual machine. The existing virtual machine is called the parent of the clone. When the cloning operation is complete, the clone is a separate virtual machine — though it may share virtual disks with the parent virtual machine.

  • Changes made to a clone do not affect the parent virtual machine. Changes made to the parent virtual machine do not appear in a clone.
  • A clone’s MAC address and UUID are different from those of the parent virtual machine.

Procedure

  • First of all go to the SQL Server you want to clone and check the services. Most people use custom Active Directory Service Accounts for specific SQL Services as shown below

sqlcloning1

  • It is worth taking a screenshot of your services so you know which ones have been set so you can go back easily post cloning and adjust them
  • It is also worth knowing your drive mappings if you have separate drives for SQL DBs and SQL Logs etc although you can get them from the server afterwards. E.g What is held on C, D, E Drives etc
  • Also make sure you know all your passwords as you will need to set these on the original SQL Server and the newly cloned SQL Server afterwards
  • Next you will need to change the start-up mode of all your critical services like SQL server and Application services from “Automatic” to “Manual” start-up
  • If SQL server and its related services are started by local Windows accounts, then I suggest that you change the service account to “Local system” for now.

localsystemaccount

  • Reboot the original SQL Server just to make sure everything is ok
  • Now you can either do a cold clone or a hot clone
  • Go to vCenter and right click on the SQL Server you want to clone and the Clone Virtual Machine Wizard will come up
  • Put in a name and inventory location

sqlcloning2

  • Choose a Host/Cluster to run the SQL Clone on

sqlcloning3

  • Choose a Resource Pool

sqlcloning4

  • Choose a location for your cloned VM. Make sure you have enough space as there are often multiple drives associated with SQL Server for the Database and Logs etc

sqlcloning5

  • On the Guest Customization wizard, it is recommended to choose to customize

sqlcloning6

  • You will obviously have different customizations to go through. E.g NIC Settings etc
  • When you have completed these, click Next and you are ready to complete and start cloning
  • There is an experimental setting highlighted in blue below where you can edit your virtual hardware before proceeding. It depends if you want to change your settings but in any case you can adjust this afterwards at any point as well.

sqlcloning8

  • When the cloning has finished, power on your cloned SQL Server
  • Check the VM name and IP Address/Subnet Mask/Gateway are corrrect
  • Join the VM to the domain if not already through Guest Customisations
  • Check all your disk drives are online and operational
  • IMPORTANT: When I did the cloning and powered the VM on, the Cloned VM had re-arranged the drive mappings. They need to be identical to the VM you cloned from or your SQL Services will not start probably saying
  • Windows could not start the SQL Server (MSSQLSERVER) Service on Local Computer. Error 2. The system cannot find the file specified

sqlservercloning2

  • Go into Services
  • Change your services to the accounts you want, put them on Automatic and Start them
  • Hopefully at this point everything is looking ok
  • Next you will need to log into SQL Management Studio and follow the below link for some further info
  • http://support.microsoft.com/kb/303774
  • If you want to check the name of your cloned SQL Server, run a query and type Select @@SERVERNAME

sqlcloning10

  • To check if you have a mismatch between your SQL Server servername and the computer’s machinename, compare the values from the statements that follow. If the values do not match or if @@SERVERNAME is NULL, you need to rename your SQL Server. For example: The values below match. We don’t have an instance which is why the second column is NULL. This is how it should look after you have renamed the server using the MS Link above

sqlservercloning

  • If everything is looking ok then you will need to restart the SQL Server (MSSSQLSERVER) Service for the change to take effect if it hasn’t already
  • If there are other SQL Services like SSIS, SSRS and SSAS then you may need to restart these also to avoid any issues. We found some issues with SSIS reporting afterwards which was resolved by restarting
  • Finish 🙂