Date post: | 21-Jun-2015 |
Category: |
Technology |
Upload: | tobiasz-janusz-koprowski |
View: | 140 times |
Download: | 0 times |
@KoprowskiT
Premier
Gold
Silver
Bronze
OUR AWESOME SPONSORS
@KoprowskiT
ABOUT ME
Leader of Polish SQL Server User Group
Microsoft Certified Trainer (SharePoint, SQL Server, Security, Azure)
SQL Server MVP (five years)
MVP Mentor Program Member
consultant, security & licensing auditor
active blogger, influencer, technical writer
last 9 years living in Data Processing Center
last 14 years banking and ICT
NOW going into Independent Consultancy
frequently speaker at several conferences: SQL Server Community Launch, Time for
SharePoint, CodeCamps, InfoMEET, SharePoint Community Launch, CISSP Day, SQL in the
City, InfoTRAMS, SQL Bits, IT Camp, SQL Saturday, CareerCon, Sharepoint & SQL
Connection, Kariera IT, SQL Rally, SQL Relay, InfoTech…
Microsoft Terminology Community / translations for Wndows 7/8 and Visual Studio
2010/2012
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 4
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 5
PHASE ONE – SLIDE TALKS
Maintenance Plans – what we are talking about?
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 8
Maintenance Plans – how, where, when?
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 11
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 12
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 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/
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 14
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 manyorganizations 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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 15
(Everything I do) I do it for you
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners
16
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 17
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 omittingthis option has no effect. Error messages are sorted by object ID, except for those messages generatedfrom 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. Thisdecreases the overall execution time. NOINDEX does not affect system tables because integrity checks arealways performed on system table indexes
Y O
U S
H O
U L
D R
E M
E M
B E
R
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 18
NEVER USE THIS OPTION IN MAINTENANCE PLANS
MDF & LDF
100 GB reserved
15 GB in use
DBCC SHRINKDATABASE
or
DBCC SHRINKFILE | MANUAL MODE
Reduction of Reserved Space
Y O
U M
U S
T R
E M
E M
B E
R
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 19
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
Y O
U S
H O
U L
D R
E M
E M
B E
R
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 20
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 21
Choosing the data (right data) for deleting:
Backup and restore history
SQL Server Agent job history
Maintenance Plan history
Y O
U M
U S
T R
E M
E M
B E
R
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 22
PHASE TWO – SHOWTIME
Summary
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners
24
PHASE THREE - DISCUSSION
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 26
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 27
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
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 28
CONTACT:
MAIL: [email protected]
MSG: [email protected]
TWITTER/FACEBOOK/LINKEDIN: KoprowskiT
SLIDES FROM SESSION:
SQL Relay 2014 Page: https://www.sqlrelay.co.uk/
SlideShare Profile: http://www.slideshare.net/Anorak
BLOGS:
ITPRO Anorak’sVision: http://itblogs.pl/notbeautifulanymore/ [PL/EN]
Volume Licensing Specialites: http://koprowskit.eu/licensing/ [PL]
My MVP Blog: http://koprowskit.eu/geek/ [EN/ES/PL]
AFTER SESSION
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 29
Premier
Gold
Silver
Bronze
OUR AWESOME SPONSORS
ThankYou Very Much
Please remember about Feedback and raffle
SQL Relay 2014 | Birmingham Oct 14th | KoprowskiT - Maintenance Plans for Beginners 31