I have been working with two of my customers on a number of automation tasks which integration with Nimble, VMware and Microsoft. They both had a requirement to complete SQL dumps to disk and have been doing so on the production servers.
This has been a pain for them in the past due to the load and time it takes to complete the SQL Dumps, and the DBAs also like to have SQL dumps as another method for recovery..
I scripted a solution using powershell whic can be used to complete the SQL dumps from a upstream or downstream replica and thought I would share it with the community.
I have attached the scripts and some quick documentation for everyone to look at and give it a try, please feel free to send feedback or RFEs (time permitting on requests of course).
So what does the script do, well its broken up into a number of different modules which you can find under the “ModuleScript” directory. There is a VMConfig.ps1 you will need to complete with your environment variables as well, but it basically does the following:
RestoreVM.ps1 - Used to restore a VM from a clone and invoke a backup script within the VM.
- Connects to all management points such as VMware, Nimble, etc
- Creates Clones from a Volume Collection, you define which snap version you would like to use as well.
- Creates a number of VMware folders to keep things tidy.
- Attaches the Clones to a nominated ESXi host.
- Searches the cloned datastores for .vmx files and adds the VMs to the inventory.
- Disables the frontend network adapters to ensure we don’t get IP conflicts.
- Option to add additional NIC if required.
- Option to add additional HDD via a VMDK on a specified datastore. This is useful as a target for backup jobs and is reused based on the VM Name.
- Powers on the VMs and answers any questions.
- Waits for VM Tools to start successfully.
- Invokes a nominated script to complete a task within the VM.
RemoveClone.ps1 - Used as a post-script to clean up Cloned VM, Datastores and Nimble Volumes.
- Powers off VMs that have been restored.
- Unregisters the VMs.
- Unmounts cloned datastores.
- Deletes cloned volumes on the array.
Please ensure you read the Documentation which is in the package for further instructions. Feedback would be appreciated, I will be updating the document further with a compete howto guide and adding additional capability to all for recovery of directly presented volumes to VMs.