Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

0 votes
1 answers
161 views
Unable to create maintenance plan
When trying to create a maintenance plan locally on two prod servers through SSMS, I receive this error: [![Maintenance plan creation][1]][1] [1]: https://i.sstatic.net/Wh84N.png No such error occurs on my UAT system. They're all running SQL Server 2017 (14.0.3162.1), and they were all installed wit...
When trying to create a maintenance plan locally on two prod servers through SSMS, I receive this error: Maintenance plan creation No such error occurs on my UAT system. They're all running SQL Server 2017 (14.0.3162.1), and they were all installed with the same feature set. The UAT machine is Windows 10, while the prod servers are Windows Server 2016. Which components/features specifically need to be installed such that I can create a maintenance plan?
Franzl (101 rep)
Jun 30, 2019, 10:33 AM • Last activity: Jul 13, 2025, 04:05 PM
1 votes
1 answers
193 views
Automatic database restore fails as cannot find file
A while back I asked for help automating a database restore using a backup file provided from another server: https://dba.stackexchange.com/questions/91223/automatically-restore-sql-server-database-from-file-from-another-server. I'm pleased to say that I now have this working as a SQL Server Agent j...
A while back I asked for help automating a database restore using a backup file provided from another server: https://dba.stackexchange.com/questions/91223/automatically-restore-sql-server-database-from-file-from-another-server . I'm pleased to say that I now have this working as a SQL Server Agent job. We are now trying to trigger this job as part of a maintenance plan that runs on the other (dev) server. At the moment we have a maintenance plan that runs on the live server and performs the following steps, in sequence: 1. Back up the target databases 2. Call an external process to copy the created backup files 3. Clean up any backup older than 2 days (runs at the same time as 2) 4. Start the restore job on the other server When I run the maintenance plan on live it reports success, however when we check the job history on the dev server it shows that it has failed saying that it could not find the file. Running the job again returns success, and a manual check indicates that the files have been copied correctly. It would seem that the restore job is being started too soon but I can't figure out why. Is there any reason why the restore job is being triggered before the copy process has completed? EDIT: I've checked the maintenance plan logs and the restore job step starts 1 second after the transfer step. Obviously the transfer takes longer than this, so I can at least see evidence of the problem.
toryan (335 rep)
Mar 16, 2015, 11:17 PM • Last activity: Jun 23, 2025, 05:04 PM
0 votes
1 answers
367 views
Text file report is not generating of Availability Databases other Databases during auto backup through maintenance plans in MS SQL Server 2012
I have setup `Automated backup` in `SQL Server 2012 Enterprise` Database backup through `'Maintenance Plan'`. I have also configure `AlwaysOn High Availability` to that server .There is `5 databases` in the server, where there is `3 databases` has added `"Availability Database"` in Availability Grou...
I have setup Automated backup in SQL Server 2012 Enterprise Database backup through 'Maintenance Plan'. I have also configure AlwaysOn High Availability to that server .There is 5 databases in the server, where there is 3 databases has added "Availability Database" in Availability Groups and properly configured with 'secondary replica' & where 'Availability Mode' is 'Synchronous commit' between both server replica. The 'Maintenance Plan' backup is configure with 'copy-only backup' . Because i have added 3 databases in 'Availability Database' in availability group and which 'backup type' is 'full'. I am also attaching the screen shot here enter image description here Whenever i am not selecting 'copy-only backup' in 'Back Up Database Task' window , as per microsoft alert message ' at promtly windows shows the message like ' This backup type is not supported on a secondary replica and task will fail if the task runs on a secondary replica. For information , see http://go.microsoft.com/fwlink/?Linkid=208213 . whenever i am selecting 'For availability database,ignore Replica Priority for Backup and Backup on Primary Settings'. The message shows like that 'This backup type is not supported on a secondary replica and task will fail if the task runs on a secondary replica. Note: Ignoring the backup priority and availability group settings may results in simultaneous parallel backups if the maintenance plan is cloned on all replicas. for more information, see: http://go.microsoft.com/fwlink/?Linkid=208213 So, I have finally select the option like 'copy-only Backup' due to copy-only backup in 'secondary replica' . **Note:-** The 'Availability mode' of server is 'Synchronous commit' mode ( from 'Primary Replica Server' to 'Secondary Replica Server'). The schedule backup is running successfully , and 2 backup files are generating in (H: drive).Because out of 5 database (3 database are in full recovery mode, which are added in 'Availability Databases' and other 2 database are in 'simple recovery model'. Only 'Simple Recovery model' database backup file is generating. As microsoft BOL Here and MSSQLTIPS Blog documentation Here At the time of this writing, only transaction log backups and full backups with COPY_ONLY are supported on secondary replicas. **But the'text file report' is not generating.** I am attaching the 'Log file viewer' history screen shot here enter image description here I am also attaching the backup preferencesscreen window here. enter image description here **Note:-** The Schedule Backup location drive is 'Network Drive'. In mine case here, it is (H:) Drive. As shown in picture. I have configure the folder path of 'Reporting and logging' of my network drive. Here it is (H: Drive). I am attaching the screen shot of that window here enter image description here My MS SQL Server 2012 Enterprise version is > Microsoft SQL Server 2012 - 11.0.2325.0 (X64) Jun 8 2012 18:54:43 > Copyright (c) Microsoft Corporation Enterprise Edition: Core-based > Licensing (64-bit) on Windows NT 6.2 (Build 9200: ) (Hypervisor) -----------------After Edit --------------- Microsoft(R) Server Maintenance Utility (Unicode) Version 11.0.2325 Report was generated on "Primary Replica instace ID". Maintenance Plan: AlwaysOn Backup Duration: 00:00:01 Status: Succeeded. Details: Back Up Database (Full) (Primary Replica instance ID) Backup Database on Local server connection Databases: Database1,Database2,Database3,Database4,Database5 Type: Full Append existing Task start: 2016-09-10T00:00:01. Task end: 2016-09-10T00:00:03. Success Note:- Here i have edited my Server instance id as well as Database Name . Because this is my Live server database. Here only Database4 and Database5 file is generated after execution of schedule backup. Which time is showing like this in mail message. Which is Task start: 2016-09-10T00:00:01. Task end: 2016-09-10T00:00:03. Success **Note:-I am not including TSQL script here.** My concern is that What i am committing the mistake here for 'text file report' generation in 'Primary Replica Server'. Any tips or suggestions will be appreciated.
Md Haidar Ali Khan (6533 rep)
Sep 20, 2016, 11:51 AM • Last activity: May 18, 2025, 10:03 AM
0 votes
1 answers
47 views
in maintenance job, how to manually signal success or failure to notify task
i have a primary/secondary instance setup. I would like to only run a task when its the primary instance. To test: ``` tsql task- checks for primary if primary -> notify primary task -> email with subject primary if secondary -> notify secondary task -> email with subject secondary ``` ``` DECLARE @...
i have a primary/secondary instance setup. I would like to only run a task when its the primary instance. To test:
tsql task- checks for primary 
if primary   -> notify primary  task  -> email with subject primary
if secondary -> notify secondary task -> email with subject secondary
DECLARE @role_desc varchar(20),
                  @msg varchar(50) = 'ERROR -- no primary instance';
    IF EXISTS( SELECT hars.role_desc FROM sys.DATABASES d INNER JOIN sys.dm_hadr_availability_replica_states hars ON d.replica_id = hars.replica_id WHERE hars.role_desc = 'PRIMARY' )
    begin
      SELECT @role_desc = 'PRIMARY' 
    end
    ELSE
    begin
      SELECT @role_desc = 'SECONDARY' 
      RAISERROR(@msg, 5, 1);
    end
so far, i am only getting primary, although i am on the secondary instance
user30197 (11 rep)
Jan 10, 2025, 05:43 PM • Last activity: Jan 21, 2025, 12:41 PM
1 votes
1 answers
113 views
SQL Maintenance Plan failing
We have a Maintenance Plan active on our 2-node SQL cluster, which is failing since a week or so. The reason why it's failing is unclear to me. These are the Tasks : [![enter image description here][1]][1] [1]: https://i.sstatic.net/Lgwpatdr.jpg So my questions are : 1) Do we in fact need a maintena...
We have a Maintenance Plan active on our 2-node SQL cluster, which is failing since a week or so. The reason why it's failing is unclear to me. These are the Tasks : enter image description here So my questions are : 1) Do we in fact need a maintenance plan, and are these the correct steps? 2) How can I figure out the exact reason why it's failing? Eventvwr has very few details, and the Job Activity Monitor doesn't show details either. Thanks
Geert (11 rep)
Jan 9, 2025, 01:32 PM • Last activity: Jan 10, 2025, 09:25 AM
0 votes
0 answers
75 views
Index and Statistics Maintenance Scheduling Questions
I'm working on setting up a maintenance plans for some SQL Server instances. I'm trying to find a good/safe staring point to start the maintenance plan on and I can adjust and make appropriate changes based on the results. I'm using Ola Hallengren's maintenance solution to create the maintenance pla...
I'm working on setting up a maintenance plans for some SQL Server instances. I'm trying to find a good/safe staring point to start the maintenance plan on and I can adjust and make appropriate changes based on the results. I'm using Ola Hallengren's maintenance solution to create the maintenance plans and watched Brent Ozar's/Erik Darling's setting up Ola Hallengren's maintenance solution video among others. My idea so far has been to set up an index maintenance job and a separate statistics update job. I wanted to start off more conservatively by running the index maintenance job monthly and the statistics job weekly. Here is what I have setup for each job: Index (Runs monthly): EXECUTE [dbo].[IndexOptimize] @Databases = 'USER_DATABASES', @FragmentationMedium = 'INDEX_REORGANIZE', @FragmentationHigh = 'INDEX_REBUILD_OFFLINE,INDEX_REORGANIZE', @FragmentationLevel1 = 50, @FragmentationLevel2 = 80, @MinNumberOfPages = 5000, @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'Y', @LogToTable = 'Y' Statistics (Runs weekly): EXECUTE [dbo].[IndexOptimize] @Databases = 'USER_DATABASES', @FragmentationLow = NULL, @FragmentationMedium = NULL, @FragmentationHigh = NULL, @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'Y', @LogToTable = 'Y' I'm using Standard edition and have maintenance windows through the weekend and evenings. My questions are: 1. As a starting point with auto update statistics on, should I even create the weekly statistics job? Would auto update statistics and index maintenance with statistics maintenance once a month be a better starting point until I know for sure that some databases need more statistics updates? 2. If I should proceed with both the jobs, the index job runs on the first Friday of the month and statistics run on each Saturday. Should I flip the days around (statistics friday and index saturday), so the index job doesn't update statistics and get overwritten a day later with statistics updates? Ideally, I would like to do index optimize that first weekend and do statistics for the rest of the weekends when index isn't running but I'm not finding a way to schedule that with SSMS.
Solizmi (1 rep)
Aug 30, 2024, 06:06 PM
0 votes
0 answers
817 views
Maintenance Plans Failing Invalid Class String
This is on a SQL Server 2017. We are required to use maintenance plans for full/log backups and DBCC Checks. They have been working fine, but I received an email that they have failed yesterday. I see all jobs not based on maintenance plans are fine, but all jobs based from a maintenance plan fail....
This is on a SQL Server 2017. We are required to use maintenance plans for full/log backups and DBCC Checks. They have been working fine, but I received an email that they have failed yesterday. I see all jobs not based on maintenance plans are fine, but all jobs based from a maintenance plan fail. They are set for the SA account as owner and running as SQL Server Agent. Service accounts are running and accounts have permissions as I can run them manually just fine. Wrote to a output log for more details: >Started: 12:00:01 PM > >Could not load package "Maintenance Plans\Log" because of error 0x800401F3. > >Description: Invalid class string\ Source: \ Started: 12:00:01 PM\ Finished: 12:00:01 PM\ Elapsed: 0.219 seconds\ > >Microsoft (R) SQL Server Execute Package Utility\ Version 14.0.3465.1 for 64-bit\ > >Copyright (C) 2017 Microsoft. All rights reserved.\ I did install SSMS 20 yesterday, but then re-installed SSMS 19 and still have the issue. I'm not sure if it's related. I updated SSMS to 20 on many other database servers without any problems, but those were running SQL Server 2019. I'm not finding much on the web. Has anyone seen this before? Thanks
Lisa (1 rep)
Apr 26, 2024, 07:25 PM • Last activity: May 3, 2024, 11:20 AM
3 votes
1 answers
3403 views
SQL Maintenance Plan 'Could not find part of the path' - where is it getting the path from?
I have a SQL Server 2012 maintenance plan which backs up all of the databases. Today I had an issue with a failed backup which I was able to resolve by viewing the detail in the 'Log File Viewer' through SSMS: ![FullBackupError][1] The three 'child' items read as follows: 03/02/2014 05:36:48: Could...
I have a SQL Server 2012 maintenance plan which backs up all of the databases. Today I had an issue with a failed backup which I was able to resolve by viewing the detail in the 'Log File Viewer' through SSMS: FullBackupError The three 'child' items read as follows: 03/02/2014 05:36:48: Could not find a part of the path 'F:\\sql\\log\\Full Backup All Dbs_Subplan_1_20140203053648.txt'. 03/02/2014 05:36:48: Could not generate mail report.An exception occurred while executing a Transact-SQL statement or batch.No global profile is configured. Specify a profile name in the @profile_name parameter. 03/02/2014 04:00:01: Executing the query "BACKUP DATABASE [MainDb..." failed with the following error: "Write on "M:\\sql\\full\\MainDb\\MainDb_backup_2014_02_03_040001_7658846.bak" failed: 112(There is not enough space on the disk.) BACKUP DATABASE is terminating abnormally. 10 percent processed. 20 percent processed. 30 percent processed. 40 percent processed. 50 percent processed. 60 percent processed. 70 percent processed. 80 percent processed. 90 percent processed.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. I have now sorted out the disk space issue and have re-run the full backup successfully, but I remain concerned about the log item above which references F:\sql\log because the machine does not have an F: drive at all, just a C: and an M: drive. It does appear that the 'Could not generate mail report' issue is related but again this error is a bit odd; I am receiving emails when the various jobs complete and I was alerted to the disk space error via an email, so I wonder why an error is logged if the email was sent successfully? I've dug through the SQL Server, SQL Agent, Database Mail and the maintenance plan configurations but I can find nothing which is set to F:\sql\log and so I have no idea why the maintenance plan is trying to write to that path, or why it is logging an error when email is sent successfully. Can anyone help me to work out how to resolve this? Thanks for any assistance.
Elliveny (233 rep)
Feb 3, 2014, 10:32 AM • Last activity: Sep 16, 2023, 10:44 PM
0 votes
1 answers
138 views
Huge Transaction Log File - Full Database backup, but no Transaction log backups
I hope someone can help. Please be gentle, this type of admin is not what I usually do. I have inherited a database which is set up to do a FULL database backup at 02:00 every day. The transaction log is huge (almost 1TB) and has never had any backups (hence it is growing). The database is 172GB. Th...
I hope someone can help. Please be gentle, this type of admin is not what I usually do. I have inherited a database which is set up to do a FULL database backup at 02:00 every day. The transaction log is huge (almost 1TB) and has never had any backups (hence it is growing). The database is 172GB. The Logs and database are on different drives, as are the backups. We would like to put a new maintenance plan in place with 1 FULL backup every week, 4 differential backups each day, and transaction log backups every 15 minutes. The size of the transaction log is worrying me. We don't have a drive with that space in order to back it up. Can I set the backup type to Simple, delete the transaction log, change back to Full, then set up the new jobs to do the differential and log file backups? Or will that break something? Is there a proper / better way to deal with this transaction log - I'm worried we will run out of space soon on the drive. Very happy to provide more info if needed. I wasn't sure what would be pertinent at this point. Thanks in advance.
Jubs666 (1 rep)
Jul 24, 2023, 02:10 PM • Last activity: Jul 24, 2023, 03:34 PM
1 votes
1 answers
6891 views
What does [298] SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'WIN-443PT0LULQU\Administrator', error code 0x534
I'm going slightly nuts. I'm a programmer by trade - and I only dabble in NT security and DB setup issues. However, we had a server fail to reboot after a MS Update. I've restored the entire machine from Windows Backup - but I've realized that I cannot rebuild the machine because one cannot realisti...
I'm going slightly nuts. I'm a programmer by trade - and I only dabble in NT security and DB setup issues. However, we had a server fail to reboot after a MS Update. I've restored the entire machine from Windows Backup - but I've realized that I cannot rebuild the machine because one cannot realistically use a Windows Backup to restore a database to a different machine, AFAICT. Rather, I need actual DB backups to do that. In pursuit of having regular SQL Server backups, I'm running into the title error: SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'WIN-443PT0LULQU\Administrator', error code 0x534 Essentially, I've enabled SQL Server Agent viz SSMS, then I created a management plan to do full backups on our SQL server instance, and scheduled it for daily operations. However, when I manually ask it to execute that job - to ensure all is working correctly - I get the error: SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'WIN-443PT0LULQU\Administrator', error code 0x534 That sounds to me like an NT permissions issue - that whatever it is - XP Agent? - attempts to retrieve the permissions of the aforementioned user - and that fails. Part of what is bizarre here - is there is not machine 'WIN-443PT0LULQU' - that doesn't exist - WTH is SQL Server forcing that in there for in the first place?! I want this to run as the Administrator - on the local machine 'BUILD-SERVER' - not that garbage name it keeps forcing... I'm way out of my depth here and this whole process is crazy-making. How in 2018 is it not possibly to click a few wizard NEXT style buttons and configure Windows / SQL Server to back its freakin' self up regularly correctly?
Mordachai (123 rep)
May 31, 2018, 12:40 PM • Last activity: Jul 5, 2023, 08:59 AM
-1 votes
1 answers
300 views
SQL Server error on Maintenance Plan: could not continue scan with NOLOCK due to data movement
We're using the solution of Hallengren for the maintenance of the database. The Maintenance of Hallengren we use is **SQL Server Index and Statistics Maintenance**. cc IndexOptimize Lately, we're getting the following error on a specific table: > **could not continue scan with NOLOCK due to data mov...
We're using the solution of Hallengren for the maintenance of the database. The Maintenance of Hallengren we use is **SQL Server Index and Statistics Maintenance**. cc IndexOptimize Lately, we're getting the following error on a specific table: > **could not continue scan with NOLOCK due to data movement** DBCC CHECKDB returns no errors. The error is found when we manually run the procedure (We have scheduled a job to do this but since we were unable to see the error we manually run it to see what happens). We have found the table that the problem occurs. Is there any idea on how to proceed with the resolution of the above statement?
Vasileios G (43 rep)
Jun 26, 2023, 06:33 AM • Last activity: Jun 27, 2023, 09:02 AM
2 votes
1 answers
1459 views
SQL Server maintenance plan not working after renaming administrator
I have renamed the Windows administrator account to `TEST` using Local Group Policy editor. After that, the SQL Server maintenance plans are not working anymore: > Unable to determine if the owner of job has server access I have tried methods below but no luck yet: 1. I have tried to add a login to...
I have renamed the Windows administrator account to TEST using Local Group Policy editor. After that, the SQL Server maintenance plans are not working anymore: > Unable to determine if the owner of job has server access I have tried methods below but no luck yet: 1. I have tried to add a login to SQL Server for TEST account, but it says that this login already exists. I can not see the name of TEST in the Login tab, but the administrator exists already 2. I have deleted the Maintenance plans and created new ones but no change happened Please let me know if there is another way to connect the Maintenance plans to the new administrator name.
Ali Sheikhpour (231 rep)
Dec 22, 2018, 10:54 AM • Last activity: Jan 26, 2023, 04:22 AM
2 votes
0 answers
456 views
Setting up Database Integrity Checks
I'm relatively new to SQL and, unfortunately, am definitely not at the level of a DBA - However, it's become my job to look into some SQL issues... There's a Database Integrity Check set to run for one of our customers every evening from 21:30 - This usually runs for approximately 2-5 hours (give or...
I'm relatively new to SQL and, unfortunately, am definitely not at the level of a DBA - However, it's become my job to look into some SQL issues... There's a Database Integrity Check set to run for one of our customers every evening from 21:30 - This usually runs for approximately 2-5 hours (give or take) however in recent times has increased in duration reaching up to 8-9 hours - I'm not too clear on causation here, but I believe the databases are quite large and this could potentially just be down to how large those databases are. From reading through https://social.technet.microsoft.com/wiki/contents/articles/54312.sql-server-database-integrity-check-best-practices.aspx - It suggests separating the Integrity checks into phases - My question is this: **Would I be setting up separate scheduled jobs on separate times/days to space these checks out?** Presumably running the below would be no different than me simply running CHECKDB, correct? EXECUTE dbo.DatabaseIntegrityCheck @Databases = 'ALL_DATABASES', @CheckCommands = 'CHECKALLOC,CHECKTABLE,CHECKCATALOG' So, in theory I would guess that I want three separate scheduled jobs at different times like so: EXECUTE dbo.DatabaseIntegrityCheck @Databases = 'ALL_DATABASES', @CheckCommands = 'CHECKALLOC' EXECUTE dbo.DatabaseIntegrityCheck @Databases = 'ALL_DATABASES', @CheckCommands = 'CHECKTABLE' EXECUTE dbo.DatabaseIntegrityCheck @Databases = 'ALL_DATABASES', @CheckCommands = 'CHECKCATALOG' Would we say that this is accurate? Thanks for any time spent on answering this query. 1) Microsoft SQL Server 2012, exact version would be 11.0.5058.0 (for MSSMS) 2) There's one single Step in the job named "Integrity Check" of the type "T-SQL" and within that is the script I list above (dbo.DatabseIntegrityCheck across ALL_DATABASES) 3) Total size of all DB's from what I can see would be 1.1 TB
Yeldur (21 rep)
Dec 14, 2022, 11:37 AM • Last activity: Jan 6, 2023, 06:59 AM
0 votes
1 answers
146 views
Very long timestamp for a backup file created via a Maintenance Plan
I have been using Maintenance Plans to back up my databases. It works well enough for me but I am curious to know why the .bak have a very long date/time suffix. Here is an example: MyDatabase_backup_2022_10_27_213008_2710399.bak I can see the yyyy_MM_dd_hhmmss format but what about the rest (271039...
I have been using Maintenance Plans to back up my databases. It works well enough for me but I am curious to know why the .bak have a very long date/time suffix. Here is an example: MyDatabase_backup_2022_10_27_213008_2710399.bak I can see the yyyy_MM_dd_hhmmss format but what about the rest (2710399), microseconds...? Thanks,
JLL (3 rep)
Oct 28, 2022, 07:44 PM • Last activity: Oct 28, 2022, 09:12 PM
2 votes
0 answers
613 views
Include stored procedure text output in the maintenance plan log
I have a maintenance plan subtask in SQL Server 2012 Enterprise that executes a stored procedure (or a SQL Server agent job). In the log file for this maintenance plan, there are a few lines for this task, such as the start- and end- date, and the SQL statement used to execute the stored procedure....
I have a maintenance plan subtask in SQL Server 2012 Enterprise that executes a stored procedure (or a SQL Server agent job). In the log file for this maintenance plan, there are a few lines for this task, such as the start- and end- date, and the SQL statement used to execute the stored procedure. Can I somehow generate text output in the stored procedure and have it included in the log? It does not absolutely have to be part of the log file, but I would greatly prefer it that way. I would like to avoid another table which has to be separately cleaned up, backed up, documented, etc.
HugoRune (371 rep)
Mar 6, 2017, 12:18 PM • Last activity: Oct 28, 2022, 12:57 PM
2 votes
2 answers
522 views
Availability Group - Deleting old backup files
I'm using Azure VMs with a SQL Server Availability Group, and Ola Hallengren' scripts. Backups are working without issues, however I've noticed that old backup files are not being removed from the server. To remove the files, I'm running this command; DECLARE @BackupDir NVARCHAR(4000) = (SELECT Back...
I'm using Azure VMs with a SQL Server Availability Group, and Ola Hallengren' scripts. Backups are working without issues, however I've noticed that old backup files are not being removed from the server. To remove the files, I'm running this command; DECLARE @BackupDir NVARCHAR(4000) = (SELECT BackupDir = dbo.fn_SQLServerBackupDir()) DECLARE @Date DATETIME = DATEADD(DAY, -4, GETDATE()) EXECUTE [master].[dbo].xp_delete_file 0, @BackupDir, 'bak', @Date, 1; **Note**: The function gets the default backup location for the SQL Instance. Whenever I run this command, it completes successfully, but no files are removed. The Cleanup process that is included in the Ola Hallengren script is also unable to remove files. In other environments, that are not AGs, the above command, plus the Cleanup in Ola Hallengren' script, work without issues. This leads me to think the issue is either environment related or has something to do with the fact the backups where performed on databases in an AG. Has anyone else encountered something like this before and might be able to offer some insight? Backups are stored on the F:\ drive, which is a local disk on the server. I have also confirmed that the correct permissions have been set. At the moment, I've set full control for Everyone. (Environment is not live yet). I tried modifying the function to add the \ at the end of the backup path, but this did not fix the issue. I've confirmed that there are backups which meet the date requirement, too. **EDIT 1:** Here is the backup command that's running, which includes the @Cleanup parameter, that doesn't remove the files; EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @BackupType = 'Log', @Verify = 'Y', @Checksum = 'Y', @Compress = 'Y', @LogToTable = 'Y', @CleanupTime = 0, @AvailabilityGroupDirectoryStructure = '{DatabaseName}', @AvailabilityGroupFileName = '{DatabaseName}_{BackupType}_{Partial}_{CopyOnly}_{Year}_{Month}_{Day}_{Hour}{Minute}{Second}_{FileNumber}.{FileExtension}', @Encrypt = 'Y', @EncryptionAlgorithm = 'AES_256' , @ServerCertificate = 'Cert_Name'
Tom.Wheater (193 rep)
Aug 27, 2019, 12:47 PM • Last activity: Sep 22, 2022, 08:03 PM
5 votes
2 answers
6102 views
How to specify a SQL Server maintenance plan subtask to run unconditionally on success or failure of preceding tasks?
I am having a (rather standard) daily maintenance plan created with SQL Server Management Studio Maintenance Plan Wizard. ![enter image description here][1] AFAIU, the penultimate task "Back Up Database Task" will be executed only on the success of all preceding tasks. Since the constraints (arrows...
I am having a (rather standard) daily maintenance plan created with SQL Server Management Studio Maintenance Plan Wizard. enter image description here AFAIU, the penultimate task "Back Up Database Task" will be executed only on the success of all preceding tasks. Since the constraints (arrows containing tasks) are all the same (taken from default options creation): enter image description here and use "Logical AND" Now if I change in the preceding constraint the "Logical AND" to "Logical OR", the backup task still will fail if one of the preceding tasks fail. Correct? How can I make the backup task to run in any case? **UPDATE** After accepting the answers, I am still in doubt about the term "completion": Does failed task considered to be run to completion in SQL Server maintenance plan terminology?
Fulproof (1392 rep)
Sep 24, 2013, 10:41 AM • Last activity: Sep 2, 2022, 08:02 AM
0 votes
0 answers
154 views
Maintenance plan run date wrong
Win server 2019 & SQL Server 2017 On Jan 28th, 2022, I setup 3 maintenance plans to backup 3 databases from 3:00AM – 3:40AM. The last one finishes at 3:45AM. For a few weeks I confirmed that I am getting backups every day and then did not check till today **03/17/2022 at about 12:00PM** Today I happ...
Win server 2019 & SQL Server 2017 On Jan 28th, 2022, I setup 3 maintenance plans to backup 3 databases from 3:00AM – 3:40AM. The last one finishes at 3:45AM. For a few weeks I confirmed that I am getting backups every day and then did not check till today **03/17/2022 at about 12:00PM** Today I happen to notice that the most recent backups of all the databases were dated **03/16/2022.** Both in the backup name as well as Windows File stamp. 03/16/2022 03:44 AM 2,383 Daily_DBNAME_Subplan_1_20220316034417.txt I then checked the maintenance plan history for each job and not one job was missed or reported a failure since inception, but in each case the most recent job reported had the previous days’ date. 3/16/2022 3:44 Success Daily_DBNAME Subplan_1 I found an unrelated post, wherein the sysadmin had changed the date (month) incorrectly and now all jobs were scheduled to next run a month later. In this case the Dbadmin resolved it by changing the create date to the next run date. But in his case the jobs had stopped running. In my case jobs are running, just showing yesterday's date. After changing the job create date to 03/18/2022. The following is the result of a query on all jobs. Will update on results. Daily_DBNAME1.Subplan_1 Daily Every Day 3:00:00 3/18/2022 3:00 Daily_DBNAME2.Subplan_1 Daily Every Day 3:20:00 3/18/2022 3:20 Daily_DBNAME3.Subplan_1 Daily Every Day 3:40:00 3/18/2022 3:40 Does anybody know why?
Lansend (1 rep)
Mar 17, 2022, 08:09 PM • Last activity: Mar 17, 2022, 09:45 PM
0 votes
1 answers
48 views
Stop Changes to Maintenance Plan from Renaming Linked SQL Agent Job
Is there a way to stop a SQL job (which calls a maintenance plan) from being renamed every time i open and save that maintenance plan? Each time i do that, a prefix of "_SubPlan" gets added to the name of the job - even after i've removed it. Thanks
Is there a way to stop a SQL job (which calls a maintenance plan) from being renamed every time i open and save that maintenance plan? Each time i do that, a prefix of "_SubPlan" gets added to the name of the job - even after i've removed it. Thanks
SQLNewbie (11 rep)
Feb 11, 2022, 11:34 AM • Last activity: Feb 11, 2022, 03:58 PM
0 votes
2 answers
2967 views
Maximum Error Count Reached
I created a maintenance plan to backup all the databases locally on a folder in E Drive. Out of nowhere, the job is failing occasionally. sometimes the job runs successfully and sometimes sends an error. The point of confusion is that even though the we receive an error that the job failed, i can se...
I created a maintenance plan to backup all the databases locally on a folder in E Drive. Out of nowhere, the job is failing occasionally. sometimes the job runs successfully and sometimes sends an error. The point of confusion is that even though the we receive an error that the job failed, i can see the latest .bak files in the directory. I even restored those db's and the data within the tables are synced. This happens in 7/10 errors. sometimes, there is only backup of master, model and user db and sometimes we have all the databases backed up even on failure. Below is the error: Message >Executed as user: WIN-N81LQ9R0SAA\localadmin . Microsoft (R) SQL Server Execute Package Utility Version 13.0.5830.85 for 64-bit Copyright (C) 2016 Microsoft. All rights reserved. Started: 3:53:00 PM Progress: 2020-11-18 15:53:01.44 Source: {F019CE0D-91E8-4CA8-9CCD-F5B3BB69E1D4} Executing query "DECLARE @Guid UNIQUEIDENTIFIER EXECUTE msdb..sp...".: 100% complete End Progress Progress: 2020-11-18 15:53:01.77 Source: Maintenance Cleanup Task Executing query "EXECUTE master.dbo.xp_delete_file 0,N'E:\DatabaseB...".: 100% complete End Progress Progress: 2020-11-18 15:53:01.91 Source: Back Up Database Task Executing query "BACKUP DATABASE [master] TO DISK = N'E:\DatabaseB...".: 50% complete End Progress Progress: 2020-11-18 15:53:01.97 Source: Back Up Database Task Executing query "declare @backupSetId as int select @backupSetId =...".: 100% complete End Progress Progress: 2020-11-18 15:53:02.08 Source: Back Up Database Task Executing query "BACKUP DATABASE [model] TO DISK = N'E:\DatabaseBa...".: 50% complete End Progress Progress: 2020-11-18 15:53:02.13 Source: Back Up Database Task Executing query "declare @backupSetId as int select @backupSetId =...".: 100% complete End Progress Progress: 2020-11-18 15:53:02.37 Source: Back Up Database Task Executing query "BACKUP DATABASE [msdb] TO DISK = N'E:\DatabaseBac...".: 50% complete End Progress Progress: 2020-11-18 15:53:02.56 Source: Back Up Database Task Executing query "declare @backupSetId as int select @backupSetId =...".: 100% complete End Progress Progress: 2020-11-18 15:53:02.76 Source: Back Up Database Task Executing query "BACKUP DATABASE [xyz] TO DISK...".: 50% complete End Progress Progress: 2020-11-18 15:53:02.89 Source: Back Up Database Task Executing query "declare @backupSetId as int select @backupSetId =...".: 100% complete End Progress Progress: 2020-11-18 15:53:14.53 Source: Back Up Database Task Executing query "BACKUP DATABASE [abc] TO DISK = N'E:\D...".: 50% complete End Progress Error: 2020-11-18 15:53:17.54 Code: 0xC002F210 Source: Back Up Database Task Execute SQL Task Description: Executing the query "declare @backupSetId as int select @backupSetId =..." failed with the following error: "A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The network connection was aborted by the local system.)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. End Error Warning: 2020-11-18 15:53:17.54 Code: 0x80019002 Source: Subplan_1 Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. End Warning DTExec: The package execution returned DTSER_FAILURE (1). Started: 3:53:00 PM Finished: 3:53:17 PM Elapsed: 16.875 seconds. The package execution failed. The step failed. Can someone please explain this strange behavior and help us resolving this issue? Below is the error i got in Maintenace plan history. Error Number: -1073548784 Error Message: Executing the query "declare @backupSetId as int select @backupSetId =..." failed with the following error: "A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The network connection was aborted by the local system.)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. TSQL Code: BACKUP DATABASE [master] TO DISK = N''E:\DatabaseBackups\Daily16\master_backup_2020_11_24_155301_7291762.bak'' WITH NOFORMAT, NOINIT, NAME = N''master_backup_2020_11_24_155301_7291762'', SKIP, REWIND, NOUNLOAD, COMPRESSION, STATS = 10 GO declare @backupSetId as int select @backupSetId = position from msdb..backupset where database_name=N''master'' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N''master'' ) if @backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''master'''' not found.'', 16, 1) end RESTORE VERIFYONLY FROM DISK = N''E:\DatabaseBackups\Daily16\master_backup_2020_11_24_155301_7291762.bak'' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND GO BACKUP DATABASE [model] TO DISK = N''E:\DatabaseBackups\Daily16\model_backup_2020_11_24_155301_7331781.bak'' WITH NOFORMAT, NOINIT, NAME = N''model_backup_2020_11_24_155301_7331781'', SKIP, REWIND, NOUNLOAD, COMPRESSION, STATS = 10 GO declare @backupSetId as int select @backupSetId = position from msdb..backupset where database_name=N''model'' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N''model'' ) if @backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''model'''' not found.'', 16, 1) end RESTORE VERIFYONLY FROM DISK = N''E:\DatabaseBackups\Daily16\model_backup_2020_11_24_155301_7331781.bak'' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND GO BACKUP DATABASE [msdb] TO DISK = N''E:\DatabaseBackups\Daily16\msdb_backup_2020_11_24_155301_7361812.bak'' WITH NOFORMAT, NOINIT, NAME = N''msdb_backup_2020_11_24_155301_7361812'', SKIP, REWIND, NOUNLOAD, COMPRESSION, STATS = 10 GO declare @backupSetId as int select @backupSetId = position from msdb..backupset where database_name=N''msdb'' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N''msdb'' ) if @backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''msdb'''' not found.'', 16, 1) end RESTORE VERIFYONLY FROM DISK = N''E:\DatabaseBackups\Daily16\msdb_backup_2020_11_24_155301_7361812.bak'' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND GO BACKUP DATABASE [abc] TO DISK = N''E:\DatabaseBackups\Daily16\abc_backup_2020_11_24_155301_7391866.bak'' WITH NOFORMAT, NOINIT, NAME = N''abc_backup_2020_11_24_155301_7391866'', SKIP, REWIND, NOUNLOAD, COMPRESSION, STATS = 10 GO declare @backupSetId as int select @backupSetId = position from msdb..backupset where database_name=N''abc'' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N''abc'' ) if @backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''abc'''' not found.'', 16, 1) end RESTORE VERIFYONLY FROM DISK = N''E:\DatabaseBackups\Daily16\abc_backup_2020_11_24_155301_7391866.bak'' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND GO BACKUP DATABASE [xyz] TO DISK = N''E:\DatabaseBackups\Daily16\xyz_backup_2020_11_24_155301_7411886.bak'' WITH NOFORMAT, NOINIT, NAME = N''xyz_backup_2020_11_24_155301_7411886'', SKIP, REWIND, NOUNLOAD, COMPRESSION, STATS = 10 GO declare @backupSetId as int select @backupSetId = position from msdb..backupset where database_name=N''xyz'' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N''xyz'' ) if @backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''xyz'''' not found.'', 16, 1) end RESTORE VERIFYONLY FROM DISK = N''E:\DatabaseBackups\Daily16\xyz_backup_2020_11_24_155301_7411886.bak'' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND GO
Azeem Khan (1 rep)
Nov 25, 2020, 09:59 AM • Last activity: Jan 27, 2022, 08:07 AM
Showing page 1 of 20 total questions