SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
Maintenance Plans
ad hoc
SQL Saturday #409
Organizer
Bronze Sponsor
Silver Sponsor
Gold Sponsor
You rock!
Maintenance Plans
for beginners
SQL Saturday #409
about me
• independent consultant, security & licensing auditor
• Microsoft Certified Trainer
• SQL Server MVP (five years in a row)
• MVP Mentor Program Member
• SharePoint Subject Matter Expert at CQURE
• active blogger, influencer, technical writer
• last 9 years living in Data Processing Center Jungle
• last 15 years working arroung banking and ICT
• Polish Information Technology Society Board Member
agenda
PHASE ONE – slide talks
 MP– what we are talking about?
 MP – how, where, when?
 MP - methods, tools, right (?) ways
 what Maintenance Plans can do you You
PHASE TWO – show time
PHASE THREE – discussion time
PHASE ONE – SLIDE TALKS
Maintenance Plans – what we are talking about?
maintenance plans:
what are you talking about?
 Clean Environment
 Silence
 Knowledge about environment
 Productivity / Performance
DEFINITION:
A database maintenance plan is a set of specific, proactive task
that need to be performed regularly on databases
to ensure their adequate performance and availability
maintenance plans:
permissions…
To create or manage maintenance plans:
 you must be a member of the sysadmin fixed server role
 Note that Object Explorer only displays maintenance plans if the user is a member of
the sysadmin fixed server role
 The results generated by the maintenance tasks can be written as a report to a text
file, or written to the maintenance plan tables, sysmaintplan_log and
sysmaintplan_logdetail, in msdb.
Maintenance Plans – how, where, when?
maintenance plans:
how, where, when?
HOW:
 Maintenance Plan Wizard
 Maintenance Plan Designer
 T-SQL Scripts
 PowerShell Scripts
WHERE
 SQL Server Management Studio from Standard and above
 See you in… Express
WHEN:
 BEFORE: problems / service windows
 AFTER: maintaining / clients back to home
how:
maintenance plan wizard
 Very simple (although advanced) wizard
 Providing possibility for creation simple task in dozens of seconds
 Enough in many cases, environments
 Limited but include many options
Limitations:
 number of databases
 granularity
 single tasks / no multitasking
 no scripting for another instances
 some known problems in previous version of SQL Server
 SQL Server 2005 Service Pack 2 / SQL Server 2008
how:
maintenance plan designer
 More flexible and advanced tool (not on this session)
 Graphical user interface with SSIS
 Most often used for „real DBA”
 Increased features
 Workflow for specified tasks with execution plan
 Multitasking
 Two additional Maintenance plans
 Execute T-SQL Statement
 Notify Operator
limitations:
maintenance plan wizard & designer
Limitations for both tools / those ideas are not possible
 Identification and removing fragmentation for physical files
 Identification abandoned, duplicated, forgotten indexes
 Providing backup on demand
 Werification good quality of backup
 Werification succesful restore
 Monitoring of performance
 Monitoring of SQL OS
 Monitoring of Windows OS
 Monitoring available space
maintenance plan:
t-sql & powershell scripts
 Functionality for „Real *Tru* DBA”
 Necessary for working with multiple databases, instances, server farms
 Feauters for scripting:
 Access to OS
 Posibility of moving
 Scripts sharing
One of the best examples and tools for free:
HTTP://OLA.HALLENGREN.COM/
maintenance plan:
replacement
 The SQL Server Maintenance Solution comprises scripts for running backups, integrity
checks, and index and statistics maintenance on all editions of Microsoft SQL Server
2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL Server 2014.
 The solution is based on stored procedures, the sqlcmd utility, and SQL Server Agent
jobs. I designed the solution for the most mission-critical environments, and it is used
in many organizations around the world.
 Numerous SQL Server community experts recommend the SQL Server Maintenance
Solution, which has been a Gold winner in the 2013, 2012, 2011, and 2010 SQL Server
Magazine Awards. The SQL Server Maintenance Solution is free.
“After you review this checklist run — do not walk — over to this website:
http://ola.hallengren.com. Download, read, understand and implement these scripts. My
friend Ola has done a better job on these scripts than I’ve seen anywhere else, hands
down.” - Buck Woody
(Everything I do) I do it for you
maintenance plans:
available tasks
 Check Database Integrity | DBCC CHECKDB
 Shrink Database | NEVER, NEVER, NEVER
 Reorganize Index | ALTER INDEX , and next Update Statistics
 Rebuild Index | ALTER INDEX, Update Statistics are not necessary
 Update Statistics | sp_updatestats
 History Cleanup | using msdb, don’t do that too much frequently
 Execute SQL Server Agent Job | providing scripts using wen you work with agent
 Back Up Database (Full) | executing BACKUP DATABASE with FULL option >>Transaction Log
 Back Up Database (Differential) | executing BACKUP DATABASE with DIFFERENTIAL option
 Back Up Database (Transaction Log) | executing BACKUP LOG, frequency...
 Maintenance Cleanup Task | most complicated feature ? BAK, TRN, TXT
Functionality:
verify integrity of database
 using DBCC CHECKDB
 Daily
 Weekly
 Monthly
 DBCC CHECKDB (’database_name’) WITH NO_INFOMSGS
 Suppresses all informational messages.
 DBCC CHECKDB (’database_name’) WITH NO_INFOMSGS, ALL_ERRORMSGS
 Displays all reported errors per object. All error messages are displayed by default.
Specifying or omitting this option has no effect. Error messages are sorted by
object ID, except for those messages generated from tempdb database.
 In SQL Server Management Studio, the maximum number of error messages
returned is 1000.
 DBCC CHECKDB (’database_name’) NOINDEX
 Specifies that intensive checks of nonclustered indexes for user tables should not
be performed. This decreases the overall execution time. NOINDEX does not affect
system tables because integrity checks are always performed on system table
indexes
YOUSHOULDREMEMBER
possibilities:
shrink database
NEVER USE THIS OPTION IN MAINTENANCE PLANS
 Automated Database Shrinking:
 When the AUTO_SHRINK database option has been set to ON, the
Database Engine automatically shrinks databases that have free space.
 This option is set using the ALTER DATABASE statement. By default, it is
set to OFF.
 Manual Database Shrinking:
 If a DBCC SHRINKDATABASE or DBCC SHRINKFILE statement cannot
reclaim all the specified space in a log file, the statement will issue an
informational message that indicates what action you must perform to
make more space eligible to be freed.
 When using the DBCC SHRINKDATABASE statement, you cannot shrink
a whole database to be smaller than its original size.
 Therefore, if a database was created with a size of 10 MB and grew to
100 MB, the smallest the database could be reduced to is 10 MB, even if
all the data in the database has been deleted.
YOUMUSTREMEMBER
possibilities:
shrink database
Two very good posts about shrinking databases and other links:
 Shrinking a Database (TechNet):
 http://technet.microsoft.com/en-
us/library/ms189080(v=SQL.105).aspx
 Pinal Dave: SQL SERVER – Shrinking Database is Bad – Increases
Fragmentation – Reduces Performance
 http://blog.sqlauthority.com/2011/01/19/sql-server-shrinking-
database-is-bad-increases-fragmentation-reduces-performance/
 Brent Ozar: Stop Shrinking Your Database Files. Seriously. Now.
 http://www.brentozar.com/archive/2009/08/stop-shrinking-your-
database-files-seriously-now/
YOUMUSTREMEMBER
possibilities:
maintain index & column statistics
Automation:
 AUTO_CREATE_STATISTICS
 AUTO_UPDATE_STATISTICS
 Executing automatically after: INSERT, UPDATE, DELETE
 UPDATE STATISTICS table_name WITH FULLSCAN
When:
 Never…
 Just after Index Reorganization
 On the days when we’re not using Index Rebuild or Reorganize
Index
Important options (UPDATE STATISTICS):
• All existing statistics
• Column statistics only
• Index statistics only
YOUSHOULDREMEMBER
possibilities:
reorganize vs rebuild
Reorganize Index Task Rebuild Index Task
removing empty
space and logical
fragmentation
Performs a less thorough index
defragmentation than Rebuild Index. If an
index does not have any fragmentation, then
is not reoganized, saving resources.
Virtually all wasted free space and logical fragmentation is
removed. All indexes are rebuild from scratch, whether
they need it or not.
performance
impact
does not require long blocking locks. An
online task that allows users to access the
database duringthe task
requires potentially long blocking locks that prevent users
from accessing the indexes being rebuilt. A task that
should be performed offline, though with the Enterprise
Edition of SQL Server, you can use the online version of an
index
speed generally takes longer to run that the Rebuild
Index Task
Generally runs faster than Reorganize Index Task
space
requirements
Uses less disk space that the Rebuild Index
Task. Uses less space i the transaction log
than Rebuild Index Task
Use more disk space than Reorganize Index Task. More
space is required in the transaction log than the
Reorganize Index.
statistics
maintenance
Index and column statistics must be updated
separately. This adds to the administration
hassle.
Index and column statistic are automatically updated as
part of this step, using FULLSCANN option
possibilities:
history clean up (msdb)
Choosing the data (right data) for deleting:
 Backup and restore history
 SQL Server Agent job history
 Maintenance Plan history
YOUMUSTREMEMBER
PHASE TWO – SHOWTIME
results:
no maintenance plans (no tr backup)
results:
no maintenance plans (no tr backup)
PHASE THREE - DISCUSSION
summary
 We should remember about:
 Task sequences
 Task execution
 Task priority
 Documentation
 Using: daily / weekly / occasionally
 We get better expoloration of our environment
 We can monitoring / (partially) of performance and space
 Standard and above (sorry)
 Maintenance Plan Wizard
 for beginners and small installations
 Maintenance Plan Designer
 Adult  , more complicated, wide environment
links
 Brad McGehee | Brad’ Sure Guide to SQL Server
Maintenance Plans
„My new eBook, Brad’ Sure Guide to SQL Server Maintenance Plans is now available as
a free, 269 page PDF eBook. The book is designed for part-time or novice DBAs who
want to learn how to properly create Maintenance Plans using the tools that come with
SQL Server Management Studio (SSMS) in SQL Server 2005/2008.
LINK: http://bit.ly/1ijdnah
 Ola Hallengreen | Maintenance Plans Scripts PASS
slidedeck
„The SQL Server Maintenance Solution comprises scripts for running backups,
integrity checks, and index and statistics maintenance on all editions of Microsoft
SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012. The
solution is based on stored procedures, sqlcmd utility, and SQL Server Agent jobs”
LINK: http://bit.ly/1b220Ns
after session
CONTACT:
• MAIL: KoprowskiT@windowslive.com
• SOCIAL MEDIA: facebook, twitter, linkedin, xing
SLIDES FROM SESSION:
• SlideShare Profile: http://www.slideshare.net/Anorak
BLOGS:
• ITPRO Anorak’s Vision: http://itblogs.pl/notbeautifulanymore/ [PL/EN]
• Volume Licensing Specialites: http://koprowskit.eu/licensing/ [PL]
• My MVP Blog: http://koprowskit.eu/geek/ [EN/ES/PL]
Save the date!
nächsten Sitzungen nach Kaffeepause -
wahrscheinlich alle auf Deutsch :)
Vielen Dank!

Mais conteúdo relacionado

Mais procurados

SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DAC
sqlserver.co.il
 
Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013
sqlserver.co.il
 
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended EventsSQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
sqlserver.co.il
 

Mais procurados (20)

Windows 7 Feature Overview It Academic Day 2009
Windows 7 Feature Overview   It Academic Day 2009Windows 7 Feature Overview   It Academic Day 2009
Windows 7 Feature Overview It Academic Day 2009
 
Introduction to SQL Server Analysis services 2008
Introduction to SQL Server Analysis services 2008Introduction to SQL Server Analysis services 2008
Introduction to SQL Server Analysis services 2008
 
38_Spotkanie_PLSSUGweWroclawiu_KilkaSłów_ApexSQL_FreeTools
38_Spotkanie_PLSSUGweWroclawiu_KilkaSłów_ApexSQL_FreeTools38_Spotkanie_PLSSUGweWroclawiu_KilkaSłów_ApexSQL_FreeTools
38_Spotkanie_PLSSUGweWroclawiu_KilkaSłów_ApexSQL_FreeTools
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DAC
 
Introduction to Azure SQL DB
Introduction to Azure SQL DBIntroduction to Azure SQL DB
Introduction to Azure SQL DB
 
Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013
 
Azure SQL Database Introduction by Tim Radney
Azure SQL Database Introduction by Tim RadneyAzure SQL Database Introduction by Tim Radney
Azure SQL Database Introduction by Tim Radney
 
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheCloudsKoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
 
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended EventsSQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
 
Keep your environment always on with sql server 2016 sql bits 2017
Keep your environment always on with sql server 2016 sql bits 2017Keep your environment always on with sql server 2016 sql bits 2017
Keep your environment always on with sql server 2016 sql bits 2017
 
Securing your data with Azure SQL DB
Securing your data with Azure SQL DBSecuring your data with Azure SQL DB
Securing your data with Azure SQL DB
 
DAC 2012
DAC 2012DAC 2012
DAC 2012
 
SQL Server 2016 New Security Features
SQL Server 2016 New Security FeaturesSQL Server 2016 New Security Features
SQL Server 2016 New Security Features
 
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
 
KoprowskiT_it_camp2013 - 2amADisasterJustBegan
KoprowskiT_it_camp2013 - 2amADisasterJustBeganKoprowskiT_it_camp2013 - 2amADisasterJustBegan
KoprowskiT_it_camp2013 - 2amADisasterJustBegan
 
Windows azure sql_database_tutorials
Windows azure sql_database_tutorialsWindows azure sql_database_tutorials
Windows azure sql_database_tutorials
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018 Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
 
HA/DR options with SQL Server in Azure and hybrid
HA/DR options with SQL Server in Azure and hybridHA/DR options with SQL Server in Azure and hybrid
HA/DR options with SQL Server in Azure and hybrid
 
Roman Rehak: 24/7 Database Administration + Database Mail Unleashed
Roman Rehak: 24/7 Database Administration + Database Mail UnleashedRoman Rehak: 24/7 Database Administration + Database Mail Unleashed
Roman Rehak: 24/7 Database Administration + Database Mail Unleashed
 
Introducing Azure SQL Database
Introducing Azure SQL DatabaseIntroducing Azure SQL Database
Introducing Azure SQL Database
 

Destaque

Destaque (6)

KoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloud
 
KoprowskiT_ECCV_Trust.ThePrimer
KoprowskiT_ECCV_Trust.ThePrimerKoprowskiT_ECCV_Trust.ThePrimer
KoprowskiT_ECCV_Trust.ThePrimer
 
KoprowskiT_ESRM_TrustThePrimer
KoprowskiT_ESRM_TrustThePrimerKoprowskiT_ESRM_TrustThePrimer
KoprowskiT_ESRM_TrustThePrimer
 
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbeganKoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
 
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginnersKoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
 
Wysoka dostępność środowiska SharePoint w kontekście umów SLA
Wysoka dostępność środowiska SharePoint w kontekście umów SLAWysoka dostępność środowiska SharePoint w kontekście umów SLA
Wysoka dostępność środowiska SharePoint w kontekście umów SLA
 

Semelhante a KoprowskiT_SQLSaturday409_MaintenancePlansForBeginners

DBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docxDBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
seifusisay06
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
sqlserver.co.il
 
Maruthi_YH_resume
Maruthi_YH_resumeMaruthi_YH_resume
Maruthi_YH_resume
Maruthi YH
 
Be05 introduction to sql azure
Be05   introduction to sql azureBe05   introduction to sql azure
Be05 introduction to sql azure
DotNetCampus
 
Bb performance-engineering-toad
Bb performance-engineering-toadBb performance-engineering-toad
Bb performance-engineering-toad
Steve Feldman
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
Concentrated Technology
 

Semelhante a KoprowskiT_SQLSaturday409_MaintenancePlansForBeginners (20)

KoprowskiT_HUG-MSSQL_AdHocMaintenancePlansForBeginners
KoprowskiT_HUG-MSSQL_AdHocMaintenancePlansForBeginnersKoprowskiT_HUG-MSSQL_AdHocMaintenancePlansForBeginners
KoprowskiT_HUG-MSSQL_AdHocMaintenancePlansForBeginners
 
SQLSaturday#290_Kiev_AdHocMaintenancePlansForBeginners
SQLSaturday#290_Kiev_AdHocMaintenancePlansForBeginnersSQLSaturday#290_Kiev_AdHocMaintenancePlansForBeginners
SQLSaturday#290_Kiev_AdHocMaintenancePlansForBeginners
 
KoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginnersKoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginners
 
Plany Konserwacji SQL Server dla żółtodziobów
Plany Konserwacji SQL Server dla żółtodziobówPlany Konserwacji SQL Server dla żółtodziobów
Plany Konserwacji SQL Server dla żółtodziobów
 
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docxDBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
High Performance SSRS
High Performance SSRSHigh Performance SSRS
High Performance SSRS
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
 
Maruthi_YH_resume
Maruthi_YH_resumeMaruthi_YH_resume
Maruthi_YH_resume
 
Espc17 make your share point fly by tuning and optimising sql server
Espc17 make your share point  fly by tuning and optimising sql serverEspc17 make your share point  fly by tuning and optimising sql server
Espc17 make your share point fly by tuning and optimising sql server
 
Make your SharePoint fly by tuning and optimizing SQL Server
Make your SharePoint  fly by tuning and optimizing SQL ServerMake your SharePoint  fly by tuning and optimizing SQL Server
Make your SharePoint fly by tuning and optimizing SQL Server
 
SQL Server - High availability
SQL Server - High availabilitySQL Server - High availability
SQL Server - High availability
 
Be05 introduction to sql azure
Be05   introduction to sql azureBe05   introduction to sql azure
Be05 introduction to sql azure
 
Bb performance-engineering-toad
Bb performance-engineering-toadBb performance-engineering-toad
Bb performance-engineering-toad
 
Exploring sql server 2016
Exploring sql server 2016Exploring sql server 2016
Exploring sql server 2016
 
The dr overnight dba
The dr overnight dbaThe dr overnight dba
The dr overnight dba
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
 
Remote DBA Experts 11g Features
Remote DBA Experts 11g FeaturesRemote DBA Experts 11g Features
Remote DBA Experts 11g Features
 
Sql server 2016 Discovery Day
Sql server 2016 Discovery DaySql server 2016 Discovery Day
Sql server 2016 Discovery Day
 
Azure data platform overview
Azure data platform overviewAzure data platform overview
Azure data platform overview
 

Mais de Tobias Koprowski

Mais de Tobias Koprowski (17)

KoprowskiT_2AMaDisasterJustBeganAD2018
KoprowskiT_2AMaDisasterJustBeganAD2018KoprowskiT_2AMaDisasterJustBeganAD2018
KoprowskiT_2AMaDisasterJustBeganAD2018
 
DataMindsConnect2018_SECDEVOPS
DataMindsConnect2018_SECDEVOPSDataMindsConnect2018_SECDEVOPS
DataMindsConnect2018_SECDEVOPS
 
KoprowskiT_SQLDay2016_2AMaDisasterJustBegan
KoprowskiT_SQLDay2016_2AMaDisasterJustBeganKoprowskiT_SQLDay2016_2AMaDisasterJustBegan
KoprowskiT_SQLDay2016_2AMaDisasterJustBegan
 
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_CloudKoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
 
KoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
KoprowskiT-Difinify2017-SQL_Security_In_The_CloudKoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
KoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
 
KoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheClouds
KoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheCloudsKoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheClouds
KoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheClouds
 
KoprowskiT_SBIPTI_Keynote
KoprowskiT_SBIPTI_KeynoteKoprowskiT_SBIPTI_Keynote
KoprowskiT_SBIPTI_Keynote
 
KoprowskiT_Session2_SDNEvent_SourceControlForDBA
KoprowskiT_Session2_SDNEvent_SourceControlForDBAKoprowskiT_Session2_SDNEvent_SourceControlForDBA
KoprowskiT_Session2_SDNEvent_SourceControlForDBA
 
KoprowskiT_session1_SDNEvent_WASDforBeginners
KoprowskiT_session1_SDNEvent_WASDforBeginnersKoprowskiT_session1_SDNEvent_WASDforBeginners
KoprowskiT_session1_SDNEvent_WASDforBeginners
 
KoprowskiT_SPBizConf_2AMaDisasterJustBegan
KoprowskiT_SPBizConf_2AMaDisasterJustBeganKoprowskiT_SPBizConf_2AMaDisasterJustBegan
KoprowskiT_SPBizConf_2AMaDisasterJustBegan
 
KoprowskiT_InfoTRAMS_TrustThePrimer
KoprowskiT_InfoTRAMS_TrustThePrimerKoprowskiT_InfoTRAMS_TrustThePrimer
KoprowskiT_InfoTRAMS_TrustThePrimer
 
KoprowskiT_SPBizConference_2AMaDisasterJustBegan
KoprowskiT_SPBizConference_2AMaDisasterJustBeganKoprowskiT_SPBizConference_2AMaDisasterJustBegan
KoprowskiT_SPBizConference_2AMaDisasterJustBegan
 
KoprowskiT_SQLSat409_MaintenancePlansForBeginners
KoprowskiT_SQLSat409_MaintenancePlansForBeginnersKoprowskiT_SQLSat409_MaintenancePlansForBeginners
KoprowskiT_SQLSat409_MaintenancePlansForBeginners
 
KoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloud
 
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
 
KoprowskiT_SQLRelay2014#6_Leeds_WADBForBeginners
KoprowskiT_SQLRelay2014#6_Leeds_WADBForBeginnersKoprowskiT_SQLRelay2014#6_Leeds_WADBForBeginners
KoprowskiT_SQLRelay2014#6_Leeds_WADBForBeginners
 
KoprowskiT_SQLRelay2014#5_Newcastle_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#5_Newcastle_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#5_Newcastle_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#5_Newcastle_FromPlanToBackupToCloud
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

KoprowskiT_SQLSaturday409_MaintenancePlansForBeginners

  • 8. about me • independent consultant, security & licensing auditor • Microsoft Certified Trainer • SQL Server MVP (five years in a row) • MVP Mentor Program Member • SharePoint Subject Matter Expert at CQURE • active blogger, influencer, technical writer • last 9 years living in Data Processing Center Jungle • last 15 years working arroung banking and ICT • Polish Information Technology Society Board Member
  • 9. agenda PHASE ONE – slide talks  MP– what we are talking about?  MP – how, where, when?  MP - methods, tools, right (?) ways  what Maintenance Plans can do you You PHASE TWO – show time PHASE THREE – discussion time
  • 10. PHASE ONE – SLIDE TALKS
  • 11. Maintenance Plans – what we are talking about?
  • 12. maintenance plans: what are you talking about?  Clean Environment  Silence  Knowledge about environment  Productivity / Performance DEFINITION: A database maintenance plan is a set of specific, proactive task that need to be performed regularly on databases to ensure their adequate performance and availability
  • 13. maintenance plans: permissions… To create or manage maintenance plans:  you must be a member of the sysadmin fixed server role  Note that Object Explorer only displays maintenance plans if the user is a member of the sysadmin fixed server role  The results generated by the maintenance tasks can be written as a report to a text file, or written to the maintenance plan tables, sysmaintplan_log and sysmaintplan_logdetail, in msdb.
  • 14. Maintenance Plans – how, where, when?
  • 15. maintenance plans: how, where, when? HOW:  Maintenance Plan Wizard  Maintenance Plan Designer  T-SQL Scripts  PowerShell Scripts WHERE  SQL Server Management Studio from Standard and above  See you in… Express WHEN:  BEFORE: problems / service windows  AFTER: maintaining / clients back to home
  • 16. how: maintenance plan wizard  Very simple (although advanced) wizard  Providing possibility for creation simple task in dozens of seconds  Enough in many cases, environments  Limited but include many options Limitations:  number of databases  granularity  single tasks / no multitasking  no scripting for another instances  some known problems in previous version of SQL Server  SQL Server 2005 Service Pack 2 / SQL Server 2008
  • 17. how: maintenance plan designer  More flexible and advanced tool (not on this session)  Graphical user interface with SSIS  Most often used for „real DBA”  Increased features  Workflow for specified tasks with execution plan  Multitasking  Two additional Maintenance plans  Execute T-SQL Statement  Notify Operator
  • 18. limitations: maintenance plan wizard & designer Limitations for both tools / those ideas are not possible  Identification and removing fragmentation for physical files  Identification abandoned, duplicated, forgotten indexes  Providing backup on demand  Werification good quality of backup  Werification succesful restore  Monitoring of performance  Monitoring of SQL OS  Monitoring of Windows OS  Monitoring available space
  • 19. maintenance plan: t-sql & powershell scripts  Functionality for „Real *Tru* DBA”  Necessary for working with multiple databases, instances, server farms  Feauters for scripting:  Access to OS  Posibility of moving  Scripts sharing One of the best examples and tools for free: HTTP://OLA.HALLENGREN.COM/
  • 20. maintenance plan: replacement  The SQL Server Maintenance Solution comprises scripts for running backups, integrity checks, and index and statistics maintenance on all editions of Microsoft SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL Server 2014.  The solution is based on stored procedures, the sqlcmd utility, and SQL Server Agent jobs. I designed the solution for the most mission-critical environments, and it is used in many organizations around the world.  Numerous SQL Server community experts recommend the SQL Server Maintenance Solution, which has been a Gold winner in the 2013, 2012, 2011, and 2010 SQL Server Magazine Awards. The SQL Server Maintenance Solution is free. “After you review this checklist run — do not walk — over to this website: http://ola.hallengren.com. Download, read, understand and implement these scripts. My friend Ola has done a better job on these scripts than I’ve seen anywhere else, hands down.” - Buck Woody
  • 21. (Everything I do) I do it for you
  • 22. maintenance plans: available tasks  Check Database Integrity | DBCC CHECKDB  Shrink Database | NEVER, NEVER, NEVER  Reorganize Index | ALTER INDEX , and next Update Statistics  Rebuild Index | ALTER INDEX, Update Statistics are not necessary  Update Statistics | sp_updatestats  History Cleanup | using msdb, don’t do that too much frequently  Execute SQL Server Agent Job | providing scripts using wen you work with agent  Back Up Database (Full) | executing BACKUP DATABASE with FULL option >>Transaction Log  Back Up Database (Differential) | executing BACKUP DATABASE with DIFFERENTIAL option  Back Up Database (Transaction Log) | executing BACKUP LOG, frequency...  Maintenance Cleanup Task | most complicated feature ? BAK, TRN, TXT
  • 23. Functionality: verify integrity of database  using DBCC CHECKDB  Daily  Weekly  Monthly  DBCC CHECKDB (’database_name’) WITH NO_INFOMSGS  Suppresses all informational messages.  DBCC CHECKDB (’database_name’) WITH NO_INFOMSGS, ALL_ERRORMSGS  Displays all reported errors per object. All error messages are displayed by default. Specifying or omitting this option has no effect. Error messages are sorted by object ID, except for those messages generated from tempdb database.  In SQL Server Management Studio, the maximum number of error messages returned is 1000.  DBCC CHECKDB (’database_name’) NOINDEX  Specifies that intensive checks of nonclustered indexes for user tables should not be performed. This decreases the overall execution time. NOINDEX does not affect system tables because integrity checks are always performed on system table indexes YOUSHOULDREMEMBER
  • 24. possibilities: shrink database NEVER USE THIS OPTION IN MAINTENANCE PLANS  Automated Database Shrinking:  When the AUTO_SHRINK database option has been set to ON, the Database Engine automatically shrinks databases that have free space.  This option is set using the ALTER DATABASE statement. By default, it is set to OFF.  Manual Database Shrinking:  If a DBCC SHRINKDATABASE or DBCC SHRINKFILE statement cannot reclaim all the specified space in a log file, the statement will issue an informational message that indicates what action you must perform to make more space eligible to be freed.  When using the DBCC SHRINKDATABASE statement, you cannot shrink a whole database to be smaller than its original size.  Therefore, if a database was created with a size of 10 MB and grew to 100 MB, the smallest the database could be reduced to is 10 MB, even if all the data in the database has been deleted. YOUMUSTREMEMBER
  • 25. possibilities: shrink database Two very good posts about shrinking databases and other links:  Shrinking a Database (TechNet):  http://technet.microsoft.com/en- us/library/ms189080(v=SQL.105).aspx  Pinal Dave: SQL SERVER – Shrinking Database is Bad – Increases Fragmentation – Reduces Performance  http://blog.sqlauthority.com/2011/01/19/sql-server-shrinking- database-is-bad-increases-fragmentation-reduces-performance/  Brent Ozar: Stop Shrinking Your Database Files. Seriously. Now.  http://www.brentozar.com/archive/2009/08/stop-shrinking-your- database-files-seriously-now/ YOUMUSTREMEMBER
  • 26. possibilities: maintain index & column statistics Automation:  AUTO_CREATE_STATISTICS  AUTO_UPDATE_STATISTICS  Executing automatically after: INSERT, UPDATE, DELETE  UPDATE STATISTICS table_name WITH FULLSCAN When:  Never…  Just after Index Reorganization  On the days when we’re not using Index Rebuild or Reorganize Index Important options (UPDATE STATISTICS): • All existing statistics • Column statistics only • Index statistics only YOUSHOULDREMEMBER
  • 27. possibilities: reorganize vs rebuild Reorganize Index Task Rebuild Index Task removing empty space and logical fragmentation Performs a less thorough index defragmentation than Rebuild Index. If an index does not have any fragmentation, then is not reoganized, saving resources. Virtually all wasted free space and logical fragmentation is removed. All indexes are rebuild from scratch, whether they need it or not. performance impact does not require long blocking locks. An online task that allows users to access the database duringthe task requires potentially long blocking locks that prevent users from accessing the indexes being rebuilt. A task that should be performed offline, though with the Enterprise Edition of SQL Server, you can use the online version of an index speed generally takes longer to run that the Rebuild Index Task Generally runs faster than Reorganize Index Task space requirements Uses less disk space that the Rebuild Index Task. Uses less space i the transaction log than Rebuild Index Task Use more disk space than Reorganize Index Task. More space is required in the transaction log than the Reorganize Index. statistics maintenance Index and column statistics must be updated separately. This adds to the administration hassle. Index and column statistic are automatically updated as part of this step, using FULLSCANN option
  • 28. possibilities: history clean up (msdb) Choosing the data (right data) for deleting:  Backup and restore history  SQL Server Agent job history  Maintenance Plan history YOUMUSTREMEMBER
  • 29. PHASE TWO – SHOWTIME
  • 32. PHASE THREE - DISCUSSION
  • 33. summary  We should remember about:  Task sequences  Task execution  Task priority  Documentation  Using: daily / weekly / occasionally  We get better expoloration of our environment  We can monitoring / (partially) of performance and space  Standard and above (sorry)  Maintenance Plan Wizard  for beginners and small installations  Maintenance Plan Designer  Adult  , more complicated, wide environment
  • 34.
  • 35. links  Brad McGehee | Brad’ Sure Guide to SQL Server Maintenance Plans „My new eBook, Brad’ Sure Guide to SQL Server Maintenance Plans is now available as a free, 269 page PDF eBook. The book is designed for part-time or novice DBAs who want to learn how to properly create Maintenance Plans using the tools that come with SQL Server Management Studio (SSMS) in SQL Server 2005/2008. LINK: http://bit.ly/1ijdnah  Ola Hallengreen | Maintenance Plans Scripts PASS slidedeck „The SQL Server Maintenance Solution comprises scripts for running backups, integrity checks, and index and statistics maintenance on all editions of Microsoft SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012. The solution is based on stored procedures, sqlcmd utility, and SQL Server Agent jobs” LINK: http://bit.ly/1b220Ns
  • 36. after session CONTACT: • MAIL: KoprowskiT@windowslive.com • SOCIAL MEDIA: facebook, twitter, linkedin, xing SLIDES FROM SESSION: • SlideShare Profile: http://www.slideshare.net/Anorak BLOGS: • ITPRO Anorak’s Vision: http://itblogs.pl/notbeautifulanymore/ [PL/EN] • Volume Licensing Specialites: http://koprowskit.eu/licensing/ [PL] • My MVP Blog: http://koprowskit.eu/geek/ [EN/ES/PL]
  • 38. nächsten Sitzungen nach Kaffeepause - wahrscheinlich alle auf Deutsch :)