SQLCMD Error ODBC Driver 11

  • SQL Server 2014 Enterprise Cluster
    Windows 2012 R2 Servers

    On the Node1 SQL Cluster server I am running SQLCMD scripts to backup the SQL databases.

    PS C:\Util> 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

    Online..


    Just built this Node1 server not sure why sqlcmd does not run on the server itself

    Any ideas ??

    Thank you,

    Tom

  • trgrassijr - Sunday, April 22, 2018 2:44 PM

    SQL Server 2014 Enterprise Cluster
    Windows 2012 R2 Servers

    On the Node1 SQL Cluster server I am running SQLCMD scripts to backup the SQL databases.

    PS C:\Util> 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

    Online..


    Just built this Node1 server not sure why sqlcmd does not run on the server itself

    Any ideas ??

    Thank you,

    Tom

    Is this a named instance or a default instance?
    What protocols are enabled?
    Do you only get the errors running from sqlcmd while on the server itself?
    Do you get the error when you specify the server name?

    Sue

  • Hi Sue

    Thank you for replying.

    This is the default instance  but during the install I gave the SQL Server Network name this TGCS014-N1-SLC

    All protocols are enabled

    I get this from running the command on the server itself

    I was able to get it to work using this command
    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

    Strange that from the server I get this I have the exact same sqlcmd on my other SQL servers one SQL 2012 and another SQL 2014 server.

    Any ideas why I would need the server name when running from the server?

    Thank you
    Tom

  • trgrassijr - Tuesday, April 24, 2018 6:09 PM

    Hi Sue

    Thank you for replying.

    This is the default instance  but during the install I gave the SQL Server Network name this TGCS014-N1-SLC

    All protocols are enabled

    I get this from running the command on the server itself

    I was able to get it to work using this command
    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

    Strange that from the server I get this I have the exact same sqlcmd on my other SQL servers one SQL 2012 and another SQL 2014 server.

    Any ideas why I would need the server name when running from the server?

    Thank you
    Tom

    It looks for the default instance MSSQLSERVER when you don't specify the name.

    Sue

  • Sue

    Ok that makes sense now to me

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply