Repair of SQL Server database corruption-export data from the database to another new database

Source: Internet
Author: User

The following statement is usually used to fix database corruption:

 
========================================================== ===========-- Fix a table in the database -- use the following statement to fix exec sp_dboption 'databasename ', 'Single user', 'true' go DBCC checktable ('tablename', repair_allow_data_loss) Go sp_dboption 'databasename', 'single user ', 'false' go into restoring the entire database-use the following statement to fix it and change databasename to the database name alter database [databasename] Set single_usergodbcc checkdb ('databasename ', repair_allow_data_loss) with tablockgoalter database [databasename] Set multi_usergo

However, none of the above methods work. Sometimes the preceding statements cannot be executed successfully. In this case, you need to try other methods, such as importing data to a new blank database.

During the data import process, you will find that the table cannot be imported and the table has a problem. You can temporarily cancel the import of these tables and import them smoothly.

The remaining problematic tables cannot be opened in the query analyzer. What should I do? Try to import them to an Excel table first. Sometimes it cannot be imported to an SQL table, however, you can import data to an Excel file. Even if an error message is displayed during the export process, it indicates that the export fails. However, when you open an Excel file, you can find that the data is in it, in this way, you can import data from the Excel table to the new database.

 

If you cannot export an Excel file, check whether the table can be opened in the enterprise manager. If you can open the table, select all and copy and paste it into the Excel file.

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.