Configuring custom database maintenance - Acunetix 360 On-Premises
THIS DOCUMENT IS FOR:
- Acunetix 360 On-Premises
Acunetix 360 performs daily automatic SQL Server Index maintenance every morning at 6 a.m. (RebuildIndexesLongTermQuery) and 7 a.m. (RebuildIndexes). You can disable this automatic database maintenance and instead set your own custom database maintenance schedule using the SQL Server Agent.
This document provides you with the steps you need to follow to configure custom database maintenance.
How to configure custom database maintenance
There are five steps you need to follow to configure your custom database maintenance.
NOTE: You will need the SQL Server Agent installed in order to carry out these instructions. |
Step 1: Disable automatic database maintenance
- Log in to Acunetix 360 as an Account Owner or Account Administrator.
- Select Settings > Database from the left-side menu.
- Click the checkbox next to Disable DB Maintenance.
- Click Verify & Save.
- Restart IIS. (Open Command Prompt and execute the command: iisreset )
Step 2: Create a new database for maintenance operations
Create a new SQL Server database using the query below.
CODE: USE [master] GO CREATE DATABASE [DBAtools] |
Step 3: Run stored procedure and table creation operations
- Execute the following “CommandLog” script on the newly created DBAtools database to create a command log table. Information about the operations performed for Index maintenance will be recorded in this table.
CODE: SET ANSI_NULLS ON |
- Execute the following “CommandExecute” script on the DBAtools database.
CODE: <insert sql file> |
- Execute the following “IndexOptimize” script on the DBAtools database.
CODE: <insert sql file> |
- Your database structure will now look like this:
Step 4: Schedule automatic maintenance operations
- Ensure that the SQL Server Agent is running. (Open Services to check the status. If it is not running, right-click on SQL Server Agent, and select Properties, then click Start.)
- In Object Explorer, right-click on Jobs (under the SQL Server Agent node) and select New Job… from the context menu.
- In the General tab of the New Job form, set the Name, Owner, Category, and Description for the job.
- Select the Steps tab, then click New….
- Specify the Step name. In the Type field, select Transact-SQL script (T-SQL).
- Ensure the Database field is set to DBAtools. Then enter the custom maintenance script (below) into the Command box. Click OK to save the job step.
CODE: EXECUTE dbo.IndexOptimize |
- Select the Schedules tab, then click New.
- Enter a Name for the schedule and set the Frequency parameters. Then click OK to save the new schedule.
Step 5: Check the operations run correctly
- Locate the newly created job in the Object Explorer under the Jobs node. Right-click on the job and select Start Job at Step… from the context menu.
- When the job is completed, a success message appears.
NOTE: You can view the operations performed using the following query: SELECT * FROM [DBAtools].[dbo].[CommandLog] |