1) Verify the current database configuration.a) On the machine which hosts your SQL node open your Microsoft SQL Server Management Studio (SSMS) and connect to the database server instance where the SkySync database is installed.b) Right click on your database named “SkySync” (or the Name you gave it) and select properties. c) Under the Files tab there is a table which includes the path which is where your “.mdf” and “log.ldf” files are located. You will need this path information later. Info |
---|
Note: If you navigate to that directory you can see the current sizes of both files. |
d) Under the options tab make sure the recovery model is set to "Simple". (This will keep your transaction log from growing. If you want to do Full you will need to back your “.ldf” transaction log file.).e) Verify that the SQL Server Agent is running. If it is not running you will need to start SQL Server configuration manager and select "SQL Server Services". From there you can select the SQL Server Agent and set the start mode to "Automatic". Then start the Agent Service.2) Download and apply the maintenance script to the database.a) In a browser open the following URL https://ola.hallengren.com and then download the free to use SQL Server script “MaintenanceSolution.sql”. While this is a 3rd party script which we are not affiliated with but we believe it is an excellent solution.b) Open the SQL script file which will load the contents into your Microsoft SQL Server Management Studio query window.c) Execute the script which will create the stored procedures in your master database on your SQL Server.d) In the object explorer under databases expand the following trees: System Databases, "Master Database", then "Programmability", then "Stored Procedures". The following four maintenance stored procedures should have been added by the script:i) dbo.CommandExecuteii) dbo.DatabaseBackupiii) dbo.DatabaseIntegrityCheckiv) dbo.IndexOptimize3) Create several system tasks to back up the database and rebuild the indexes.a) Creation of a nightly backup task.a) Under SQL Server Agent, right click on "Jobs" and click on "New Job..."b) Name the Job something like "Nightly SkySync Maintenance".c) Select "Steps" page on the left.d) Click New… on the bottom.i) Name the Step “Backup”.ii) Make sure the Type: is Transact-SQL script (T-SQL)iii) Database: "Master".iv) Command: EXECUTE [dbo].[DatabaseBackup] @Databases = ‘SkySync', @Directory = N'D:\DbBackups', @BackupType = 'FULL', @Verify = 'Y', @CleanupTime = 48, @CheckSum = 'Y', @LogToTable = 'Y'v) Notes:1) @Databases – This is the name of your database.2) @Directory – This is the path on your server where you would like the backup to be deposited.vi) Click "OK" to save the step.e) Click "New…" on the bottom.i) Name the Step “Integrity Check”.ii) Make sure the Type: is Transact-SQL script (T-SQL).iii) Database: "Master".iv) Command: EXECUTE [dbo].[DatabaseIntegrityCheck] @Databases = 'SkySync', @LogToTable = 'Y'v) Notes:1) @Databases – This is the name of your database.vi) Click "OK" to save the step.f) Click "New…" on the bottom.i) Name the Step “Reorg Indexes and Update Stats”.ii) Make sure the Type: is Transact-SQL script (T-SQL).iii) Database: "Master".iv) Command: EXECUTE [dbo].[IndexOptimize] @Databases = 'SkySync', @FragmentationLow = NULL, @FragmentationMedium = INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', @FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', @FragmentationLevel1 = 5, @FragmentationLevel2 = 30, @UpdateStatistics = 'ALL', @LogToTable = 'Y'v) Notes:1) @Databases – This is the name of your database.vi) Click "OK" to save the step.g) Select the "Schedules" page on the left.h) Click "New…" on the bottom.i) Name the Schedule "Nightly".ii) Schedule Type: "Recurring".iii) File in the rest to job for example: "Nightly at 3am".iv) Click "OK" to save the Schedule.i) You can set Alerts or Notifications on the status of the Job.j) Click "OK" to save the job. |