Skip to content

Commit 09347e6

Browse files
author
Chris Lumnah
committed
More changes
1 parent da418f4 commit 09347e6

File tree

1 file changed

+111
-10
lines changed

1 file changed

+111
-10
lines changed

MSSQL/Backup Validation and DBCC CHECKDB using Rubrik Live Mount.ipynb

Lines changed: 111 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,60 @@
1111
"# Backup Validation and DBCC CHECKDB using Rubrik Live Mount"
1212
]
1313
},
14+
{
15+
"cell_type": "markdown",
16+
"metadata": {},
17+
"source": [
18+
"## Backup Validatation of a database using Live Mount\n",
19+
"\n",
20+
"Live mount allows for near instant recovery of a database. If a database restore/export normally takes hours, then live mounting a database will take a few minutes. Live Mount does a full recovery of a database to either the same SQL Server Instance with a different database name or another SQL Server Instance with the same or different database name. The recovery of the database is much faster, because Rubrik does not need to copy the contents of the backup from the Rubrik Cluster back to the SQL Server. All of the recovery work is done on the Rubrik cluster itself. Then the database files are presented to the SQL Server Instance via a secure SMB3 share that is only accessible by the machine the share is mounted to.\n",
21+
"\n",
22+
"Live Mounting a database is great for a lot of different use cases:\n",
23+
"- DBA Backup validation testing\n",
24+
"- Object level recovery\n",
25+
"- Developer testing\n",
26+
"- DevOps Automation\n",
27+
"- Reporting databases\n",
28+
"- Database migration application smoke test validation.\n",
29+
"\n",
30+
"A key parameter is RecoveryDateTime. All dates in Rubrik are stored in UTC format. This parameter is expecting a fully qualified date and time in UTC format. example value is 2018-08-01T02:00:00.000Z. In the example below, we are pulling the latest recovery point that Rubrik knows about.\n",
31+
"\n",
32+
"**This article serves as a way to demonstrate how to use Live Mount for Backup Validation.**"
33+
]
34+
},
35+
{
36+
"cell_type": "markdown",
37+
"metadata": {},
38+
"source": [
39+
"### Set Variables Which will be used throughout the rest of this demo"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"metadata": {
46+
"dotnet_interactive": {
47+
"language": "pwsh"
48+
}
49+
},
50+
"outputs": [],
51+
"source": [
52+
"# Set Variables\n",
53+
"$Server = $Rubrik.Server.cdm02\n",
54+
"$Token = $Rubrik.token.cdm02\n",
55+
"$SourceSQLServerInstance = \"rp-sql19s-001.perf.rubrik.com\"\n",
56+
"$SourceDatabaseName = \"AdventureWorks2019\"\n",
57+
"$TargetSQLServerInstance = \"rp-sql19s-001.perf.rubrik.com\"\n",
58+
"$MountedDatabaseName = \"AdventureWorks2019_LiveMount\""
59+
]
60+
},
61+
{
62+
"cell_type": "markdown",
63+
"metadata": {},
64+
"source": [
65+
"#### Connect to the Rubrik Cluster"
66+
]
67+
},
1468
{
1569
"cell_type": "code",
1670
"execution_count": null,
@@ -21,17 +75,64 @@
2175
},
2276
"outputs": [],
2377
"source": [
24-
"$PROFILE\n",
2578
"#Connect-Rubrik with an API Token\n",
26-
"$Rubrik.Server.cdm02\n",
27-
"# $Server = \"amer1-rbk01.rubrikdemo.com\"\n",
28-
"# $Token = \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI2MTE4MjEyNC0yMGNmLTQwM2EtYWE4Yi00NDYxOWVhZjBmMDIiLCJpc3MiOiI1ZDYyZjBlNy1jNjQ2LTQ5NjMtOGE1Zi1kOTVkMGFiNWZmMGIiLCJqdGkiOiIzYWI0ODY5Ni1mMzU1LTRiYTQtOTNjOC00NTBhZDljNmEyNzgifQ.K1zReV2yTeXu8J6FGEAYvcYoVeURqljMAh_8kEIU1hE\"\n",
29-
"# Connect-Rubrik -Server $Server -Token $Token\n",
30-
"\n",
31-
"# # Get database information from Rubrik\n",
32-
"# $SourceSQLServerInstance = \"am1-sql16-1\"\n",
33-
"# $SourceDatabaseName = \"AdventureWorks2016\"\n",
34-
"# $RubrikDatabase = Get-RubrikDatabase -Name $SourceDatabaseName -ServerInstance $SourceSQLServerInstance"
79+
"Connect-Rubrik -Server $Server -Token $Token"
80+
]
81+
},
82+
{
83+
"cell_type": "markdown",
84+
"metadata": {},
85+
"source": [
86+
"#### Get details about the database from the Rubrik Cluster"
87+
]
88+
},
89+
{
90+
"cell_type": "code",
91+
"execution_count": null,
92+
"metadata": {
93+
"dotnet_interactive": {
94+
"language": "pwsh"
95+
}
96+
},
97+
"outputs": [],
98+
"source": [
99+
"# Get database information from Rubrik\n",
100+
"$RubrikDatabase = Get-RubrikDatabase -Name $SourceDatabaseName -ServerInstance $SourceSQLServerInstance\n",
101+
"$RubrikDatabase | Format-List *"
102+
]
103+
},
104+
{
105+
"cell_type": "markdown",
106+
"metadata": {},
107+
"source": [
108+
"#### Mount the database to a SQL Server"
109+
]
110+
},
111+
{
112+
"cell_type": "code",
113+
"execution_count": null,
114+
"metadata": {
115+
"dotnet_interactive": {
116+
"language": "pwsh"
117+
}
118+
},
119+
"outputs": [],
120+
"source": [
121+
"#Mount a database to a SQL Server\n",
122+
"$TargetInstance = Get-RubrikSQLInstance -ServerInstance $TargetSQLServerInstance\n",
123+
"$RubrikRequest = New-RubrikDatabaseMount -id $RubrikDatabase.id `\n",
124+
"\t-TargetInstanceId $TargetInstance.id `\n",
125+
"\t-MountedDatabaseName $MountedDatabaseName `\n",
126+
"\t-recoveryDateTime (Get-date (Get-RubrikDatabase -id $RubrikDatabase.id).latestRecoveryPoint) `\n",
127+
" -Confirm:$false\n",
128+
"Get-RubrikRequest -id $RubrikRequest.id -Type mssql -WaitForCompletion "
129+
]
130+
},
131+
{
132+
"cell_type": "markdown",
133+
"metadata": {},
134+
"source": [
135+
"A Live mount of a database is the equivolent to doing a T-SQL Restore with your native backups. SQL Server has recovered the snapshot via the SQL Server VSS Writer, and if applicable, rolled the database forward to a point in time chosen by the user. This means we have applied all transactions from the time the snapshot has happened until the point in time chosen. Once a database has been Live Mounted to a SQL Server, the database is ready for any read/write query you would like to run. "
35136
]
36137
}
37138
],

0 commit comments

Comments
 (0)