(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:
To HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession Manager
Delete PendingFileRenameOperations
(2) shrinking the database
-- Re-indexing
DBCC REINDEX
DBCC INDEXDEFRAG
-- Shrink data and logs
DBCC SHRINKDB
DBCC SHRINKFILE
(3) compressing the database
Dbcc shrinkdatabase (dbname)
(4) transfer the database to a new user with existing user permissions
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) WITH TABLOCK
GO
Alter database [dvbbs] SET MULTI_USER
GO
-- CHECKDB has three parameters:
-- REPAIR_ALLOW_DATA_LOSS
-- 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