You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Maintenance Solution add a variable used to create all jobs with a common prefix. I provided some sample code I used. The new lines are in BOLD. I did not add all of the jobs in the sample and the AWS portion is just a best guess.
INSERT INTO #Config ([Name], [Value]) VALUES('CreateJobs', @CreateJobs) INSERT INTO #Config ([Name], [Value]) VALUES('JobPrefix', @JobPrefix)
IF (SELECT [Value] FROM #Config WHERE Name = 'CreateJobs') = 'Y' AND SERVERPROPERTY('EngineEdition') NOT IN(4, 5) AND (IS_SRVROLEMEMBER('sysadmin') = 1 OR (DB_ID('rdsadmin') IS NOT NULL AND SUSER_SNAME(0x01) = 'rdsa')) AND (SELECT [compatibility_level] FROM sys.databases WHERE database_id = DB_ID()) >= 90
BEGIN
DECLARE @JobPrefix nvarchar(100)
SELECT @JobPrefix = [Value] FROM #Config WHERE Name = 'JobPrefix'
Why not just script out renaming the job and have it run after you deploy the OLA Jobs? Something like: USE [msdb] GO EXEC msdb.dbo.sp_update_job @job_name=N'CommandLog Cleanup', @new_name=N'_MAINT_CommandLog Cleanup',@enabled=1 GO
In the Maintenance Solution add a variable used to create all jobs with a common prefix. I provided some sample code I used. The new lines are in BOLD. I did not add all of the jobs in the sample and the AWS portion is just a best guess.
DECLARE @JobPrefix nvarchar(max) = 'DBA--' -- Specify Job Prefix. Default is ''.
INSERT INTO #Config ([Name], [Value]) VALUES('CreateJobs', @CreateJobs)
INSERT INTO #Config ([Name], [Value]) VALUES('JobPrefix', @JobPrefix)
IF (SELECT [Value] FROM #Config WHERE Name = 'CreateJobs') = 'Y' AND SERVERPROPERTY('EngineEdition') NOT IN(4, 5) AND (IS_SRVROLEMEMBER('sysadmin') = 1 OR (DB_ID('rdsadmin') IS NOT NULL AND SUSER_SNAME(0x01) = 'rdsa')) AND (SELECT [compatibility_level] FROM sys.databases WHERE database_id = DB_ID()) >= 90
BEGIN
DECLARE @JobPrefix nvarchar(100)
SELECT @JobPrefix = [Value] FROM #Config WHERE Name = 'JobPrefix'
INSERT INTO @Jobs ([Name], CommandTSQL, DatabaseName, OutputFileNamePart01, OutputFileNamePart02)
SELECT @JobPrefix + 'DatabaseBackup - SYSTEM_DATABASES - FULL',
IF @AmazonRDS = 1
BEGIN
UPDATE @Jobs
SET Selected = 1
WHERE [Name] IN(@JobPrefix + 'DatabaseIntegrityCheck - USER_DATABASES',@JobPrefix + 'IndexOptimize - USER_DATABASES',@JobPrefix + 'CommandLog Cleanup')
The text was updated successfully, but these errors were encountered: