Sample Header Ad - 728x90

Database Administrators

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

Latest Questions

0 votes
3 answers
2911 views
SQL Server Agent & sp_send_dbmail failing on permissions
I have set up a SQL Server Agent job to call `sp_send_dbmail` with a very simple select on a certain table in a certain database. Within the properties > permissions of the target database, the Database Role 'public' has `select` permission. The job runs fine, the email arrives, all good. The proble...
I have set up a SQL Server Agent job to call sp_send_dbmail with a very simple select on a certain table in a certain database. Within the properties > permissions of the target database, the Database Role 'public' has select permission. The job runs fine, the email arrives, all good. The problem is, if I turn off the worryingly generous 'public' select permission and try to add the SQLServerAgent user (which is the user the agent is running under and the user that owns the agent job) and give them select permissions, the job fails with this error message: > Failed to initialize sqlcmd library with error number -2147467259. > [SQLSTATE 42000] (error 22050) Can anyone shed any light on this for me? I suspect that maybe a different user is involved in some way. I cannot get SQL Server Profiler to run (it's not installed) and I don't have access to the server to install it.
Columbo (123 rep)
Jan 13, 2021, 12:33 PM • Last activity: Aug 2, 2025, 06:06 AM
1 votes
1 answers
1322 views
Mysql 8 event scheduler timezone
I'm a bit confused about the **event scheduler**. First off, it is running and working, but the timezone handling confuses me a bit, as it seems it's not what is documented on [events metadata][1] [1]: https://dev.mysql.com/doc/refman/8.0/en/events-metadata.html - It says that mysql.event table hold...
I'm a bit confused about the **event scheduler**. First off, it is running and working, but the timezone handling confuses me a bit, as it seems it's not what is documented on events metadata - It says that mysql.event table holds event data as well. This table does not exist in our system. - It also says in the info schema, **starts** and **last_executed** are displayed as event **timezone**, but that doesn't seem to be the case in our system either. starts = reported as 'system' time zone, currently UTC -0400, hence I had to make the start time -4 hours to have it run in UTC at the start of next month (2019-07-31 20:00:00). I know I can set the session timezone to UTC. While that works, as soon as you edit the event, the old gets deleted and a new **create** event is triggered by **phpmyadmin** ( possibly bug? ). I also know I can run the commands in SQL tab with alter an event, but I am not the only one accessing the system, and anyone could basically use the event interface to edit the event = back to the system timezone **timezone** reported after adding is system (UTC -4). On a test run, last_executed was in UTC (no problem really, but it's not what docs say) Now docs say mysql.event displays the start used to add the event in utc ( again our system not has this table ) and stores the timezone used to prevent wrong timings when changing timezones What happens when we possibly change the system timezone at a later point? since info schema reports as system and not -0400 what would happen to our event which right now has a starts time of 31.07.2019 20:00:00? Say we change to utc, would the starts column update to reflect this change? Would the timezone reflect the change? I'm afraid our event would then possibly run at 8pm in utc instead of -0400, since timezone in info schema might still be 'system' then. Anyone has some insight on this? Don't really want to mess with the global timezone to test this out, since system is in production. Appreciate any help/insights on this, Seb
Sebastian Witt (11 rep)
Jul 1, 2019, 09:59 PM • Last activity: Jul 29, 2025, 02:01 PM
0 votes
1 answers
145 views
SQL Server Replication - only ran once. How to configure scheduler from beginning
I have configured a transactional replication from server A to Server B some 2 month ago. The source database is a new production server, and the data is being updated there constantly. I have some issues ... I am not sure how to resolve. 1. I see that the "last sync" occurred 2 month ago, when I in...
I have configured a transactional replication from server A to Server B some 2 month ago. The source database is a new production server, and the data is being updated there constantly. I have some issues ... I am not sure how to resolve. 1. I see that the "last sync" occurred 2 month ago, when I initially set it up. - I was expecting a snapshot job to be of a periodic nature, but it is not. - It is actually set to a "One time" and is not enabled. I know, I can "enable it" and set the schedule for the future, however I am looking for how to do it at the time when I configure the replication. I may be configuring it with the script and be expecing the configuration go into effect from the power shell script rn, and want to make sure i know how to set the schedule from the beginning. This is what I see in a schedule of a Snapshot job on the Sql Server agent. Replication Snapshot-agent job
Dmitriy Ryabin (111 rep)
May 21, 2024, 01:55 PM • Last activity: Jul 20, 2025, 06:03 AM
0 votes
2 answers
2130 views
SQL Server Backup Jobs Failing. The error seems to be related to MaximumErrorCount, but I am not sure how to fix value or if changing it will resolve?
My backup jobs are failing with following error when check it's history. I have already checked this link regarding maximumerrorcount value: [SQL Server 2008 - Change the MaximumErrorCount or fix the errors](https://stackoverflow.com/questions/3250648/sql-server-2008-change-the-maximumerrorcount-or-...
My backup jobs are failing with following error when check it's history. I have already checked this link regarding maximumerrorcount value: [SQL Server 2008 - Change the MaximumErrorCount or fix the errors](https://stackoverflow.com/questions/3250648/sql-server-2008-change-the-maximumerrorcount-or-fix-the-errors) . At this point I'm not sure what to do if maximumerrorcount is only masking the actual problem. Log job history (DB_TaxExemption_BKP.Subplan_1): > Step ID 1 Server INHOUSE-DB Job Name DB_TaxExemption_BKP.Subplan_1 > Step Name Subplan_1 Duration 00:00:00 Sql Severity 0 Sql Message ID 0 > Operator Emailed Operator Net sent Operator Paged Retries Attempted 0 > Message Executed as user: NT AUTHORITY\LOCAL SERVICE. Microsoft (R) > SQL Server Execute Package Utility Version 14.0.1000.169 for 64-bit > Copyright (C) 2017 Microsoft. All rights reserved. Started: 10:12:00 > PM Error: 2022-03-30 22:12:00.47 Code: 0xC00291EC Source: > {4D6AAF94-D3FC-4873-9F66-E35E323A6BEE} Execute SQL Task Description: > Failed to acquire connection "Local server connection". Connection may > not be configured correctly or you may not have the right permissions > on this connection. End Error Warning: 2022-03-30 22:12:00.47 Code: > 0x80019002 Source: OnPreExecute 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 Error: 2022-03-30 > 22:12:00.48 Code: 0xC0024104 Source: Back Up Database (Full) > Description: The Execute method on the task returned error code > 0x80131904 (Login failed for user 'backupuser'.). The Execute method > must succeed, and indicate the result using an "out" parameter. End > Error ## Heading ##Error: 2022-03-30 22:12:00.48 Code: 0xC0024104 > Source: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} Description: The > Execute method on the task returned error code 0x80131904 (Login > failed for user 'backupuser'.). The Execute method must succeed, and > indicate the result using an "out" parameter. End Error Warning: > 2022-03-30 22:12:00.48 Code: 0x80019002 Source: OnPostExecute > Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The > Execution method succeeded, but the number of errors raised (2) > 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: 10:12:00 PM Finished: 10:12:00 PM Elapsed: 0.219 seconds. The > package execution failed. The step failed I know for sure that the user for this backup job is sysadmin and it is not locked out all rights are grated. And this is production so I cannot take many risks. What am I missing ?
Syed sabeeh Ahmed Fatmi (9 rep)
Apr 1, 2022, 05:52 AM • Last activity: Jul 10, 2025, 07:03 PM
2 votes
1 answers
189 views
Disabled SQL Server job still being run
SQL Server 15.0.4395.2 We have a SSIS package that we run to interface with another system. It is (or was) run from a SQL Server Agent job, and scheduled to run every hour. For reasons outside the scope of this question, the link to the other system became defunct and the package fails whenever it i...
SQL Server 15.0.4395.2 We have a SSIS package that we run to interface with another system. It is (or was) run from a SQL Server Agent job, and scheduled to run every hour. For reasons outside the scope of this question, the link to the other system became defunct and the package fails whenever it is run. This is not a problem - we disabled the job in SQL Server Agent, and according to the Job Activity Monitor (both the main screen and the job history screen) it hasn't run since 8th August. That's absolutely what we expect to see. But if we go to the database in Integration Service Catalogs and run the All Executions report, that package still shows up as being run (and failing) every hour. There's nothing running with that frequency in SQL Server Agent, where is that job coming from? Is there some other way of scheduling packages to run that won't show up in SQL Agent? It's a fairly old system, so there might be ancient code lurking somewhere!
Chris Hunt (121 rep)
Oct 11, 2024, 08:56 AM • Last activity: Jul 8, 2025, 07:02 AM
1 votes
2 answers
2059 views
Is it possible to query for the job schedule description?
Working on putting together a script to analyze all of the active jobs and I have nearly everything I need, but if possible I would like to be able to query for the schedules description as well. Is this possible? I am able to query for the name and ID out of ```msdb.dbo.sysschedules``` but it doesn...
Working on putting together a script to analyze all of the active jobs and I have nearly everything I need, but if possible I would like to be able to query for the schedules description as well. Is this possible? I am able to query for the name and ID out of
.dbo.sysschedules
but it doesn't seem to have the schedules description. Where can I find this information?
Jeremy S. (237 rep)
Nov 27, 2019, 05:23 PM • Last activity: Jul 1, 2025, 09:15 AM
1 votes
2 answers
197 views
SQL SERVER Detailed Backup Report
I need to create a script that gives the report for the following information: - Backup Job Name - Databases that have been backed up in the last 24 hours - Size of each DB backup - Start time of backup - End time of backup - Duration of backup - Location of the backup files I need to still include...
I need to create a script that gives the report for the following information: - Backup Job Name - Databases that have been backed up in the last 24 hours - Size of each DB backup - Start time of backup - End time of backup - Duration of backup - Location of the backup files I need to still include Log backup information, backup size and the location of the backup files stored. Could someone point me in the right direction of how to better my query? Thanks in advance. What I have tried:
@dbname sysname
SET @dbname = NULL --set this to be whatever dbname you want
SELECT 
  bup.database_name AS [Database],
  bup.server_name AS [Server],
  bup.backup_start_date AS [Backup Started],
  bup.backup_finish_date AS [Backup Finished]
  ,CAST((CAST(DATEDIFF(s, bup.backup_start_date, bup.backup_finish_date) AS int))/3600 AS varchar) + ' hours, ' 
  + CAST((CAST(DATEDIFF(s, bup.backup_start_date, bup.backup_finish_date) AS int))/60 AS varchar)+ ' minutes, '
  + CAST((CAST(DATEDIFF(s, bup.backup_start_date, bup.backup_finish_date) AS int))%60 AS varchar)+ ' seconds'
  AS [Total Time]
FROM msdb.dbo.backupset bup
WHERE bup.backup_set_id IN
  (SELECT MAX(backup_set_id) 
   FROM msdb.dbo.backupset
   WHERE database_name = ISNULL(@dbname, database_name) --if no dbname, then return all
   AND type = 'D' --only interested in the time of last full backup
   GROUP BY database_name) 
/* COMMENT THE NEXT LINE IF YOU WANT ALL BACKUP HISTORY */
AND bup.database_name IN (SELECT name FROM master.dbo.sysdatabases)
ORDER BY bup.database_name
sqllover2020 (73 rep)
Dec 23, 2020, 09:47 PM • Last activity: Jun 25, 2025, 07:04 PM
0 votes
1 answers
217 views
Would re-seeding the InstanceID column of sys.jobhistory table create issues?
I have two Production servers, one active, one passive. On the active server, application specific jobs are enabled and run all the time. Jobs on the passive server do not run. On a regular schedule, we fail over between the servers to test our fail over process. Once done, we remain on the "new" se...
I have two Production servers, one active, one passive. On the active server, application specific jobs are enabled and run all the time. Jobs on the passive server do not run. On a regular schedule, we fail over between the servers to test our fail over process. Once done, we remain on the "new" server until the next scheduled fail over. We have a custom service built that logs job statuses to splunk utilizing the InstanceID from sys.jobhistory. Problem is, when we fail over, the InstanceID on the passive node is MUCH smaller than the active one, and the service is checking for "max(InstanceID)" to know what record in history to begin pulling data from. My questions is around reseeding the identity column in sys.jobhistory as part of the fail over process to be max(id) from prod server + 1. In theory this should work, but I'm concerned with any potential issues.
RickS (1 rep)
Jun 15, 2021, 03:42 PM • Last activity: Jun 17, 2025, 05:01 PM
1 votes
1 answers
226 views
How to verify DBCC CHECKDB
I am logging the `DBCC CHECKDB` job output to a table. When I look at the job log using the below command, I want to verify that all is well. use msdb EXEC dbo.sp_help_jobsteplog @job_name = N'DatabaseIntegrityCheck - USER_DATABASES' ; Would you say that we are good if we see "Outcome: Succeeded" in...
I am logging the DBCC CHECKDB job output to a table. When I look at the job log using the below command, I want to verify that all is well. use msdb EXEC dbo.sp_help_jobsteplog @job_name = N'DatabaseIntegrityCheck - USER_DATABASES' ; Would you say that we are good if we see "Outcome: Succeeded" in the log for the job or is there something else we should also review? We are using Ola's job output but I am also logging it to a table and am just wondering about the output. If we see "outcome succeeded' in the job, is this enough to know the CHECKDB found nothing wrong?
cspell (511 rep)
Aug 31, 2017, 02:19 PM • Last activity: Jun 7, 2025, 09:04 PM
1 votes
2 answers
2074 views
Cannot run a job to update table on a linked server
I am running SQL Server 2012 on a server (server 1) and have set up a job to run a stored procedure which will summarize data from a series of tables and update a table on a linked server (server 2) which is also SQL Server 2012. I can successfully run the stored procedure on it's own, but when the...
I am running SQL Server 2012 on a server (server 1) and have set up a job to run a stored procedure which will summarize data from a series of tables and update a table on a linked server (server 2) which is also SQL Server 2012. I can successfully run the stored procedure on it's own, but when the scheduled job runs, I get the following error: >Executed as user: NT AUTHORITY\NETWORK SERVICE. The OLE DB provider "SQLNCLI11" for linked server "222.222.222.222" reported an error. Authentication failed. [SQLSTATE 42000] (Error 7399) Cannot initialize the data source object of OLE DB provider "SQLNCLI11" for linked server "222.222.222.222". [SQLSTATE 42000] (Error 7303) OLE DB provider "SQLNCLI11" for linked server "222.222.222.222" returned message "Invalid authorization specification". [SQLSTATE 01000] (Error 7412). The step failed.,00:00:00,16,7412,,,,0 I suspect this is a security issue, but cannot find the settings that will let me run this.
Tim (11 rep)
Mar 14, 2018, 06:55 PM • Last activity: May 29, 2025, 03:01 PM
0 votes
2 answers
413 views
How automate backup and restore in Azure SQL Managed Instance?
I'm the DBA of one Azure SQL Managed Instance and one of our clients asked us if is possible automate a backup and restore in order to have a copy of one of the database before one of our ETL procces start. That's because they want to do all insertions and work on the copy database instead of the ma...
I'm the DBA of one Azure SQL Managed Instance and one of our clients asked us if is possible automate a backup and restore in order to have a copy of one of the database before one of our ETL procces start. That's because they want to do all insertions and work on the copy database instead of the main production database and after finish everything and if data validations are OK, change database name. So I thought use a SQL Job just for backup a database to one blob storage and then restore using a backup file from a blob storage, the problem start when I realized that could not use a proxy account (related to the credential with access to blob storage)in the SQL Job and also there are some limitations in TSQL (WITH CREDENTIAL for example) Now with those restrictions I don't know how can automate this task. If I am not wrong, ELASTIC JOBS are only for Azure SQLDatabase Thanks in advance
SakZepelin (21 rep)
Feb 22, 2024, 09:29 PM • Last activity: May 25, 2025, 11:04 PM
5 votes
2 answers
6628 views
Issues running SSIS package as SQL Server Agent job
I've got some ridiculously stubborn difficulties when trying to run SSIS packages SQL Server Agent jobs on two SQL Servers, one in a domain and one without. I've read hundreds of posts on dozens of different forums, alas to no avail. Applying fixes and solutions I've found (eg. using proxies) only r...
I've got some ridiculously stubborn difficulties when trying to run SSIS packages SQL Server Agent jobs on two SQL Servers, one in a domain and one without. I've read hundreds of posts on dozens of different forums, alas to no avail. Applying fixes and solutions I've found (eg. using proxies) only resulted in getting (slightly) different error messages. When running the packages from Visual Studio or from SQL Server Management Studio directly they execute as expected. This is what I've got so far: ### Machine A - is named *APP-TEST-SERVER* - is not in domain - runs SQL Server 2016 - SQL Server Agent is run by *NT Service\SQLSERVERAGENT* and is sysadmin in SQL Server - Integration Services is run by *NT Service\MsDtsServer130* (not in SQL Server and cannot be added either) - has a proxy named *ssis_proxy* which is a local login in the machine the SQL Server is running and is sysadmin in SQL Server (temporarily, of course, to see if it is the one that causes permission/login issues) When running the job that has its step run as *SQL Server Agent Service Account* I get the following error message: > Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility Version 13.0.1601.5 for 32-bit Copyright (C) 2016 Microsoft. All rights reserved. Started: 2:59:44 PM Failed to execute IS server package because of error 0x80131904. Server: 172.16.2.107, Package path: \SSISDB\test\test sp run\Package.dtsx, Environment reference Id: 6. Description: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Source: .Net SqlClient Data Provider Started: 2:59:44 PM Finished: 2:59:44 PM Elapsed: 0.171 seconds. The package execution failed. The step failed. What is that *NT AUTHORITY\ANONYMOUS LOGON* nonsense? Shouldn't it use the Windows authentication that is used by SQL Server Agent (i.e. NT Service\SQLSERVERAGENT)? How can that be anonymous? Could it be that MsDtsServer130 not being added as login in SQL Server is causing this trouble? What can I do in this case? MsDtsServer130 cannot be added as login in SQL Server. When it is run with step run as set to a proxy *ssis_proxy* I get: > Executed as user: APP-TEST-SERVER\ssis_proxy. Microsoft (R) SQL Server Execute Package Utility Version 13.0.1601.5 for 32-bit Copyright (C) 2016 Microsoft. All rights reserved. Started: 3:23:15 PM Failed to execute IS server package because of error 0x80131904. Server: 172.16.2.107, Package path: \SSISDB\test\test sp run\Package.dtsx, Environment reference Id: 6. Description: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Source: .Net SqlClient Data Provider Started: 3:23:15 PM Finished: 3:23:15 PM Elapsed: 0.172 seconds. The package execution failed. The step failed. Why is it mentioning untrusted domain: - for a login that can connect using Windows authentication in SQL Server Management Studio? - on a machine that is not in a domain anyway? ### Machine B - is named *LINESRV03* - is in domain LINEAR - runs SQL Server 2014 - SQL Server Agent is run by *NT AUTHORITY\NETWORKSERVICE* and is sysadmin - Integration Services is also run by *NT AUTHORITY\NETWORKSERVICE* - has a proxy named *busztv*, which is a domain user in LINEAR and is sysadmin (temporarily, of course, to see if it is the one that causes permission/login issues) in SQL Server When running the job that has its step run as *SQL Server Agent Service Account* I get the following error message: > Executed as user: LINEAR\LINESRV03$. Microsoft (R) SQL Server Execute Package Utility Version 12.0.5000.0 for 32-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 15:31:31 Failed to execute IS server package because of error 0x80131904. Server: 172.16.2.80, Package path: \SSISDB\test\test sp run\Package.dtsx, Environment reference Id: 10. Description: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Source: .Net SqlClient Data Provider Started: 15:31:31 Finished: 15:31:31 Elapsed: 0.328 seconds. The package execution failed. The step failed. Again this untrusted domain. I just cannot figure out who is the distrustful here, Integration Services or SQL Server but providing that other (non-ssis) jobs are run and the Agent runs it on its own makes me thin SQL Server is fine with *NT AUTHORITY\NETWORKSERVICE* and its Integration Services that simply cannot get over it. When it is run with step run as set to a proxy *busztv* I get: > Executed as user: LINEAR\busztv. Microsoft (R) SQL Server Execute Package Utility Version 12.0.5000.0 for 32-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 15:33:25 Failed to execute IS server package because of error 0x80131904. Server: 172.16.2.80, Package path: \SSISDB\test\test sp run\Package.dtsx, Environment reference Id: 10. Description: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Source: .Net SqlClient Data Provider Started: 15:33:25 Finished: 15:33:26 Elapsed: 0.312 seconds. The package execution failed. The step failed. It seems like it has some serious trust issues and it doesn't trust itself. This *untrusted domain* is annoying beyond any measure and this #@!% wickedly refrains from telling which login and which domain it is talking about. **EDIT:** _The packages on the two servers were the same, both only trying to access a database on the SQL Server that's on the machine Integration Services is (ie. no remote servers accessed, not even through linked server) and file resources (delete and copy an SQLite database file which is later accessed through ODBC) on the same machine. Also, the proxies were given all the necessary permissions required (they can access the databases and the files). The tasks were removed one by one from the packages to see if they were the reason that prevented the job from running until there was nothing left there. Currently the task doesn't do anything and has no connection managers remaining. Still, the job fails with the same error messages as before._ Could anyone shed some light on how to kill this dragon?
gemisigo (343 rep)
Feb 28, 2017, 03:42 PM • Last activity: May 7, 2025, 05:02 PM
0 votes
1 answers
309 views
Chaining remote SQL Server Agent Jobs with success/failure feedback
I have 2 `Microsoft SQL Server 2014 (SP3-CU4)` instances, residing on different servers. `ServerA` has a linked server, pointing to `ServerB\InstanceB`. Both instances have a job, and `JobA` triggers the remote execution of `JobB`. So the execution of the jobs is chained. Schematic of setup - `Serve...
I have 2 Microsoft SQL Server 2014 (SP3-CU4) instances, residing on different servers. ServerA has a linked server, pointing to ServerB\InstanceB. Both instances have a job, and JobA triggers the remote execution of JobB. So the execution of the jobs is chained. Schematic of setup - ServerA\InstanceA - Server Objects - Linked Servers - LinkedServerToB (target: ServerB\InstanceB) - SQL Server Agent - Jobs - JobA - Step1 = Execute some local code - Step2 = EXEC [LinkedServerToB].[msdb].[dbo].sp_start_job @job_name="JobB" - ServerB\InstanceB - SQL Server Agent - Jobs - JobB This all works fine. Except for when JobB fails. When that happens, JobA.Step2 doesn't know about that. All JobA.Step2 did was *trigger* the remote execution of JobB, and then it's done. So JobA in its entirety runs successfully, despite the failure of JobB. Although I understand why it's behaving that way, its not the outcome I was looking for. Instead, I'd like the parent job (JobA) to fail when a child job (JobB) fails. How can I get JobA to fail when JobB fails? Maybe some sort of success/failure feedback between them, but I don't know how to implement that.
Bjorn Mistiaen (101 rep)
May 29, 2020, 03:27 PM • Last activity: May 5, 2025, 02:03 PM
1 votes
1 answers
343 views
SQL Server Jobs - fail on connection timeout
We have a LIVE set of 3 SQL Server instances on one network and a DEV set of 3 SQL Server instances on another. Being on different networks; LIVE cannot talk to DEV however the instances can talk to each other on the same network. In each set; we have a parent/child relationship between the instance...
We have a LIVE set of 3 SQL Server instances on one network and a DEV set of 3 SQL Server instances on another. Being on different networks; LIVE cannot talk to DEV however the instances can talk to each other on the same network. In each set; we have a parent/child relationship between the instances. Ie.
(DEV)                             (LIVE)
    Parent                            Parent
    /    \                     /    \
Child1  Child2                     Child1  Child2
To talk between instances, we are using LINKEDSERVERS. Both LIVE and DEV should be a mirror image of each other. All 3 instances in the set will have the same tables. Both child instances have the same procedures to send the table data up to its parent. The parent instance can send data down using its own procedures. Parent Procedures Logic: Loops through each child server and checks if the server is online - if it is then pull/push data - otherwise it will skip that server and go onto the next. Includes try-catches that show message when it fails. We have SQL Jobs that runs on the parent server that calls the above parent procedures. The problem is when one of the child instances goes down. The jobs fails on LIVE but doesn't fail on DEV. Even though the settings seem to be the same. DEV job shows the message and succeeds - SQL Severity 0 LIVE job produces an error and fails - SQL Severity 16 DEV: > Executed as user: NT SERVICE\SQLSERVERAGENT. OLE DB provider > "SQLNCLI11" for linked server "Child1" returned message "Login > timeout expired". [SQLSTATE 01000] (Message 7412) OLE DB provider > "SQLNCLI11" for linked server "Child1" returned message "A > network-related or instance-specific error has occurred while > establishing a connection to SQL Server. Server is not found or not > accessible. Check if instance name is correct and if SQL Server is > configured to allow remote connections. For more information see SQL > Server Books Online.". [SQLSTATE 01000] (Message 7412) OLE DB > provider "SQLNCLI11" for linked server "Child1" returned message > "Login timeout expired". [SQLSTATE 01000] (Message 7412) OLE DB > provider "SQLNCLI11" for linked server "Child1" returned message "A > network-related or instance-specific error has occurred while > establishing a connection to SQL Server. Server is not found or not > accessible. Check if instance name is correct and if SQL Server is > configured to allow remote connections. For more information see SQL > Server Books Online.". [SQLSTATE 01000] (Message 7412). The step > succeeded. LIVE: > Executed as user: TI\admin. OLE DB provider "SQLNCLI11" for > linked server "Child1" returned message "Login timeout expired". > [SQLSTATE 01000] (Message 7412) OLE DB provider "SQLNCLI11" for > linked server "Child1" returned message "A network-related or > instance-specific error has occurred while establishing a connection > to SQL Server. Server is not found or not accessible. Check if > instance name is correct and if SQL Server is configured to allow > remote connections. For more information see SQL Server Books > Online.". [SQLSTATE 01000] (Message 7412) Named Pipes Provider: Could > not open a connection to SQL Server . [SQLSTATE 42000] (Error > 50000) OLE DB provider "SQLNCLI11" for linked server "Parent" > returned message "A network-related or instance-specific error has > occurred while establishing a connection to SQL Server. Server is not > found or not accessible. Check if instance name is correct and if SQL > Server is configured to allow remote connections. For more information > see SQL Server Books Online.". [SQLSTATE 01000] (Error 7412) OLE DB > provider "SQLNCLI11" for linked server "Parent" returned message > "Login timeout expired". [SQLSTATE 01000] (Error 7412) I did notice that the LIVE job error has mention of the parent server but DEV does not; even though the parent server is online and just the child is offline in both cases. Also, that LIVE is using a different login than DEV to execute the job. What i've tried: - Verified LINKEDSERVER settings on both LIVE and DEV - Verified server settings match - Verified login has permissions for TI\admin - Verified query/remote timeouts set to 0 on both LIVE and DEV - Verified procedures are the exact same - Verified job settings are exactly the same   Again, everything works as expected when all instances are online. To me this seems more like a settings issue than the procedure logic as it works fine on DEV but not LIVE. Is there some kind of settings I am missing or something I can check?
Drees (11 rep)
Sep 22, 2023, 03:28 PM • Last activity: Apr 29, 2025, 11:05 AM
1 votes
1 answers
141 views
Confused - I disabled sa account for security reasons - My sql agent jobs owned by sa now fail
All the articles over the years tell me that disabling sa wont affect any jobs owned and run by sa. I'm running the SSMS builtin Maint wizard job: "Misc Cleanup.Subplan_1" and "DB Integrity Check.Subplan_1" and also a Ola Hallengren "Index Optimize and stats" job. All of them fail since I disabled t...
All the articles over the years tell me that disabling sa wont affect any jobs owned and run by sa. I'm running the SSMS builtin Maint wizard job: "Misc Cleanup.Subplan_1" and "DB Integrity Check.Subplan_1" and also a Ola Hallengren "Index Optimize and stats" job. All of them fail since I disabled the sa account. If I re-enable sa the jobs all work. Message:\ >Executed as user: NT Service\SQLSERVERAGENT. \ \ Microsoft (R) SQL Server Execute Package Utility Version 15.0.4420.2 for 64-bit Copyright (C) 2019 Microsoft. All rights reserved. \ \ Started: 11:08:30 AM Error: 2025-03-17 11:08:30.84 Code: 0xC00291EC Source: {D9910D3F-29BA-4AFB-9499-EB09B2E4F937} Execute SQL Task Description: Failed to acquire connection "Local server connection". Connection may not be configured correctly or you may not have the right permissions on this connection. End Error\ \ Warning: 2025-03-17 11:08:30.84 Code: 0x80019002 Source: OnPreExecute 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\ \ Error: 2025-03-17 11:08:30.86 Code: 0xC0024104 Source: History Cleanup Task Description: The Execute method on the task returned error code 0x80131904 (Login failed for user 'sa'. Reason: The account is disabled.). The Execute method must succeed, and indicate the result using an "out" parameter. End Error \ \ Warning: 2025-03-17 11:08:30.86 Code: 0x80019002 Source: Subplan_1 Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (2) 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 \ \ Error: 2025-03-17 11:08:30.86 Code: 0xC0024104 Source: {229E238E-F0DA-453A-AB7A-027524E534C9} Description: The Execute method on the task returned error code 0x80131904 (Login failed for user 'sa'. Reason: The account is disabled.). The Execute method must succeed, and indicate the result using an "out" parameter. End Error\ \ Warning: 2025-03-17 11:08:30.86 Code: 0x80019002 Source: OnPostExecute Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (2) 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: 11:08:30 AM Finished: 11:08:30 AM Elapsed: 0.422 seconds. The package execution failed. The step failed.
Jeff Shervey (21 rep)
Mar 17, 2025, 04:24 PM • Last activity: Apr 15, 2025, 12:11 PM
2 votes
1 answers
841 views
Installing SSIS package outside of SSIDB catalog
I'm trying to simplify deployment of a SSIS package to a remote server. At the moment, I have * Local Visual Studio SSDT and SSIS package that has 4 connection managers - **DEV** environment * Remote server with SQL, SSMS, and SSDT installed - **PROD** environment The easiest way to deploy SSIS pack...
I'm trying to simplify deployment of a SSIS package to a remote server. At the moment, I have * Local Visual Studio SSDT and SSIS package that has 4 connection managers - **DEV** environment * Remote server with SQL, SSMS, and SSDT installed - **PROD** environment The easiest way to deploy SSIS package from local computer to the remote server is to * Create SSIDB catalog on the remote server * Perform Deploy from Visual Studio and point it to the catalog created on the remote server In this case everything works fine. In the meantime, some **remote servers may not be accessible from Visual Studio** directly, so I'm trying to precompile SSIS package on local computer, upload to the remote server and add it to SQL server job as a single file, like it's described in this article . The second screenshot in that article shows that I can choose Package Source = File System and specify a path to SSIS package file. **The issue** When I deploy SSIS package from Visual Studio to SSIDB catalog and create SQL server job using package in the catalog, it correctly shows 4 connection managers used by the package. When I create SQL server with manually uploaded SSIS package file, the tab Data Sources in SSMS shows empty list of connection managers. **Why in the second scenario, connection managers were not deployed with the package?**
Anonymous (143 rep)
Jan 26, 2021, 08:18 PM • Last activity: Apr 13, 2025, 09:06 PM
0 votes
2 answers
656 views
Need help in getting mysql event scheduled every monday and wednesday
I have coded an event as below to run every Monday and Wednesday, but it runs only on Monday and doesn't on Wednesday. ``` delimiter | CREATE EVENT IF NOT EXISTS evnt_demo_ref_fs_test ON SCHEDULE EVERY 1 DAY ON COMPLETION PRESERVE enable DO BEGIN DECLARE errorCode CHAR(5) DEFAULT '00000'; DECLARE er...
I have coded an event as below to run every Monday and Wednesday, but it runs only on Monday and doesn't on Wednesday.
delimiter |
CREATE EVENT IF NOT EXISTS evnt_demo_ref_fs_test
ON SCHEDULE EVERY 1 DAY 
ON COMPLETION PRESERVE enable
DO 
   BEGIN
	DECLARE errorCode CHAR(5) DEFAULT '00000';
    DECLARE errorMessage TEXT DEFAULT '';
    
DECLARE exit HANDLER FOR SQLEXCEPTION 
    BEGIN
    GET DIAGNOSTICS CONDITION 1
        /*errorCode = RETURNED_SQLSTATE, errorMessage = MESSAGE_TEXT;*/
        @p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT;
        SELECT @p1 as RETURNED_SQLSTATE  , @p2 as MESSAGE_TEXT;
        INSERT INTO demo_log_fs (CODE, message) SELECT CONCAT('ERR_CODE: ', @p1) AS STATUS, CONCAT('MySQL ERROR: ', @p1, ': ', @p2) AS MESSAGE;
		ROLLBACK;
    END;
    /*IF DAYOFWEEK(curdate()) BETWEEN 5 and 7 THEN */
    IF WEEKDAY(curdate()) BETWEEN 0 AND 2 THEN 
INSERT INTO demo_log_fs (CODE, message) values ('0000','demo refresh started');
INSERT INTO demo_log_fs (CODE, message) values ('0000','Deletes started');
delete from drop_curr_fs;
delete from drop_hist_fs;
INSERT INTO demo_log_fs (CODE, message) values ('0000','Deletes Completed');
INSERT INTO demo_log_fs (CODE, message) values ('0000','Inserts Started');
insert into drop_curr_fs select  * From 	master	;
insert into drop_hist_fs select  * From 	hist_master	;
INSERT INTO demo_log_fs (CODE, message) values ('0000','Inserts Completed');
INSERT INTO demo_log_fs (CODE, message) values ('0000','demo refresh Completed');
end if;
END |
delimiter ;
How do I achieve this?
Mushtaq (1 rep)
Jun 28, 2021, 08:35 AM • Last activity: Apr 8, 2025, 02:04 AM
0 votes
1 answers
625 views
Archive logs Pg_archive cleaner
I have Postgres installed on windows 10. I have master-slave replication ( 1 pc is master and 2 other pc are slaves). I have archive logs saved on a file on master pc and slaves are connected to that file. That file has become quite big and i need to know how to remove log files with pg_archive clea...
I have Postgres installed on windows 10. I have master-slave replication ( 1 pc is master and 2 other pc are slaves). I have archive logs saved on a file on master pc and slaves are connected to that file. That file has become quite big and i need to know how to remove log files with pg_archive cleaner. I also have automatic backup jobs on every day. 😊
Anisa Ibro (31 rep)
May 5, 2021, 04:44 PM • Last activity: Mar 14, 2025, 10:05 AM
1 votes
1 answers
77 views
execute job only on primary replica ( R/W) of Azure SQL MI failover groups
I am trying to setup SQL agent job that will only execute if it is primary replica of Azure SQL MI of failover groups. I am trying to get primary replica using `sys.dm_hadr_database_replica_states` where `is_primary_replica =1` but when I run it on SQL MI in different region , it also returns value...
I am trying to setup SQL agent job that will only execute if it is primary replica of Azure SQL MI of failover groups. I am trying to get primary replica using sys.dm_hadr_database_replica_states where is_primary_replica =1 but when I run it on SQL MI in different region , it also returns value 1. I am using dbo.fn_hadr_group_is_primary(@AGName)=1 function for on-prem so looking for something similar for Azure SQL MI.
SqlDBA (171 rep)
Feb 19, 2025, 02:12 PM • Last activity: Feb 24, 2025, 03:48 PM
0 votes
1 answers
171 views
Oracle scheduler, set repeat_interval to run job at exactly date and time?
I have question regarding Oracle scheduler. How to set repeat_interval to run job on example, two times per month, at exact time? On example: 5th in month, at 09:00 and 20th in month, at 14:00 Is it possible without creating two jobs? I am trying to set scheduler and I have specific needs for my cus...
I have question regarding Oracle scheduler. How to set repeat_interval to run job on example, two times per month, at exact time? On example: 5th in month, at 09:00 and 20th in month, at 14:00 Is it possible without creating two jobs? I am trying to set scheduler and I have specific needs for my customers, which include example like this.
Krešimir Margetić
Feb 19, 2025, 02:05 PM • Last activity: Feb 19, 2025, 07:28 PM
Showing page 1 of 20 total questions