在我的情况下是“ANSI_X3.4-1968”,所以一定有什么问题。我将进一步查看文档中建议的文章,但现在我不知道如何确认我确实安装了两个驱动程序以及如何删除一个。

在我的情况下是“ANSI_X3.4-1968”,所以一定有什么问题。我将进一步查看文档中建议的文章,但现在我不知道如何确认我确实安装了两个驱动程序以及如何删除一个。

我今天更新了我的服务器,所有待处理的更新,重启后我无法连接到 SQL Server。重启之前,我还启用了防火墙,但现在它又被禁用了,服务器在另一次重启后也是如此。当我尝试使用

sqlcmd -S localhost

我收到错误:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 17 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..

服务器本身已启动并正在运行:

hyperqbe@slaro:/etc$ sudo systemctl status mssql-server
[sudo] hasło użytkownika hyperqbe:
● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-08-08 15:06:28 CEST; 19min ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 7259 (sqlservr)
    Tasks: 158
   CGroup: /system.slice/mssql-server.service
           ├─7259 /opt/mssql/bin/sqlservr
           └─7288 /opt/mssql/bin/sqlservr

sie 08 15:06:38 slaro sqlservr[7259]: [95B blob data]
sie 08 15:06:38 slaro sqlservr[7259]: [91B blob data]
sie 08 15:06:38 slaro sqlservr[7259]: [145B blob data]
sie 08 15:06:38 slaro sqlservr[7259]: [61B blob data]
sie 08 15:06:39 slaro sqlservr[7259]: [96B blob data]
sie 08 15:06:39 slaro sqlservr[7259]: [66B blob data]
sie 08 15:06:40 slaro sqlservr[7259]: [96B blob data]
sie 08 15:06:40 slaro sqlservr[7259]: [100B blob data]
sie 08 15:06:40 slaro sqlservr[7259]: [71B blob data]
sie 08 15:06:40 slaro sqlservr[7259]: [124B blob data]

我也无法从其他机器进行远程连接:

TITLE: Connect to Server
------------------------------
Cannot connect to 192.168.1.141.
------------------------------
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - Istniejące połączenie zostało gwałtownie zamknięte przez zdalnego hosta.) (Microsoft SQL Server, Error: 10054)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=10054&LinkId=20476

据我所知,更新过程中没有出现任何错误。

以下是错误日志中的最后条目:

2019-08-08 15:06:34.89 Server      Microsoft SQL Server 2019 (CTP3.2) - 15.0.1800.32 (X64)
        Jul 17 2019 21:29:33
        Copyright (C) 2019 Microsoft Corporation
        Express Edition (64-bit) on Linux (Ubuntu 18.04.3 LTS) <X64>
2019-08-08 15:06:34.89 Server      UTC adjustment: 2:00
2019-08-08 15:06:34.89 Server      (c) Microsoft Corporation.
2019-08-08 15:06:34.89 Server      All rights reserved.
2019-08-08 15:06:34.89 Server      Server process ID is 32.
2019-08-08 15:06:34.89 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2019-08-08 15:06:34.89 Server      Registry startup parameters:
         -d /var/opt/mssql/data/master.mdf
         -l /var/opt/mssql/data/mastlog.ldf
         -e /var/opt/mssql/log/errorlog
2019-08-08 15:06:34.90 Server      SQL Server detected 1 sockets with 4 cores per socket and 4 logical processors per socket, 4 total logical processors; using 4 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2019-08-08 15:06:34.90 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2019-08-08 15:06:34.90 Server      Detected 12800 MB of RAM. This is an informational message; no user action is required.
2019-08-08 15:06:34.90 Server      Using conventional memory in the memory manager.
2019-08-08 15:06:34.90 Server      Page exclusion bitmap is enabled.
2019-08-08 15:06:35.01 Server      Buffer pool extension is not supported on Linux platform.
2019-08-08 15:06:35.02 Server      Buffer Pool: Allocating 2097152 bytes for 1963331 hashPages.
2019-08-08 15:06:35.16 Server      Default collation: SQL_Latin1_General_CP1_CI_AS (us_english 1033)
2019-08-08 15:06:35.69 Server      Buffer pool extension is already disabled. No action is necessary.
2019-08-08 15:06:35.99 Server      Successfully initialized the TLS configuration. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are ['ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!DHE-RSA-AES256-GCM-SHA384:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA'].
2019-08-08 15:06:36.01 Server      Query Store settings initialized with enabled = 1,
2019-08-08 15:06:36.07 Server      The maximum number of dedicated administrator connections for this instance is '1'
2019-08-08 15:06:36.07 Server      Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2019-08-08 15:06:36.11 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2019-08-08 15:06:36.17 Server      In-Memory OLTP initialized on lowend machine.
2019-08-08 15:06:36.37 Server      CLR version v4.0.30319 loaded.
2019-08-08 15:06:36.57 Server      [INFO] Created Extended Events session 'hkenginexesession'

2019-08-08 15:06:36.58 Server      Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2019-08-08 15:06:36.59 Server      Total Log Writer threads: 2. This is an informational message; no user action is required.
2019-08-08 15:06:36.72 Server      clflushopt is selected for pmem flush operation.
2019-08-08 15:06:36.72 Server      Software Usage Metrics is disabled.
2019-08-08 15:06:36.97 spid11s     [1]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-08-08 15:06:36.98 spid11s     Starting up database 'master'.
2019-08-08 15:06:37.58 Server      Common language runtime (CLR) functionality initialized.
2019-08-08 15:06:37.77 spid11s     SQL Server Audit is starting the audits. This is an informational message. No user action is required.
2019-08-08 15:06:37.78 spid11s     SQL Server Audit has started the audits. This is an informational message. No user action is required.
2019-08-08 15:06:38.05 Server      Failed to verify the Authenticode signature of 'C:\binn\secforwarder.dll'. Signature verification of SQL Server DLLs will be skipped. Genuine copies of SQL Server are signed. Failure to verify the Authenticode signature might indicate that this is not an authentic release of SQL Server. Install a genuine copy of SQL Server or contact customer support.
2019-08-08 15:06:38.11 spid11s     SQL Trace ID 1 was started by login "sa".
2019-08-08 15:06:38.27 spid11s     Server name is 'slaro'. This is an informational message only. No user action is required.
2019-08-08 15:06:38.29 spid29s     Always On: The availability replica manager is starting. This is an informational message only. No user action is required.
2019-08-08 15:06:38.29 spid29s     Always On: The availability replica manager is waiting for the instance of SQL Server to allow client connections. This is an informational message only. No user action is required.
2019-08-08 15:06:38.30 spid11s     [4]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-08-08 15:06:38.30 spid11s     Starting up database 'msdb'.
2019-08-08 15:06:38.32 spid12s     [32767]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-08-08 15:06:38.32 spid12s     Starting up database 'mssqlsystemresource'.
2019-08-08 15:06:38.33 spid12s     The resource database build version is 15.00.1800. This is an informational message only. No user action is required.
2019-08-08 15:06:38.36 spid12s     [3]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-08-08 15:06:38.36 spid12s     Starting up database 'model'.
2019-08-08 15:06:38.40 Server      Failed to verify the Authenticode signature of 'C:\binn\msoledbsql.dll'. Signature verification of SQL Server DLLs will be skipped. Genuine copies of SQL Server are signed. Failure to verify the Authenticode signature might indicate that this is not an authentic release of SQL Server. Install a genuine copy of SQL Server or contact customer support.
2019-08-08 15:06:38.48 spid28s     A self-generated certificate was successfully loaded for encryption.
2019-08-08 15:06:38.51 Server      Error: 37308, Severity: 16, State: 1.
2019-08-08 15:06:38.51 Server      Loaded None enclave for always encrypted.
2019-08-08 15:06:38.51 spid28s     Server is listening on [ 192.168.1.141 <ipv4> 1433].
2019-08-08 15:06:38.54 spid28s     Dedicated administrator connection support was not started because it is disabled on this edition of SQL Server. If you want to use a dedicated administrator connection, restart SQL Server using the trace flag 7806. This is an informational message only. No user action is required.
2019-08-08 15:06:38.54 spid28s     Error: 39002, Severity: 16, State: 1.
2019-08-08 15:06:38.54 spid28s     SQL failed to boot extensibility for error code 0x80070005.
2019-08-08 15:06:38.55 spid28s     InitializeXdbPkgLauncher failed. ErrorCode: 0x80004005.
2019-08-08 15:06:38.55 spid28s     SQL Server is now ready for client connections. This is an informational message; no user action is required.
2019-08-08 15:06:38.85 spid12s     Clearing tempdb database.
2019-08-08 15:06:39.88 spid12s     [2]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-08-08 15:06:39.89 spid12s     Starting up database 'tempdb'.
2019-08-08 15:06:40.26 spid29s     The Service Broker endpoint is in disabled or stopped state.
2019-08-08 15:06:40.26 spid29s     The Database Mirroring endpoint is in disabled or stopped state.
2019-08-08 15:06:40.27 spid29s     Service Broker manager has started.
2019-08-08 15:06:40.27 spid11s     Recovery is complete. This is an informational message only. No user action is required.
2019-08-08 15:27:16.30 spid55      [5]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-08-08 15:27:16.30 spid55      Starting up database 'ProgramMagazynowy'.
2019-08-08 15:27:16.53 spid55      Parallel redo is started for database 'ProgramMagazynowy' with worker pool size [2].
2019-08-08 15:27:16.73 spid55      Parallel redo is shutdown for database 'ProgramMagazynowy' with worker pool size [2].

这可能与 ODBC 驱动程序有关。我能够启用日志记录并发现以下内容:

[ODBC][29210][1565333226.007247][SQLDriverConnectW.c][290]
                Entry:
                        Connection = 0x8c90e0
                        Window Hdl = (nil)
                        Str In = [DRIVER={ODBC Driver 17 for SQL Server};SERVER={192.168.1.141};Trusted_Connection={YES};WSID={slaro};APP={SQLCMD};][length = 113 (SQL_NTS)]
                        Str Out = (nil)
                        Str Out Max = 0
                        Str Out Ptr = (nil)
                        Completion = 0
                UNICODE Using encoding ASCII 'ANSI_X3.4-1968' and UNICODE 'UTF-16LE'

根据文档

如果 ASCII 字符编码不是 UTF-8,则表示安装了多个驱动程序管理器,而您的应用程序使用了错误的驱动程序管理器,或者驱动程序管理器未正确构建。

在我的情况下是“ANSI_X3.4-1968”,所以一定有什么问题。我将进一步查看文档中建议的文章,但现在我不知道如何确认我确实安装了两个驱动程序以及如何删除一个。

编辑:

odbcinst 仅列出一个驱动程序:

hyperqbe@slaro:/etc$ odbcinst -q -d
[ODBC Driver 17 for SQL Server]

这部分似乎没问题。我不确定我的 odbc.ini 和 odbcinst.ini 是否定义正确。

hyperqbe@slaro:/etc$ cat odbc.ini
[slaro]
Driver='ODBC Driver 17 for SQL Server'
Servername=192.168.1.141

hyperqbe@slaro:/etc$ cat odbcinst.ini
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.4.so.1.1
UsageCount=1
Trace=Yes
TraceFile=/home/hyperqbe/odbc.log

=======================================

编辑((每个请求的ufw详细信息)):

hyperqbe@slaro:~$ sudo ufw status
[sudo] hasło użytkownika hyperqbe:
Stan: aktywny

Do                         Działanie   Z
--                         ---------   -
27                         ALLOW       Anywhere
1433                       ALLOW       Anywhere
1434                       ALLOW       Anywhere
8686                       ALLOW       Anywhere
27 (v6)                    ALLOW       Anywhere (v6)
1433 (v6)                  ALLOW       Anywhere (v6)
1434 (v6)                  ALLOW       Anywhere (v6)
8686 (v6)                  ALLOW       Anywhere (v6)

22/tcp                     REJECT OUT  Anywhere
22/tcp (v6)                REJECT OUT  Anywhere (v6)

hyperqbe@slaro:~$ sudo iptables --list
Chain INPUT (policy DROP)
target     prot opt source               destination
ufw-before-logging-input  all  --  anywhere             anywhere
ufw-before-input  all  --  anywhere             anywhere
ufw-after-input  all  --  anywhere             anywhere
ufw-after-logging-input  all  --  anywhere             anywhere
ufw-reject-input  all  --  anywhere             anywhere
ufw-track-input  all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
ufw-before-logging-forward  all  --  anywhere             anywhere
ufw-before-forward  all  --  anywhere             anywhere
ufw-after-forward  all  --  anywhere             anywhere
ufw-after-logging-forward  all  --  anywhere             anywhere
ufw-reject-forward  all  --  anywhere             anywhere
ufw-track-forward  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ufw-before-logging-output  all  --  anywhere             anywhere
ufw-before-output  all  --  anywhere             anywhere
ufw-after-output  all  --  anywhere             anywhere
ufw-after-logging-output  all  --  anywhere             anywhere
ufw-reject-output  all  --  anywhere             anywhere
ufw-track-output  all  --  anywhere             anywhere

Chain ufw-after-forward (1 references)
target     prot opt source               destination

Chain ufw-after-input (1 references)
target     prot opt source               destination
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:netbios-ns
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:netbios-dgm
ufw-skip-to-policy-input  tcp  --  anywhere             anywhere             tcp dpt:netbios-ssn
ufw-skip-to-policy-input  tcp  --  anywhere             anywhere             tcp dpt:microsoft-ds
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:bootps
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:bootpc
ufw-skip-to-policy-input  all  --  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST

Chain ufw-after-logging-forward (1 references)
target     prot opt source               destination
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-input (1 references)
target     prot opt source               destination
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-output (1 references)
target     prot opt source               destination

Chain ufw-after-output (1 references)
target     prot opt source               destination

Chain ufw-before-forward (1 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere             icmp time-exceeded
ACCEPT     icmp --  anywhere             anywhere             icmp parameter-problem
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
ufw-user-forward  all  --  anywhere             anywhere

Chain ufw-before-input (1 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ufw-logging-deny  all  --  anywhere             anywhere             ctstate INVALID
DROP       all  --  anywhere             anywhere             ctstate INVALID
ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere             icmp time-exceeded
ACCEPT     icmp --  anywhere             anywhere             icmp parameter-problem
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
ACCEPT     udp  --  anywhere             anywhere             udp spt:bootps dpt:bootpc
ufw-not-local  all  --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251          udp dpt:mdns
ACCEPT     udp  --  anywhere             239.255.255.250      udp dpt:1900
ufw-user-input  all  --  anywhere             anywhere

Chain ufw-before-logging-forward (1 references)
target     prot opt source               destination

Chain ufw-before-logging-input (1 references)
target     prot opt source               destination

Chain ufw-before-logging-output (1 references)
target     prot opt source               destination

Chain ufw-before-output (1 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ufw-user-output  all  --  anywhere             anywhere

Chain ufw-logging-allow (0 references)
target     prot opt source               destination
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

Chain ufw-logging-deny (2 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere             ctstate INVALID limit: avg 3/min burst 10
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-not-local (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL
RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type MULTICAST
RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST
ufw-logging-deny  all  --  anywhere             anywhere             limit: avg 3/min burst 10
DROP       all  --  anywhere             anywhere

Chain ufw-reject-forward (1 references)
target     prot opt source               destination

Chain ufw-reject-input (1 references)
target     prot opt source               destination

Chain ufw-reject-output (1 references)
target     prot opt source               destination

Chain ufw-skip-to-policy-forward (0 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere

Chain ufw-skip-to-policy-input (7 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere

Chain ufw-skip-to-policy-output (0 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere

Chain ufw-track-forward (1 references)
target     prot opt source               destination

Chain ufw-track-input (1 references)
target     prot opt source               destination

Chain ufw-track-output (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW
ACCEPT     udp  --  anywhere             anywhere             ctstate NEW

Chain ufw-user-forward (1 references)
target     prot opt source               destination

Chain ufw-user-input (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:27
ACCEPT     udp  --  anywhere             anywhere             udp dpt:27
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ms-sql-s
ACCEPT     udp  --  anywhere             anywhere             udp dpt:ms-sql-s
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ms-sql-m
ACCEPT     udp  --  anywhere             anywhere             udp dpt:ms-sql-m
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8686
ACCEPT     udp  --  anywhere             anywhere             udp dpt:8686

Chain ufw-user-limit (0 references)
target     prot opt source               destination
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere

Chain ufw-user-logging-forward (0 references)
target     prot opt source               destination

Chain ufw-user-logging-input (0 references)
target     prot opt source               destination

Chain ufw-user-logging-output (0 references)
target     prot opt source               destination

Chain ufw-user-output (1 references)
target     prot opt source               destination
REJECT     tcp  --  anywhere             anywhere             tcp dpt:ssh reject-with tcp-reset

我发现邮政这表明该问题可能是由 python 引起的。

答案1

请检查此链接,这对我有用。这似乎是 openssl 版本的问题,微软在 MSSQL 的 CU10 上修复了这个问题,并在 CU16 中恢复了这个问题。

答案2

我也突然无法再连接到我的 SQL 服务器了。这是因为缺少空间。所以我释放了空间并重新启动了 apache2 服务(或者如果它不起作用,则重新启动整个服务器)。

相关内容