cherrylane
asked on
Error running SQL script from BAT file
We are running SQL server express 2005 on a Virtual server. In order to backup our databases nightly, I have a Windows scheduled tasks that runs a BAT file every night with the following code: sqlcmd -S . -i "C:\SQLbackup\DatabaseBack up.sql"
The SQL file referenced has code to run the backup.
We recently moved our server from one machine to ther other - it had previously worked and now it doesn't which means the code is okay, but there is a setting on the new machine that needs to be fixed. When I run the BAT file, I get the following error:
C:>sqlcmd -S . -i "C:\SQLbackup\DatabaseBack up.sql"
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
I've already configured the protocols in SQL Server Configuration Manager - shared memory, named pipes, and TCP/IP are enabled. In MSSMSE, remote connections are also enabled. (600 second query timeout)
In SQL server surface area configuration, I have local & remote connections set to be allowed using both TCP/IP and named pipes.
Any ideas what this could be??
Thanks!!
M
The SQL file referenced has code to run the backup.
We recently moved our server from one machine to ther other - it had previously worked and now it doesn't which means the code is okay, but there is a setting on the new machine that needs to be fixed. When I run the BAT file, I get the following error:
C:>sqlcmd -S . -i "C:\SQLbackup\DatabaseBack
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
I've already configured the protocols in SQL Server Configuration Manager - shared memory, named pipes, and TCP/IP are enabled. In MSSMSE, remote connections are also enabled. (600 second query timeout)
In SQL server surface area configuration, I have local & remote connections set to be allowed using both TCP/IP and named pipes.
Any ideas what this could be??
Thanks!!
M
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.