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
LVL 23
Thomas GrassiSystems AdministratorAsked:
Who is Participating?
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
You're missing the server (-S) and the credential (-E) parameters:
sqlcmd   -S tgcs014-n1-sqlc -E -d master -Q "EXECUTE dbo.DatabaseBackup @Databases  =  'Master',  @Directory  =  'F:\SQL-BackupData\',  @BackupType  =  'FULL',  @Verify = 'Y',  @CleanupTime  =  672" -b >>$LogFolder\$LogFile
0
 
Bharat BhushanSolution ManagerCommented:
Hi Thomas,

Temporarily disable Windows Firewall and test your SQL script once more.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
In your client connect attempt, remove the curly braces.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Thomas GrassiSystems AdministratorAuthor Commented:
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
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
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?
0
 
Thomas GrassiSystems AdministratorAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.