|
36 | 36 | "cell_type": "markdown", |
37 | 37 | "metadata": {}, |
38 | 38 | "source": [ |
39 | | - "### Set Variables Which will be used throughout the rest of this demo" |
| 39 | + "### Set up environment for all next steps. " |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "markdown", |
| 44 | + "metadata": {}, |
| 45 | + "source": [ |
| 46 | + "##### Install the SQLServer package" |
40 | 47 | ] |
41 | 48 | }, |
42 | 49 | { |
|
73 | 80 | "language": "pwsh" |
74 | 81 | } |
75 | 82 | }, |
76 | | - "outputs": [], |
| 83 | + "outputs": [ |
| 84 | + { |
| 85 | + "data": { |
| 86 | + "text/plain": [] |
| 87 | + }, |
| 88 | + "metadata": {}, |
| 89 | + "output_type": "display_data" |
| 90 | + }, |
| 91 | + { |
| 92 | + "name": "stdout", |
| 93 | + "output_type": "stream", |
| 94 | + "text": [ |
| 95 | + "\n", |
| 96 | + "\u001b[32;1mName Value\u001b[0m\n", |
| 97 | + "\u001b[32;1m---- -----\u001b[0m\n", |
| 98 | + "api 1\n", |
| 99 | + "version 6.0.2-p2-13398\n", |
| 100 | + "server 10.8.49.101\n", |
| 101 | + "header {User-Agent, Authorization}\n", |
| 102 | + "id \n", |
| 103 | + "authType Token\n", |
| 104 | + "time 01/13/2022 18:34:50\n", |
| 105 | + "userId 5e8de809-821c-4569-b53b-8bc3aa5b2f2a\n", |
| 106 | + "\n" |
| 107 | + ] |
| 108 | + } |
| 109 | + ], |
77 | 110 | "source": [ |
78 | 111 | "#Connect-Rubrik with an API Token\n", |
79 | 112 | "Connect-Rubrik -Server $Server -Token $Token" |
|
94 | 127 | "language": "pwsh" |
95 | 128 | } |
96 | 129 | }, |
97 | | - "outputs": [], |
| 130 | + "outputs": [ |
| 131 | + { |
| 132 | + "data": { |
| 133 | + "text/plain": [] |
| 134 | + }, |
| 135 | + "metadata": {}, |
| 136 | + "output_type": "display_data" |
| 137 | + }, |
| 138 | + { |
| 139 | + "name": "stdout", |
| 140 | + "output_type": "stream", |
| 141 | + "text": [ |
| 142 | + "\n", |
| 143 | + "\u001b[32;1mid : \u001b[0mMssqlDatabase:::42527305-5e85-4777-8689-955237d3d951\n", |
| 144 | + "\u001b[32;1mname : \u001b[0mAdventureWorks2019\n", |
| 145 | + "\u001b[32;1mconfiguredSlaDomainId : \u001b[0mINHERIT\n", |
| 146 | + "\u001b[32;1mconfiguredSlaDomainName : \u001b[0mInherit\n", |
| 147 | + "\u001b[32;1mconfiguredSlaDomainType : \u001b[0mProtectionSla\n", |
| 148 | + "\u001b[32;1mprimaryClusterId : \u001b[0m39b92c18-d897-4b55-a7f9-17ff178616d0\n", |
| 149 | + "\u001b[32;1misConfiguredSlaDomainRetentionLocked : \u001b[0mFalse\n", |
| 150 | + "\u001b[32;1mslaLastUpdateTime : \u001b[0m08/06/2021 14:05:30\n", |
| 151 | + "\u001b[32;1meffectiveSlaDomainId : \u001b[0m4be3bc1f-6936-432e-86ef-220554df0c35\n", |
| 152 | + "\u001b[32;1meffectiveSlaDomainName : \u001b[0mSQL Server\n", |
| 153 | + "\u001b[32;1misEffectiveSlaDomainRetentionLocked : \u001b[0mFalse\n", |
| 154 | + "\u001b[32;1meffectiveSlaSourceObjectId : \u001b[0mMssqlInstance:::8c66675e-8c84-45b6-a136-73dce79d2372\n", |
| 155 | + "\u001b[32;1meffectiveSlaSourceObjectName : \u001b[0mMSSQLSERVER\n", |
| 156 | + "\u001b[32;1mslaAssignment : \u001b[0mDerived\n", |
| 157 | + "\u001b[32;1mretentionSlaDomainId : \u001b[0m4be3bc1f-6936-432e-86ef-220554df0c35\n", |
| 158 | + "\u001b[32;1mrootProperties : \u001b[0m@{rootType=Host; rootId=Host:::93c5aed0-2140-4c3a-a464-d57b8\n", |
| 159 | + " \u001b[32;1m\u001b[0ma8dcfbb; rootName=rp-sql19s-001.perf.rubrik.com}\n", |
| 160 | + "\u001b[32;1minstanceId : \u001b[0mMssqlInstance:::8c66675e-8c84-45b6-a136-73dce79d2372\n", |
| 161 | + "\u001b[32;1minstanceName : \u001b[0mMSSQLSERVER\n", |
| 162 | + "\u001b[32;1misRelic : \u001b[0mFalse\n", |
| 163 | + "\u001b[32;1mcopyOnly : \u001b[0mFalse\n", |
| 164 | + "\u001b[32;1mlogBackupFrequencyInSeconds : \u001b[0m3600\n", |
| 165 | + "\u001b[32;1mlogBackupRetentionHours : \u001b[0m168\n", |
| 166 | + "\u001b[32;1misLiveMount : \u001b[0mFalse\n", |
| 167 | + "\u001b[32;1misLogShippingSecondary : \u001b[0mFalse\n", |
| 168 | + "\u001b[32;1mrecoveryModel : \u001b[0mFULL\n", |
| 169 | + "\u001b[32;1mstate : \u001b[0mONLINE\n", |
| 170 | + "\u001b[32;1mhasPermissions : \u001b[0mTrue\n", |
| 171 | + "\u001b[32;1misInAvailabilityGroup : \u001b[0mFalse\n", |
| 172 | + "\u001b[32;1mreplicas : \u001b[0m{@{instanceId=MssqlInstance:::8c66675e-8c84-45b6-a136-73dce7\n", |
| 173 | + " \u001b[32;1m\u001b[0m9d2372; instanceName=MSSQLSERVER; recoveryModel=FULL; state=\n", |
| 174 | + " \u001b[32;1m\u001b[0mONLINE; hasPermissions=True; isStandby=False; recoveryForkGu\n", |
| 175 | + " \u001b[32;1m\u001b[0mid=307AC875-147C-4D77-AA65-8DD58C631ED5; isArchived=False; i\n", |
| 176 | + " \u001b[32;1m\u001b[0msDeleted=False; rootProperties=}}\n", |
| 177 | + "\u001b[32;1munprotectableReasons : \u001b[0m{}\n", |
| 178 | + "\u001b[32;1mnumMissedSnapshot : \u001b[0m0\n", |
| 179 | + "\u001b[32;1mlastSnapshotTime : \u001b[0m01/13/2022 08:00:08\n", |
| 180 | + "\u001b[32;1mincludeBackupTaskInfo : \u001b[0mFalse\n", |
| 181 | + "\u001b[32;1misOnline : \u001b[0mTrue\n", |
| 182 | + "\n", |
| 183 | + "\n" |
| 184 | + ] |
| 185 | + } |
| 186 | + ], |
98 | 187 | "source": [ |
99 | 188 | "# Get database information from Rubrik\n", |
100 | 189 | "$RubrikDatabase = Get-RubrikDatabase -Name $SourceDatabaseName -ServerInstance $SourceSQLServerInstance\n", |
|
116 | 205 | "language": "pwsh" |
117 | 206 | } |
118 | 207 | }, |
119 | | - "outputs": [], |
| 208 | + "outputs": [ |
| 209 | + { |
| 210 | + "data": { |
| 211 | + "text/plain": [] |
| 212 | + }, |
| 213 | + "metadata": {}, |
| 214 | + "output_type": "display_data" |
| 215 | + }, |
| 216 | + { |
| 217 | + "name": "stdout", |
| 218 | + "output_type": "stream", |
| 219 | + "text": [ |
| 220 | + "\n", |
| 221 | + "\u001b[32;1mid : \u001b[0mMSSQL_DB_MOUNT_23a5e731-04ef-48ef-9c77-4e8a89db4e9b_4f453e22-eeb9-489a-acaf-d665403fc08\n", |
| 222 | + " \u001b[32;1m\u001b[0md:::0\n", |
| 223 | + "\u001b[32;1mstatus : \u001b[0mSUCCEEDED\n", |
| 224 | + "\u001b[32;1mstartTime : \u001b[0m01/13/2022 23:34:59\n", |
| 225 | + "\u001b[32;1mendTime : \u001b[0m01/13/2022 23:35:43\n", |
| 226 | + "\u001b[32;1mnodeId : \u001b[0mcluster:::RVMHM204S006832\n", |
| 227 | + "\u001b[32;1mlinks : \u001b[0m{@{href=https://10.8.49.101/api/v1/mssql/db/mount/5642b730-80d1-4e42-8ae6-8fc326eb2dc5;\n", |
| 228 | + " \u001b[32;1m\u001b[0m rel=result}, @{href=https://10.8.49.101/api/v1/mssql/request/MSSQL_DB_MOUNT_23a5e731-0\n", |
| 229 | + " \u001b[32;1m\u001b[0m4ef-48ef-9c77-4e8a89db4e9b_4f453e22-eeb9-489a-acaf-d665403fc08d:::0; rel=self}}\n", |
| 230 | + "\n", |
| 231 | + "\n" |
| 232 | + ] |
| 233 | + } |
| 234 | + ], |
120 | 235 | "source": [ |
121 | 236 | "#Mount a database to a SQL Server\n", |
122 | 237 | "$TargetInstance = Get-RubrikSQLInstance -ServerInstance $TargetSQLServerInstance\n", |
|
132 | 247 | "cell_type": "markdown", |
133 | 248 | "metadata": {}, |
134 | 249 | "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. " |
| 250 | + "A Live mount of a database is the equivalent 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. " |
| 251 | + ] |
| 252 | + }, |
| 253 | + { |
| 254 | + "cell_type": "code", |
| 255 | + "execution_count": null, |
| 256 | + "metadata": { |
| 257 | + "dotnet_interactive": { |
| 258 | + "language": "pwsh" |
| 259 | + } |
| 260 | + }, |
| 261 | + "outputs": [ |
| 262 | + { |
| 263 | + "name": "stdout", |
| 264 | + "output_type": "stream", |
| 265 | + "text": [ |
| 266 | + "\n", |
| 267 | + "\u001b[32;1mname state_desc\u001b[0m\n", |
| 268 | + "\u001b[32;1m---- ----------\u001b[0m\n", |
| 269 | + "master ONLINE\n", |
| 270 | + "tempdb ONLINE\n", |
| 271 | + "model ONLINE\n", |
| 272 | + "msdb ONLINE\n", |
| 273 | + "AdventureWorks2019 ONLINE\n", |
| 274 | + "AdventureWorksDW2019 ONLINE\n", |
| 275 | + "AdventureWorksLT2019 ONLINE\n", |
| 276 | + "AdventureWorks2019_LiveMount ONLINE\n", |
| 277 | + "\n" |
| 278 | + ] |
| 279 | + } |
| 280 | + ], |
| 281 | + "source": [ |
| 282 | + "$Query = \"SELECT name, state_desc FROM sys.databases\"\n", |
| 283 | + "Invoke-Sqlcmd -ServerInstance $TargetSQLServerInstance -Query $Query | Format-Table" |
| 284 | + ] |
| 285 | + }, |
| 286 | + { |
| 287 | + "cell_type": "code", |
| 288 | + "execution_count": null, |
| 289 | + "metadata": { |
| 290 | + "dotnet_interactive": { |
| 291 | + "language": "pwsh" |
| 292 | + } |
| 293 | + }, |
| 294 | + "outputs": [ |
| 295 | + { |
| 296 | + "data": { |
| 297 | + "text/plain": [] |
| 298 | + }, |
| 299 | + "metadata": {}, |
| 300 | + "output_type": "display_data" |
| 301 | + } |
| 302 | + ], |
| 303 | + "source": [ |
| 304 | + "#Unmount a database from SQL Server\n", |
| 305 | + "$RubrikDatabaseMount = Get-RubrikDatabaseMount -MountedDatabaseName $MountedDatabaseName -TargetInstanceId $TargetInstance.id\n", |
| 306 | + "$RubrikRequest = Remove-RubrikDatabaseMount -id $RubrikDatabaseMount.id -Confirm:$false" |
136 | 307 | ] |
137 | 308 | } |
138 | 309 | ], |
|
0 commit comments