Sửa lỗi instance name mssqlserver is already in use năm 2024
This is something I’ve posted about on newsgroups, but one of my colleagues encountered it recently, and I think it deserves a blog entry. Show
The CRM Environment Diagnostics Wizard may throw the error ‘The instance name must be the same as computer name’. The most common cause of this is if the SQL Server has been renamed after SQL Server was installed. The reason is that, at installation time, SQL Server stores the computer name in a system table, sysservers. This information is not updated when the computer is renamed, and the error from the CRM Environment Diagnostics Wizard indicates that the entry in sysservers does not match the current computer name. You can diagnose and resolve this by using some SQL system stored procedures. One of them lists the data in sysservers, the other 2 allow you to modify the data to reflect the current machine name. To check if this is the issue, use SQL Management Studio (or Query Analyzer for SQL 2000) to execute the following query: sp_helpserver This will return output like the following: Name,network_name,status,id,collation_name,connect_timeout,query_timeout ORGNAME,ORIGNAME,rpc,rpc out,use remote collation,0,null,0,0 If the value in the name column does not match the current computer name, then you have to use the following SQL stored procedures to fix the problem. Note that sp_helpserver normally returns one record, but can return more records if you have configured linked servers. If this is the case, it is the row with id=0 that matters. To change the information you have to first remove the incorrect record, then add the correct one, with the following queries: sp_dropserver ‘ORIGNAME’ -- where ORIGNAME is the name returned by sp_helpserver sp_addserver ‘CURRENTNAME’, ‘LOCAL’ – where CURRENTNAME is the current computer name If you use named instances, refer to them in the form SERVERNAME\INSTANCENAME. It may then be necessary to restart SQL Server after these changes, but I'm not sure of this. It can't harm though if you can. There is a KB article about this here. This descibes a similar solution, but be warned of a couple of minor issues with the solution - it fails to specify that quotes are required around the parameters to sp_dropserver and sp_addserver, and I have a feeling (though can't provide concrete evidence) that running sp_helpserver is more reliable than select @@servername. How do you resolve error "Instance name you entered is already in use. Please enter a name that is not being used"? CauseThis error may be caused if you do not follow correct procedure to uninstall product. AnswerInstaller will detect instance/port entry in /etc/services file. If the entry already exist in /etc/services installer will return the instance already exist error. To correct error remove entry from /etc/services file. An example of the entry that you should remove shown below; db2c_db2inst1 50001/tcp [{"Product":{"code":"SS2K5T","label":"InfoSphere Federation Server"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Installation","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"8.2;9.1;9.1.1;9.1.1.2;9.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}] Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In this articleApplies to: SQL Server When connecting to a SQL Server instance, you may encounter one or more of the following . This article provides some steps to help you troubleshoot these errors, which are provided in order of the issues from simple to complex. Error messagesThe complete error messages vary depending on the client library that's used in the application and the server environment. You can check the following details to see if you're encountering one of the following error messages: "A network-related or instance-specific error occurred while establishing a connection to SQL Server. Verify that the instance name is correct and that SQL Server is configured to allow remote connections"provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server (Microsoft SQL Server, Error: 53) A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server (Microsoft SQL Server, Error: 53) provider: TCP Provider, error: 0 - No such host is known. (Microsoft SQL Server, Error: 11001) provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified Login timeout expired SQL Server Native Client Data Link Error [Microsoft SQL Server Native Client 10.0]: Login timeout expired [Microsoft SQL Server Native Client 10.0]: 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. [Microsoft SQL Server Native Client 10.0]: SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. provider: TCP Provider, error: 0 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Microsoft SQL Server, Error: 10060 provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server Microsoft SQL Server, Error: 53 The network path was not found [Microsoft][SQL Server Native Client 11.0]TCP Provider: No connection could be made because the target machine actively refused it SQL Server Native Client Data Link Error [Microsoft][SQL Server Native Client 11.0]TCP Provider: No connection could be made because the target machine actively refused it. [Microsoft][SQL Server Native Client 11.0]Login timeout expired. [Microsoft][SQL Server Native Client 11.0]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. "SQL Server does not exist or access denied"This error usually means that the client can't find the SQL Server instance. This issue occurs when at least one of the following problems exists:
Windows error 233: No process is on the other end of the pipeThe complete message is: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233) This message means that SQL Server isn't listening on the Shared Memory or Named Pipes protocol. Gather information for troubleshooting the errorWe recommend that you gather the information listed in this section using one of the following options before proceeding with the actual steps to troubleshoot the error. Option 1: Use the SQL Check tool to gather the required informationIf you can sign in locally to the SQL Server computer and have administrator access, use SQLCHECK. This tool provides most of the information required for troubleshooting in one file. Review the tool's home page for more information on using the tool and the information it gathers. You can also check the recommended prerequisites and checklist page. Option 2: Collect the data individually using the following proceduresGet the instance name from Configuration ManagerOn the server that hosts the SQL Server instance, use SQL Server Configuration Manager to verify the instance name: Note Configuration Manager is automatically installed on the computer when SQL Server is installed. Instructions on starting Configuration Manager vary slightly by versions of SQL Server and Windows. For version-specific details, see SQL Server Configuration Manager.
Get the IP address of the serverYou can use the following steps to get the IP address of the computer hosting the instance of SQL Server.
Get the TCP port of the instanceIn most cases, you connect to the Database Engine on another computer by using the TCP protocol. To get the TCP port of the instance, follow these steps:
Step 1:Verify that the instance is runningOption 1: Use the SQLCHECK output file
Option 2: Use SQL Server Configuration ManagerTo verify that the instance is running, select SQL Server Services in SQL Server Configuration Manager and check the symbol by the SQL Server instance.
If the instance is stopped, right-click the instance and select Start. Then, the server instance starts, and the indicator becomes a green arrow. Option 3: Use PowerShell commandsYou can use the following command in PowerShell to check the status of SQL Server services on the system:
You can use the following command to search the error log file for the specific string "SQL Server is now ready for client connections. This is an informational message; no user action is required.":
Step 2: Verify that the SQL Server Browser service is runningNote This step is required only for troubleshooting connectivity issues with named instances. Option 1: Use the SQLCHECK output file
Option 2: Use SQL Server Configuration ManagerTo connect to a named instance, the SQL Server Browser service must be running. In SQL Server Configuration Manager, locate the SQL Server Browser service and verify that it's running. If it's not running, start the service. The SQL Server Browser service isn't required for default instances. For more information on using SQL Server Browser service in your environment, see SQL Server Browser service. For more information on stopping and starting SQL Services, see Start, stop, pause, resume, restart SQL Server services. Step 3: Verify the server name in the connection stringYou often encounter errors when an incorrect server name is specified in the connection string. Make sure that the server name matches the one that you retrieved in the previous steps. Note If you are using the SQLCHECK tool, review the NetBios Name/FQDN values in the Computer Information section of the output file.
Step 4: Verify the aliases on the client machinesAliases are often used in client environments when you connect to SQL Server with an alternate name or when there are name resolution issues in the network. They're created by using SQL Server Configuration Manager or client network utility. An incorrect alias can cause the connections from your applications to connect to the wrong server, resulting in failure. Use the following methods to check for incorrect aliases. You can also use a tool (such as SQLCHECK) on the client machine to check for aliases and various other connectivity-related settings on a client machine. Option 1: Use the SQLCHECK output file
Example output: SQL Aliases:
The output indicates that Option 2: Check aliases in SQL Server Configuration Manager
Option 3: Check aliases in SQL Server Client Network Utility
Step 5: Verify the firewall configurationYou can verify the firewall configuration depending on the default instance or named instance. Note If you are using third party firewalls in your network, the concepts still apply. However, you may have to work with your network administrator or consult the firewall product's documentation for more information on configuring the firewall to allow necessary ports for communication with SQL Server. Default instance of SQL ServerA default instance typically runs on port 1433. Some installations also use a non-standard port (other than 1433) to run SQL instances. The firewall may block either port. To check the port number further, follow these steps:
Named instance of SQL ServerIf your SQL instance is a named instance, it may be configured to use either dynamic ports or a static port. In either case, the underlying network libraries query the SQL Server Browser service running on your SQL Server machine through UDP port 1434 to enumerate the port number for the named instance. If a firewall between the client and the server blocks this UDP port, the client library can't determine the port (a requirement for connection) and the connection fails. To check the connection, you can use one of the following methods:
Step 6: Verify the enabled protocols on SQL ServerIn some installations of SQL Server, connections to the Database Engine from another computer aren't enabled unless an administrator manually enables them. You can use one of the following options to check and enable the necessary protocols to allow remote connections to SQL Server Database Engine. Option 1: Use the SQLCHECK output file
Option 2: Use SQL Server Configuration ManagerTo enable connections from another computer by using the SQL Server Configuration Manager, follow these steps:
Step 7: Test TCP/IP connectivityConnecting to SQL Server by using TCP/IP requires that Windows establish the connection. You can use the following steps to test TCP connectivity by using the ping tool.
Step 8: Test local connectionBefore troubleshooting a connection problem from another computer, test your ability to connect from a client application installed locally on the computer that is running SQL Server. Local connection avoids issues with networks and firewalls. This procedure requires SQL Server Management Studio. If you don't have Management Studio installed, see Download SQL Server Management Studio (SSMS). If you can't install Management Studio, you can test the connection by using the sqlcmd.exe utility. sqlcmd.exe is installed with the Database Engine. For information about sqlcmd.exe, see sqlcmd Utility.
Step 9: Test remote connectionOnce you can connect by using TCP on the same computer, it's time to try to connect from the client computer. You could use any client application, but to avoid complexity, install the SQL Server Management tools on the client. After installation, try to use SQL Server Management Studio.
Step 10: Check user permissionsIf you are using Named Pipes to connect, check if a user has permissions to log into Windows. For more information, see Troubleshooting the Named Pipes connections issue. |