Discover sql server maintenance cleanup task, include the articles, news, trends, analysis and practical advice about sql server maintenance cleanup task on alibabacloud.com
. beyond this range, consider maintenance to improve SQL performance:There are three ways to reduce fragmentation:
Delete and recreate the clustered index. Re-creating the clustered index will redistribute the data so that the data page fills up. The fill level can be configured using the FILLFACTOR option in the Create INDEX. NBSP;
fragments between 10% and 30%, reorganize the index,
, item number, order number, customer code, vendor code, and so on.3. Create a delete tag instead of physically deleting the data.For example, some large systems, an object may have dozens of fields. The usual practice is to accommodate all these fields with a table, but for system access efficiency, you can use two table to store them. The main table holds the key, most frequently accessed field properties, as far as possible, without using the variable width field, and storing additional, desc
that the ownership of the index key is unique, be sure to define the index as a unique index.4. When indexing on a table that often inserts operations, use the FILLFACTOR (fill factor) to reduce page splits, while increasing concurrency to reduce deadlocks. If you are indexing on a read-only table, you can set the FILLFACTOR to 1005. When selecting the index key, try to select those with small data types as keys, so that each index page can accommodate as many index keys and pointers as possibl
beyond the company's affordability.
Therefore, the focus on data backup work is the day-to-day management of the network administrator must always pay attention to a task, but also must periodically repeat the operation of a work.
Current backup strategy
My company in the formation of local area network, taking into account the characteristics of commercial enterprises, carefully consider the purchase, sale, storage of the three major links occurr
you build an index on a read-only table, you can set the FILLFACTOR to 100.
(6) When selecting index keys, try to select those with small data types as keys so that each index page can hold as many key and pointers as possible, in this way, you can make a query must traverse the index page to minimize. Also, use integers as key values whenever possible, because it provides access faster than any data type.
V. Maintenance of the Index
As mentioned abo
This article focuses on SQL Server 2005 maintenance plans that cannot be removed (SQL Server maintnance plan can not delete), and the following is full text:
A database to change the IP and host name, only the database instance modified, forget to maintain the plan to remov
Tags: database Add delete Modify index foreign key columnSummary of MySQL, SQL Server, Oracle Three database maintenance indexes, foreign keys, field syntax1. mysql database 1) Create an indexCREATE INDEX index_name on table_name (column_list)CREATE UNIQUE INDEX index_name on table_name (column_list)To modify a table by adding an indexALTER TABLE table_name ADD I
On-premise SQL Server provides a maintenance plan to maintain SQL Server on a regular, scheduled basis. As a general rule, define SQL Server Agent jobs, and the
Step one: See if maintenance is required to see if scan density/scan density is 100%
DECLARE @table_id int
SET @table_id=object_id (' table name ')
DBCC SHOWCONTIG (@table_id)
Step two: Refactor SQL Server database table indexes
DBCC DBREINDEX (' table name ', PK_ index name, 100)
Redo the first step, such as finding the scan
/1000 N ' Total time spent in MS ',total_worker_time/1000 N ' Total CPU time MS ',Total_physical_reads N ' Total number of physical reads ',Total_logical_reads/execution_count N ' Each logical read ',Total_logical_reads N ' Logical reads total number of times ',Total number of total_logical_writes N ' logical writes ',Execution_count N ' execution times ',Creation_time N ' statement compilation Time ',Last_execution_time N ' Last Execution time ',SUBSTRING (St.text, (QS.STATEMENT_START_OFFSET/2)
1. DBCC ShowcontigDisplays fragmentation information for the data and indexes of the specified table. When you make a large number of modifications to a table or add data, execute this statement to view fragmentation information for the specified table or the data and index that is being displayed, whether it is fragmented or not.Its syntax format:DBCCShowcontig[({table_name | table_id | view_name | view_id} [, Index_name | index_id] ) ] [with {[, [All_indexes] ] [, [Tableresults] ]
Label:--LockNote:locks in SQL Server are used to control the concurrency of one transaction with another. The system automatically sets or releases the lock for the resource being accessed . If a transaction locks a resource and another transaction accesses the resource, SQL Server determines whether to grant a second
, @level0type = N ' SCHEMA ', @level0name = n ' dbo ', @l Evel1type = N ' TABLE ', @level1name = @tableName;
END
ELSE
BEGIN--Modify
EXEC [SYS]. [Sp_updateextendedproperty] @name = n ' ms_description ', @value = @tableDesc, @level0type = N ' SCHEMA ', @level0name = n ' dbo ', @level1type = N ' TABLE ', @level1name = @tableName;
END
GO
2, fill in paragraph description
Select the table you want to set, right-click on "Design"
3
This article turns from http://543925535.blog.51cto.com/639838/1427529In the daily SQL maintenance, there are many tasks that need to be repeated periodically, we are not likely to do manual operations, such as backup jobs, rebuild maintenance index, database collation and so on.Take backup as an example, we usually put the time period of database backup at night
Maintenance statement
DBCC dbreindex rebuilding one or more indexes of a table in the specified databaseDBCC dbrepair remove corrupted DatabaseDBCC indexdefrag sorts out clustered indexes and secondary index fragments of a specified table or view.DBCC shrinkdatabase: shrink the data file size in the specified databaseDBCC shrinkfile: compresses the specified data file or log file size of the relevant databaseDBCC updateusage reports and corrects inc
and their properties. They can authorize, deny, and REVOKE server-level permissions. You can also authorize, deny, and revoke database-level permissions. Additionally, they can reset the password for the SQL Server 2008 login.Serveradmin: Members of this server role can change ser
separated from the database, you can consider Table partitions and then back up the data of other tables (primary partition backup) after Partitioning. These backups cannot use differential backup, only full backup can be used each time, and Table partitions cannot be used during restoration. You can only change the table name and create a new table. For details, refer:SQL Server maintenance plan backup pr
),@pdname nvarchar(Ten),@salemoney decimal( -,2)
--extracts the first record and assigns the extracted variable to the corresponding variable
Fetch Next fromC_ Sales Table _ Date into @pdno,@pdname,@salemoney
--use the global variable @ @fetch_status whether the value is 0 as a loop to determine whether to extract records, such as extracted to the output extracted in the loop body value,
--then continue to extract the data using the FETCH command until the @ @FETCH_STATUS value is not 0
w
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.