If you are in charge of a SQL Server-based project or you have just been in touch with SQL Server, you may have to face some database performance problems, this article will provide you with some useful guidance (most of which can also be used for other DBMS ).
Here, I am not going to introduce the tips for using
SQL Server database penetration from the basics
Create lab environment
Next, I will provide an example to demonstrate the basic steps for creating an SQL Server.
Download Microsoft SQL Server Express and Install
, because the table memory is not involved, and you can query SQL Server Books Online for specific usage.Value has the following usage:The option_name is enabled (true, on, or 1) or disabled (false, off , or 0)Example:EXEC sp_tableoption ' Department ', ' pintable ', ' true 'Department The data table to reside memoryEXEC sp_tableoption ' Department ', ' pintable
]"]
Simple Export Example 1:
Figure-2Simple Export Example 2:
Figure-3The SSMS can also be executed at the same time:
EXEC [Master]. xp_cmdshell
' BCP testdb_2005.dbo. T1 out E:\T1_02.txt-c-t ' Go
Code-1
Figure-4
EXEC [Master]. xp_cmdshell
' BCP ' select * from Testdb_2005.dbo. T1 "Queryout E:\T1_03.txt-c-t ' Go
Code-2
Figure-5Personally, I prefer to use the second style with the queryout option, because it makes it more flexible to control the data to be exported. If you run the bcp command
best to monitor the users who have no permission to delete the wrong table. Of course, do not use an account unless necessary !)
You can use
EXECsp_configure'defaulttraceenabled',0;
RECONFIGUREWITHOVERRIDE;
To disable the default trail.
Black box tracking helps us diagnose database failures. We should also find it when searching sp_create_trace on MSDN.
Then we can create a similar stored procedure to quickly create a black box tracking, to help us diagnose some exceptions!
CREA
Because SQL Server Compact Edition and SQL Server 2005 are contemporaries, interoperability and convergence between them are better than previous versions of SQL Server, so if you want to consider using
is more important to compare the number of reads between different query statements and to optimize the statements by reducing the number of reads.As for the pre-read scenario, we have previously analyzed that the data is preloaded by another thread when the T-SQL query statement is optimized.So this thread actually has a reference value when reading the data, and the data can be read from this reference to ensure that most of the data is useful, tha
"peripheral application configurator" in SQL Server books online ".
Query relevant information and find the solution:
Enable ad hoc distributed queries:Exec sp_configure 'show advanced options', 1ReconfigureExec sp_configure 'ad hoc distributed queries ', 1ReconfigureAfter use, disable ad hoc distributed queries:Exec sp_configure 'ad hoc distributed queries ',
If you are in charge of a SQL Server-based project, or you have just been in touch with SQL Server, you may have to face some database performance problems, this article
Article It will provide you with some useful guidance (most of which can also be used for other DBMS ).
Here, I am not going to introduce the tip
sp_configure ' show advanced options ', 1
Reconfigure
Go
sp_configure ' xp_cmdshell ', 1
Reconfigure
Go
sp_configure ' show advanced options ', 0
Reconfigure
Go
--Control the execution of a stored procedure from a local or remote server running an instance of SQL Server
sp_configure ' show advanced options ', 1
Reconfigure
server, the time it takes to cache the execution plan, and the parameters of the current cached execution plan compile time.After the query to the execution plan of the corresponding stored procedure cache, it is found that the execution plan is quite different from the execution plan that currently executes SQL directly into the parameters.Of course, the problem is not entirely consistent with parameter s
If you are in charge of a SQL Server-based project or you have just been in touch with SQL Server, you may have to face some database performance problems, this article will provide you with some useful guidance (most of which can also be used for other DBMS ).
Here, I am not going to introduce the tips for using
deadlock state. A common implementation method is to undo or suspend some processes to recycle some resources, and then allocate these resources to the blocked processes so that they are ready to continue running. Deadlock Detection and removal measures may make the system obtain better resource utilization and throughput, but the implementation is also the most difficult.
According to the deadlock handling method in the above 4, it is about lock monitor to detect and remove deadlocks. As a
the deadlock. This is a measure to match the detection of deadlocks. When a deadlock has been detected in the system, the process must be freed from the deadlock state. A common practice is to undo or suspend some processes in order to reclaim some resources, and then assign those resources to a process that is already in a blocked state and make it ready to continue running. Deadlock detection and lifting measures, it is possible to make the system to achieve better resource utilization and th
, temporary worksheets, temporary stored procedures, large types of temporary storage, and intermediate result sets, table variables and cursors. In addition, it is used to meet all other temporary storage requirements.
2. Internal Operating Principle of tempdb
Unlike other SQL Server databases, tempdb stops at SQL Server
Every time you talk about the high availability of SQL Server, a lot of DBAs, especially SQL Server DBA, have a pain in their head: Because everyone thinks that SQL Server cannot or wil
It is understood that most developers have a smattering of understanding of the index, limited to most of the daily work no opportunity, what is not necessary to care about, understand the index, it is really a query too slow to find the query conditions to build an index on OK, which day again a query slow, and then establish an index is, Or simply send the entire query SQL directly to the DBA, let the
high. First, check the system process to determine the process that causes the CPU usage too high.
SQL Server Profiler can easily monitor which SQL statements are executed for a long time and consume the most CPU resources.
You can use SQL statements to view the CPU usage of each
Server to execute. Therefore, the query plan formed by this statement is the same as the preceding query plan.The optimization here is all due to the intelligence of SQL Server.But when we write the statement, you need to understand, master, in order to write efficient T-SQL statement.ReferencesLogical operators and physical operators in Microsoft
causes this error will be recorded in msdb. dbo. suspect_pages. The error page number is also recorded in the SQL Server Error Log, as shown in 2.
. 824 description of errors in SQL Server Error records
Therefore, if we have a complete backup, we can use the backup to restore the page (here, I would like to em
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.