SQL Server database has six practical skills: (1) pending operations When installing the SQL or SP patch, the system prompts that a pending installation operation is required. Restart is often useless. Solution: Go to HKEY_LOCAL_MACHINE/system/CurrentControlSet/control/Session Manager. Delete pendingfilerenameoperations (2) shrinking the database -- Re-create the index DBCC reindex DBCC indexdefrag -- Shrink data and log DBCC shrinkdb DBCC shrinkfile (3) compressing database DBCC shrinkdatabase (dbname) (4) Transfer the database to a new user with the existing user permission exec sp_change_users_login @ # update_one @ #, @ # newname @ #, @ # oldname @ # Go (5) Check the backup set restore verifyonly from disk =@# E:/dvbbs. Bak @# (6) database Restoration Alter database [dvbbs] Set single_user go DBCC checkdb (@ # dvbbs @ #, repair_allow_data_loss) Wh tablock go alter database [dvbbs] Set multi_user go -- checkdb has three parameters: -- ignore -- Execute all the repairs completed by repair_rebuild, including allocating and unassigning rows and pages to correct the allocation errors, structure row or page errors, and deleting corrupted text objects. These fixes may cause some data loss. The repair operation can be completed under the user transaction to allow the user to roll back the changes. If the rollback is fixed, the database will still contain errors and the backup should be restored. If an error fix is missing due to the severity of the severity level provided, it will omit any fix that depends on the fix. After the restoration, back up the database. -- Repair_fast Performs small and time-consuming repair operations, such as fixing the additional keys in non-clustered indexes. These repairs can be completed quickly without the risk of data loss. -- Repair_rebuild: execute all the repairs completed by repair_fast, including repairs that require a long period of time (such as re-indexing ). There is no risk of data loss when performing these repairs. -- DBCC checkdb (@ # dvbbs @ #) with no_infomsgs, physical_only (Responsible editor: Lu Zhaolin) Http://tech.ccidnet.com/art/1106/20071225/1321707_1.html |