SlideShare a Scribd company logo
1 of 8
SQL SERVER
BACKUP INTERNALS
About Me
Hamid J. Fard
I am SQL Server Data Platform Expert with more than 9 years’ of professional
experience, I am currently Microsoft Certified Master: SQL Server 2008,
Microsoft Certified Solutions Master: Charter-Data Platform, Microsoft Data
Platform MVP and CIW Database Design Specialist. After a few years of being a
production database administrator I jumped into the role of Data Platform
Expert. Being a consultant allows me to work directly with customers to help
solve questions regarding database issues for SQL Server.
How SQL Server BackupWorks!
1- Checkpoint (Few times)
2- Start Buffering Data (Async I/O)
1- Writing Buffered Data
2- Exchange the Buffers
SQL Server Backup Buffer Exchange
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
ReadThread WriteThread
SQL Server Backup Options
• BufferCount
Specifies the total number of I/O buffers to be used for the backup operation.You can specify any
positive integer; however, large numbers of buffers might cause “out of memory” errors because of
inadequate virtual address space in the Sqlservr.exe process.
• MaxTransferSize
Specifies the largest unit of transfer in bytes to be used between SQL Server and the backup media.
The possible values are multiples of 65536 bytes (64 KB) ranging up to 4194304 bytes (4 MB).
How Many Concurrent BackupWorks!
Controller
Worker #1
Read
Stream
Worker #2
Write
Stream
Worker #3
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
Buffer
DATABASE BACKUPCOMMAND
SQL Server BackupWorkers andTasks
Backup Database Tempdata to disk = 'C:tempbackup1.bak', disk = 'C:tempbackup2.bak',
disk = 'C:tempbackup3.bak',disk = 'C:tempbackup4.bak'
With Init, Format, Buffercount =8 , Maxtransfersize=65536;
Stream Reader Thread
Stream Writer Threads
Controller Thread
What SQL Server Backup is Doing!
WARNING:
This trace flags should be used under the guidance of
Microsoft SQL Server support.They are used in this
post for discussion purposes only and may not be
supported in future versions.
DBCCTRACEON (3004 , 3605 , -1);
DatabaseTempData
Starting up database 'TempData'.
Backup: Media open
Backup: Media ready to backup
Backup: Clearing differential bitmaps
Backup: Bitmaps cleared
BackupDatabase:Checkpoint done
BackupManager::SyncWithLog: SEReplLSN : 0 (0x00000000:00000000:0000)
BackupManager::SyncWithLog: Start LSN : 282000000023200037 (0x0000011a:000000e8:0025)
Backup: Scanning allocation bitmaps
Backup: Done with allocation bitmaps
BackupDatabase:Work estimates done
Backup: Leading metadata section done
Backup:Copying data
Backup: DBReaderCount = 2
…..
BackupDatabase: Database files done
Backup:Copying log
BackupDatabase : Log files done
Backup:Trailing config done
Backup: MBC done
BackupDatabase:Writing history records
Database backed up. Database:TempData, creation date(time): 2015/10/20(20:05:41), pages dumped: 1553, first LSN: …
Writing backup history records
BACKUP DATABASE successfully processed 338 pages in 0.087 seconds (30.267 MB/sec).
BackupDatabase: Finished

More Related Content

What's hot

Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic Concepts
James Bayer
 

What's hot (20)

WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
 
Understanding oracle rac internals part 1 - slides
Understanding oracle rac internals   part 1 - slidesUnderstanding oracle rac internals   part 1 - slides
Understanding oracle rac internals part 1 - slides
 
Oracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLON
 
Standard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & HowStandard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & How
 
Oracle E-Business Suite on Kubernetes Cluster
Oracle E-Business Suite on Kubernetes ClusterOracle E-Business Suite on Kubernetes Cluster
Oracle E-Business Suite on Kubernetes Cluster
 
AIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RACAIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RAC
 
Oracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningOracle GoldenGate Performance Tuning
Oracle GoldenGate Performance Tuning
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
Introduction to LDAP and Directory Services
Introduction to LDAP and Directory ServicesIntroduction to LDAP and Directory Services
Introduction to LDAP and Directory Services
 
Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive
 
Automating Your Clone in E-Business Suite R12.2
Automating Your Clone in E-Business Suite R12.2Automating Your Clone in E-Business Suite R12.2
Automating Your Clone in E-Business Suite R12.2
 
Secure your app with keycloak
Secure your app with keycloakSecure your app with keycloak
Secure your app with keycloak
 
Workshop on CIFS / SMB Protocol Performance Analysis
Workshop on CIFS / SMB Protocol Performance AnalysisWorkshop on CIFS / SMB Protocol Performance Analysis
Workshop on CIFS / SMB Protocol Performance Analysis
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuning
 
Introduction to failover clustering with sql server
Introduction to failover clustering with sql serverIntroduction to failover clustering with sql server
Introduction to failover clustering with sql server
 
Oracle Exadata Maintenance tasks 101 - OTN Tour 2015
Oracle Exadata Maintenance tasks 101 - OTN Tour 2015Oracle Exadata Maintenance tasks 101 - OTN Tour 2015
Oracle Exadata Maintenance tasks 101 - OTN Tour 2015
 
Oracle data guard for beginners
Oracle data guard for beginnersOracle data guard for beginners
Oracle data guard for beginners
 
Ebs clone r12.2.4
Ebs clone r12.2.4Ebs clone r12.2.4
Ebs clone r12.2.4
 
OpenStack VDI and DaaS with Leostream and the Teradici Pervasive Cloud Comput...
OpenStack VDI and DaaS with Leostream and the Teradici Pervasive Cloud Comput...OpenStack VDI and DaaS with Leostream and the Teradici Pervasive Cloud Comput...
OpenStack VDI and DaaS with Leostream and the Teradici Pervasive Cloud Comput...
 
Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic Concepts
 

Viewers also liked

Disaster recovery with sql server
Disaster recovery with sql serverDisaster recovery with sql server
Disaster recovery with sql server
Rajib Kundu
 
Disaster recovery in sql server
Disaster recovery in  sql serverDisaster recovery in  sql server
Disaster recovery in sql server
Rajib Kundu
 

Viewers also liked (20)

Tutorial backup sql server
Tutorial backup sql serverTutorial backup sql server
Tutorial backup sql server
 
How to Restore SQL Server Database
How to Restore SQL Server DatabaseHow to Restore SQL Server Database
How to Restore SQL Server Database
 
SQL Server Backup and Restore
SQL Server Backup and RestoreSQL Server Backup and Restore
SQL Server Backup and Restore
 
SQL Server Backup and Recovery Challenges
SQL Server Backup and Recovery ChallengesSQL Server Backup and Recovery Challenges
SQL Server Backup and Recovery Challenges
 
Fard Solutions Sdn Bhd
Fard Solutions Sdn Bhd Fard Solutions Sdn Bhd
Fard Solutions Sdn Bhd
 
Evaluating Daily Checklist Against 1000 Servers using Policy Based Management
Evaluating Daily Checklist Against 1000 Servers using Policy Based ManagementEvaluating Daily Checklist Against 1000 Servers using Policy Based Management
Evaluating Daily Checklist Against 1000 Servers using Policy Based Management
 
Lecture 5. MS SQL. Transactions
Lecture 5. MS SQL. TransactionsLecture 5. MS SQL. Transactions
Lecture 5. MS SQL. Transactions
 
Backup And Recovery Planning
Backup And Recovery PlanningBackup And Recovery Planning
Backup And Recovery Planning
 
SQL Server Database Backup and Restore Plan
SQL Server Database Backup and Restore PlanSQL Server Database Backup and Restore Plan
SQL Server Database Backup and Restore Plan
 
Database backup & recovery
Database backup & recoveryDatabase backup & recovery
Database backup & recovery
 
Optimizing your backup
Optimizing your backupOptimizing your backup
Optimizing your backup
 
Common SQL Server Backup Problems
Common SQL Server Backup ProblemsCommon SQL Server Backup Problems
Common SQL Server Backup Problems
 
Disaster recovery solution for VMware vCenter, vHost and VMs
Disaster recovery solution for VMware vCenter, vHost and VMsDisaster recovery solution for VMware vCenter, vHost and VMs
Disaster recovery solution for VMware vCenter, vHost and VMs
 
Presentazione rockwell automation
Presentazione rockwell automationPresentazione rockwell automation
Presentazione rockwell automation
 
SQL Server Memory Pressure
SQL Server Memory PressureSQL Server Memory Pressure
SQL Server Memory Pressure
 
Database backup and recovery basics
Database backup and recovery basicsDatabase backup and recovery basics
Database backup and recovery basics
 
Disaster recovery with sql server
Disaster recovery with sql serverDisaster recovery with sql server
Disaster recovery with sql server
 
Disaster recovery in sql server
Disaster recovery in  sql serverDisaster recovery in  sql server
Disaster recovery in sql server
 
MS SQL Server 2014 - In-Memory OLTP
MS SQL Server 2014 - In-Memory OLTPMS SQL Server 2014 - In-Memory OLTP
MS SQL Server 2014 - In-Memory OLTP
 
Presentation citrix desktop virtualization (2)
Presentation   citrix desktop virtualization (2)Presentation   citrix desktop virtualization (2)
Presentation citrix desktop virtualization (2)
 

Similar to Sql server backup internals

IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
Antonios Chatzipavlis
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
Mike Willbanks
 
Sql And Storage Considerations For Share Point Server 2010
Sql And Storage Considerations For Share Point Server 2010Sql And Storage Considerations For Share Point Server 2010
Sql And Storage Considerations For Share Point Server 2010
Mike Watson
 

Similar to Sql server backup internals (20)

SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back endSPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
 
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs Faster
 
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next Frontier
 
Large Scale SQL Considerations for SharePoint Deployments
Large Scale SQL Considerations for SharePoint DeploymentsLarge Scale SQL Considerations for SharePoint Deployments
Large Scale SQL Considerations for SharePoint Deployments
 
Performance Tuning for Pirates!
Performance Tuning for Pirates!Performance Tuning for Pirates!
Performance Tuning for Pirates!
 
Experience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's ViewExperience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's View
 
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
 
SharePoint 2010 Virtualization - Hungarian SharePoint User Group
SharePoint 2010 Virtualization - Hungarian SharePoint User GroupSharePoint 2010 Virtualization - Hungarian SharePoint User Group
SharePoint 2010 Virtualization - Hungarian SharePoint User Group
 
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAGeek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
 
Sql Health in a SharePoint environment
Sql Health in a SharePoint environmentSql Health in a SharePoint environment
Sql Health in a SharePoint environment
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
Sql server 2016 it just runs faster sql bits 2017 edition
Sql server 2016 it just runs faster   sql bits 2017 editionSql server 2016 it just runs faster   sql bits 2017 edition
Sql server 2016 it just runs faster sql bits 2017 edition
 
Sql And Storage Considerations For Share Point Server 2010
Sql And Storage Considerations For Share Point Server 2010Sql And Storage Considerations For Share Point Server 2010
Sql And Storage Considerations For Share Point Server 2010
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
 
Investigate SQL Server Memory Like Sherlock Holmes
Investigate SQL Server Memory Like Sherlock HolmesInvestigate SQL Server Memory Like Sherlock Holmes
Investigate SQL Server Memory Like Sherlock Holmes
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
 
Copy Data Management for the DBA
Copy Data Management for the DBACopy Data Management for the DBA
Copy Data Management for the DBA
 

More from Hamid J. Fard

Data Platform Overview
Data Platform OverviewData Platform Overview
Data Platform Overview
Hamid J. Fard
 
SQL Server 2016 Everything built-in FULL deck
SQL Server 2016 Everything built-in FULL deckSQL Server 2016 Everything built-in FULL deck
SQL Server 2016 Everything built-in FULL deck
Hamid J. Fard
 

More from Hamid J. Fard (9)

SQL Server High Availability Solutions (Pros & Cons)
SQL Server High Availability Solutions (Pros & Cons)SQL Server High Availability Solutions (Pros & Cons)
SQL Server High Availability Solutions (Pros & Cons)
 
SQL Server In-Memory Internals and Performance Tips
SQL Server In-Memory Internals and Performance TipsSQL Server In-Memory Internals and Performance Tips
SQL Server In-Memory Internals and Performance Tips
 
Sql server enterprise edition awareness
Sql server enterprise edition awarenessSql server enterprise edition awareness
Sql server enterprise edition awareness
 
Data Platform Overview
Data Platform OverviewData Platform Overview
Data Platform Overview
 
SQL Server 2016 Everything built-in FULL deck
SQL Server 2016 Everything built-in FULL deckSQL Server 2016 Everything built-in FULL deck
SQL Server 2016 Everything built-in FULL deck
 
SQL Server - Inside Optimizer Engine
SQL Server - Inside Optimizer EngineSQL Server - Inside Optimizer Engine
SQL Server - Inside Optimizer Engine
 
SQL Server Security And Encryption
SQL Server Security And EncryptionSQL Server Security And Encryption
SQL Server Security And Encryption
 
SQL Server Index and Partition Strategy
SQL Server Index and Partition StrategySQL Server Index and Partition Strategy
SQL Server Index and Partition Strategy
 
SQL Saturday #438
SQL Saturday #438SQL Saturday #438
SQL Saturday #438
 

Recently uploaded

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

Sql server backup internals

  • 2. About Me Hamid J. Fard I am SQL Server Data Platform Expert with more than 9 years’ of professional experience, I am currently Microsoft Certified Master: SQL Server 2008, Microsoft Certified Solutions Master: Charter-Data Platform, Microsoft Data Platform MVP and CIW Database Design Specialist. After a few years of being a production database administrator I jumped into the role of Data Platform Expert. Being a consultant allows me to work directly with customers to help solve questions regarding database issues for SQL Server.
  • 3. How SQL Server BackupWorks! 1- Checkpoint (Few times) 2- Start Buffering Data (Async I/O) 1- Writing Buffered Data 2- Exchange the Buffers
  • 4. SQL Server Backup Buffer Exchange Buffer Buffer Buffer Buffer Buffer Buffer Buffer Buffer Buffer Buffer Buffer Buffer Buffer Buffer ReadThread WriteThread
  • 5. SQL Server Backup Options • BufferCount Specifies the total number of I/O buffers to be used for the backup operation.You can specify any positive integer; however, large numbers of buffers might cause “out of memory” errors because of inadequate virtual address space in the Sqlservr.exe process. • MaxTransferSize Specifies the largest unit of transfer in bytes to be used between SQL Server and the backup media. The possible values are multiples of 65536 bytes (64 KB) ranging up to 4194304 bytes (4 MB).
  • 6. How Many Concurrent BackupWorks! Controller Worker #1 Read Stream Worker #2 Write Stream Worker #3 Buffer Buffer Buffer Buffer Buffer Buffer Buffer DATABASE BACKUPCOMMAND
  • 7. SQL Server BackupWorkers andTasks Backup Database Tempdata to disk = 'C:tempbackup1.bak', disk = 'C:tempbackup2.bak', disk = 'C:tempbackup3.bak',disk = 'C:tempbackup4.bak' With Init, Format, Buffercount =8 , Maxtransfersize=65536; Stream Reader Thread Stream Writer Threads Controller Thread
  • 8. What SQL Server Backup is Doing! WARNING: This trace flags should be used under the guidance of Microsoft SQL Server support.They are used in this post for discussion purposes only and may not be supported in future versions. DBCCTRACEON (3004 , 3605 , -1); DatabaseTempData Starting up database 'TempData'. Backup: Media open Backup: Media ready to backup Backup: Clearing differential bitmaps Backup: Bitmaps cleared BackupDatabase:Checkpoint done BackupManager::SyncWithLog: SEReplLSN : 0 (0x00000000:00000000:0000) BackupManager::SyncWithLog: Start LSN : 282000000023200037 (0x0000011a:000000e8:0025) Backup: Scanning allocation bitmaps Backup: Done with allocation bitmaps BackupDatabase:Work estimates done Backup: Leading metadata section done Backup:Copying data Backup: DBReaderCount = 2 ….. BackupDatabase: Database files done Backup:Copying log BackupDatabase : Log files done Backup:Trailing config done Backup: MBC done BackupDatabase:Writing history records Database backed up. Database:TempData, creation date(time): 2015/10/20(20:05:41), pages dumped: 1553, first LSN: … Writing backup history records BACKUP DATABASE successfully processed 338 pages in 0.087 seconds (30.267 MB/sec). BackupDatabase: Finished

Editor's Notes

  1. Once the ‘Backup Database’ command executed, SQL Server automatically does few ‘Checkpoint’ to reduce the recovery time and also it makes sure that at point of command execution there is no dirty pages in the buffer pool. After that SQL Server creates at least three workers as ‘Controller’, ‘Stream Reader’ and ‘Stream Writer’ to read and buffer the data asynchronously into the buffer area (Out of buffer pool) and write the buffers into the backup device. Be aware that ‘Stream Reader’ thread is one per volume and ‘Stream Writer’ thread is one per backup device.
  2. As mentioned before, SQL Server backup process creates buffer for backup purposes. The ‘Stream Reader’ thread loads the data into buffer area asynchronously and the ‘Stream Writer’ thread writes the data into the backup device, once the buffer data been written into the backup device the buffer goes under ‘Stream Reader’ queue to be filled up and later on goes to ‘Stream Writer’ queue to be emptied. The count of buffer are vary and the buffer size can be from 64kb to 4MB. For example, based on the above figure our backup buffer can be either minimum 384KB or maximum 24MB.
  3. To get the buffer count value, you can use the following formula: BufferCount = #ofBackupDevices x 3 + #ofBackupDevices + (2 x #ofVolumeInvolved)
  4. remaining virtual address space must be considered for concurrent backup operations.   For example on a 32 bit system you get into the ‘memory to leave’ discussion but on 64 bit it is not a ‘memory to leave’ discussion, therefore how much you shrink the buffer pool memory to support allocations outside the buffer pool is considered.  The direct memory consumers to consider are: The stream threads (one per output target) are threads so the stacks are allocated by the operating system outside the buffer pool.  (x86 = .5MB, x86 WOW = .75MB, x64 = 2MB, …) The backup buffers are larger than 8K so they are also allocated outside the buffer pool. So to find how many concurrent backup can work together, we need to do some calculation as following:- NumOfTotalWorkers: #ofSchedulers x 255 - 200 NumOfBackupWorkers: 2 + #OfVolumeInvolved + #OfBackupDevices Concurrent Backups = NumOfTotalWorkers / NumOfBackupWorkers For example: NumOfTotalWorkers = 4 x 255 – 200 = 820 NumOfBackupWorkers = 2 + 2 + 4 = 8 Concurrent Backups = 820 / 8 = 102
  5. With use of the following script you can capture the backup internal threads and their last wait type as well. while (1=1) begin Insert Into TasksTB select R.command, T.task_address, T.session_id,T.pending_io_byte_average,T.pending_io_count,T.task_state,W.memory_object_address, W.last_wait_type,W.status,W.state, TH.stack_bytes_committed,TH.status [thread status],sysdatetime() as [timestamp] --into taskstb from sys.dm_os_tasks T Inner Join sys.dm_exec_requests R On R.session_id = T.session_id AND R.command = 'BACKUP DATABASE' Inner Join sys.dm_os_workers W on W.worker_address = T.worker_address Inner Join Sys.dm_os_threads TH on TH.worker_address = W.worker_address End Run the above script in a session and open another session and run the following script once the backup operation is done. SELECT distinct [command],[task_address] ,[session_id] ,[last_wait_type],memory_object_address,timestamp FROM [TempData].[dbo].[TasksTB] where timestamp = '2016-04-16 16:48:52.2217219' order by last_wait_type Make sure that you filter it by one of the timestamp values to see how many threads were running during backup operation.
  6. The following is SQL Server error log output using trace flag 3004 to collect extended information.   Trace flag 3605 is also required to force the output into the error log. I highlighted the normal messages to help show the phase breakdowns better.   Looking at the detailed messages you can see what is doing on.   For example halting the full text crawls happens before you see the starting up database message.  Using the timings and the associated message here you can take a standard restore sequence and determine the areas of performance to focus on.