SlideShare a Scribd company logo
Operational Foundation
for the SQL Server DBA
Peter Shore
About Me
▪ SQL Server Database
Administrator – ThirtyOne Gifts
▪ Intentionally Accidental DBA
▪ Over 25 years IT experience
– Server Engineer
– Desktop Engineer
– Network Infrastructure
– Desk side support
▪ President CBusPASS
▪ Co-Organizer SQL Saturday
Columbus
▪ How to find me
– Twitter: @pshore73
– E-mail: pshore73@outlook.com
Background and Foundation
What is Microsoft SQL Server?
▪ SQL Server is Microsoft’s Relational Database Management System
(RDBMS)
▪ Relational database – digital database based on the relational model
proposed by E.F. Codd in 1970*
▪ SQL is ANSI/ISO standard
▪ Transact SQL (T-SQL) Microsoft Adaptation of the standard
▪ *https://en.wikipedia.org/wiki/Relational_database
▪ https://www.techopedia.com/definition/24559/relational-model-database
A.C.I.D.
▪ Atomicity
– No partial changes, all or nothing
– Any part of transaction fails all parts fail
▪ Consistent
– Only valid data is written to the database
– Transactions violating consistency rules will be entirely rolled back
– Completed transaction takes database from one consistent state to another
▪ Isolation
– Multiple simultaneous transactions do not impact each other
– Transactions will not read intermediate data
– Not ordinal just isolated
▪ Durability
– Committed transactions will not be lost
– Backups and transactions logs facilitate restoration regardless of software or hardware failure
SQL Server System Databases
System database Description
master Database Records all the system-level information for an instance of SQL Server.
msdb Database Is used by SQL Server Agent for scheduling alerts and jobs.
model Database
Is used as the template for all databases created on the instance of SQL
Server. Modifications made to the model database, such as database size,
collation, recovery model, and other database options, are applied to any
databases created afterward.
Resource Database
Is a read-only database that contains system objects that are included
with SQL Server. System objects are physically persisted in the Resource
database, but they logically appear in the sys schema of every database.
tempdb Database Is a workspace for holding temporary objects or intermediate result sets.
SQL Server System Databases
▪ Master
– Instance wide metadata
▪ Login accounts
▪ Endpoints
▪ Linked Servers
▪ System Configuration Settings
▪ Existence of other databases
▪ File location for other databases
– Cannot
▪ Add files or file groups
▪ Change collation
▪ Drop database
https://docs.microsoft.com/en-us/sql/relational-
databases/databases/master-database?view=sql-server-2017
▪ MSDB
– Used by SQL Agent
▪ Jobs schedules
▪ Alerts
▪ Maintains backup history
– Cannot
▪ Change collation
▪ Drop database
▪ Mirror
▪ Remove primary file/filegroup
https://docs.microsoft.com/en-us/sql/relational-
databases/databases/msdb-database?view=sql-server-2017
SQL Server System Databases
▪ Model
▪ Template for all new databases
▪ Used if no additional information is
specified in CREATE
▪ Some settings used forTempDB on
startup
▪ Must exist
– Cannot
▪ Change collation
▪ Drop database
▪ Mirror
▪ Remove primary file/filegroup
https://docs.microsoft.com/en-us/sql/relational-
databases/databases/model-database?view=sql-server-2017
▪ Resource
– Not visible in SQL Server
Management Studio (SSMS)
– Read-Only
– Holds all system objects
– Cannot be backed up via SQL
– Backup can be taken as you would a
file
– Should not be moved
https://docs.microsoft.com/en-us/sql/relational-
databases/databases/resource-database?view=sql-server-2017
SQL Server System Databases
▪ TempDB
– Hold temporary objects that are explicitly created
▪ TempTables
▪ Temp Indexes
▪ Temp stored procs
▪ Temp variables
▪ Tables returned in table valued functions or cursors
– Holds internal system objects
▪ Work tables to store intermediate results for spools, cursors, sorts, and temporary
large object (LOB) storage.
▪ Work files for hash join or hash aggregate operations.
▪ Intermediate sort results for operations such as creating or rebuilding indexes (if
SORT_IN_TEMPDB is specified), or certain GROUP BY, ORDER BY, or UNION queries.
SQL Server System Databases
▪ TempDB
– Hold sVersion Stores
▪ Collection of data pages holding data rows required to support features which use row
versioning
▪ Common version store and on-line index build version store
▪ Version stores contain
– Row versions that are generated by data modification transactions in a database that uses
read-committed using row versioning isolation or snapshot isolation transactions.
– Row versions that are generated by data modification transactions for features, such as: online
index operations, Multiple Active Result Sets (MARS), and AFTER triggers.
https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database?view=sql-server-2017
SQL Server System Databases
▪ TempDB
– Best practices
▪ For every logical processor have one TempDB file up to eight (8)
▪ When logical processor is greater than eight start with eight files
▪ Add files beyond eight if there is contention
▪ Add files in groups of four (4)
▪ Size files equally
▪ Set growth to the same increment
https://support.microsoft.com/en-us/help/2154845/recommendations-to-reduce-allocation-contention-in-sql-server-tempdb-d
Database Files
▪ Data files
– Storage for the data
– Tend to be random access
– Extension MDF or NDF
▪ MDF – Main Data File
▪ NDF – SecoNdary Data File
– MDF is required
– NDF optional
– File Groups
– Zero writing not required
▪ Transaction Log
– ACID compliance
– Sequential Read/Write
– Extension LDF
▪ Log Data File
– Must be zero written on-premises
Pages and Extents
▪ SQL Server data on disk and in RAM is stored in 8KB pages
▪ Pages are managed in extents
– Extents are 8 physically contiguous pages
– Extents are 64KB
– Uniform extents are owned by the same object and only can be used by that
object
– Mixed extents are share by up to 8 objects
https://docs.microsoft.com/en-us/sql/relational-databases/pages-and-extents-architecture-guide?view=sql-server-2017
Operational foundation for the sql server dba
Virtual Log Files
VLF1
FREE
VLF2
FREE
VLF3
FREE
VLF4
FREE
Virtual Log Files
VLF1
ACTIVE
VLF2
FREE
VLF3
FREE
VLF4
FREE
Virtual Log Files
VLF1
ACTIVE
VLF2
FREE
VLF3
FREE
VLF4
FREE
Transaction 1
Virtual Log Files
VLF1
ACTIVE
VLF2
FREE
VLF3
FREE
VLF4
FREE
Transaction 1 Transaction 2
Virtual Log Files
https://social.technet.microsoft.com/wiki/contents/articles/51379.sql-server-transaction-log-internal-architecture-facts-every-sql-server-
database-professional-should-know.aspx
VLF1
ACTIVE
VLF2
FREE
VLF3
FREE
VLF4
FREE
Transaction 1 Transaction 2 Transaction 3
SQL Agent
▪ SQL Server’s task scheduler
▪ Jobs
– Tasks
▪ TSQL
▪ Command line
▪ SSIS
▪ Maintenance plans
– Schedules
▪ Alerts
– Operators
https://docs.microsoft.com/en-us/sql/ssms/agent/sql-server-agent?view=sql-server-2017
Database Mail
▪ Reliable, Scalable, Secure,
Supportable
▪ Send e-mail from within SQL
Server
https://docs.microsoft.com/en-us/sql/relational-
databases/database-mail/database-mail?view=sql-server-2017
Restore Strategy
Why a recovery strategy?
▪ On-line nature of SQL Server
▪ Focus on RecoveryTime and Recovery Point
▪ RecoveryTime Objective (RTO)
– “How long can we be down?”
– Controlled by the business/application owner
▪ Recovery Point Objective (RPO)
– “How much data can we lose?”
▪ Time not size
– Controlled by the business/application owner
Recovery Models
▪ Simple
– No log backups
– No point in time recovery
– Operations which require log backups cannot be used on databases in Simple
▪ Log Shipping
▪ Availability Groups
▪ Database Mirroring
– Only recover to last full/differential backup
– SQL Server manages log truncation
Recovery Models
▪ Bulk logged
– Requires log backups
– Adjunct to full recovery but permits high performance bulk copy operations
– Most bulk operations are minimally logged and use less disk space
https://docs.microsoft.com/en-us/sql/relational-databases/import-export/prerequisites-for-minimal-logging-in-bulk-import?view=sql-
server-2017
Backup Types
▪ Full
– Complete data backup
– Contains enough of the log to allow for recovery of that data
▪ Differential
– Backup of all data changed since the last FULL backup
▪ Log
– Backup of the transaction log
– Includes all records not previously backed up
▪ Copy Only
– Full backup that does not affect log sequence
https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/backup-overview-sql-server?view=sql-server-2017
Backup Types – Keeping Files in Order
▪ Full
– Complete data backup
– Contains enough of the log to allow for recovery of that data
▪ Differential
– Backup of all data changed since the last FULL backup
▪ Log
– Backup of the transaction log
– Includes all records not previously backed up
▪ Copy Only
– Full backup that does not affect log sequence
The How of Backups
▪ Schedule
▪ Maintenance Plans
▪ Roll your own
▪ FreeTools
▪ PaidTools
▪ Who owns backup?
▪ Test Restores
– GivesTiming for restore
– Not done without Integrity Check
Install and Configure
Preparing to install SQL Server
▪ Windows Configuration
– Give SQL Server Engine account permissions
▪ Lock Pages In Memory
▪ PerformVolume Maintenance (Instant File Initialization aka IFI)
– ConfirmTCP Chimney Offload is set to off
▪ Storage Configuration
– Follow vendor documentation for SQL Server
– Allocation Unit Size 64Kb
▪ Service Accounts
– Windows accounts
– Separate for each service & server
▪ VM configuration
– VMware follow document
https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/solutions/sql-server-on-vmware-best-practices-guide.pdf
Beyond Next Next Next
▪ Screenshots
Beyond Next Next Next
▪ Post install configuration
▪ Max Memory
▪ Ad Hoc
▪ MaxDOP
▪ CTP
▪ Alerts
Monitor and Troubleshoot
What to monitor?
▪ CPU
– Overall
– By socket
– By Core
▪ Memory
– Page Life Expectency
– Memory Grants Pending
▪ Disk
– IOPs
– Queue depth
▪ Queries
– Long running
– Blocking
– Deadlocking
– WAITS
▪ Misc.
– Up/Down of server and services
– Job failures
Where to monitor from?
▪ Windows Performance
Counters
– Instance specific
– Grouped by function
– Can be collected
▪ Dynamic ManagementViews
and Dynamic Management
Functions (DMV and DMF)
– Collectively called DMVs
– https://www.sqlskills.com/blogs/gl
enn/category/dmv-queries/
How to monitor?
▪ Build
– Exactly what you want
▪ Details
▪ Reports
– You must maintain
– You must test with new SQL versions
▪ Buy
– Vendor handles the maintaining and version updates
– May or may not give exactly what you want
▪ Hybrid
– Vendor solution primary
– Use DMVs/roll your own process for deeper dive or specific details
Baseline
▪ Shows what normal is
▪ Easy to see anomalies
▪ Easy to see results of changes
▪ Critical for monitoring and tuning
Details on bad things
▪ SQL Server Logs
▪ Windows Event Logs
▪ Extended Events
Operational foundation for the sql server dba
Addressing Performance
ZEN and the Art of SQL
Maintenance
Maintenance
▪ Backups
▪ Integrity Check
– DBCC CHECKDB
– Explain what it does
– Link to Paul’s article
▪ Index

More Related Content

What's hot (20)

PDF
RMAN in 12c: The Next Generation (WP)
Gustavo Rene Antunez
 
PDF
Oracle database 12c introduction- Satyendra Pasalapudi
pasalapudi123
 
PPTX
Oracle 12c Architecture
AmeerpetTrainingOnline
 
PDF
DBA 101 : Calling all New Database Administrators (WP)
Gustavo Rene Antunez
 
PPS
Overview of oracle database
Samar Prasad
 
PDF
Oracle database 12c intro
pasalapudi
 
PPTX
Oracle DBA
shivankuniversity
 
PDF
DBA 101 : Calling all New Database Administrators (PPT)
Gustavo Rene Antunez
 
PDF
Oracle RDBMS architecture
Martin Berger
 
PDF
My First 100 days with a MySQL DBMS (WP)
Gustavo Rene Antunez
 
PDF
Oracle 12c and its pluggable databases
Gustavo Rene Antunez
 
PPTX
An AMIS Overview of Oracle database 12c (12.1)
Marco Gralike
 
PPTX
Oracle 12c
Tank Bhavin
 
PDF
Exploring Oracle Multitenant in Oracle Database 12c
Zohar Elkayam
 
PDF
How DBAs can garner the power of the Oracle Public Cloud?
Gustavo Rene Antunez
 
PDF
SQL Server 2012 - FileTables
Sperasoft
 
PDF
Oracle 12c New Features_RAC_slides
Saiful
 
PDF
Oracle Database 12c Multitenant for Consolidation
Yudi Herdiana
 
PPTX
Oracle 12c - Multitenant Feature
Vigilant Technologies
 
PPTX
SQL Server Reporting Services Disaster Recovery Webinar
Denny Lee
 
RMAN in 12c: The Next Generation (WP)
Gustavo Rene Antunez
 
Oracle database 12c introduction- Satyendra Pasalapudi
pasalapudi123
 
Oracle 12c Architecture
AmeerpetTrainingOnline
 
DBA 101 : Calling all New Database Administrators (WP)
Gustavo Rene Antunez
 
Overview of oracle database
Samar Prasad
 
Oracle database 12c intro
pasalapudi
 
Oracle DBA
shivankuniversity
 
DBA 101 : Calling all New Database Administrators (PPT)
Gustavo Rene Antunez
 
Oracle RDBMS architecture
Martin Berger
 
My First 100 days with a MySQL DBMS (WP)
Gustavo Rene Antunez
 
Oracle 12c and its pluggable databases
Gustavo Rene Antunez
 
An AMIS Overview of Oracle database 12c (12.1)
Marco Gralike
 
Oracle 12c
Tank Bhavin
 
Exploring Oracle Multitenant in Oracle Database 12c
Zohar Elkayam
 
How DBAs can garner the power of the Oracle Public Cloud?
Gustavo Rene Antunez
 
SQL Server 2012 - FileTables
Sperasoft
 
Oracle 12c New Features_RAC_slides
Saiful
 
Oracle Database 12c Multitenant for Consolidation
Yudi Herdiana
 
Oracle 12c - Multitenant Feature
Vigilant Technologies
 
SQL Server Reporting Services Disaster Recovery Webinar
Denny Lee
 

Similar to Operational foundation for the sql server dba (20)

PDF
MS-SQL SERVER ARCHITECTURE
Douglas Bernardini
 
PPTX
Managing SQLserver for the reluctant DBA
Concentrated Technology
 
PPTX
SQL Server 2017 Community Driven Features
Javier Villegas
 
DOC
Sql server-dba
NaviSoft
 
DOCX
Trainmesfottech - Sql Server DBA Training Course Content
Trainmesofttech
 
PPT
Managing SQLserver
Concentrated Technology
 
PPT
Ms sql server architecture
Ajeet Singh
 
PPT
Sql server basics
Dilfaroz Khan
 
PDF
Managing and Configuring Databases
Ram Kedem
 
PPT
SQL Server Basics Hello world iam here.ppt
nanisaketh
 
PDF
2008 2086 Gangler
Secure-24
 
PPT
Implementing the Databese Server session 02
Guillermo Julca
 
PDF
SQL Server 2019 ctp2.2
Gianluca Hotz
 
PPTX
Sql server 2016 it just runs faster sql bits 2017 edition
Bob Ward
 
PDF
SQLServer Database Structures
Antonios Chatzipavlis
 
PPTX
SQL Server 2017 - Mejoras Impulsadas por la Comunidad
Javier Villegas
 
PPTX
SQL Server It Just Runs Faster
Bob Ward
 
PDF
SQL-Server Database.pdf
ShehryarSH1
 
PPTX
Sql Server tips from the field
InnoTech
 
MS-SQL SERVER ARCHITECTURE
Douglas Bernardini
 
Managing SQLserver for the reluctant DBA
Concentrated Technology
 
SQL Server 2017 Community Driven Features
Javier Villegas
 
Sql server-dba
NaviSoft
 
Trainmesfottech - Sql Server DBA Training Course Content
Trainmesofttech
 
Managing SQLserver
Concentrated Technology
 
Ms sql server architecture
Ajeet Singh
 
Sql server basics
Dilfaroz Khan
 
Managing and Configuring Databases
Ram Kedem
 
SQL Server Basics Hello world iam here.ppt
nanisaketh
 
2008 2086 Gangler
Secure-24
 
Implementing the Databese Server session 02
Guillermo Julca
 
SQL Server 2019 ctp2.2
Gianluca Hotz
 
Sql server 2016 it just runs faster sql bits 2017 edition
Bob Ward
 
SQLServer Database Structures
Antonios Chatzipavlis
 
SQL Server 2017 - Mejoras Impulsadas por la Comunidad
Javier Villegas
 
SQL Server It Just Runs Faster
Bob Ward
 
SQL-Server Database.pdf
ShehryarSH1
 
Sql Server tips from the field
InnoTech
 
Ad

Recently uploaded (20)

PDF
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
PPTX
What Is Data Integration and Transformation?
subhashenia
 
PDF
apidays Singapore 2025 - The API Playbook for AI by Shin Wee Chuang (PAND AI)
apidays
 
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
PPT
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
PPTX
04_Tamás Marton_Intuitech .pptx_AI_Barometer_2025
FinTech Belgium
 
PDF
A GraphRAG approach for Energy Efficiency Q&A
Marco Brambilla
 
PPTX
Listify-Intelligent-Voice-to-Catalog-Agent.pptx
nareshkottees
 
PDF
apidays Singapore 2025 - Streaming Lakehouse with Kafka, Flink and Iceberg by...
apidays
 
PDF
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
PDF
apidays Singapore 2025 - Surviving an interconnected world with API governanc...
apidays
 
PPTX
SlideEgg_501298-Agentic AI.pptx agentic ai
530BYManoj
 
PDF
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
PPTX
apidays Helsinki & North 2025 - APIs at Scale: Designing for Alignment, Trust...
apidays
 
PPT
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
PDF
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
PPTX
Feb 2021 Ransomware Recovery presentation.pptx
enginsayin1
 
PPTX
BinarySearchTree in datastructures in detail
kichokuttu
 
PDF
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
PPTX
Powerful Uses of Data Analytics You Should Know
subhashenia
 
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
What Is Data Integration and Transformation?
subhashenia
 
apidays Singapore 2025 - The API Playbook for AI by Shin Wee Chuang (PAND AI)
apidays
 
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
04_Tamás Marton_Intuitech .pptx_AI_Barometer_2025
FinTech Belgium
 
A GraphRAG approach for Energy Efficiency Q&A
Marco Brambilla
 
Listify-Intelligent-Voice-to-Catalog-Agent.pptx
nareshkottees
 
apidays Singapore 2025 - Streaming Lakehouse with Kafka, Flink and Iceberg by...
apidays
 
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
apidays Singapore 2025 - Surviving an interconnected world with API governanc...
apidays
 
SlideEgg_501298-Agentic AI.pptx agentic ai
530BYManoj
 
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
apidays Helsinki & North 2025 - APIs at Scale: Designing for Alignment, Trust...
apidays
 
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
Feb 2021 Ransomware Recovery presentation.pptx
enginsayin1
 
BinarySearchTree in datastructures in detail
kichokuttu
 
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
Powerful Uses of Data Analytics You Should Know
subhashenia
 
Ad

Operational foundation for the sql server dba

  • 1. Operational Foundation for the SQL Server DBA Peter Shore
  • 2. About Me ▪ SQL Server Database Administrator – ThirtyOne Gifts ▪ Intentionally Accidental DBA ▪ Over 25 years IT experience – Server Engineer – Desktop Engineer – Network Infrastructure – Desk side support ▪ President CBusPASS ▪ Co-Organizer SQL Saturday Columbus ▪ How to find me – Twitter: @pshore73 – E-mail: [email protected]
  • 4. What is Microsoft SQL Server? ▪ SQL Server is Microsoft’s Relational Database Management System (RDBMS) ▪ Relational database – digital database based on the relational model proposed by E.F. Codd in 1970* ▪ SQL is ANSI/ISO standard ▪ Transact SQL (T-SQL) Microsoft Adaptation of the standard ▪ *https://en.wikipedia.org/wiki/Relational_database ▪ https://www.techopedia.com/definition/24559/relational-model-database
  • 5. A.C.I.D. ▪ Atomicity – No partial changes, all or nothing – Any part of transaction fails all parts fail ▪ Consistent – Only valid data is written to the database – Transactions violating consistency rules will be entirely rolled back – Completed transaction takes database from one consistent state to another ▪ Isolation – Multiple simultaneous transactions do not impact each other – Transactions will not read intermediate data – Not ordinal just isolated ▪ Durability – Committed transactions will not be lost – Backups and transactions logs facilitate restoration regardless of software or hardware failure
  • 6. SQL Server System Databases System database Description master Database Records all the system-level information for an instance of SQL Server. msdb Database Is used by SQL Server Agent for scheduling alerts and jobs. model Database Is used as the template for all databases created on the instance of SQL Server. Modifications made to the model database, such as database size, collation, recovery model, and other database options, are applied to any databases created afterward. Resource Database Is a read-only database that contains system objects that are included with SQL Server. System objects are physically persisted in the Resource database, but they logically appear in the sys schema of every database. tempdb Database Is a workspace for holding temporary objects or intermediate result sets.
  • 7. SQL Server System Databases ▪ Master – Instance wide metadata ▪ Login accounts ▪ Endpoints ▪ Linked Servers ▪ System Configuration Settings ▪ Existence of other databases ▪ File location for other databases – Cannot ▪ Add files or file groups ▪ Change collation ▪ Drop database https://docs.microsoft.com/en-us/sql/relational- databases/databases/master-database?view=sql-server-2017 ▪ MSDB – Used by SQL Agent ▪ Jobs schedules ▪ Alerts ▪ Maintains backup history – Cannot ▪ Change collation ▪ Drop database ▪ Mirror ▪ Remove primary file/filegroup https://docs.microsoft.com/en-us/sql/relational- databases/databases/msdb-database?view=sql-server-2017
  • 8. SQL Server System Databases ▪ Model ▪ Template for all new databases ▪ Used if no additional information is specified in CREATE ▪ Some settings used forTempDB on startup ▪ Must exist – Cannot ▪ Change collation ▪ Drop database ▪ Mirror ▪ Remove primary file/filegroup https://docs.microsoft.com/en-us/sql/relational- databases/databases/model-database?view=sql-server-2017 ▪ Resource – Not visible in SQL Server Management Studio (SSMS) – Read-Only – Holds all system objects – Cannot be backed up via SQL – Backup can be taken as you would a file – Should not be moved https://docs.microsoft.com/en-us/sql/relational- databases/databases/resource-database?view=sql-server-2017
  • 9. SQL Server System Databases ▪ TempDB – Hold temporary objects that are explicitly created ▪ TempTables ▪ Temp Indexes ▪ Temp stored procs ▪ Temp variables ▪ Tables returned in table valued functions or cursors – Holds internal system objects ▪ Work tables to store intermediate results for spools, cursors, sorts, and temporary large object (LOB) storage. ▪ Work files for hash join or hash aggregate operations. ▪ Intermediate sort results for operations such as creating or rebuilding indexes (if SORT_IN_TEMPDB is specified), or certain GROUP BY, ORDER BY, or UNION queries.
  • 10. SQL Server System Databases ▪ TempDB – Hold sVersion Stores ▪ Collection of data pages holding data rows required to support features which use row versioning ▪ Common version store and on-line index build version store ▪ Version stores contain – Row versions that are generated by data modification transactions in a database that uses read-committed using row versioning isolation or snapshot isolation transactions. – Row versions that are generated by data modification transactions for features, such as: online index operations, Multiple Active Result Sets (MARS), and AFTER triggers. https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database?view=sql-server-2017
  • 11. SQL Server System Databases ▪ TempDB – Best practices ▪ For every logical processor have one TempDB file up to eight (8) ▪ When logical processor is greater than eight start with eight files ▪ Add files beyond eight if there is contention ▪ Add files in groups of four (4) ▪ Size files equally ▪ Set growth to the same increment https://support.microsoft.com/en-us/help/2154845/recommendations-to-reduce-allocation-contention-in-sql-server-tempdb-d
  • 12. Database Files ▪ Data files – Storage for the data – Tend to be random access – Extension MDF or NDF ▪ MDF – Main Data File ▪ NDF – SecoNdary Data File – MDF is required – NDF optional – File Groups – Zero writing not required ▪ Transaction Log – ACID compliance – Sequential Read/Write – Extension LDF ▪ Log Data File – Must be zero written on-premises
  • 13. Pages and Extents ▪ SQL Server data on disk and in RAM is stored in 8KB pages ▪ Pages are managed in extents – Extents are 8 physically contiguous pages – Extents are 64KB – Uniform extents are owned by the same object and only can be used by that object – Mixed extents are share by up to 8 objects https://docs.microsoft.com/en-us/sql/relational-databases/pages-and-extents-architecture-guide?view=sql-server-2017
  • 20. SQL Agent ▪ SQL Server’s task scheduler ▪ Jobs – Tasks ▪ TSQL ▪ Command line ▪ SSIS ▪ Maintenance plans – Schedules ▪ Alerts – Operators https://docs.microsoft.com/en-us/sql/ssms/agent/sql-server-agent?view=sql-server-2017
  • 21. Database Mail ▪ Reliable, Scalable, Secure, Supportable ▪ Send e-mail from within SQL Server https://docs.microsoft.com/en-us/sql/relational- databases/database-mail/database-mail?view=sql-server-2017
  • 23. Why a recovery strategy? ▪ On-line nature of SQL Server ▪ Focus on RecoveryTime and Recovery Point ▪ RecoveryTime Objective (RTO) – “How long can we be down?” – Controlled by the business/application owner ▪ Recovery Point Objective (RPO) – “How much data can we lose?” ▪ Time not size – Controlled by the business/application owner
  • 24. Recovery Models ▪ Simple – No log backups – No point in time recovery – Operations which require log backups cannot be used on databases in Simple ▪ Log Shipping ▪ Availability Groups ▪ Database Mirroring – Only recover to last full/differential backup – SQL Server manages log truncation
  • 25. Recovery Models ▪ Bulk logged – Requires log backups – Adjunct to full recovery but permits high performance bulk copy operations – Most bulk operations are minimally logged and use less disk space https://docs.microsoft.com/en-us/sql/relational-databases/import-export/prerequisites-for-minimal-logging-in-bulk-import?view=sql- server-2017
  • 26. Backup Types ▪ Full – Complete data backup – Contains enough of the log to allow for recovery of that data ▪ Differential – Backup of all data changed since the last FULL backup ▪ Log – Backup of the transaction log – Includes all records not previously backed up ▪ Copy Only – Full backup that does not affect log sequence https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/backup-overview-sql-server?view=sql-server-2017
  • 27. Backup Types – Keeping Files in Order ▪ Full – Complete data backup – Contains enough of the log to allow for recovery of that data ▪ Differential – Backup of all data changed since the last FULL backup ▪ Log – Backup of the transaction log – Includes all records not previously backed up ▪ Copy Only – Full backup that does not affect log sequence
  • 28. The How of Backups ▪ Schedule ▪ Maintenance Plans ▪ Roll your own ▪ FreeTools ▪ PaidTools ▪ Who owns backup? ▪ Test Restores – GivesTiming for restore – Not done without Integrity Check
  • 30. Preparing to install SQL Server ▪ Windows Configuration – Give SQL Server Engine account permissions ▪ Lock Pages In Memory ▪ PerformVolume Maintenance (Instant File Initialization aka IFI) – ConfirmTCP Chimney Offload is set to off ▪ Storage Configuration – Follow vendor documentation for SQL Server – Allocation Unit Size 64Kb ▪ Service Accounts – Windows accounts – Separate for each service & server ▪ VM configuration – VMware follow document https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/solutions/sql-server-on-vmware-best-practices-guide.pdf
  • 31. Beyond Next Next Next ▪ Screenshots
  • 32. Beyond Next Next Next ▪ Post install configuration ▪ Max Memory ▪ Ad Hoc ▪ MaxDOP ▪ CTP ▪ Alerts
  • 34. What to monitor? ▪ CPU – Overall – By socket – By Core ▪ Memory – Page Life Expectency – Memory Grants Pending ▪ Disk – IOPs – Queue depth ▪ Queries – Long running – Blocking – Deadlocking – WAITS ▪ Misc. – Up/Down of server and services – Job failures
  • 35. Where to monitor from? ▪ Windows Performance Counters – Instance specific – Grouped by function – Can be collected ▪ Dynamic ManagementViews and Dynamic Management Functions (DMV and DMF) – Collectively called DMVs – https://www.sqlskills.com/blogs/gl enn/category/dmv-queries/
  • 36. How to monitor? ▪ Build – Exactly what you want ▪ Details ▪ Reports – You must maintain – You must test with new SQL versions ▪ Buy – Vendor handles the maintaining and version updates – May or may not give exactly what you want ▪ Hybrid – Vendor solution primary – Use DMVs/roll your own process for deeper dive or specific details
  • 37. Baseline ▪ Shows what normal is ▪ Easy to see anomalies ▪ Easy to see results of changes ▪ Critical for monitoring and tuning
  • 38. Details on bad things ▪ SQL Server Logs ▪ Windows Event Logs ▪ Extended Events
  • 41. ZEN and the Art of SQL Maintenance
  • 42. Maintenance ▪ Backups ▪ Integrity Check – DBCC CHECKDB – Explain what it does – Link to Paul’s article ▪ Index