Dedicated processing method

xiaoxiao2021-03-06  107

step 1:

Create a new database, named the name of the original database.

Step 2:

Stop SQL Server

Step 3:

Replace the MDF file of the old database to the corresponding MDF file of the new database and delete the LDF file.

Step 4:

Restart the SQL Server service and run the following command:

Use master

Go

sp_configure 'allow updates', 1

Reconfigure with override

Go

Begin TRAN

Update sysdatabases set status = 32768 where name = 'db_name'

--Verify one row is updated before committing

Commit TRAN

Step 5:

Stop SQL then restart the SQL Server service, then run the following command:

DBCC TRACEON (3604)

DBCC Rebuild_Log ('db_name', 'c: /msql7/data/dbxxx_3.ldf')

Go

Step 6:

Stop SQL then restart the SQL Server service, then run:

Use master

Update sysdatabases set status = 8 where name = 'db_name'

Go

sp_configue 'allow updates', 0

Reconfigure with override

Go

Step 7:

Run DBCC Checkdb (DB_NAME) Check the integrity of the database

Note: All replacement into a real database name.

转载请注明原文地址:https://www.9cbs.com/read-101758.html

New Post(0)