The reason why Ola Hallengren's solution is better than the DBCC REINDEX commands:
- Microsoft recommends doing a reorganize only when fragmentation > 5% and < 30% and even do nothing when fragmentation < 5%, and then even ignore tables with < 10 000 rows.
- DBCC REINDEX syntax is deprecated (SQL 2000 syntax).
Ola Hallengren's script will dynamically choose what to do based on several factors:
- Licensing models (REBUILD ONLINE when possible)
- fragmentation level
- fields in tables (XML fields will prohibit REBUILD ONLINE and force REBUILD OFFLINE)
I have struggled for years with Microsoft Maintenance plans, and when this came along, I have started using it on all my db's. Whorks everytime, it's a no brainer and is even actively supported and updated.