【正文】
, the connections will no longer fail with a timeout error: Recovery Complete 14 If the recovery process takes a long time, you may have to additionally troubleshoot the recovery process. Test different ways to connect to the instance of SQL Server If you experience connectivity problems when you connect to the instance of SQL Server, you can use one or more of the following methods to work around the connectivity problem. ? Test the connectivity to the instance of SQL Server by using both SQL Server Authentication and Windows authentication. ? Test the connectivity to the instance of SQL Server from other data sources, such as an ODBC DSN, a .udl file, SQL Query Analyzer, SQL Server Enterprise Manager, the isql utility, or the osql utility. ? Test the connectivity to the instance of SQL Server by using different protocols. You can specify different protocols by creating a new alias for the instance of SQL Server using that protocol. You can also specify the protocol in your connection string by adding tcp:, np:, lpc:, or rpc: to the beginning of the name of the instance of SQL Server. For example, if TCP/IP connections are not successful, named pipes connections succeed. ? Test the connectivity by using a different login account to help you determine if the problem is associated with a particular login account. ? Try to add an entry that corresponds to the IP address of the puter that is running the instance of SQL Server to the %systemroot%\system32\drivers\etc\hosts file. ? Try to connect to the instance of SQL Server from the puter that is running SQL Server and from the client. ? If you are connecting from the puter that is running SQL Server, you can specify . or (local) (without the quotation marks) instead of the server name and then connect. ? Try to connect to the instance of SQL Server by using the IP address instead of the server name. ? Try to specify the specific port that the instance of SQL Server is listening on, either by creating an alias or by adding a port number to the connection string (MyServer\MyInstance, 1433, for example). Capture work monitor traces If the connectivity problem is not resolved by the steps that are mentioned in Test different ways to connect to the instance of SQL Server 2021 section, use the Network Monitor utility to capture work traces. To obtain more detailed information, you may have to use SQL Profiler traces. You can also use the Network Diagnostics Tool for nonclustered puters that are running SQL Server for work tracing. 15 B2 中文譯文 如何解決 SQL Server 2021 中的連接問題 Chris Tull, Microsoft Help and Support 這一 篇 文章能幫助你解決微軟 SQL 伺候器 2021 的連接性問題。這一 篇文章包含你能拿幫助解決你的連接性問題的通常連接性問題和步驟的描述。 SQL Server 的例證和客戶端申請之間的溝通的 SQL Server 2021 支持一些方法。如果你的客戶申請和 SQL Server 的例證在相同的計算機(jī)上住 , Microsoft Windows 處理之間的 溝通 (IPC) 成份 ( 像是當(dāng)?shù)氐拿芑蛘弑环窒淼挠洃浻涗?) 用來溝通。 然而 , 當(dāng)客戶 端 申請和 SQL Server 的例證在不同的計算機(jī) , 網(wǎng)絡(luò) IPC( 像是 TCP/IP上住的時候或者命名管 道 ) 用來溝通。 SQL Sever 2021 使用 網(wǎng)絡(luò)控件庫 (一個 DLL)與一個特別的網(wǎng)絡(luò)記錄溝通。 一雙相配 網(wǎng)絡(luò)控件庫 一定在客戶計算機(jī)和服務(wù)器計算機(jī)上是活躍的支援你想要使用的網(wǎng)絡(luò)記錄。 舉例來說,如果你想要使一個客戶申請能夠與 通 過 TCP/IP的一個 SQL Server的特定例證溝通 , 客戶 TCP/IP套接字 網(wǎng)絡(luò)控件庫 () 一定配置成在客戶計算機(jī)上對伺候器連接。 同樣地 , 服務(wù)器 TCP/IP套接字網(wǎng)絡(luò)控件庫 () 一定在伺候器計算機(jī)上聽。 在這一個情節(jié)中 , TCP/IP協(xié)議堆棧 一定是裝置在客戶計算機(jī)和 服務(wù)器 計算機(jī)。 在你安裝 SQL Server 2021 之后,你能配置客戶端網(wǎng)絡(luò)的特性使用客戶端網(wǎng)絡(luò)公用程序的網(wǎng)絡(luò)庫屬性。 你能配置服務(wù)器網(wǎng)絡(luò)的特性使用服務(wù)器網(wǎng)絡(luò)公用程序()的網(wǎng)絡(luò)控件庫屬性。在安裝 SQL Server 安裝程序中的服務(wù)器工具期間,服務(wù)器的網(wǎng)絡(luò)庫也被同時 安裝了。然而,一些服務(wù)器的網(wǎng)絡(luò)庫可能不是激活的。如此, SQL Server 2021 啟用并偵聽 TCP/IP、命名管道和共享內(nèi)存。因此,讓一個客戶端對一部服務(wù)器計算機(jī)連接,客戶端一定使用一個客戶端網(wǎng)絡(luò)庫,該網(wǎng)絡(luò)庫匹配與 SQL Server 實例正在使用的服務(wù)器網(wǎng)絡(luò)庫之一。 對于關(guān)于 SQL Server通訊部件和網(wǎng)絡(luò)庫的其它信息, 請參見 “SQL Server 在線參考書 ”中的下列主題: ? 通信部件 ? 客戶端和服務(wù)器網(wǎng)絡(luò)庫 ? 管理客戶端 解決連接問題 在 SQL Server 2021 中大多數(shù)連接問題 你可能會注意到的都是由 TCP/IP 的問題或 Windows 身份認(rèn)證的問題引起,或者兩者共同組合引起。 重要說明:你開始 解決 SQL Server 2021 的連接問題之前,確定MSSQLServer 服務(wù)已在運(yùn)行 SQL Server 的計算機(jī)上啟動。 驗證 DNS 設(shè)置 16 域名系統(tǒng) (DNS)的名稱解析過程被用于解決 IP 對 SQL Server 實例名稱 。如果名稱解析程序不正確地工作, SQL服務(wù)器的實例不是可到達(dá)的, 你可能接受到一條或多條下列錯誤信息: SQL Server does not exist or access denied General Network Error Cannot Generate SSPI Context 為了要確認(rèn)名稱解析程序是解析正確的服務(wù)器,你能使用服務(wù)器的服務(wù)器名字和 IP 地址 ping服務(wù)器。為此,請遵從如下步驟操作: 1. 單擊 “開始 ”,然后單擊 “運(yùn)行 ”。 2. 在 “運(yùn)行 ”對話框中,在 “打開 ”框中鍵入 cmd,然后單擊 “確定 ”。 3. 在命令提示符下,運(yùn)行下列命令: ping Server Name 記錄返回的 IP 地址。 4. 在命令提示符下,運(yùn)行下列命令(此 處的 IP address 就是 你 在步驟 3 中記錄的 IP 地址): ping –a IP address 確認(rèn)指令跟正確的服務(wù)器名字解決。如果任一指定指令不成功、超時或者沒有返回正確的數(shù)值在兩個指定的命令,那么 DNS 查找未能正常工作,或者 因為其它的網(wǎng)絡(luò)問題引發(fā)問題。要查看當(dāng)前 DNS 設(shè)定,在命令提示符下運(yùn)行下列命令: ipconfig /all 要解決此問題,可以在客戶端計算機(jī)上的 %systemroot%\system32\drivers\etc\hosts 文件中為服務(wù)器添加一個條目。要解決此問題 ,還可以使用命名管道網(wǎng)絡(luò)庫連接到服務(wù)器。 啟用的協(xié)議和別名 的驗證 如果客戶端計算機(jī)上的別名 錯誤 設(shè)置,可能會引起連接問題。 你 可以 查看別名 使用客戶端網(wǎng)絡(luò)實用程序。為此,請按以下步驟操作: 1. 啟動客戶端網(wǎng)絡(luò)實用程序。如果 SQL Server 客戶端工具被安裝在正在運(yùn)行客戶端應(yīng)用程序的計算機(jī)上,請啟動客戶端網(wǎng)絡(luò)實用程序 按照以下步驟 : a. 單擊 “開始 ”,然后指向 “程序 ”。 b. 指向 “Microsoft SQL Server”,然后單擊 “客戶端網(wǎng)絡(luò)實用程序 ”。 如果 SQL Server 客戶端工具沒 有安裝在客戶端計算機(jī)上,請按照以下步驟啟動客戶端網(wǎng)絡(luò)實用程序: a. 單擊 “開始 ”,然后單擊 “運(yùn)行 ”。 b. 在 “運(yùn)行 ”對話框中,在 “打開 ”框中鍵入 cliconfg,然后單擊 “確定 ”。 2. 在 “SQL Server 客戶端網(wǎng)絡(luò)實用程序 ”窗口中,單擊 “常規(guī) ”標(biāo)簽,然后啟用 你 要使用的所有協(xié)議。 注意: 你 必須啟用 TCP/IP 協(xié)議和命名管道協(xié)議 至少 。 17 3. 單擊 “別名 ”標(biāo)簽,然后驗證為 SQL Server 實例所配置的別名。 4. 驗證別名的屬性,確認(rèn)服務(wù)器名或 IP 地址和協(xié)議的配置是正確的。 你 可以 測試連接性能創(chuàng)建一個新的別名 ,通過使用服務(wù)器名、 IP 地址或者其他協(xié)議 。 注意 :在 Microsoft 數(shù)據(jù)存取部件 (MDAC) 的早期版本中,客戶端網(wǎng)絡(luò)實用程序的用戶界面是不同的。因此,如果 你 沒有看到選項 在本文中列出的 ,請在正在運(yùn)行客戶端應(yīng)用程序的計算機(jī)上安裝 MDAC 的新版本。 驗證 SQL Server 實例正在正確地偵聽 要驗證 SQL Server 實例正在正確地偵聽命名管道、 TCP/IP 或 你 在客戶端應(yīng)用程序中使用的其他協(xié)議,請打開當(dāng)前的 SQL Server 錯誤紀(jì)錄文件 。 SQL Server 錯誤日志文件可能包括與以下類似的條目: 20211106 09:49: server SQL server listening on TCP, Shared Memory, Named Pipes. 20211106 09:49: server SQL server listening on :1433, :1433. 通過分析 SQL Server 錯誤日志文件中的條目,可以驗證 SQL Server 實例是否正在偵 聽正確的 IP 地址和端口。在默認(rèn)情況下,一個 SQL Server 實例 默認(rèn) 偵聽端口 1433。 你 還可以驗證 SQL Server 的協(xié)議設(shè)置并更改 SQL Server 中的屬性 使用服務(wù)器網(wǎng)絡(luò)實用程序 ,包括可以連接到 SQL Server 和可以使用的端口的協(xié)議