SlideShare a Scribd company logo
1 of 29
Download to read offline
Restoring SQL Server databases
using Powershell
Johan Bijnens
#ITPROceed
Johan Bijnens
• Who am I ?
– SQLServerCentral.com
– @alzdba
• CERA – KBC Bank (1988 – 1999)
– Assembler / Cobol / APS / SAS / JCL
– VSAM / IMSdb / DB2
• ALZ – Ugine&ALZ – Arcelor – ArcelorMittal -
– PLI / Cobol / VBS / VB.net
– DB2
– SQLServer (7.0 – 2000 – 2005 – 2008 R2 – 2012 - 2014)
– Oracle
/ Powershell
Restoring Databases
using .
• Build plan of approach to structured point
in time restores of databases ( e.g. from
Production to QA ) using Powershell as an
easy helper tool to ensure all steps are
being performed.
Think
Know
Backup
• Backup:
• Minimise data loss in case of disaster
• RPO: Recovery Point Objective = Data loss
• RTO: Recovery Time Objective = Down time
• RSO: Recovery Service Objective = Disaster infrastructure needed
• SQL server database backup :
– Full: Copy of all active pages in your database into a file.
– Differential: Copy of all modified pages since the last Full backup
– Log: Copy of all database transactions since the last Log backup
– Checksum ( Exec sp_configure ‘backup checksum default’,1; Reconfigure )
• What good is a backup if you cannot restore it ?
The Setup
• # SQLServer instances have been set up to support the
different QA environments
• Every instance already has the databases pre-configured,
SQLUser accounts in place, windows domain groups, …
• Segregation of duties:
– different passwords
– Different windows domain groups
• Naming conventions help out to make it all work smooth.
• Keep It Simple & Stupid works !
The Setup
• Dev/QA teams:
– Have databases for which they are responsible
– Request ad-hoc data refresh for a given
database for which they have responsibility.
– point-in-time restore can be requested
– Approval by team leader
SQL Server and Powershell
• SQLPs:
– Powershell integration provided by Microsoft SQL
Server since 2008
– SQL 2012 provides module SQLPs
– SQL 2014 enhanced / extended SQLPs
– SQLAgent integration (job step)
- http://sqlpsx.codeplex.com/
SMO vs Powershell ?
• SQL Server Management Objects (SMO)
– SSMS
– object hierarchy and the relationships
– http://msdn.microsoft.com/en-
us/library/ms162209.aspx
– Namespaces for different areas of
functionality within SMO.
– Still needed in case SQLPs
• doesn’t cover the topic
• cannot handle it
SMO vs Powershell ?
• SMO namespaces:
– http://msdn.microsoft.com/en-us/library/ms162233.aspx
Class Function
Microsoft.SqlServer.Management.Smo Contains instance classes, utility classes, and enumerations
Microsoft.SqlServer.Management.Common Replication Management Objects (RMO) and SMO, such as connection classes.
Microsoft.SqlServer.Management.Smo.Agent SQL Server Agent.
Microsoft.SqlServer.Management.Smo.Wmi WMI Provider.
Microsoft.SqlServer.Management.Smo.RegisteredServers Registered Server. (SSMS)
Microsoft.SqlServer.Management.Smo.Mail Database Mail.
Microsoft.SqlServer.Management.Smo.Broker Service Broker.
SMO vs Powershell ?
• SQLPs:
– 46 Cmdlets that facilitate functionality
– Powershell programmers will be able to recognize parallels
– Discovery / get-help
get-command -module sqlps | sort noun, verb | ft -autosize
get-command -module sqlps |
sort noun, verb | Select Noun, Name| ft -autosize
Noun Name
PolicyEvaluation Invoke-PolicyEvaluation
SqlAlwaysOn Disable-SqlAlwaysOn
Enable-SqlAlwaysOn
SqlAuthenticationMode Set-SqlAuthenticationMode
SqlAvailabilityDatabase Add-SqlAvailabilityDatabase
Remove-SqlAvailabilityDatabase
Resume-SqlAvailabilityDatabase
Suspend-SqlAvailabilityDatabase
SqlAvailabilityGroup Join-SqlAvailabilityGroup
New-SqlAvailabilityGroup
Remove-SqlAvailabilityGroup
Set-SqlAvailabilityGroup
Switch-SqlAvailabilityGroup
Test-SqlAvailabilityGroup
SqlAvailabilityGroupListener New-SqlAvailabilityGroupListener
Set-SqlAvailabilityGroupListener
SqlAvailabilityGroupListenerStaticIp Add-SqlAvailabilityGroupListenerStaticIp
SqlAvailabilityReplica New-SqlAvailabilityReplica
Remove-SqlAvailabilityReplica
Set-SqlAvailabilityReplica
Test-SqlAvailabilityReplica
SqlBackupEncryptionOption New-SqlBackupEncryptionOption
Sqlcmd Invoke-Sqlcmd
Noun Name
SqlCredential Get-SqlCredential
New-SqlCredential
Remove-SqlCredential
Set-SqlCredential
SqlDatabase Backup-SqlDatabase
Get-SqlDatabase
Restore-SqlDatabase
SqlDatabaseReplicaState Test-SqlDatabaseReplicaState
SqlFirewallRule Add-SqlFirewallRule
Remove-SqlFirewallRule
SqlHADREndpoint New-SqlHADREndpoint
Set-SqlHADREndpoint
SqlInstance Get-SqlInstance
Start-SqlInstance
Stop-SqlInstance
SqlName Decode-SqlName
Encode-SqlName
SqlNetworkConfiguration Set-SqlNetworkConfiguration
SqlSmartAdmin Get-SqlSmartAdmin
Set-SqlSmartAdmin
Test-SqlSmartAdmin
UrnToPath Convert-UrnToPath
Basic functions with regards to
recovery
• Get-help Restore-SQLDatabase
• Restore-SqlDatabase -ServerInstance
‘serverinstance’ -Database ‘Db_Restored’
-BackupFile
‘J:MSSQL12.instanceMSSQLBackupDbFull.bak’
• Done! Right ?
Restoring is just a part
• Security
– Sqlusers / passwords
– Domain accounts
– Domain groups
• Integrity
– Detect physical / logical errors ASAP
– Backup corruption
– Restore corruption
Restore: Preparation
• Prevent restores
– Recovery fork
• FirstLSN
• LastLSN
• DatabaseBackupLSN
– If point in time is not available
• Source check
– Instance
– Database
– Backup
• Instance
• Database
• Time frame
• Alternate backup file locations
Restore: Preparation
• Target check
– Instance
– Database
– Disk space
Read Backup file content
• SQLPS 2014: No Get-SQLBackupFileInfo
• Wrap it into a powershell function using …
SMO
Get-SQLBackupFileInfo
function Get-SQLBackupFileInfo {
param ([string[]]$BackupFile,
[string]$SQLServer='servermissing',
[string]$DbName
)
$tmpout = @()
$sqlsvr = New-Object -TypeName Microsoft.SQLServer.Management.Smo.Server($SQLServer)
$restore = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Restore
$devicetype = [Microsoft.SqlServer.Management.Smo.DeviceType]::File
foreach ($file in $BackupFile){
$restoredevice = New-Object -TypeName Microsoft.SQLServer.Management.Smo.BackupDeviceItem($file,$devicetype)
$restore.Devices.add($restoredevice)
$errcnt=0
try{
$Headers = $restore.ReadBackupHeader($sqlsvr) | where-object { $_.DatabaseName -eq $DbName }
$Headers | Select @{n='BackupFileName';e={$file}}, *
}
catch [System.Exception]{
$errcnt = 1
}
finally {
if ($errcnt -ne 1){
$tmpout += $file
}
$errcnt = 0
}
$restore.Devices.remove($restoredevice) | out-null
Remove-Variable restoredevice
}
return
}
Backup fork
$DBBackupInfo.FamilyGUID -eq $LogBackup.FamilyGUID
Loop over LastLSN sequences
$PreviousLogLastLSN = $LogBackup.LastLSN
Check Point-In-Time
foreach ( $BU in $LogBackupInfo ) {
$counter ++
$MaxBackupFinishDate = $("{0:yyyy-MM-dd HH:mm:ss.fff}" -f $BU.BackupFinishDate )
if ( $BU.BackupFinishDate -ge $dtPIT -and $PITFound -eq $false ) {
$MaxBackupFilePointer = $counter
$PITFound = $true
}
else {
write-verbose $('start [{0}] - end [{1}]' -f $("{0:yyyy-MM-dd HH:mm:ss.fff}" -f
$BU.BackupStartDate ), $("{0:yyyy-MM-dd HH:mm:ss.fff}" -f $BU.BackupFinishDate ) )
}
}
if ( $PITFound -eq $false ) {
Write-Error $('Point in Time [{0}] not found in available log backups for database
[{1}] of server [{2}]. Maximum available is [{3}]' -f $PointInTime, $SourceDb,
$SourceServer, $MaxBackupFinishDate )
break
}
PIT
The actual restore
Full Diff Log
Process all collected backup files
• Force target dabase offline
– (Get-SqlDatabase -ServerInstance ‘si' -Name ‘db‘).SetOffline()
• will fail without notification when there are still connections
– $SMOdb.ExecuteNonQuery( $("if exists ( select 1 from sys.databases
where name ='{0}' and state = 0 ) Alter database [{0}] set offline
with rollback immediate ; " -f $TargetDb ) )
• -NoRecovery
• -Checksum
• -RelocateFile $rfl
• -FileNumber $DBBackupInfo.Position
• -ReplaceDatabase
Post restore operations
• Send-MailMessage
• Sp_changedbowner / ALTER AUTHORIZATION
• Resync Logins and SQLUsers
– Naming conventions
– Do not grant missing accounts !
• DBCC CheckDB
Things start coming together
• Put it in a .PS1 file to be used providing
the parameters
Clear-Host
Set-Location $ScriptPath ;
& '.ALZDBA Restore SQL Server database (SQLPS).ps1' -SourceServer ‘S1I1'
-SourceDb 'DB' -TargetServer ‘S2I2' -TargetDb 'DB'-LogRestore
-PointInTimeRestore -PointInTime '2014-05-21 12:00:00'
Thoughts
• Individual execution of restores
• Pipe
• Parallel execution
– Posh Jobs
– Posh Workflows
$DbNames | % { Set-Location $Script:ScriptPath ;
& '.ALZDBA Restore SQL Server database (SQLPS).ps1'
-SourceServer "$SourceServer" -SourceDb "$_"
-TargetServer "$TargetServer" -TargetDb "$_"
-LogRestore -PointInTimeRestore -PointInTime $PointInTime;
}
FF & resources
Session evaluations
Thank you
Thank you
“Education is not to fill a bucket, but lighting a fire."
William Butler Yeats
(Irish prose Writer, Dramatist and Poet. Nobel Prize for Literature in 1923. 1865-1939)
Belgium’s biggest IT PRO Conference

More Related Content

What's hot

Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new featuresAlfredo Krieg
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015Yury Velikanov
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptChien Chung Shen
 
GLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesGLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesBiju Thomas
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQLKyle Hailey
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersKyle Hailey
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTChristian Gohmann
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PGConf APAC
 
Oracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with DockerOracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with DockerGuatemala User Group
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Alex Zaballa
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraSveta Smirnova
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1Chien Chung Shen
 
Sql Server 2008 New Programmability Features
Sql Server 2008 New Programmability FeaturesSql Server 2008 New Programmability Features
Sql Server 2008 New Programmability Featuressqlserver.co.il
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf TuningHighLoad2009
 
Major features postgres 11
Major features postgres 11Major features postgres 11
Major features postgres 11EDB
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)Altinity Ltd
 
監査ログをもっと身近に!〜統合監査のすすめ〜
監査ログをもっと身近に!〜統合監査のすすめ〜監査ログをもっと身近に!〜統合監査のすすめ〜
監査ログをもっと身近に!〜統合監査のすすめ〜Michitoshi Yoshida
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...Alex Zaballa
 

What's hot (19)

Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new features
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning Concept
 
GLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New FeaturesGLOC 2014 NEOOUG - Oracle Database 12c New Features
GLOC 2014 NEOOUG - Oracle Database 12c New Features
 
Intro to ASH
Intro to ASHIntro to ASH
Intro to ASH
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQL
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmasters
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using REST
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
Oracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with DockerOracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with Docker
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with Galera
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
 
Sql Server 2008 New Programmability Features
Sql Server 2008 New Programmability FeaturesSql Server 2008 New Programmability Features
Sql Server 2008 New Programmability Features
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
Major features postgres 11
Major features postgres 11Major features postgres 11
Major features postgres 11
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
 
監査ログをもっと身近に!〜統合監査のすすめ〜
監査ログをもっと身近に!〜統合監査のすすめ〜監査ログをもっと身近に!〜統合監査のすすめ〜
監査ログをもっと身近に!〜統合監査のすすめ〜
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
 

Similar to SQL Track: Restoring databases with powershell

Migrate database to Exadata using RMAN duplicate
Migrate database to Exadata using RMAN duplicateMigrate database to Exadata using RMAN duplicate
Migrate database to Exadata using RMAN duplicateUmair Mansoob
 
Get database properties using power shell in sql server 2008 techrepublic
Get database properties using power shell in sql server 2008   techrepublicGet database properties using power shell in sql server 2008   techrepublic
Get database properties using power shell in sql server 2008 techrepublicKaing Menglieng
 
Desired state-configuration-ravikanth-august-2013-vtc india
Desired state-configuration-ravikanth-august-2013-vtc indiaDesired state-configuration-ravikanth-august-2013-vtc india
Desired state-configuration-ravikanth-august-2013-vtc indiaRavikanth Chaganti
 
Unbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groups
Unbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groupsUnbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groups
Unbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groupsserge luca
 
An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1Navneet Upneja
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansiblesriram_rajan
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features IDenish Patel
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...HostedbyConfluent
 
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groupsUnbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groupsIsabelle Van Campenhoudt
 
07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Development07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Developmentrehaniltifat
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationScott Sutherland
 
Owning time series with team apache Strata San Jose 2015
Owning time series with team apache   Strata San Jose 2015Owning time series with team apache   Strata San Jose 2015
Owning time series with team apache Strata San Jose 2015Patrick McFadin
 
AUSPC 2013 - Business Continuity Management in SharePoint
AUSPC 2013 - Business Continuity Management in SharePointAUSPC 2013 - Business Continuity Management in SharePoint
AUSPC 2013 - Business Continuity Management in SharePointMichael Noel
 
Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013
Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013
Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013Amazon Web Services
 
Oracle Instance Architecture.ppt
Oracle Instance Architecture.pptOracle Instance Architecture.ppt
Oracle Instance Architecture.pptHODCA1
 

Similar to SQL Track: Restoring databases with powershell (20)

Migrate database to Exadata using RMAN duplicate
Migrate database to Exadata using RMAN duplicateMigrate database to Exadata using RMAN duplicate
Migrate database to Exadata using RMAN duplicate
 
Get database properties using power shell in sql server 2008 techrepublic
Get database properties using power shell in sql server 2008   techrepublicGet database properties using power shell in sql server 2008   techrepublic
Get database properties using power shell in sql server 2008 techrepublic
 
Desired state-configuration-ravikanth-august-2013-vtc india
Desired state-configuration-ravikanth-august-2013-vtc indiaDesired state-configuration-ravikanth-august-2013-vtc india
Desired state-configuration-ravikanth-august-2013-vtc india
 
Unbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groups
Unbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groupsUnbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groups
Unbreakable SharePoint 2016 with SQL Server 2016 Always On Availability groups
 
Overview of Oracle database12c for developers
Overview of Oracle database12c for developersOverview of Oracle database12c for developers
Overview of Oracle database12c for developers
 
An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features I
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
 
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groupsUnbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groups
 
07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Development07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Development
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
SQL Server 2014 Backup to Azure - SQL Saturday CR 2015
SQL Server 2014 Backup to Azure - SQL Saturday CR 2015SQL Server 2014 Backup to Azure - SQL Saturday CR 2015
SQL Server 2014 Backup to Azure - SQL Saturday CR 2015
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
 
Owning time series with team apache Strata San Jose 2015
Owning time series with team apache   Strata San Jose 2015Owning time series with team apache   Strata San Jose 2015
Owning time series with team apache Strata San Jose 2015
 
Copy Data Management for the DBA
Copy Data Management for the DBACopy Data Management for the DBA
Copy Data Management for the DBA
 
Convert single instance to RAC
Convert single instance to RACConvert single instance to RAC
Convert single instance to RAC
 
AUSPC 2013 - Business Continuity Management in SharePoint
AUSPC 2013 - Business Continuity Management in SharePointAUSPC 2013 - Business Continuity Management in SharePoint
AUSPC 2013 - Business Continuity Management in SharePoint
 
Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013
Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013
Advanced Data Migration Techniques for Amazon RDS (DAT308) | AWS re:Invent 2013
 
Oracle Instance Architecture.ppt
Oracle Instance Architecture.pptOracle Instance Architecture.ppt
Oracle Instance Architecture.ppt
 

More from ITProceed

ITPROCEED_WorkplaceMobility_Windows 10 in the enterprise
ITPROCEED_WorkplaceMobility_Windows 10 in the enterpriseITPROCEED_WorkplaceMobility_Windows 10 in the enterprise
ITPROCEED_WorkplaceMobility_Windows 10 in the enterpriseITProceed
 
ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...
ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...
ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...ITProceed
 
The Internet of your things by Jan Tielens
The Internet of your things by Jan  TielensThe Internet of your things by Jan  Tielens
The Internet of your things by Jan TielensITProceed
 
Optimal Azure Database Development by Karel Coenye
 Optimal Azure Database Development by Karel Coenye Optimal Azure Database Development by Karel Coenye
Optimal Azure Database Development by Karel CoenyeITProceed
 
Azure SQL DB V12 at your service by Pieter Vanhove
Azure SQL DB V12 at your service by Pieter VanhoveAzure SQL DB V12 at your service by Pieter Vanhove
Azure SQL DB V12 at your service by Pieter VanhoveITProceed
 
Azure stream analytics by Nico Jacobs
Azure stream analytics by Nico JacobsAzure stream analytics by Nico Jacobs
Azure stream analytics by Nico JacobsITProceed
 
ITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteApp
ITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteAppITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteApp
ITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteAppITProceed
 
ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...
ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...
ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...ITProceed
 
ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...
ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...
ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...ITProceed
 
ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...
ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...
ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...ITProceed
 
ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...
ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...
ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...ITProceed
 
Office Track: Information Protection and Control in Exchange Online/On Premis...
Office Track: Information Protection and Control in Exchange Online/On Premis...Office Track: Information Protection and Control in Exchange Online/On Premis...
Office Track: Information Protection and Control in Exchange Online/On Premis...ITProceed
 
Office Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van HorenbeeckOffice Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van HorenbeeckITProceed
 
Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...
Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...
Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...ITProceed
 
Office Track: Lync & Skype Federation v2 Deep Dive - Johan Delimon
Office Track: Lync & Skype Federation v2 Deep Dive - Johan DelimonOffice Track: Lync & Skype Federation v2 Deep Dive - Johan Delimon
Office Track: Lync & Skype Federation v2 Deep Dive - Johan DelimonITProceed
 
Office Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim Borgers
Office Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim BorgersOffice Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim Borgers
Office Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim BorgersITProceed
 
Office Track: SharePoint Apps for the IT Pro - Thomas Vochten
Office Track: SharePoint Apps for the IT Pro - Thomas VochtenOffice Track: SharePoint Apps for the IT Pro - Thomas Vochten
Office Track: SharePoint Apps for the IT Pro - Thomas VochtenITProceed
 
SQL Track: Get more out of your data visualizations
SQL Track: Get more out of your data visualizationsSQL Track: Get more out of your data visualizations
SQL Track: Get more out of your data visualizationsITProceed
 
SQL Track: SQL Server unleashed meet SQL Server's extreme sides
SQL Track: SQL Server unleashed meet SQL Server's extreme sidesSQL Track: SQL Server unleashed meet SQL Server's extreme sides
SQL Track: SQL Server unleashed meet SQL Server's extreme sidesITProceed
 
SQL Track: In Memory OLTP in SQL Server
SQL Track: In Memory OLTP in SQL ServerSQL Track: In Memory OLTP in SQL Server
SQL Track: In Memory OLTP in SQL ServerITProceed
 

More from ITProceed (20)

ITPROCEED_WorkplaceMobility_Windows 10 in the enterprise
ITPROCEED_WorkplaceMobility_Windows 10 in the enterpriseITPROCEED_WorkplaceMobility_Windows 10 in the enterprise
ITPROCEED_WorkplaceMobility_Windows 10 in the enterprise
 
ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...
ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...
ITPROCEED_TransformTheDatacenter_ten most common mistakes when deploying adfs...
 
The Internet of your things by Jan Tielens
The Internet of your things by Jan  TielensThe Internet of your things by Jan  Tielens
The Internet of your things by Jan Tielens
 
Optimal Azure Database Development by Karel Coenye
 Optimal Azure Database Development by Karel Coenye Optimal Azure Database Development by Karel Coenye
Optimal Azure Database Development by Karel Coenye
 
Azure SQL DB V12 at your service by Pieter Vanhove
Azure SQL DB V12 at your service by Pieter VanhoveAzure SQL DB V12 at your service by Pieter Vanhove
Azure SQL DB V12 at your service by Pieter Vanhove
 
Azure stream analytics by Nico Jacobs
Azure stream analytics by Nico JacobsAzure stream analytics by Nico Jacobs
Azure stream analytics by Nico Jacobs
 
ITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteApp
ITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteAppITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteApp
ITPROCEED_WorkplaceMobility_Delivering applications with Azure RemoteApp
 
ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...
ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...
ITPROCEED_TransformTheDatacenter_Automate yourself service management like a ...
 
ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...
ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...
ITPROCEED_WorkplaceMobility_Creating a seamless experience with ue v and wind...
 
ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...
ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...
ITPROCEED_WorkplaceMobility_Delivering traditional File Server Workloads in a...
 
ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...
ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...
ITPROCEED2015_WorkplaceMobility_Configuration Manager 2012’s latest Service P...
 
Office Track: Information Protection and Control in Exchange Online/On Premis...
Office Track: Information Protection and Control in Exchange Online/On Premis...Office Track: Information Protection and Control in Exchange Online/On Premis...
Office Track: Information Protection and Control in Exchange Online/On Premis...
 
Office Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van HorenbeeckOffice Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van Horenbeeck
 
Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...
Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...
Office Track: SharePoint Online Migration - Asses, Prepare, Migrate & Support...
 
Office Track: Lync & Skype Federation v2 Deep Dive - Johan Delimon
Office Track: Lync & Skype Federation v2 Deep Dive - Johan DelimonOffice Track: Lync & Skype Federation v2 Deep Dive - Johan Delimon
Office Track: Lync & Skype Federation v2 Deep Dive - Johan Delimon
 
Office Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim Borgers
Office Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim BorgersOffice Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim Borgers
Office Track: Lync in a VDI Infrastructure - Ruben Nauwelaers & Wim Borgers
 
Office Track: SharePoint Apps for the IT Pro - Thomas Vochten
Office Track: SharePoint Apps for the IT Pro - Thomas VochtenOffice Track: SharePoint Apps for the IT Pro - Thomas Vochten
Office Track: SharePoint Apps for the IT Pro - Thomas Vochten
 
SQL Track: Get more out of your data visualizations
SQL Track: Get more out of your data visualizationsSQL Track: Get more out of your data visualizations
SQL Track: Get more out of your data visualizations
 
SQL Track: SQL Server unleashed meet SQL Server's extreme sides
SQL Track: SQL Server unleashed meet SQL Server's extreme sidesSQL Track: SQL Server unleashed meet SQL Server's extreme sides
SQL Track: SQL Server unleashed meet SQL Server's extreme sides
 
SQL Track: In Memory OLTP in SQL Server
SQL Track: In Memory OLTP in SQL ServerSQL Track: In Memory OLTP in SQL Server
SQL Track: In Memory OLTP in SQL Server
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

SQL Track: Restoring databases with powershell

  • 1. Restoring SQL Server databases using Powershell Johan Bijnens #ITPROceed
  • 2. Johan Bijnens • Who am I ? – SQLServerCentral.com – @alzdba • CERA – KBC Bank (1988 – 1999) – Assembler / Cobol / APS / SAS / JCL – VSAM / IMSdb / DB2 • ALZ – Ugine&ALZ – Arcelor – ArcelorMittal - – PLI / Cobol / VBS / VB.net – DB2 – SQLServer (7.0 – 2000 – 2005 – 2008 R2 – 2012 - 2014) – Oracle / Powershell
  • 3. Restoring Databases using . • Build plan of approach to structured point in time restores of databases ( e.g. from Production to QA ) using Powershell as an easy helper tool to ensure all steps are being performed. Think Know
  • 4. Backup • Backup: • Minimise data loss in case of disaster • RPO: Recovery Point Objective = Data loss • RTO: Recovery Time Objective = Down time • RSO: Recovery Service Objective = Disaster infrastructure needed • SQL server database backup : – Full: Copy of all active pages in your database into a file. – Differential: Copy of all modified pages since the last Full backup – Log: Copy of all database transactions since the last Log backup – Checksum ( Exec sp_configure ‘backup checksum default’,1; Reconfigure ) • What good is a backup if you cannot restore it ?
  • 5. The Setup • # SQLServer instances have been set up to support the different QA environments • Every instance already has the databases pre-configured, SQLUser accounts in place, windows domain groups, … • Segregation of duties: – different passwords – Different windows domain groups • Naming conventions help out to make it all work smooth. • Keep It Simple & Stupid works !
  • 6. The Setup • Dev/QA teams: – Have databases for which they are responsible – Request ad-hoc data refresh for a given database for which they have responsibility. – point-in-time restore can be requested – Approval by team leader
  • 7. SQL Server and Powershell • SQLPs: – Powershell integration provided by Microsoft SQL Server since 2008 – SQL 2012 provides module SQLPs – SQL 2014 enhanced / extended SQLPs – SQLAgent integration (job step) - http://sqlpsx.codeplex.com/
  • 8. SMO vs Powershell ? • SQL Server Management Objects (SMO) – SSMS – object hierarchy and the relationships – http://msdn.microsoft.com/en- us/library/ms162209.aspx – Namespaces for different areas of functionality within SMO. – Still needed in case SQLPs • doesn’t cover the topic • cannot handle it
  • 9. SMO vs Powershell ? • SMO namespaces: – http://msdn.microsoft.com/en-us/library/ms162233.aspx Class Function Microsoft.SqlServer.Management.Smo Contains instance classes, utility classes, and enumerations Microsoft.SqlServer.Management.Common Replication Management Objects (RMO) and SMO, such as connection classes. Microsoft.SqlServer.Management.Smo.Agent SQL Server Agent. Microsoft.SqlServer.Management.Smo.Wmi WMI Provider. Microsoft.SqlServer.Management.Smo.RegisteredServers Registered Server. (SSMS) Microsoft.SqlServer.Management.Smo.Mail Database Mail. Microsoft.SqlServer.Management.Smo.Broker Service Broker.
  • 10. SMO vs Powershell ? • SQLPs: – 46 Cmdlets that facilitate functionality – Powershell programmers will be able to recognize parallels – Discovery / get-help get-command -module sqlps | sort noun, verb | ft -autosize
  • 11. get-command -module sqlps | sort noun, verb | Select Noun, Name| ft -autosize Noun Name PolicyEvaluation Invoke-PolicyEvaluation SqlAlwaysOn Disable-SqlAlwaysOn Enable-SqlAlwaysOn SqlAuthenticationMode Set-SqlAuthenticationMode SqlAvailabilityDatabase Add-SqlAvailabilityDatabase Remove-SqlAvailabilityDatabase Resume-SqlAvailabilityDatabase Suspend-SqlAvailabilityDatabase SqlAvailabilityGroup Join-SqlAvailabilityGroup New-SqlAvailabilityGroup Remove-SqlAvailabilityGroup Set-SqlAvailabilityGroup Switch-SqlAvailabilityGroup Test-SqlAvailabilityGroup SqlAvailabilityGroupListener New-SqlAvailabilityGroupListener Set-SqlAvailabilityGroupListener SqlAvailabilityGroupListenerStaticIp Add-SqlAvailabilityGroupListenerStaticIp SqlAvailabilityReplica New-SqlAvailabilityReplica Remove-SqlAvailabilityReplica Set-SqlAvailabilityReplica Test-SqlAvailabilityReplica SqlBackupEncryptionOption New-SqlBackupEncryptionOption Sqlcmd Invoke-Sqlcmd Noun Name SqlCredential Get-SqlCredential New-SqlCredential Remove-SqlCredential Set-SqlCredential SqlDatabase Backup-SqlDatabase Get-SqlDatabase Restore-SqlDatabase SqlDatabaseReplicaState Test-SqlDatabaseReplicaState SqlFirewallRule Add-SqlFirewallRule Remove-SqlFirewallRule SqlHADREndpoint New-SqlHADREndpoint Set-SqlHADREndpoint SqlInstance Get-SqlInstance Start-SqlInstance Stop-SqlInstance SqlName Decode-SqlName Encode-SqlName SqlNetworkConfiguration Set-SqlNetworkConfiguration SqlSmartAdmin Get-SqlSmartAdmin Set-SqlSmartAdmin Test-SqlSmartAdmin UrnToPath Convert-UrnToPath
  • 12. Basic functions with regards to recovery • Get-help Restore-SQLDatabase • Restore-SqlDatabase -ServerInstance ‘serverinstance’ -Database ‘Db_Restored’ -BackupFile ‘J:MSSQL12.instanceMSSQLBackupDbFull.bak’ • Done! Right ?
  • 13. Restoring is just a part • Security – Sqlusers / passwords – Domain accounts – Domain groups • Integrity – Detect physical / logical errors ASAP – Backup corruption – Restore corruption
  • 14. Restore: Preparation • Prevent restores – Recovery fork • FirstLSN • LastLSN • DatabaseBackupLSN – If point in time is not available • Source check – Instance – Database – Backup • Instance • Database • Time frame • Alternate backup file locations
  • 15. Restore: Preparation • Target check – Instance – Database – Disk space
  • 16. Read Backup file content • SQLPS 2014: No Get-SQLBackupFileInfo • Wrap it into a powershell function using … SMO
  • 17. Get-SQLBackupFileInfo function Get-SQLBackupFileInfo { param ([string[]]$BackupFile, [string]$SQLServer='servermissing', [string]$DbName ) $tmpout = @() $sqlsvr = New-Object -TypeName Microsoft.SQLServer.Management.Smo.Server($SQLServer) $restore = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Restore $devicetype = [Microsoft.SqlServer.Management.Smo.DeviceType]::File foreach ($file in $BackupFile){ $restoredevice = New-Object -TypeName Microsoft.SQLServer.Management.Smo.BackupDeviceItem($file,$devicetype) $restore.Devices.add($restoredevice) $errcnt=0 try{ $Headers = $restore.ReadBackupHeader($sqlsvr) | where-object { $_.DatabaseName -eq $DbName } $Headers | Select @{n='BackupFileName';e={$file}}, * } catch [System.Exception]{ $errcnt = 1 } finally { if ($errcnt -ne 1){ $tmpout += $file } $errcnt = 0 } $restore.Devices.remove($restoredevice) | out-null Remove-Variable restoredevice } return }
  • 18. Backup fork $DBBackupInfo.FamilyGUID -eq $LogBackup.FamilyGUID Loop over LastLSN sequences $PreviousLogLastLSN = $LogBackup.LastLSN
  • 19. Check Point-In-Time foreach ( $BU in $LogBackupInfo ) { $counter ++ $MaxBackupFinishDate = $("{0:yyyy-MM-dd HH:mm:ss.fff}" -f $BU.BackupFinishDate ) if ( $BU.BackupFinishDate -ge $dtPIT -and $PITFound -eq $false ) { $MaxBackupFilePointer = $counter $PITFound = $true } else { write-verbose $('start [{0}] - end [{1}]' -f $("{0:yyyy-MM-dd HH:mm:ss.fff}" -f $BU.BackupStartDate ), $("{0:yyyy-MM-dd HH:mm:ss.fff}" -f $BU.BackupFinishDate ) ) } } if ( $PITFound -eq $false ) { Write-Error $('Point in Time [{0}] not found in available log backups for database [{1}] of server [{2}]. Maximum available is [{3}]' -f $PointInTime, $SourceDb, $SourceServer, $MaxBackupFinishDate ) break } PIT
  • 21. Process all collected backup files • Force target dabase offline – (Get-SqlDatabase -ServerInstance ‘si' -Name ‘db‘).SetOffline() • will fail without notification when there are still connections – $SMOdb.ExecuteNonQuery( $("if exists ( select 1 from sys.databases where name ='{0}' and state = 0 ) Alter database [{0}] set offline with rollback immediate ; " -f $TargetDb ) ) • -NoRecovery • -Checksum • -RelocateFile $rfl • -FileNumber $DBBackupInfo.Position • -ReplaceDatabase
  • 22. Post restore operations • Send-MailMessage • Sp_changedbowner / ALTER AUTHORIZATION • Resync Logins and SQLUsers – Naming conventions – Do not grant missing accounts ! • DBCC CheckDB
  • 23. Things start coming together • Put it in a .PS1 file to be used providing the parameters Clear-Host Set-Location $ScriptPath ; & '.ALZDBA Restore SQL Server database (SQLPS).ps1' -SourceServer ‘S1I1' -SourceDb 'DB' -TargetServer ‘S2I2' -TargetDb 'DB'-LogRestore -PointInTimeRestore -PointInTime '2014-05-21 12:00:00'
  • 24. Thoughts • Individual execution of restores • Pipe • Parallel execution – Posh Jobs – Posh Workflows $DbNames | % { Set-Location $Script:ScriptPath ; & '.ALZDBA Restore SQL Server database (SQLPS).ps1' -SourceServer "$SourceServer" -SourceDb "$_" -TargetServer "$TargetServer" -TargetDb "$_" -LogRestore -PointInTimeRestore -PointInTime $PointInTime; }
  • 28. Thank you “Education is not to fill a bucket, but lighting a fire." William Butler Yeats (Irish prose Writer, Dramatist and Poet. Nobel Prize for Literature in 1923. 1865-1939)
  • 29. Belgium’s biggest IT PRO Conference