A Corrupted Table With Data

Mar 13, 1999

Hi,
I have a corrupted table wich has some valuable data in it. I found out that there is only one raw is corrupted. How do I find out which row of the table is it?
Can any one Help me in this matter Please?

Thanks Very much.
Jay k

View 7 Replies


ADVERTISEMENT

Table Corrupted?

Aug 27, 2001

SQL Server 6.5.
Hi!
When I try to create PK, Clustered index on the column in the table I have got error message: 1105 Couldn't not allocate space for object table1......
But it is a big amount of free space in the database. And actually I can create any indexes, exsept clustered with no problem.
DBCC CHECKALLOCK for this table shows: extent not ih the segment.
Does it mean the table structure is corupted? What Can I do to resolve the problem?

Thank you,
Elena.

View 1 Replies View Related

Table's Get Corrupted

May 1, 2008



Team,

I am having a critical problem.

We a team of 10 members accessing a particular database with a common user name and password . Some one have deleted the data from a business critical table. Transaction log backup is done every half an hour. Considering backup is taken at 10AM and my data is lost at 10.26AM. How to recover the lost data?

Is it possible to recover the data from log file or any other way to achieve the data recovery?

Is is possible to trace the person who have done this job. (By IP address or any other way)?

Regards,
Venkatesan Prabu . J

View 1 Replies View Related

Protecting Data Tables From Being Corrupted

Oct 1, 2005

I have several sites which refer to a table in an MS SQL data base on the server.

I'm looking for a good way to check that my tables don't get corrupted
over time. It seems that I can't create a duplicate by selecting the
individual table and going SaveAs..

Can someone point me to the fool proof method that everyone else already uses, please ?

David Morley

View 1 Replies View Related

How I Rescue Data From Corrupted Databases

Mar 7, 2007

Edit: Some changes added

This is my procedure for "rescuing" data from a corrupted database. Obviously restoring from backup is a lot easier!

0) Set the damaged database to Read-Only. if you don't have a backup make one now.

1) Script the database

2a) Create a new, TEMP database - preferably on a different machine in case of hardware problems on the original machine

2b) Size the Data for the TEMP database same size as the original (to avoid dynamic extensions). Size the Log something large-ish!

3) Run the Script on the TEMP database. Do NOT create any FK etc. yet

4a) Attempt to transfer all tables:

-- Prepare script of: INSERT INTO ... SELECT * FROM ...
SET NOCOUNT ON
SELECT 'PRINT ''' + name + '''' + CHAR(13) + CHAR(10) + 'GO' + CHAR(13) + CHAR(10)
+ CASE WHEN C.id IS NULL
THEN ''
ELSE 'SET IDENTITY_INSERT dbo.[' + name + '] ON' + CHAR(13) + CHAR(10)
END
+ 'INSERT INTO MyTempDatabase.dbo.[' + name + ']' + CHAR(13) + CHAR(10)
+ 'SELECT * FROM dbo.[' + name + ']' + CHAR(13) + CHAR(10)
+ CASE WHEN C.id IS NULL
THEN ''
ELSE 'SET IDENTITY_INSERT dbo.[' + name + '] OFF' + CHAR(13) + CHAR(10)
END
+ 'GO'
FROMdbo.sysobjects AS O
LEFT OUTER JOIN
(
SELECT DISTINCT C.id
FROMdbo.syscolumns AS C
WHEREC.colstat = 1-- Identity column
) AS C
ON C.id = O.id
WHERE type = 'U'
AND name NOT IN ('dtproperties')
ORDER BY name
SET NOCOUNT OFF

this generates statements like this:

PRINT 'MyTable'
GO
SET IDENTITY_INSERT dbo.[MyTable] ON
INSERT INTO RESTORE_XFER_TEMP.dbo.[MyTable]
SELECT * FROM dbo.[MyTable]
SET IDENTITY_INSERT dbo.[MyTable] OFF
GO

4b) This will give some sort of error on the tables which cannot be copied, and they will need to be rescued by some other means.

5a) Each "broken" table needs to be rescued using an index. Ideally you will have a clustered index on the PK and that will be undamaged, so you can "rescue" all the PKs into a temp table:

-- Copy PK fields to a temporary table
-- DROP TABLE MyRestoreDatabase.dbo.TEMP_RESCUE_PK
-- TRUNCATE TABLE MyRestoreDatabase.dbo.MyBrokenTable
SELECT[ID]=IDENTITY(int, 1, 1),
[IsCopied]=CONVERT(tinyint, 0),
MyPK
INTOMyRestoreDatabase.dbo.TEMP_RESCUE_PK
FROMMyBrokenDatabase.dbo.MyBrokenTable
ORDER BY MyPK

5b) If that is successful you have a list of all the PKs, so can can try to copy data matching those PKs, in batches:

-- If OK then selectively copy data across
-- First Prep. a temp Batch table
-- DROP TABLE MyRestoreDatabase.dbo.TEMP_RESCUE_BATCH
SELECT TOP 1 [ID]=CONVERT(int, NULL), [IsCopied]=CONVERT(bit, 0), MyPK
INTOMyRestoreDatabase.dbo.TEMP_RESCUE_BATCH
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_PK
GO
--
DECLARE@intStartint,
@intStopint,
@intBatchSizeint

-- NOTE: After the first run set these to any "gaps" in the table that you want to fill
SELECT
@intStart = 1,
@intBatchSize = 10000,
@intStop = (SELECT MAX([ID]) FROM MyRestoreDatabase.dbo.TEMP_RESCUE_PK)

SELECT@intStart = MIN([ID])
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_PK
WHERE IsCopied = 0
AND [ID] >= @intStart

WHILE@intStart < @intStop
BEGIN
SET ROWCOUNT @intBatchSize

-- Isolate batch of Keys into separate table
TRUNCATE TABLE MyRestoreDatabase.dbo.TEMP_RESCUE_BATCH
INSERT INTO MyRestoreDatabase.dbo.TEMP_RESCUE_BATCH
SELECTT.*
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_PK AS T
WHERE IsCopied = 0
AND [ID] >= @intStart
AND [ID] < @intStart + @intBatchSize

-- Attempt to copy matching records, for this batch
PRINT CONVERT(varchar(20), @intStart)
INSERT INTO MyRestoreDatabase.dbo.MyBrokenTable
SELECTS.*
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_BATCH AS T
LEFT OUTER JOIN MyRestoreDatabase.dbo.MyBrokenTable AS D
ON D.MyPK = T.MyPK
-- This will try to get the data from the broken table, it may fail!
JOIN MyBrokenDatabase.dbo.MyBrokenTable AS S
ON S.MyPK = T.MyPK
WHERED.MyPK IS NULL-- Belt and braces so as not to copy existing rows

-- Flag the rows just "Copied"
UPDATEU
SETIsCopied = 1
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_PK AS U
WHEREIsCopied = 0
AND [ID] >= @intStart
AND [ID] < @intStart + @intBatchSize

-- Loop round, until done
SELECT@intStart = @intStart + @intBatchSize
END
GO
SET ROWCOUNT 0-- Turn OFF!!
GO

5c) This will copy in batches of 10,000 [you can adjust @intbatchSize depending on table size] until it gets to a damaged part of the table, then it will abort.

Change the @intStart to the last ID number displayed, and reduce @intBatchSize (by an order of magnitude each time) until you have rescued as many records as possible in the first "part" of the table.

5d) Reset the batch size @intBatchSize to 10,000 [or whatever size is appropriate], and increase the @intStart repeatedly until you are past the damaged section - copying will start again, and will abort if there are further damaged sections

5e) Repeat that process until you have rescued as much of the data as is possible

6) Check what is left to be rescued

-- Check amount NOT done:
SELECTCOUNT(*), MIN([ID]), MAX([ID])
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_PK
WHERE IsCopied = 0
--AND [ID] > 123456-- Optionally count items after a "gap"
--
-- Double check that IsCopied set correctly, and the number of records "lost"
SELECTCOUNT(*),
[IsCopied] = SUM(CONVERT(int, IsCopied)),
[IsCopied+Record] = SUM(CASE WHEN IsCopied = 1 AND C.MyPK IS NOT NULL THEN 1 ELSE 0 END),
[IsCopiedNoRecord] = SUM(CASE WHEN IsCopied = 1 AND C.MyPK IS NULL THEN 1 ELSE 0 END),
[IsNOTCopied] = SUM(CASE WHEN IsCopied = 0THEN 1 ELSE 0 END),
[IsNOTCopied+Record] = SUM(CASE WHEN IsCopied = 0 AND C.MyPK IS NOT NULL THEN 1 ELSE 0 END),
[IsNOTCopiedNoRecord] = SUM(CASE WHEN IsCopied = 0 AND C.MyPK IS NULL THEN 1 ELSE 0 END)
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_PK AS T
LEFT OUTER JOIN MyRestoreDatabase.dbo.MyBrokenTable AS C
ON C.MyPK = T.MyPK
--
-- List of "Lost" records
SELECTMyPK
FROMMyRestoreDatabase.dbo.TEMP_RESCUE_PK
WHERE IsCopied = 0
ORDER BY [ID]

You will then have to "find" and rescue the lost records somewhere.

I have a further process using OPENQUERY() to rescue records to fill the gaps in the event that they are available on a remote system - a straight JOIN to get them is going to be far to slow on anything other than tiny tables!

7a) Create the FKs etc. Update the statistics, rebuild indexes, and possibly shrink the Log if it is unrealistically big
7b) Backup and Restore over the original database
7c) DBCC CHECKDB ('MyDatabaseName') WITH ALL_ERRORMSGS, NO_INFOMSGS

Good luck!

Kristen

View 4 Replies View Related

SQL 2000 Corrupted Record! Can't Delete Table

May 9, 2008

Hi All,

I have just one corrupted record on a table: I copied everything else to another table but I can't delete or rename the old one!

Is restoring the whole DB my only way out there?

Any help or suggestion would be much appreciated!

Cheers

View 8 Replies View Related

SQL 2012 :: FILESTREAM DATA File Is Corrupted

Jul 21, 2014

our sql server databases are on a window cluster server.how to correct this issue or why would this happen? FILESTREAM data container 'M:TessituraDB DataDocuments' is corrupted. Database cannot recover.

View 0 Replies View Related

Database Corrupted, Need Help Recovering Data From LDF File

May 9, 2007

A friend of mine called and said that his database was suspect and he detached it and was unable to attach it. The SQL Server Version is 2000 with the latest service packs installed. When I checked it the database (MDF) size was 1MB and the LDF size was 3.8 GB. I was not able to attach the two together and I was not able to attach the database using sp_attach_single_file_db. I did find an old backup of his database and attached that so he can work off of it but it is 1 yr old and he needs recent data. Since the MDF seemed to be blank we cant do much with that, but there seems to be data in the LDF. Is it possible to extract any data from the LDF file?

Sunny

View 1 Replies View Related

Corrupted Table In SQL 2000, DBCC CheckDB Found No Errors

Jan 21, 2008

Hello,

I am facing an issue with a table in my database.

1) When I run a query Select * from MY_Table the query never completes. If I press cancel in Query Analyzer after 1 second or 2 minutes, it always shows the same 174 records. The total table size is 800 KB with 3148 rows .. according to TaskPad

2) No queries, even queries that would return only 1 record complete execution against that table

3) I am unable to rename the table, if I try to rename the table Enterprise Manager becomes unresponsive and has to be closed.

4) If I try to browse the rows through Enterprise manager by scrolling through the records, it allows me to go down through a number of rows and then Enterprise manager gives me a timeout expired error.

5) I ran a DBCC CheckDB command ran for 1 hr and 7 minutes. It says there are 0 allocation errors and 0 consistency errors in the database.

6) The other database tables seem to be OK and the Database is operational except for calls involving the 1 Table

7) I am unable to Drop the Table

8) DBCC CheckAlloc finds 0 allocation errors and 0 consistency errors.

9) DBCC CheckTable on MY_Table returns with: There are 3148 rows in 33 pages for object 'MY_Table' .. no errors are printed.


Can one of the SQL Gurus on this forum please recommend a course of action.

Thanks in advance.

View 1 Replies View Related

SQL Gets Corrupted With 'WITH' Command And Rubbish When Editing Query Containing Derived Table

Jan 31, 2008

When my colleague makes any change to a query containing a derived table, the word 'WITH' followed by a lot of graphical characters appears after the alias, rendering the query unusable. We have tried this with various existing and new, simple queries, all to no avail. We are editing the queries in Visual Studio 2003, and he does not get this effect when using Visual Studio 2005. I can edit the query in 2003 on my laptop with no ill effects.

Help!

Karen

View 17 Replies View Related

SQL 2012 :: Snapshot Getting Corrupted After Insert Update Few Million Records Into A Table

Mar 12, 2015

We are facing a weird scenario in which the snapshot is getting corrupted after insertupdate few million records in to a table .

SQL Server 2012
windows server 2008 R2
service pack 1
64-bit OS

View 1 Replies View Related

Corrupted Mdf

Jul 31, 2007

Hi Everyone,

when i am trying to attach a 'xxx.mdf' file it is showing message 'xxx.mdf' is not a primary database file.

Please suggest me what could be the reasons and what are the possible ways to recover my database.

I have lot of important data in the database.

Thanks and Regards,
Shashidhar

View 7 Replies View Related

Corrupted Ndf

Jun 27, 2007

how can i attach my database without the ndf file, i still have the mdf and ldf. my ndf file contains only 2 tables which are not that very impt. unfortunately my ndf was corrupted and my backup files was deleted when the network admin formatted the harddisk where the backups were stored.. is it possible? kindly help..

View 5 Replies View Related

Corrupted Index

Sep 16, 1999

Hi,
I have a question on sqlserver 6.5 with sp5a.

I execute a query like the following

select * from eps_analysis_cm (INDEX = index2)
where ....

the query gets 32 rows.

If I use another index

select * from eps_analysis_cm (INDEX = index1)
where ....

the query gets 0 rows.

Are my indexes corrupted ?
Note: running DBCC CHECKDB I get no error messages

Thanks in advance

View 9 Replies View Related

LOG File Corrupted

Nov 14, 2007

We have one database of 5 GB of which when we take the backup and restore in another location, it says "Device Activation Error. The Physical file name e:databaseike_log.ldf may be incorrect".
The database has more than one log file.
Now when we use another procedure to create new database and stop the sql, then replace the old mdf file and REBUILDLOG. (Ie dbcc rebuildlog(nike,1,0)). It says incorrect DBCC Statment.

Pl. suggest us what to do?

View 3 Replies View Related

Master Db Corrupted

Jun 7, 2001

Hi, Folks !

What happens with all jobs after rebuilding master db if it got corrupted. Will they be working correctly ? If no, then why ?

Thanx in advance,

serg

View 2 Replies View Related

Database Corrupted?

Jan 25, 2005

Hi all,

Had a disk problem here, and all apps connected to our database hung. Nothing was responding, rebooted, and mssqlserver hangs on startup.

If i move the mdf and ldf files of the database in question to another folder, mssqlserver starts up ok, with the db marked as suspect.

It would seem the the mdf and ldf are corrupted.

I am restoring a backup from yesterday, but this will take hours.

Any suggestions trying to recover it as it sits?

Thanks in advance for any ideas.

View 7 Replies View Related

Corrupted Log Backup

Apr 5, 2007

Hi..!

Is it possible to recover data from corrupted log backup ?

Suppose we have 10 log files and 8th is corrupted then how can we recover database.

I am not facing such problem right now, but it's a question raised in my mind.

I would like to have your help, suggestions & comments. :rolleyes:

Thanks...

View 2 Replies View Related

Corrupted Backup

Aug 2, 2007

Hi Everyone,

When I am trying to restore the backup it is giving an error message "An internal consistency error occurred. Contact Technical Support for assistance".

Please suggest me on this issue.

Is there any way to restore the backup or recover the backup.

Thanks,
Shashidhar

View 4 Replies View Related

Corrupted Database?

Dec 15, 2005

I have a SQL 2000 database whose MDF is approx. 105 GB. Everything has been working fine for months until this past weekend when the database server dropped offline. I restarted the services and SQL server looks to have started up okay. However, trying to access it via Enterprise Manager causes EM to hang. Checking the Windows event log, there are a whole series of messages stating ...

3455 : Analysis of database 'ptportal' (7) is XX% complete (approximately 61 more seconds)

This 'analysis' ran for over 12 hours ... I have never seen this run before, much less this long. Now, there are a new series of messages stating ...

3450 : Recovery of database 'ptportal' (7) is XX% complete (approximately 56526 more seconds) (Phase 2 of 3).

This 'recovery' has been running for 9 hours now. Does anybody have any idea what has happened here or what is going on? My guess is that this database has been corrupted and SQL Server is trying to do a repair? Anybody know how long this usually takes and what the success liklihood would be?

Thanks
-- Jeff Chastain

View 1 Replies View Related

EM &#043; QA Installs Corrupted

Mar 19, 2007

this may well be the wrong place for my post, if so please move it.

I have a variety of boxes with SQL tools installed on them. For some reason last week several of them seem to have gone a bit squif.

Server 1. Enterprise manager fails to run, giving message MMC could not create the snap-in. QA runs fine.

Server 2. Load EM click on a database and try Tools --> QA it comes back with File Not Found. Add isqlw as an external tool and you can run that ok, but still File Not found on the QA tab.

I know its not data corruption, but I hope someone can give me a clue on this!

Cheers!

View 2 Replies View Related

Master Db Is Got Corrupted

Aug 20, 2007

Hi ALL,

My sql server is not starting becasue master db got corrupted.
I have tried to rebuild the master db with rebuild utility.Now the process of rebuilding taken 6 hours but still the process of rebuild master is going on.
Can any body faced this problem why it is not rebuilding the simple master database.

Thanks you.
BPG

EDIT by tkizer: moved to Data Corruption Issues forum

View 5 Replies View Related

Database Corrupted

Oct 4, 2007

Hi,

I have a database corrupted showing on the Object Explorer the name of the database and showing near (6.5). Deleted not accepted any other function not allow. Is there any way to take off from the Object Explorer?

Best regards

View 3 Replies View Related

Help - Corrupted SQL Server 2K Log. Is This Serious

Jul 23, 2005

Hello,I have a SS2K (SP3) that is appending very wierd looking error messagesto the SQL Server Log (Current). The messages are not formatted asother log entries. The messages suggest some kinda dump information.The messages have the following characteristics:Date Information is invalidSource information is invalidMessage information is strangeThe following is a message that appear in my current SQL Server LogDATE:78008454SOURCE: Module(MSVCRT+Message (_endthread+000000C1)There are many messages like this in the log.Is this serious?Thanks - Covi

View 1 Replies View Related

Sql 7 Password Has Been Corrupted...HELP.

Jul 20, 2005

Hey Hey everyone. It's me again asking for help.I have an NT sp6 box with SQL 7. It seems the password for SA hasbeen corrupted, so it won't allow me to log in to it.As an NT admin, is there anyway to reset the SA password?Or, can I create another SA account in SQL 7?Can't find anything in Microsoft because..... SQL7 is not longersupported.Thanks in advance for any help.Jinev

View 3 Replies View Related

Corrupted Log File

Jul 20, 2005

Need to recover from a corrupted log file. The database in EnterpriseManager shows the database as corrupt.Using sp_Attach_db produces a corrupt log message.Any way to recover the data?Thanks

View 2 Replies View Related

Why Corrupted My Sdf File?

Nov 1, 2007



hello,
i am using sql server ce 2.0 on windows ce 4.2.sometimes my sdf file gets corrupted but i cant understand why?i know how this file repair.but for me it is not a solution.please somebody help me!

View 1 Replies View Related

Corrupted SQL Files !!!

Dec 1, 2006

Hi:

I try to run VB2005 Sample101, "Using Datagridvies" with SQL Express,

Here is what I got !"



"One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. if this
is an existing database, the file may be corrupted and should be restored from a
back up.

Cannot open use default database. Login failed.
Login failed for use 'XXXXXXXXXXXAdministrator"
Lof File 'C:Program FilesMicrosoft SQL ServerMSSQL.1DataAdventureWorks_Data_Log.idl' does not match the primary file. It may be from a different database or the log
may have been rebuilt previously."



Then I re attached the Database again. Still the Same problem.

I try other sample that used Northwin and Pubs (SQL2000 ) and attached to

SQLExpress, Well I suffered the SAME PROBLEM.



WHY, Please Help



Thanks



Simon

View 7 Replies View Related

Index Corrupted

Aug 14, 2006

We need to know, how to reorganize or reindex on sql-ce?

View 1 Replies View Related

Sql Server Corrupted.

Jul 18, 2007

I am having problems with my applications files. Part of my windows foundation or plug and play (error 31 - device not attached to system). I also found that my sql server is corrupted and I got the message to uninstall and reinstall. I don't know how to find where to go to re-install and unfortunately I uninstalled the VSS sql already. How do I find my sql server to re-download? help!

View 1 Replies View Related

SSIS Corrupted?

Jan 16, 2008

Hi,

I was working away as usual, when BIDS crashed. Upon re-starting, my package tasks no longer had any connectors between them! However, if I selected, then clicked on them, the connectors reappeared again. I thought this was a one-time problem.

However, now other packages, upon opening, are missing the task connectors as well. This has never happened before until this morning after BIDS crashed. It seems to be permanently corrupted at this point.

Should I reinstall SSIS? Has anyone else seen this before?

Thanks

View 2 Replies View Related

File Corrupted....help Please

Mar 16, 2006

ok..my friend sent me a video via file transfer, but when i tried to view it, and open it up with windows movie maker (that is the program she made the video on) it said the file was corrupted. is there any way i can fix the corrupted file? or any other program i can view it on? windows media player also declares it corrupted.

View 1 Replies View Related

Repair Corrupted Database?

Mar 20, 2000

I am backing up SQL 6.5 DB using Backup Exec 7.2 on NT 4.0 server SP4 with SQL server agent. The backup job ends in Failed status and a warning that DBname is corrupt. I then try to run DBCC Checkdb, newalloc, and checkcatalog commands to repair the DB. No further ahead yet. Are there any other commands that I can perform on the DB so that the corruption can be repaired, or verified there indeed is corruption of DB?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved