I am trying to automate the Back Up of a database that runs in SQL Server 2014 Express.
For this I copied a Store Procedure from the Microsoft support page, this works since I ran it from the Sql Server Management Studio and it generates without problems the .bak file I need.
When I want to run it through a .bat file that has the following code:
sqlcmd -U USUARIO -P P -S .\SQLEXPRESS -Q "EXEC sp_BackupDatabases @backupLocation ='C:\SQLBackups\', @databaseName=’EntradasLegales’,@BackupType=’F’" -o C:\SQLBackups\LogBK.txt
I also tried the following:
sqlcmd -S .\SQLEXPRESS -U ENT_LEG_USA -P EntL3gpr0d -Q "EXEC sp_BackupDatabases @backupLocation ='C:\SQLBackups\', @databaseName=’EntradasLegales’,@BackupType=’F’" -o C:\SQLBackups\LogBK.txt
The script must be run locally on the server (Windows Server 2012). Inside the Log you can see the following:
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server: SQL Server Network Interfaces: Error Locating Server / Instance Specified [xFFFFFFFF] . Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Login timeout expired. Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server: 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 ..
How should I correct the script so that it runs smoothly?