November 2, 2009 at 1:28 pm
(I don't know where else to post this as there doesn't seem to be a category for people scripting sql in Powershell)
I am trying to run a script in Powershell to backup a database but everytime I attempt it, I get the following timeout error:
Invoke-Sqlcmd : Timeout expired. The timeout period elapsed prior to completio
n of the operation or the server is not responding.
The backup or restore was aborted.
At line:1 char:14
+ Invoke-SqlCmd <<<< -ServerInstance "localhost" -Database "dbname" -Query "BA
CKUP DATABASE [dbname] TO DISK='..file path'"
Here is the command I am using:
PS C:\testnewclient> Invoke-SqlCmd -ServerInstance "localhost" -Database "dbname
" -Query "BACKUP DATABASE [dbname] TO DISK=file path"
I am able to run the same backup command fine in sqlcmd in the DOS prompt and I have increased the timeout on the SQL Server using "sp_configure 'remote login timeout', 60
go
reconfigure with override
go "
Any suggestions?
December 23, 2009 at 3:27 pm
i am having the same problem when attaching database, did u figured it out..
December 24, 2009 at 11:28 am
have you tried to add -QueryTimeout
when using invoke-sqlcmd?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply