|
1 | | -# Refresh VMFS VMDK(s) with Snapshot Demo |
2 | | -<!-- wp:separator --> |
3 | | -<hr class="wp-block-separator"/> |
4 | | -<!-- /wp:separator --> |
5 | | - |
6 | | -# Scenario: |
7 | | -This example is for a repeatable refresh scenario, such as a nightly refresh of a production database on |
8 | | -another non-production SQL Server. |
9 | | -<BR><BR> |
10 | | -Production SQL Server & database(s) reside on a VMFS datastore. Non-production SQL Server resides on |
11 | | -a different VMFS datastore. User database(s) data and log files reside on two different VMDK disks |
12 | | -in each datastore. This workflow is intended to only be impact select Windows Disks/VMDKs that contain user |
13 | | -databases. Each datastore also resides on a different FlashArray, to demonstrate use of async snapshot |
14 | | -replication. |
15 | | -<BR><BR> |
16 | | -This example's workflow takes an on-demand snapshot of the Production datastore and async replicates it to |
17 | | -the second FlashArray. Then the snapshot is cloned as a new temporary volume/datastore. The VMDKs with the |
18 | | -production database files, residing on the temporary cloned datastore are attached to the target SQL Server, |
19 | | -replacing the prior VMDKs that stored the database files previously. Finally Storage vMotion is used to |
20 | | -migrate the VMDKs to the non-production datastore, then the temporary cloned datastore is discarded. |
21 | | -<BR><BR> |
22 | | - |
23 | | - |
24 | | -# Disclaimer: |
25 | | -This example script is provided AS-IS and is meant to be a building block to be adapted to fit an individual organization's infrastructure. |
26 | | -<BR><BR> |
27 | | -_PLEASE_ do not save your passwords in cleartext here. |
28 | | -Use NTFS secured, encrypted files or whatever else -- never cleartext! |
29 | | -<BR><BR> |
| 1 | +# VMFS-VMDK Snapshot Scripts for SQL Server |
| 2 | + |
| 3 | +This folder contains scripts for managing SQL Server databases on VMware VMFS datastores using Pure Storage FlashArray snapshots. |
| 4 | + |
| 5 | +**Files:** |
| 6 | +- `VMFS-VMDK Snapshot.ps1` — repeatable database refresh from a FlashArray snapshot across two VMFS datastores |
| 7 | +- `Point in Time Recovery - VMFS.ps1` — SQL Server 2022 T-SQL Snapshot Backup with point-in-time recovery on VMFS/VMDK |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## VMFS-VMDK Snapshot.ps1 |
| 12 | + |
| 13 | +**Scenario:** |
| 14 | + |
| 15 | +This script is for a repeatable refresh scenario, such as a nightly refresh of a production database onto a non-production SQL Server. Production SQL Server databases reside on a VMFS datastore on one FlashArray. The non-production SQL Server resides on a different VMFS datastore on a second FlashArray. |
| 16 | + |
| 17 | +The workflow takes an on-demand snapshot of the production datastore and async replicates it to the second FlashArray. The snapshot is then cloned as a new temporary volume/datastore. The VMDKs containing the production database files are attached to the target SQL Server, replacing the prior VMDKs. Finally, Storage vMotion migrates the VMDKs to the non-production datastore and the temporary cloned datastore is discarded. |
| 18 | + |
| 19 | +**Prerequisites:** |
| 20 | + |
| 21 | +1. PowerShell Modules: `dbatools` & `PureStoragePowerShellSDK2` |
| 22 | +2. VMware PowerCLI must be installed. |
| 23 | +3. Async replication must be configured between the source and target FlashArrays. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Point in Time Recovery - VMFS.ps1 |
| 28 | + |
| 29 | +**Scenario:** |
| 30 | + |
| 31 | +This script performs a point-in-time restore using SQL Server 2022's T-SQL Snapshot Backup feature with a FlashArray snapshot as the base, followed by restoring a native SQL Server log backup. |
| 32 | + |
| 33 | +**Important Note:** |
| 34 | + |
| 35 | +This script is built for a single database spanned across two VMDK files from a single datastore. The granularity of this workflow is a VMDK file and the entirety of its contents — everything in the VMDK, including files for other databases, will be impacted and overwritten. This script will need to be adapted to support multiple databases on the same VMDK(s). |
| 36 | + |
| 37 | +**Prerequisites:** |
| 38 | + |
| 39 | +1. PowerShell Modules: `dbatools` & `PureStoragePowerShellSDK2` |
| 40 | +2. VMware PowerCLI must be installed. |
| 41 | +3. SQL Server 2022 or later is required for T-SQL Snapshot Backup support. |
| 42 | + |
| 43 | +**Usage Notes:** |
| 44 | + |
| 45 | +Each section of the script is meant to be run one after the other. The script is not meant to be executed all at once. |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## Disclaimer |
| 50 | + |
| 51 | +This example script is provided AS-IS and is meant to be a building block to be adapted to fit an individual organization's infrastructure. |
| 52 | + |
30 | 53 | We encourage the modification and expansion of these scripts by the community. Although not necessary, please issue a Pull Request (PR) if you wish to request merging your modified code in to this repository. |
31 | 54 |
|
32 | | -<!-- wp:separator --> |
33 | | -<hr class="wp-block-separator"/> |
34 | | -<!-- /wp:separator --> |
| 55 | +--- |
35 | 56 |
|
36 | 57 | _The contents of the repository are intended as examples only and should be modified to work in your individual environments. No script examples should be used in a production environment without fully testing them in a development or lab environment. There are no expressed or implied warranties or liability for the use of these example scripts and templates presented by Pure Storage and/or their creators._ |
37 | 58 |
|
38 | 59 |
|
39 | 60 |
|
40 | 61 |
|
| 62 | + |
0 commit comments