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
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Problem inserting new data in one table.

Author  Topic 

cidmi.dovic
Yak Posting Veteran

53 Posts

Posted - 2009-12-25 : 18:34:08
Hello,
Today I realiced that one stored Procedure executed in my database doesn´t work because some is wrong with one table in my database. I mean te insert command doesn´t work, even when I try to add a new row using tha Sql server management studio (Edit top 200 rows option) i have an timeout error.

any idea about what is wrong with the table, maybe there are some transactions over the table not commited?

Thans in advance for your help.

The Padrón peppers itch and other don't

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-26 : 00:04:58
If it's a timeout error, then you should check for blocking via sp_who2. Also run DBCC CHECKTABLE on it to verify if there is any corruption.

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

cidmi.dovic
Yak Posting Veteran

53 Posts

Posted - 2009-12-26 : 04:23:35
I have executed DBCC CHECKTABLE and there are no errors on it.
The update command works with existing records...
If I try to make a Select count(*) from table it doesn't work too...

then how can I commit or rollback pending transactions over the table. Now I'm sure that's the problem, because there was a failrule between the begin tran and the commit tran.

This is the SP, executing sp_who2:

72 RUNNABLE SQLSRV\Administrador SQLSRV . MyDB KILLED/ROLLBACK 1856 0 12/25 08:58:00 SQLAgent - TSQL JobStep (Job 0xA79BDB78CE963A4E99B03D69736DC067 : Step 1) 72 0


Thanks.

The Padrón peppers itch and other don't
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-26 : 11:24:19
If you still have the query window open where the transaction wasn't completed yet, then simply run COMMIT TRAN or ROLLBACK TRAN. Otherwise, you'll need to kill the spid.

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

cidmi.dovic
Yak Posting Veteran

53 Posts

Posted - 2009-12-28 : 03:03:35
I've tried a lot of times :

KILL 72
GO

But the response is always the same:


spid 72: Transaction rollback in progress. Estimated rollback completion: 0% Estimated time left: 10 seconds.


The Padrón peppers itch and other don't
Go to Top of Page

cidmi.dovic
Yak Posting Veteran

53 Posts

Posted - 2009-12-28 : 06:45:05
Finally I stopped and started the SQL Service and I did recover the table.

Thanks.

The Padrón peppers itch and other don't
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-28 : 13:07:37
Just as an FYI, but a rollback takes time. I've had a rollback take several hours. Next time, you should not restart the service as it goes into crash recovery which could take even longer than a rollback.

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

cidmi.dovic
Yak Posting Veteran

53 Posts

Posted - 2009-12-29 : 07:41:27
quote:
Originally posted by tkizer

Just as an FYI, but a rollback takes time. I've had a rollback take several hours.

Tara Kizer



I know, but the rollback was active for 3 days so...I had to take some risks.
Thank you for your help

The Padrón peppers itch and other don't
Go to Top of Page
   

- Advertisement -