0

I've to do a backup on SQL2014 of a database of size 400GB. When I do a the backup after 15min SQL give me an error : Time out. The available time expired before the operation was completed or the server is not responding.

For do this operation I have set timeout = -1 so I've infinite timeout. Why SQL give me timeout error when I've set infinite timeout? The database is fully avaiable cause I can excecute query on it. Someone help me please.

Charlieface
  • 52,284
  • 6
  • 19
  • 43
  • Did you set a connection timeout or a command timeout? Please show relevant code. – Charlieface Apr 18 '23 at 10:58
  • SET LOCK_TIMEOUT -1 BACKUP DATABASE [DBName] TO DISK = N'Location\bakname.bak' WITH NOFORMAT, INIT, NAME = N'bakname', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO – Mattia Martino Apr 18 '23 at 13:19
  • Yes, but how are you executing this? From C#? Where is the C# code for that? – Charlieface Apr 18 '23 at 13:20
  • Does this answer your question? [Increasing the Command Timeout for SQL command](https://stackoverflow.com/questions/18440130/increasing-the-command-timeout-for-sql-command) – Charlieface Apr 18 '23 at 14:43
  • I excecute the query by SQL Server Management Studio query editor. – Mattia Martino Apr 18 '23 at 15:00
  • Set the execution timeout in the SSMS options https://learn.microsoft.com/en-us/sql/ssms/menu-help/options-query-execution?view=sql-server-ver16. This is client-side timeout, not a server error. `LOCK_TIMEOUT` is unnecessary, and does nothing for `BACKUP` commands anyway – Charlieface Apr 18 '23 at 15:02
  • I've already try this solution.. but nothing to do. – Mattia Martino Apr 18 '23 at 15:08
  • Please include the full error message from the event log. It should have the error number, severity, state and detailed message. Also, without disclosing anything confidential, can you tell us what is the actual DISK target? I.e. is it a local disk or network share? – SQLmojoe Apr 18 '23 at 16:31
  • helps to include full error message. – SQLmojoe Apr 18 '23 at 16:32
  • Time out. The available time expired before the operation was completed or the server is not responding. Message -2, leve 11, state 0, row 0 – Mattia Martino Apr 20 '23 at 09:43

0 Answers0