473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Need help recovering a corrupt SQL database

I have a very special case that I have been working on for several days. I have a very large SQL Server 2008 database (about 2 TB) that contains 500 filegroups to support very large partitioned tables. Recently we had a catastophic failure on one of the drive and lost several filegroups and the database became in-accessible.

We have been doing filegroup backups on a daily basis, but due to other issues, we lost our most recent backup of the log and the primary filegroup. We have all the data backed up but the primary filegroup backup is old.

There have been no schema changes since the primary filegroup backup, but the lsn's are now all out of sync and we cannot recover the data.

I have tried everything I could think of (and have tried just about every trick and hack I could google) but I still end up at the same point where I get messages saying that the files for filegroup x do not match the primary filegroup. I am now at the point of trying to edit the system tables (we have a separate temporary environment to do this so we are not worried about corrupting any production databases). I have tried updated sys.sysdbreg, sys.sysbrickfiles, and sys.sysprufiles to try to trick SQL into thinking all the files are online, but a "Select * From OPENROWSET(TABLE DBPROP, 5)" shows a different database state from what I see in sys.sysdbreg.

I am now thinking I need to somehow edit the headers of the actual data files to try to line up the lsn's with the primary.

I appreciate any help anyone can give me here, but please do not respond with things like "you are not supposed to do edit mdf, ndf files...." or "see msdn article....", etc. This is an advanced emergency case and I need a real hack so we can just get to the data in this corrupt database and export to a fresh new database. I know there is a way to do this, but not knowing what the DBPROP system functions does (i.e. does it look at system tables or does it actually open the file) is keeping me from trying to figure out how to fool SQL into allowing me to read these files.

Thanks for any help.
Jan 10 '11 #1
2 1844
ck9663
2,878 Expert 2GB
The safest way for you is to RESTORE from your last backup and work your way from there.

Good Luck!!!

~~ CK
Jan 11 '11 #2
The most recent copy of the Primary filegroup backup is not available so we have an inconsistent restore. That's the reason I am posting for help. If all I needed to do was perform a restore there would be no point in this post. This is an Emergency situation that requires a hack to recover data.

I am currently trying a demo version of Office Recovery's SQL Server Recovery. It appears to be successful in reading the data from the secondary filegroups. What would be really great is if I had a way to directly read the file headers and the IAM, GAM, and SGAM of each secondary file so I could update the sys.sysallocunits system table. If there are tools out there that can read the files in order to recover the data, there has to be a way to perform these low level tasks, they are just closely held.

Anyone out there know how to read the IAM and GAM of a SQL file (perhaps using a hex editor)?
Jan 11 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: designscout | last post by:
Hello! I recently tried to login into my movable type admin menu, but movable type tells me "invalid login" all the time. I am running my site on movable type for about 1 year now and I never...
4
by: aaj | last post by:
Hi all I have been given a corrupt access 2000 backend and asked to salvage the data.(youve gussed it, no backup) On trying to open it just kicks me out saying its not a valid database file -...
3
by: I Are Confused | last post by:
I am trying to open Database #2 while in Database #1 and delete a table that is in #2 so that I can copy a table from #1 into #2 - all through a function. My Database #2, as part of the start up,...
2
by: cm500 | last post by:
I'm very new to databases so bear with me. What I need is a way to track the training for the employees at my firm. I have 40 classes that I will be teaching on various subjects and various...
1
by: Shannon Rotz | last post by:
I have an Access XP database which just decided to corrupt, with 3 days' worth of brand-new coding in it. The regular "compact and repair" function hasn't worked in this case, and I've tried...
1
by: Gary Schrader via AccessMonster.com | last post by:
I have a database I use for training. I copy the database to the local drive of each studens machine. During training, as we work through a series of exercises, some of the machines will convert...
7
by: Steve | last post by:
Hi Can anyone help with the following: I try open an Access 2002 Database, I get a message that the database needs to be repaired as it was not closed properly, I select the option to repair...
5
by: Jeff | last post by:
I'm sorry if I am appearing noobish, but I'm a C programmer that inhereted access because I'm the only "computer guy" in the office. Now I've found some problems that I fear maybe a corrupt...
3
by: JensT | last post by:
Help My database acts very strange I have a table named T1. (And a lot of other Tables, queries etc.) Here my database works fine. Then I renamed a table from T1 to T1_imp, and created a...
0
by: Lisa Nicholson | last post by:
Trying to export reports from Quickbooks to EXCEL- this used to work fine until I just had my PC cleaned and tuned up. When I try to export I get an error code that it is the wrong verison of EXCEL....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.