Failed to connect to database. Maximum number of conections to instance exceeded

Source: Internet
Author: User

We generally know that ARCSDE has a limit of 48 connections, and many people know that this parameter can be modified, and the maximum number of connections that each operating system can support is different. If an error is applied: What should I do if I exceed the maximum number of connections?

Two solutions:

First, first determine whether the maximum number of connections must be increased. In our usual applications, especially for multi-user implementations. Sometimes there will be a graphics library inexplicable connection, if the connection with ArcMap or Arccatalog will also prompt the error message "Failed to connect to database." Maximum number of conections to instance exceeded ". The error message is very clear, but how to solve it? Many times the solution is to restart the SDE service or delete the GSRVR.EXE process on the machine where the SDE service resides. Although this can solve the current problems, but after a period of time, the same situation will be disturbed. The maximum number of connections that the SDE itself sets by default is 48. It is generally not possible to have so many users connecting to the graphics database at the same time. And our system, as well as desktop software such as ArcMap or Arccatalog, will remove the connection to the database when it exits. But why is there a problem that exceeds the maximum number of connections? After a number of attempts to find: when the system exits abnormally, or connected to the database when forced to unplug the network cable and other unconventional operations. Records such as the connection process on the SDE server and the number of user connections for SDE logged in the database cannot be deleted. resulting in an invalid connection more and more, eventually reached his limit, the error is unavoidable. We can view some of the basic setup parameters of the current SDE by typing the following command: Sdemon–o info–i config. You can also view the number of current user connections by command: Sdemon–o info–i users, plus after the Sdemon command? You can view all the parameter information for the command). When setting the maximum number of connections for a user, you need to estimate how many connection processes are possible at the same time. The number of processes opened in SDE and the number of connected users is calculated as an instance, when a machine opens n ArcMap and connects to a database, there are n connections and records for n connected users. If you confirm the maximum number of connections, you are ready to set up.

Method One: Open the table sever_config under the SDE user with Plsql or toad, and edit the field connections value to your maximum number of connections. Set the field Tcpkeepalive value to True.

Method Two: Open the SDE installation directory (the general installation path is C:/ARCGIS/ARCSDE/SQLEXE/ETC) giomgr.defs file for editing, set the connections parameter to your maximum number of connections. Then set the tcpkeepalive parameter to True. Import into the database by command: Sdeconfig–o import–f c:/arcgis/arcsde/sqlexe/etc/giomgr.defs–i ESRI_SDE (db instance name) –s (ServerName) –u SDE ( User name) –p sde (password). You will need to restart the SDE service to take effect after setup. What is the tcpkeepalive parameter for? The biggest contributor to the ability to delete invalid connections is him. When the tcpkeepalive parameter is set to True, the database continuously detects if all connections are invalid and, if the connection is invalid, automatically deletes the connection based on the response time provided by the registry key of the machine on which the SDE service resides KeepAliveTime. The KeepAliveTime registry key is not in the case of a machine that installs the operating system by default. If there is no word, the server does not actively send KeepAlive packets to confirm that the idle connection remains unchanged. The delete operation is not performed. Therefore, the above mentioned invalid connection will be more and more. You can add a DWORD entry in the following path: Local_machine/system/currentcontrolset/services/tcpip/parameters: KeepAliveTime. If you do not set a value, the default is two hours. The exact time can be determined by the situation. The general recommendation is 5 minutes. Then restart the machine (be sure to restart the registry for new entries to take effect). The world is quiet, and the mistake of exceeding the maximum number of connections will never bother your scalp again.

Second, if the actual number of connection restrictions, how can we modify? On the Windows operating system, the ArcSDE service runs as a "non-interactive desktop program", and a initialization parameter called SharedSection for Windows qualifies the maximum stack memory allocated for "non-interactive desktop programs". We can modify this value through the Windows registry. Click "Start", "Run", "regedit" to open the registry: Locate the following path: [url=file:////hkey_local_machine/system/currentcontrolset/control/ Session]//hkey_local_machine/system/currentcontrolset/control/session[/url] Manager/subsystems/windows This string example is as follows:%systemroot%/system32/csrss.exe objectdirectory=/windows sharedsection=1024,3072,512 Windows=On Subsystemtype=windows serverdll=basesrv,1 serverdll=winsrv:userserverdllinitialization,3 ServerDll=winsrv: conserverdllinitialization,2 Profilecontrol=off maxrequestthreads=16 This string contains the initialization parameters for Windows. In this string, we can find the SharedSection parameter, and the default value is 1024,3072,512. The third value (512KB) is the maximum stack memory allocated for non-interactive desktop programs. Under this value (512KB), the maximum number of connections that ARCSDE can accept is approximately 56. Increasing this value to 2M enables ARCSDE to support up to 270 maximum connections. This is set to: 1024,3072,2048 for Windows, the sum of all stack memory (non-interactive desktop and interactive desktop) is 48Mb, so we need to be careful when adjusting the sharedsection parameters.

-------------------------------------------------------------

The official default SDE maximum number of connections is 48, in the actual application once exceeded this maximum number of connections, can not be connected to SDE, prompted: "Failed to connect to database." Maximum number of conections to instance exceeded ". I often encounter this kind of situation in the actual work, the solution is to restart the service every time. In the Giomgr.defs file in the $sdehome/etc directory, the number of connections connections is modified to 128, or use the command sdeconfig-o alter-v connections=128-u sde-p SDE After all, always restart service is not a permanent solution, I also found some solutions on the Internet, the simplest way is to modify the connection parameter for a larger number. But because the system defaults to 48, and later saw an article devoted to why the maximum number of connections for the SDE service in the Windows operating system is 48, Windows has allocated a fixed-size memory for each service (default 512K). Each SDE process requires approximately 9K of memory, so the SDE default number of connections is 512/9 approximately equal to 48. This memory can be modified to change the 512k to 1024, if the number of connections is more than 250, you can change to 2048. Need to modify registry: Hkey_local_machine/system/currentcontrolset/control/session in Manager/subsystems/windows project SharedSection , and change the third item in the original sharedsection=1024,3072,512 to 1024 or 2048 to modify the default maximum number of connections for the system. But what's the effect? I have not tried, will not appear unstable situation, after all, the more the number of connections, the concurrency of the more unstable operation. If you do not modify this parameter, let SDE automatically detect and disconnect an SDE connection that has not been operational for a certain amount of time, which is the best way to resolve the problem. I see that the forum has been resolved by setting the "tcpkeepalive" parameter to True and in the registry local_machine/system/currentcontrolset/services/tcpip/parameters Add DWORD entry: KeepAliveTime. The KeepAliveTime time value is: the SDE server giomgr process does not receive the maximum threshold of the client's response, and if this value is exceeded, then the client process and its associated information will be purged. Itis on the SDE server machine. The default value of KeepAliveTime is 7200000ms (2 hours) in milliseconds. KeepAliveTime himself did not attempt to use, just modified the connection number and registry information.

Failed to connect to database. Maximum number of conections to instance exceeded

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.