Start the SQL Server service and database

In the daily management and maintenance of SQL Server, we need to pay attention to many things, and sometimes we can't do things well. Now, I will share with you the basic principles and solutions to common problems.
First introduce the basic operating principle of SQL Server.
As a Windows service, each instance of SQL Server is a sqlserve.exe process. After this process starts, it reads the startup configuration of the SQL Server instance, detects hardware, configures memory and CPU, initializes some SQL Server system configurations, starts the database, and connects to the network. Then the database is started normally, and then the client can access it normally.
This is the basic startup process. Under what circumstances does it fail to start normally? Of course, we introduce the basic situations that we can solve, such as execution file corruption, database corruption, and these problems that cannot be solved immediately will be introduced in the future.
1. The SQL Server instance service process cannot start normally. When the
sqlservr.exe process starts, it needs to read some registry keys and some files, and then take corresponding actions according to these configurations.
What are the registry keys that need to be read, and what is the general function:
1) Under HLM\SPFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer,
Audit Level: Set whether SQL Server records user login information, It can also be set in the server properties in Management Studio.
Login Mode: Set whether SQL Server only accepts Windows account logins, or accepts both WIndows and SQL server accounts.
2) Under the startup parameters HLM\SPFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\Parameters,
SQL Server can have many startup parameters, some of which are used to analyze problems.
Several fixed parameters are described below:
-d records the physical location of the data file of the master database
-l records the physical location of the master log file
-e records the location of the SQL Server error log file
3) Network configuration information HLM\SPFTWARE Under \Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib,
which network protocols SQL Server will listen to, and the configuration of each network protocol are also placed in the registry.
There are two problems that may be encountered in this step of reading SQL Server startup information from the registry:
1) Startup account permission problem
If the startup account does not have permission to read the registry or call some resource files of SQL Server, then the process of SQL Server has It may not be able to be created, and the errorlog file may not be generated at this time.
The solution to this problem is to give permissions to the startup account.
2) Log file and folder access problems
To successfully start SQL Server, it must be able to create the log file correctly. If the log file cannot be created successfully, then SQL Server cannot be started.
Sometimes the path of the log is incorrect, that is, the location specified by the -e parameter is incorrect; or a process locks the errorlog file.
2. The system database cannot be started normally
After the SQL Server service is started, the first thing to do is to start the system database. If the system database cannot be opened normally, SQL Server will not start normally.
3. Network configuration failure
To receive the connection from the client, SQL Server must configure the network protocol, usually TCP/IP, Named Pipe, LPC. If the protocol is not configured correctly, the client cannot connect to SQL Server normally.
4. User data cannot be started normally
The last step of SQL Server startup is to open the user database. If the database file is damaged, or the database was not shut down normally when SQL Server was shut down last time, you may encounter troubles when opening the user database.
5. SQL Server resources cannot be maintained in a
cluster environment. SQL Server installed in an online cluster environment will be monitored by Windows Cluster Service to see if the SQL Server is working normally. A switchover may occur if the Cluster service cannot connect to SQL Server. Management requires monitoring and analysis, why SQL Server resources cannot be kept online, and what was the reason for the last switchover.
Tip: The Errorlog log records all serious problems encountered by SQL Server during startup or operation, so when SQL Server encounters an abnormal problem, check the log file first. This file is generally saved in 7, in order of time from near to far, and restarting the SQL Server service will generate a new errorlog file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325548580&siteId=291194637