原 sqlcmd备份MSSQL数据库报错 TCP Provider Error code 0x2746
Tags: 原创故障处理MSSQLSQL Serversqlcmd
现象
192.17.1.79,1436是属于windows的机器上的sql seerver 2016:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | [root@lhropeneuler24 /]# cat /etc/os-release NAME="openEuler" VERSION="24.03 (LTS)" ID="openEuler" VERSION_ID="24.03" PRETTY_NAME="openEuler 24.03 (LTS)" ANSI_COLOR="0;31" [root@lhropeneuler24 /]# [root@lhropeneuler24 /]# sqlcmd -S 192.19.1.79,1436 -U sa -P lhr -Q "BACKUP DATABASE lhrdb TO DISK = N'D:\bk\mssql_lhrdb_$CURR_DATE.bak' WITH FORMAT, INIT;" -C Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : TCP Provider: Error code 0x2746. Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Client unable to establish connection. [root@lhropeneuler24 /]# [root@lhropeneuler24 soft]# sqlcmd -S 192.17.1.79,1436 -U sa -P lhr Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : TCP Provider: Error code 0x2746. Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Client unable to establish connection. For solutions related to encryption errors, see https://go.microsoft.com/fwlink/?linkid=2226722. [root@lhropeneuler24 soft]# [root@lhropeneuler24 soft]# sqlcmd -S 172.17.1.79,1436 -U sa -P lhr -C Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : TCP Provider: Error code 0x2746. Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Client unable to establish connection. [root@lhropeneuler24 soft]# -- 但是,连接Linux的SQL Server不报错 [root@lhropeneuler24 soft]# sqlcmd -S 172.16.7.163,14322 -U sa -P lhr Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : SSL Provider: [error:0A000086:SSL routines::certificate verify failed:self-signed certificate]. Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Client unable to establish connection. For solutions related to encryption errors, see https://go.microsoft.com/fwlink/?linkid=2226722. [root@lhropeneuler24 soft]# sqlcmd -S 172.16.7.163,14322 -U sa -P lhr -C 1> select @@version; 2> go ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Microsoft SQL Server 2022 (RTM-CU4) (KB5026717) - 16.0.4035.4 (X64) May 1 2023 10:34:45 Copyright (C) 2022 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Linux (CentOS Stream 8) <X64> (1 rows affected) [root@lhropeneuler24 soft]# sqlcmd -S 172.16.7.163,1437 -U sa -P lhr -C 1> select @@version; 2> go ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Microsoft SQL Server 2017 (RTM-CU31-GDR) (KB5021126) - 14.0.3460.9 (X64) Jan 25 2023 08:42:43 Copyright (C) 2017 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Linux (CentOS Linux 7 (Core)) (1 rows affected) 1> exit [root@lhropeneuler24 soft]# [root@lhropeneuler24 soft]# [root@lhropeneuler24 soft]# sqlcmd -S 172.16.7.163,1439 -U sa -P lhr -C 1> select @@version; 2> go ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Microsoft SQL Server 2019 (RTM-CU20) (KB5024276) - 15.0.4312.2 (X64) Apr 1 2023 12:10:46 Copyright (C) 2019 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Linux (CentOS Linux 7 (Core)) <X64> (1 rows affected) 1> |
解决
降低openssl的版本。