Core component of SQL Server for storing, processing, and securing data
Hi @N B,
Thank you for reaching out to the Microsoft Q & A Forum.
You can create a dedicated maintenance database like DBAUtility or MaintenanceDB to store Ola’s scripts. It Keeps master clean and avoids cluttering system databases. It makes version upgrades and script management easier. And It improves portability across environments.
Ola’s scripts are designed to work from any database, as long as the procedures have the correct permissions. And the jobs reference the right procedure names and parameters.
Fragmentation handling is not affected by the database where the procedure resides.
- The script dynamically connects to the target databases and indexes based on the parameters you pass like below syntax.
@Databases = 'USER_DATABASES'.
- It uses sys.dm_db_index_physical_stats on the target database, not the database where the procedure is stored.
- Rebuild/reorganize operations happen in the target database, so fragmentation is handled exactly the same way.
Please check the below things.
- Ensure the SQL Agent jobs point to the correct database where the procedures are installed.
- The account running the job must have sufficient permissions on all target databases.
- If you use CommandLog or OutputFileDirectory, make sure paths and logging tables exist in the maintenance database.
Note: Install Ola’s scripts in a dedicated maintenance database. Configure SQL Agent jobs to call procedures from that database. No impact on fragmentation or statistics updates, the logic is database-agnostic.
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh