Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sql server database attach error / database cannot attach resolution process

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Fault description

This case involves the storage of a brand R520 server with SqlServer database, and this storage contains two sets of disk arrays, both of which are raid5 at raid level. Under normal circumstances, the user's SqlServer database is stored in disk D, but because of the large amount of data, the administrator generates a .ndf file in disk E and points the database path to disk E to continue using. But about half a month later, the database suddenly failed to report an error, the connection failed, and the SqlServer database could not attach the query. The administrator then carried out a tentative data recovery operation (the administrator carried out a number of attempted recovery in the original environment, resulting in repeated changes, overwriting and disk space overwriting of the original database files), which increased the difficulty for the later data recovery work.

Backup data

According to the practice of the data recovery industry, all data must be fully mirrored before the data recovery operation, and the database must be tested and analyzed after all disks are mirrored into files using dd command or data recovery tool.

Malfunction analysis

The reason for the error in the database has been preliminarily inferred by the engineer that it may be due to the logic error caused by the insufficient storage space of disk D.

The engineer analyzed and reorganized the two groups of raid5 disk arrays on the storage, looked at the data and backed up the total database files of raid to try to attach the database, but the database reported an error. The error content is "mismatch between primary database file and secondary database file"

Data recovery

The data recovery engineer looks at the bottom layer of the .ndf file, but the amount of data found in the file is very small, there is almost no data, the engineer cancels the association between the .MDF file and the .ndf file, and there is still an error when using the .MDF file to attach the database alone, the error content is "log file (.ldf) and database file (.MDF) do not match". The engineer continued the five database additional operations of the database, the database can be attached, but the system table is damaged, the database is still unable to use normally.

The engineer tried to repair the database system table but failed, the data table was seriously damaged, the repair was extremely difficult and the effect was difficult to guarantee, so the data recovery engineer decided to give up repairing the data table and try other methods instead.

Data recovery engineers put the breakthrough of data recovery on the database records, extract the database records through a Mini Program written by themselves, and then obtain the table structure of the database according to the database backup data. ReFactor the database table structure, and then import the database records into the new table. Data recovery succeeded

Use tips for the database

In the process of using the database, it is necessary to allocate the disk space where the database files are located and clean up the garbage data in time to ensure the normal and safe operation of the database.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report