Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 Corrupted record

Author  Topic 

tripleDot
Starting Member

6 Posts

Posted - 2010-04-29 : 23:04:30
Hello everyone, one of the record of my number sequence reference table is corrupted. I have identified the record but could not fix it. I've tried deleting the record and truncating the table but it was ineffective. Reads, cannot delete or truncate. Even issuing an update statement on the record yields nothing. It just went on executing for several minutes until I simply cancel the commands.

So I duplicate the table using:

insert into new_table select * from orig_table

The new_table was ok. My plan was to drop the original table and rename new_table. My problem now is how do I attach the dependent objects (procedures in my case) to the renamed table.

I've tried using DTSWizard to duplicate orig_table hoping it can also carry over the dependency properties but it didn't. So I'm really stump here.

I'm using SQL Server 2005.

Help would be appreciated. Thanks.

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-04-30 : 02:33:04
You say there's a record corrupt. What makes you think that? Do you get errors querying that record? If so, what errors? If you don't get errors, what is it that makes you think the record is corrupt?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

tripleDot
Starting Member

6 Posts

Posted - 2010-04-30 : 07:20:18
Whenever I use update and delete statement on that record, the statement just executes forever without affecting the record. I have to terminate the execution after several minutes, and once I allowed it to reached 30min. Same thing when I use truncate statement on the table.

Also, in MS Dynamics AX, where the table is used, the system hangs whenever updating or deleting the said record. Even inserting records with values coming from this record will result in a system hang.

But in either case, there is no error message. That's how I assume the record is corrupted.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-04-30 : 08:01:19
That doesn't sound like corruption, if sounds like there's a lock on that row from some other process.

Run a query that selects that row, then query sys.dm_exec_requests and check if the query that selects that record is blocked and, if so, by what process.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-04-30 : 10:22:03
Also check view sys.dm_tran_locks



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

tripleDot
Starting Member

6 Posts

Posted - 2010-05-03 : 02:22:37
Thanks guys, your suggestions made me check the Event Viewer, turns out the SQLCtr.ini was inconsistent. So fixing that helped fix the problem.

On the other hand, I still would like to know how to deal with object dependencies in case I need it in the future.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-05-03 : 03:09:59
I don't know what you mean by 'attaching a dependant object'. If you create a table, then create a procedure that uses that table, SQL will store that dependency info. If you do it the other way around (which is allowed), you won't get the dependency info. That was the main reason why the dependency info is near-useless in SQL 2005 and why it was completely redone in SQL 2008

--
Gail Shaw
SQL Server MVP
Go to Top of Page

tripleDot
Starting Member

6 Posts

Posted - 2010-05-03 : 23:41:02
Let's say something went wrong and I have a table full of garbage. Instead of restoring the whole database it would be easier to just recreate that 1 table. So I create a new table and populate it with the right data. Then drop the old table and rename the new table. How do I attach the dependencies to the newly renamed table?

Sorry if I sound confusing. But do note that I thought of doing this because of my limited knowledge, if there are other ways... I'd appreciate them.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-03 : 23:49:20
If by dependencies you mean foreign keys, then you can generate the script for those in SSMS before you make any changes. You could also get them from your version control system, which is where the schema should also be stored.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kyzikos
Starting Member

1 Post

Posted - 2010-06-02 : 02:19:06
I was able to IMPORT data FROM foxpro dbf. to MySQL, but a FoxPro dbf. have a E_Fail Status error... so the importing process stop if there is a date value like this 02/02/0009... So how can i ignore or change the value to 02/02/2009... Please help me im a newbie... Tnx... Im Using a Visual Basic6 to import the data...

Stephenjkdmt
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-02 : 04:09:45
Please post new questions in a new thread. Thanks

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -