Only the mdf file data recovery method (05, 08, 2 k)

Source: Internet
Author: User
SQLSERVER2005 (2008) Only data recovery method for mdf files 1. Create a SharePoint_Config database 2. Stop SQLSERVER2005. overwrite the original SharePoint_Config.mdf database file and restart the database, in this case

SQL server 2005 (2008) only supports data restoration of mdf files. 1. Create a SharePoint_Config database. 2. Stop SQL SERVER 2005. the mdf data library file overwrites the newly created SharePoint_Config. mdf data library file and restart the data library.

SQL SERVER 2005 (2008)

Only mdfFileOfDataRestoreMethod

1. Create SharePoint_ConfigDataLibrary

2. Stop SQL SERVER 2005 and replace the original SharePoint_Config. mdfDataLibraryFileOverwrite the newly created SharePoint_Config. mdfDataLibraryFile, RestartDataLibrary,
In this caseDataThe table in the database cannot be read normally.

3. SetDataSet the database to emergency:

Alter database into point_config set emergency
In this caseDataIn an emergency, tables in the database can be read.

4. Run the following code:

Use master

Declare @ databasename varchar (255)

Set @ databasename = 'sharepoint _ config' -- set the variableDataName

Exec sp_dboption @ databasename, N 'single ', N 'true' -- SetDataDatabase set to single user status

Dbcc checkdb (@ databasename, REPAIR_ALLOW_DATA_LOSS)

Dbcc checkdb (@ databasename, REPAIR_REBUILD)

Exec sp_dboption @ databasename, N 'single ', N 'false' -- set the targetDataSet database to multi-user status

DataThe database is normal.

Bytes ------------------------------------------------------------------------------------

SqlServer2000

1. EnableDataLibrary
2. Create a file with the same name from the Enterprise ManagerDataLibrary
3. Stop SQL server
4. Use the original mdfFileOverwriteDataLibraryFile
5. Restart SQL server.DataLibrary Should be questionable)
6. Modify Server Settings: allow direct modification to the system directory
Sp_configure 'Allow updates', 1 reconfigure with override
7. SetDataDatabase set to emergency:
Update master. dbo. sysdatabases set status = 32768 where name ='DataDatabase name'
8. Delete the new ldfFile, Rebuild log:
Dbcc rebuild_log ('DataDatabase Name ', 'f :\DataDatabase Name _ log_new.ldf ') -- assume that the new log is stored on the drive
9. update master. dbo. sysdatabases set status = 16 where name ='DataDatabase name'
10. Modify Server Settings: Cancel direct modification to the system directory.
Sp_configure 'Allow updates', 0 reconfigure with override
11. Use the check tool to fix the error.
Use [DataDatabase Name]
Alter database [DataDatabase Name] set single_user with rollback immediate
Dbcc checkdb ('DataDatabase Name ', REPAIR_ALLOW_DATA_LOSS)
Alter database [DataDatabase Name] set multi_user
After the execution is complete, if there are still errors, repeat the execution until there are no errors.

Flying over the sea "blog, reposted please contact the author!

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.