Link to home
Create AccountLog in
Avatar of Albert Widjaja
Albert WidjajaFlag for Australia

asked on

Automated SQL Server database Rebuild Indexes and Update Statistics maintenance task ?

Hi All,

I'm about to implement Rebuild Indexes and Update Statistics maintenance job for all of my SQL Server 2012 Standard Database in my Physical box, is there any issue or caveats that I need to know before hand ?

I assumethat this maintenance task can be done while the database is online (no outage required).

Reference: https://www.veritas.com/support/en_US/article.000040169

Thanks,
SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Albert Widjaja

ASKER

Thanks Paul,

This is for other database as well not for Symantec EV.
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ok, do I just copy paste the Ola's script I can just run it as scheduled task / sql agent job ?
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Take the time and sit through Ola's video, it's quite useful in my opinion and could answer quite a few questions you might have about how best to use his work. It's a recorded meeting and has a question/answer period.
OK, so now I have downloaded the script attached MaintenanceSolution.sql which will be creating the necesary objects and also the stored procedures.

After that I can just schedule the Rebuild or reorganize all indexes with fragmentation on all user databases, performing sort operations in tempdb and using all available CPUs

EXECUTE dbo.IndexOptimize @Databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@SortInTempdb = 'Y',
@MaxDOP = 0

Open in new window


Is that correct ?

Do I need to change the USER_DATABASES with the name of the Databases or not ?
MaintenanceSolution.sql
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
thanks !