Maintenance Plans
for beginners

@KoprowskiT
reklama

2

Doroczna konferencja Polskiej Grupy Użytkowników SQL Server – kilka faktów
 28 kwietnia – całodzienne warszta...
Select {BIO}
3


polish sql server user group leader



microsoft certified trainer



pass sql azure virtual chapter c...
ENGLISH

4
maksymalny stopień równoległości prostych opcji
max degree of parallelism

Zwalniane spację w plikach bazy dany...
AGENDA

5
Maintenance Plans – what are you talking about?
Maintenance Plans – how, where, when?
 Methods, tools, right (?...
6

Maintenance Plans – what we are talking about?

Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Be...
Maintenance Plans – what are you talking about?

7
 Clean Environment
 Silence

 Knowledge about environment

 Product...
8

Maintenance Plans – how, where, when?

Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
Maintenance Plans – how, where, when?

9
HOW:
 Maintenance Plan Wizard
 Maintenance Plan Designer

 T-SQL Scripts
 Pow...
HOW: Maintenance Plan Wizard

10
 Very simple (although advanced) wizard

 Providing possibility for creation simple tas...
HOW: Maintenance Plan Designer

11

 More flexible and advanced tool (not on this session)
 Graphical user interface wit...
12

LIMITATIONS: Maintenance Plan wizard & Designer
Limitations for both tools / those ideas are not possible
 Identifica...
Maintenance Plan: t-sql & powershell scripts

13

 Functionality for „Real *Tru* DBA”
 Necessary for working with multip...
14

(Everything I do) I do it for you

Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
Maintenance plans: available tasks

15

 Check Database Integrity | DBCC CHECKDB
 Shrink Database | NEVER, NEVER, NEVER
...
Functionality: Verify Integrity of Database

16
 Daily
 Weekly

 Monthly
 DBCC CHECKDB (’database_name’) WITH NO_INFOM...
POSSIBILITIES: SHRINK DATABASE

17

 MDF & LDF

 100 GB reserved
 15 GB in use
 DBCC SHRINKDATABASE
or
 DBCC SHRINKFI...
POSSIBILITIES: Maintain Index & Column Statistics

18


AUTO_CREATE_STATISTICS



AUTO_UPDATE_STATISTICS



Executing a...
19

POSSIBILITIES: Reorganize vs rebuild

Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
POSSIBILITIES: history clean up (MSDB)

20
 Backup and restore history
 SQL Server Agent job history

 Maintenance Plan...
Summary

21

Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
SUMMARY

22
 We should remember about:


Task sequences



Task execution



Task priority



Documentation



Using...
LINKS
23
 Brad McGehee | Brad’ Sure Guide to SQL Server Maintenance Plans
„My new eBook, Brad’ Sure Guide to SQL Server M...
after hours…
24
 MAIL: KoprowskiT@windowslive.com
 MSG: KoprowskiT@windowslive.com
 SKYPE: tjkoprowski
 TWITTER/FACEBO...
Upcoming SlideShare
Loading in...5
×

Plany Konserwacji SQL Server dla żółtodziobów

504

Published on

Opowiedzieć w trzydziesci minut o konserwacji SQL Server wydaje się prawie niemożliwe, ale… Gdybyśmy spróbowali pomyśleć przez chwilę o porządku, spokoju, wolnym czasie i automatyzacji? Z jednej strony zaraportować cieżki dzień w biurze, z drugiej wciąż mieć czas na prasę – chociażby branżową. A jeśli tak naprawdę do naszego SQLa zaglądamy tylko raz dziennie, na kilka minut? Spróbujmy.

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
504
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Plany Konserwacji SQL Server dla żółtodziobów

  1. 1. Maintenance Plans for beginners @KoprowskiT
  2. 2. reklama 2 Doroczna konferencja Polskiej Grupy Użytkowników SQL Server – kilka faktów  28 kwietnia – całodzienne warsztaty  29-30 kwietnia – trzy ścieżki po pięć sesji każda  Stadion Miejski we Wrocławiu  Najlepsi prelegenci z Polski i Europy  Impreza integracyjna  Olbrzymia dawka wiedzy http://conference.plssug.org.pl/ Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  3. 3. Select {BIO} 3  polish sql server user group leader  microsoft certified trainer  pass sql azure virtual chapter co-founder  blogger, influencer, technical writer  over 8 years living in data center in wrocław  bout 14 years in it/banking area  trainer, auditor, consultant  speaker at many international conferences: sql server community launch, time for sharepoint, codecamps, sharepoint community launch, cissp day, sql in the city, infotrams, sql bits, sql saturday, careercon, sharepoint & sql connection, it camp,  deep dives co-author: high availability of sql server in the context of service level agreements Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  4. 4. ENGLISH 4 maksymalny stopień równoległości prostych opcji max degree of parallelism Zwalniane spację w plikach bazy danych Retain freed space in database files Baza danych jest zagęszczonym mleku do stron ciągłych, ale strony nie są cofniętych przydziałów, a pliki bazy danych nie zmniejszać. Użyj tej opcji, jeśli oczekujesz, że baza danych, aby rozwinąć ponownie i nie chcesz zmienić alokację przestrzeni. Po wybraniu tej opcji pliki bazy danych nie zmniejszać możliwie. Korzysta z opcji NOTRUNCATE. The database is condensed to contiguous pages but the pages are not deallocated, and the database files do not shrink. Use this option if you expect the database to expand again, and you do not want to reallocate space. With this option, the database files do not shrink as much as possible. This uses the NOTRUNCATE option. Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  5. 5. AGENDA 5 Maintenance Plans – what are you talking about? Maintenance Plans – how, where, when?  Methods, tools, right (?) ways What Maintenance Plans can do you You Short Demo Q&A Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  6. 6. 6 Maintenance Plans – what we are talking about? Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  7. 7. Maintenance Plans – what are you talking about? 7  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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  8. 8. 8 Maintenance Plans – how, where, when? Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  9. 9. Maintenance Plans – how, where, when? 9 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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  10. 10. HOW: Maintenance Plan Wizard 10  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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  11. 11. HOW: Maintenance Plan Designer 11  More flexible and advanced tool (not on this session)  Graphical user interface with SSIS  Most often used for „really DBA”  Increased features  Workflow for specified tasks with execution plan  Multitasking  Two additional Maintenance plans  Execute T-SQL Statement  Notify Operator Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  12. 12. 12 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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  13. 13. Maintenance Plan: t-sql & powershell scripts 13  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/ Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  14. 14. 14 (Everything I do) I do it for you Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  15. 15. Maintenance plans: available tasks 15  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 scrip 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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  16. 16. Functionality: Verify Integrity of Database 16  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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners YOU SHOULD REMEMBER  using DBCC CHECKDB
  17. 17. POSSIBILITIES: SHRINK DATABASE 17  MDF & LDF  100 GB reserved  15 GB in use  DBCC SHRINKDATABASE or  DBCC SHRINKFILE | MANUAL MODE Reduction of Reserved Space Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners YOU MUST REMEMBER NEVER USE THIS OPTION IN MAINTENANCE PLANS
  18. 18. POSSIBILITIES: Maintain Index & Column Statistics 18  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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners YOU SHOULD REMEMBER Automation:
  19. 19. 19 POSSIBILITIES: Reorganize vs rebuild Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  20. 20. POSSIBILITIES: history clean up (MSDB) 20  Backup and restore history  SQL Server Agent job history  Maintenance Plan history Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners YOU MUST REMEMBER Choosing the data (right data) for deleting:
  21. 21. Summary 21 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  22. 22. SUMMARY 22  We should remember about:  Task sequences  Task execution  Task priority  Documentation  Using: daily / weekly / occasionally  Better expoloration of our environment  Monitoring (partially) of performance  Standard and above (sorry)  Maintenance Plan Wizard  for beginners and small installations  Maintenance Plan Designer  Adult  , more complicated, wide environment Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  23. 23. LINKS 23  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 Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  24. 24. after hours… 24  MAIL: KoprowskiT@windowslive.com  MSG: KoprowskiT@windowslive.com  SKYPE: tjkoprowski  TWITTER/FACEBOOK/LINKEDIN: KoprowskiT 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/ [PL/EN/ES] Kariera IT Kraków | 22 Feb 2014 | KoprowskiT - Maintenance Plans for Beginners
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×