Link to home
Start Free TrialLog in
Avatar of Member_2_6492660_1
Member_2_6492660_1Flag for United States of America

asked on

SQLCMD no working n SQL 2014 Clster Server

SQL 2014 Enterprise Cluster
Windows2012 R2 Cluster Servers

Cannot get sqlcmd to run

PS C:\Windows\system32> sqlcmd  -d master -Q "EXECUTE dbo.DatabaseBackup @Databases  =  'Master',  @Directory  =  'F:\SQL-BackupData\',  @BackupType  =  'FULL',  @Verify = 'Y',  @CleanupTime  =  672" -b >>$LogFolder\$LogFile

sqlcmd : Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .
At line:1 char:1
+ sqlcmd  -d master -Q "EXECUTE dbo.DatabaseBackup @Databases  =  'Mast ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Sqlcmd: Error: ...L Server [2]. .:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
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

That is running on the SQL Cluster server

From my windows 10 computer
Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>sqlcmd -S tgcs014-n1-sqlc -E
1> use {master}
2> go
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Syntax error, permission violation, or other nonspecific error.
1>


Any thoughts

Tom
Avatar of Bharat Bhushan
Bharat Bhushan
Flag of United States of America image

Hi Thomas,

Temporarily disable Windows Firewall and test your SQL script once more.
Avatar of Qlemo
In your client connect attempt, remove the curly braces.
Avatar of Member_2_6492660_1

ASKER

Thanks guys

Removing the curly braces worked from the client


Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>sqlcmd -S tgcs014-n1-sqlc -E
1> use master
2> go
Changed database context to 'master'.
1>


I also tried hat on my SQL Server and it worked

So the question now is why does this command not work from my SQL Server

sqlcmd  -d master -Q "EXECUTE dbo.DatabaseBackup @Databases  =  'Master',  @Directory  =  'F:\SQL-BackupData\',  @BackupType  =  'FULL',  @Verify = 'Y',  @CleanupTime  =  672" -b >>$LogFolder\$LogFile
ASKER CERTIFIED SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
On the server you should not need to provide a server name or -E. Is the result of sqlcmd -L showing (local) and/or the server name?
ADDing the -S tgcs014-n1-sqlc -E  worked

Just strange that I need to add that when running from the sql server itself.

Thanks for all the help