<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; TRUNCATE Can&#8217;t be Rolled Back Using Log Files After Transaction Session Is Closed</title>
	<atom:link href="http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Wed, 22 May 2013 19:03:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: sri</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-409295</link>
		<dc:creator><![CDATA[sri]]></dc:creator>
		<pubDate>Fri, 18 Jan 2013 08:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-409295</guid>
		<description><![CDATA[very nice explanation]]></description>
		<content:encoded><![CDATA[<p>very nice explanation</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #009 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-400669</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #009 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 29 Dec 2012 01:30:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-400669</guid>
		<description><![CDATA[[...] TRUNCATE Can’t be Rolled Back Using Log Files After Transaction Session Is Closed [...]]]></description>
		<content:encoded><![CDATA[<p>[...] TRUNCATE Can’t be Rolled Back Using Log Files After Transaction Session Is Closed [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-336287</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 12:42:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-336287</guid>
		<description><![CDATA[It is possible for DELETE and not for TRUNCATE]]></description>
		<content:encoded><![CDATA[<p>It is possible for DELETE and not for TRUNCATE</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Santosh</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-324474</link>
		<dc:creator><![CDATA[Santosh]]></dc:creator>
		<pubDate>Fri, 03 Aug 2012 22:56:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-324474</guid>
		<description><![CDATA[If we don&#039;t use BEGIN TRANSACTION statement but we deleted or truncated a table. It is possible to rollback and I think using .ldf.
I don&#039;t know how Can anyone help Me on this???

Great Thanks in Advance!]]></description>
		<content:encoded><![CDATA[<p>If we don&#8217;t use BEGIN TRANSACTION statement but we deleted or truncated a table. It is possible to rollback and I think using .ldf.<br />
I don&#8217;t know how Can anyone help Me on this???</p>
<p>Great Thanks in Advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jv</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-282074</link>
		<dc:creator><![CDATA[jv]]></dc:creator>
		<pubDate>Sat, 05 May 2012 05:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-282074</guid>
		<description><![CDATA[hi.......once transaction is committed,it can not be rolled back for both delete and truncate]]></description>
		<content:encoded><![CDATA[<p>hi&#8230;&#8230;.once transaction is committed,it can not be rolled back for both delete and truncate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bharat</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-259301</link>
		<dc:creator><![CDATA[bharat]]></dc:creator>
		<pubDate>Sun, 04 Mar 2012 08:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-259301</guid>
		<description><![CDATA[cn u send me kuries with answer  on my email [email removed]]]></description>
		<content:encoded><![CDATA[<p>cn u send me kuries with answer  on my email [email removed]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhargava</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-163567</link>
		<dc:creator><![CDATA[Bhargava]]></dc:creator>
		<pubDate>Tue, 30 Aug 2011 09:49:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-163567</guid>
		<description><![CDATA[Hi Pinal,

I am the regular reader of ur site.where i have some doubt and confusion regarding the rollback for delete after commiting it.

Can u please explain with an example,so that it could be useful for many folks like me.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I am the regular reader of ur site.where i have some doubt and confusion regarding the rollback for delete after commiting it.</p>
<p>Can u please explain with an example,so that it could be useful for many folks like me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Day 6 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-146272</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Day 6 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Wed, 06 Jul 2011 01:31:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-146272</guid>
		<description><![CDATA[[...] (Read more here) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] (Read more here) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jai kumar</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-102285</link>
		<dc:creator><![CDATA[jai kumar]]></dc:creator>
		<pubDate>Fri, 26 Nov 2010 10:49:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-102285</guid>
		<description><![CDATA[Hi 
     Pinaldave

I am using Sql Server 2008
accedently data delete from table but I have no Transactional Backup and my database in full recovery .
I have Full Backup of  last 1 Month .so plz suggest me how to recover data from table ...plz it is very urgent ....]]></description>
		<content:encoded><![CDATA[<p>Hi<br />
     Pinaldave</p>
<p>I am using Sql Server 2008<br />
accedently data delete from table but I have no Transactional Backup and my database in full recovery .<br />
I have Full Backup of  last 1 Month .so plz suggest me how to recover data from table &#8230;plz it is very urgent &#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raj</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-80088</link>
		<dc:creator><![CDATA[raj]]></dc:creator>
		<pubDate>Tue, 13 Jul 2010 14:22:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-80088</guid>
		<description><![CDATA[suppose, i have one table with four columns(name,id,city,salary)

in name column,i&#039;l have raj,ravi,ashok,poonam,pooja,etc and i want to add  &#039;s with every name. So,what can i do.]]></description>
		<content:encoded><![CDATA[<p>suppose, i have one table with four columns(name,id,city,salary)</p>
<p>in name column,i&#8217;l have raj,ravi,ashok,poonam,pooja,etc and i want to add  &#8216;s with every name. So,what can i do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-75640</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Fri, 11 Jun 2010 11:11:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-75640</guid>
		<description><![CDATA[try on SQL Server 2008]]></description>
		<content:encoded><![CDATA[<p>try on SQL Server 2008</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rishikesh Kumar</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-75638</link>
		<dc:creator><![CDATA[Rishikesh Kumar]]></dc:creator>
		<pubDate>Fri, 11 Jun 2010 10:37:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-75638</guid>
		<description><![CDATA[SELECT GETDATE() fn_GetDate, SYSDATETIME() fn_SysDateTime

This SYSDATETIME()  is not get a proper value and sql server 2005 show error message.]]></description>
		<content:encoded><![CDATA[<p>SELECT GETDATE() fn_GetDate, SYSDATETIME() fn_SysDateTime</p>
<p>This SYSDATETIME()  is not get a proper value and sql server 2005 show error message.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sagar Vernekar</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-65296</link>
		<dc:creator><![CDATA[Sagar Vernekar]]></dc:creator>
		<pubDate>Fri, 16 Apr 2010 06:02:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-65296</guid>
		<description><![CDATA[it was nice thanks dear]]></description>
		<content:encoded><![CDATA[<p>it was nice thanks dear</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: srinivas</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-61120</link>
		<dc:creator><![CDATA[srinivas]]></dc:creator>
		<pubDate>Sun, 14 Feb 2010 03:44:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-61120</guid>
		<description><![CDATA[Sir

I have one table (Example - table name)

In that table two fileds is there 1) slno - int, 2)name - varchar(50)

I entered the records

slno             Name

1                  a
2                   b
3                   c

First I Delete one record using Delete Command

delete from example where slno =&#039;1&#039;

after that

truncate the table using truncate command

truncate table example

Now

I roll back record of 1

how can i?

i try this but i can&#039;t? Please help me]]></description>
		<content:encoded><![CDATA[<p>Sir</p>
<p>I have one table (Example &#8211; table name)</p>
<p>In that table two fileds is there 1) slno &#8211; int, 2)name &#8211; varchar(50)</p>
<p>I entered the records</p>
<p>slno             Name</p>
<p>1                  a<br />
2                   b<br />
3                   c</p>
<p>First I Delete one record using Delete Command</p>
<p>delete from example where slno =&#8217;1&#8242;</p>
<p>after that</p>
<p>truncate the table using truncate command</p>
<p>truncate table example</p>
<p>Now</p>
<p>I roll back record of 1</p>
<p>how can i?</p>
<p>i try this but i can&#8217;t? Please help me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raj</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-56170</link>
		<dc:creator><![CDATA[raj]]></dc:creator>
		<pubDate>Fri, 25 Sep 2009 15:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-56170</guid>
		<description><![CDATA[Hi

I have tested the pinal dave post.. Truncate can be rollback whether the database is Full recovery model or simple recovery model…

Still am not clear please explain me. I am using SQL SERVER 2008



thanks
Raj.....-)]]></description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I have tested the pinal dave post.. Truncate can be rollback whether the database is Full recovery model or simple recovery model…</p>
<p>Still am not clear please explain me. I am using SQL SERVER 2008</p>
<p>thanks<br />
Raj&#8230;..-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sachin Dhaske</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-55434</link>
		<dc:creator><![CDATA[Sachin Dhaske]]></dc:creator>
		<pubDate>Mon, 31 Aug 2009 12:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-55434</guid>
		<description><![CDATA[I read abt  Truncate command is 

The TRUNCATE command Drop The Table and And Recreate it.]]></description>
		<content:encoded><![CDATA[<p>I read abt  Truncate command is </p>
<p>The TRUNCATE command Drop The Table and And Recreate it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shiv</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-53248</link>
		<dc:creator><![CDATA[Shiv]]></dc:creator>
		<pubDate>Thu, 25 Jun 2009 10:13:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-53248</guid>
		<description><![CDATA[Hey Guys,
I&#039;m not sure if modification I have done are correct or not but I&#039;m able recover all the rows brefore the truncate statement.  I just made the wait time little longer... 

--STEP 1. Creating DB
SET NOCOUNT ON
CREATE DATABASE TEST
GO
ALTER DATABASE TEST SET RECOVERY FULL
USE TEST
GO

--STEP 2. Creating table with some data (100 rows)
CREATE TABLE data (f1 INT IDENTITY)
GO

INSERT data DEFAULT VALUES
GO 100
select COUNT(*) AS CNT,&#039;1st 100&#039; AS Remark FROM data
--STEP 3. Performing full backup
BACKUP DATABASE TEST TO DISK=&#039;D:\test_full.bak&#039; WITH INIT
GO

--The above full backup will guarantee the first hundred recovery.

--===================
INSERT data DEFAULT VALUES
GO 100
select COUNT(*)AS CNT,&#039;2nd 100 AFTER full backup&#039; AS Remark FROM data
--====================
--STEP 4. Performing log backup
DECLARE @date DATETIME

--variant1: Date mark just before truncation
SET @date = DATEADD(s, 0, GETDATE())
select @date as TimeOfRB

--variant2: Date mark after truncation
--SET @date = DATEADD(s, 1, GETDATE())

TRUNCATE TABLE data
WAITFOR DELAY &#039;00:00:10&#039;
select COUNT(*) AS CNT,&#039;trun&#039; AS Remark FROM data
--This log backup now has all the 100 records inserted after full backup
--making total count to 200 records in the table
BACKUP LOG TEST TO DISK=&#039;D:\test_log.bak&#039; WITH INIT

--STEP 5. Restoring Test DB.
USE MASTER
RESTORE DATABASE TEST FROM DISK=&#039;D:\test_full.bak&#039; WITH NORECOVERY, REPLACE
RESTORE LOG TEST FROM DISK=&#039;D:\test_log.bak&#039; WITH RECOVERY, STOPAT=@date
GO
USE TEST
GO
--This will return count less than 200
select COUNT(*)AS CNT ,&#039;last&#039; AS Remark FROM data
go
USE MASTER
DROP DATABASE TEST]]></description>
		<content:encoded><![CDATA[<p>Hey Guys,<br />
I&#8217;m not sure if modification I have done are correct or not but I&#8217;m able recover all the rows brefore the truncate statement.  I just made the wait time little longer&#8230; </p>
<p>&#8211;STEP 1. Creating DB<br />
SET NOCOUNT ON<br />
CREATE DATABASE TEST<br />
GO<br />
ALTER DATABASE TEST SET RECOVERY FULL<br />
USE TEST<br />
GO</p>
<p>&#8211;STEP 2. Creating table with some data (100 rows)<br />
CREATE TABLE data (f1 INT IDENTITY)<br />
GO</p>
<p>INSERT data DEFAULT VALUES<br />
GO 100<br />
select COUNT(*) AS CNT,&#8217;1st 100&#8242; AS Remark FROM data<br />
&#8211;STEP 3. Performing full backup<br />
BACKUP DATABASE TEST TO DISK=&#8217;D:\test_full.bak&#8217; WITH INIT<br />
GO</p>
<p>&#8211;The above full backup will guarantee the first hundred recovery.</p>
<p>&#8211;===================<br />
INSERT data DEFAULT VALUES<br />
GO 100<br />
select COUNT(*)AS CNT,&#8217;2nd 100 AFTER full backup&#8217; AS Remark FROM data<br />
&#8211;====================<br />
&#8211;STEP 4. Performing log backup<br />
DECLARE @date DATETIME</p>
<p>&#8211;variant1: Date mark just before truncation<br />
SET @date = DATEADD(s, 0, GETDATE())<br />
select @date as TimeOfRB</p>
<p>&#8211;variant2: Date mark after truncation<br />
&#8211;SET @date = DATEADD(s, 1, GETDATE())</p>
<p>TRUNCATE TABLE data<br />
WAITFOR DELAY &#8217;00:00:10&#8242;<br />
select COUNT(*) AS CNT,&#8217;trun&#8217; AS Remark FROM data<br />
&#8211;This log backup now has all the 100 records inserted after full backup<br />
&#8211;making total count to 200 records in the table<br />
BACKUP LOG TEST TO DISK=&#8217;D:\test_log.bak&#8217; WITH INIT</p>
<p>&#8211;STEP 5. Restoring Test DB.<br />
USE MASTER<br />
RESTORE DATABASE TEST FROM DISK=&#8217;D:\test_full.bak&#8217; WITH NORECOVERY, REPLACE<br />
RESTORE LOG TEST FROM DISK=&#8217;D:\test_log.bak&#8217; WITH RECOVERY, STOPAT=@date<br />
GO<br />
USE TEST<br />
GO<br />
&#8211;This will return count less than 200<br />
select COUNT(*)AS CNT ,&#8217;last&#8217; AS Remark FROM data<br />
go<br />
USE MASTER<br />
DROP DATABASE TEST</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - 2008 - Interview Questions and Answers - Part 3 Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-47472</link>
		<dc:creator><![CDATA[SQL SERVER - 2008 - Interview Questions and Answers - Part 3 Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Thu, 26 Feb 2009 12:03:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-47472</guid>
		<description><![CDATA[[...] (Read More Here) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] (Read More Here) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - Time Out Due to Executing DELETE on Large RecordSet Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-47283</link>
		<dc:creator><![CDATA[SQL SERVER - Time Out Due to Executing DELETE on Large RecordSet Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Tue, 24 Feb 2009 18:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-47283</guid>
		<description><![CDATA[[...] TRUNCATE command if not used with BEGIN and END transaction, you will not be able to roll back using log files. Make sure you absolutely do not need the truncated data. SQL SERVER - TRUNCATE Can’t be Rolled Back Using Log Files After Transaction Session Is Closed [...]]]></description>
		<content:encoded><![CDATA[<p>[...] TRUNCATE command if not used with BEGIN and END transaction, you will not be able to roll back using log files. Make sure you absolutely do not need the truncated data. SQL SERVER &#8211; TRUNCATE Can’t be Rolled Back Using Log Files After Transaction Session Is Closed [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: deb</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-46738</link>
		<dc:creator><![CDATA[deb]]></dc:creator>
		<pubDate>Mon, 16 Feb 2009 13:56:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-46738</guid>
		<description><![CDATA[Truncate can be very much rolled back when it is used in a transaction.

--select * from emp

begin transaction

truncate table emp

--rollback transaction

above is the code snap short please try and let me know.]]></description>
		<content:encoded><![CDATA[<p>Truncate can be very much rolled back when it is used in a transaction.</p>
<p>&#8211;select * from emp</p>
<p>begin transaction</p>
<p>truncate table emp</p>
<p>&#8211;rollback transaction</p>
<p>above is the code snap short please try and let me know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anil Danta</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-45959</link>
		<dc:creator><![CDATA[Anil Danta]]></dc:creator>
		<pubDate>Sat, 24 Jan 2009 08:29:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-45959</guid>
		<description><![CDATA[Hi Folks,

I have a different observation on this rolling back / recovering the data lost by truncate. The example provided by Alexander is perfect. But here the data truncated is not exactly recovered by restoring the log file to a point before truncate. We are taking a full backup after inserting 100 records, and then truncating the table. So restoring the full backup took care of retrieving all records not the transaction log. 

I have a different case to prove that the data lost due to a TRUNCATE can be recovered, but not 100%. As storage engine only records the deallocation of pages in log, and releases the pages and its corresponding extent for allocation there is definite possibility for data loss. The percentage of data loss depends on how soon we take a log backup and the new requests for page allocation. My simple guess is the transaction log backup we are taking itself can grab those deallocated pages of TRUNCATE and cause data loss. To prove this I have made little changes to Alexander&#039;s code as below. I have added a INSERT statement (highlighted in &#039;==&#039;) after taking full backup. These inserts are logged in only transaction log, not backedup during full backup.

-- STEP 1. Creating DB
SET NOCOUNT ON
CREATE DATABASE TEST
GO
ALTER DATABASE TEST SET RECOVERY FULL
USE TEST
GO

-- STEP 2. Creating table with some data (100 rows)
CREATE TABLE data (f1 INT IDENTITY)
GO

INSERT data DEFAULT VALUES
GO 100

-- STEP 3. Performing full backup
BACKUP DATABASE TEST TO DISK=&#039;c:\test_full.bak&#039; WITH INIT
GO

--The above full backup will guarantee the first hundred recovery.

--===================
INSERT data DEFAULT VALUES
GO 100
--====================
-- STEP 4. Performing log backup
DECLARE @date DATETIME

-- variant1: Date mark just before truncation
SET @date = DATEADD(s, 0, GETDATE())

-- variant2: Date mark after truncation
--SET @date = DATEADD(s, 1, GETDATE())

TRUNCATE TABLE data
WAITFOR DELAY &#039;00:00:03&#039;
--This log backup now has all the 100 records inserted after full backup
--making total count to 200 records in the table
BACKUP LOG TEST TO DISK=&#039;c:\test_log.bak&#039; WITH INIT

-- STEP 5. Restoring Test DB.
USE MASTER
RESTORE DATABASE TEST FROM DISK=&#039;c:\test_full.bak&#039; WITH NORECOVERY, REPLACE
RESTORE LOG TEST FROM DISK=&#039;c:\test_log.bak&#039; WITH RECOVERY, STOPAT=@date
GO
USE TEST
GO
--This will return count less than 200
select COUNT(*) AS CNT FROM data
go
USE MASTER
DROP DATABASE TEST

This test gives us a different count every time which confirms a data loss. I am glad to see this forum and will appreciate your feed back.]]></description>
		<content:encoded><![CDATA[<p>Hi Folks,</p>
<p>I have a different observation on this rolling back / recovering the data lost by truncate. The example provided by Alexander is perfect. But here the data truncated is not exactly recovered by restoring the log file to a point before truncate. We are taking a full backup after inserting 100 records, and then truncating the table. So restoring the full backup took care of retrieving all records not the transaction log. </p>
<p>I have a different case to prove that the data lost due to a TRUNCATE can be recovered, but not 100%. As storage engine only records the deallocation of pages in log, and releases the pages and its corresponding extent for allocation there is definite possibility for data loss. The percentage of data loss depends on how soon we take a log backup and the new requests for page allocation. My simple guess is the transaction log backup we are taking itself can grab those deallocated pages of TRUNCATE and cause data loss. To prove this I have made little changes to Alexander&#8217;s code as below. I have added a INSERT statement (highlighted in &#8216;==&#8217;) after taking full backup. These inserts are logged in only transaction log, not backedup during full backup.</p>
<p>&#8211; STEP 1. Creating DB<br />
SET NOCOUNT ON<br />
CREATE DATABASE TEST<br />
GO<br />
ALTER DATABASE TEST SET RECOVERY FULL<br />
USE TEST<br />
GO</p>
<p>&#8211; STEP 2. Creating table with some data (100 rows)<br />
CREATE TABLE data (f1 INT IDENTITY)<br />
GO</p>
<p>INSERT data DEFAULT VALUES<br />
GO 100</p>
<p>&#8211; STEP 3. Performing full backup<br />
BACKUP DATABASE TEST TO DISK=&#8217;c:\test_full.bak&#8217; WITH INIT<br />
GO</p>
<p>&#8211;The above full backup will guarantee the first hundred recovery.</p>
<p>&#8211;===================<br />
INSERT data DEFAULT VALUES<br />
GO 100<br />
&#8211;====================<br />
&#8211; STEP 4. Performing log backup<br />
DECLARE @date DATETIME</p>
<p>&#8211; variant1: Date mark just before truncation<br />
SET @date = DATEADD(s, 0, GETDATE())</p>
<p>&#8211; variant2: Date mark after truncation<br />
&#8211;SET @date = DATEADD(s, 1, GETDATE())</p>
<p>TRUNCATE TABLE data<br />
WAITFOR DELAY &#8217;00:00:03&#8242;<br />
&#8211;This log backup now has all the 100 records inserted after full backup<br />
&#8211;making total count to 200 records in the table<br />
BACKUP LOG TEST TO DISK=&#8217;c:\test_log.bak&#8217; WITH INIT</p>
<p>&#8211; STEP 5. Restoring Test DB.<br />
USE MASTER<br />
RESTORE DATABASE TEST FROM DISK=&#8217;c:\test_full.bak&#8217; WITH NORECOVERY, REPLACE<br />
RESTORE LOG TEST FROM DISK=&#8217;c:\test_log.bak&#8217; WITH RECOVERY, STOPAT=@date<br />
GO<br />
USE TEST<br />
GO<br />
&#8211;This will return count less than 200<br />
select COUNT(*) AS CNT FROM data<br />
go<br />
USE MASTER<br />
DROP DATABASE TEST</p>
<p>This test gives us a different count every time which confirms a data loss. I am glad to see this forum and will appreciate your feed back.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-43680</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Mon, 13 Oct 2008 21:27:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-43680</guid>
		<description><![CDATA[@Raj,

Take transactional backup, Then try to restore database using Stop at function, give the time when you think the deleted record was available, and database will be restored till that time, and the record will be available. This process will create a new database. Be careful dont over write the old database. 


Hope this helps,
Imran.]]></description>
		<content:encoded><![CDATA[<p>@Raj,</p>
<p>Take transactional backup, Then try to restore database using Stop at function, give the time when you think the deleted record was available, and database will be restored till that time, and the record will be available. This process will create a new database. Be careful dont over write the old database. </p>
<p>Hope this helps,<br />
Imran.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raj</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-43658</link>
		<dc:creator><![CDATA[raj]]></dc:creator>
		<pubDate>Sat, 11 Oct 2008 15:55:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-43658</guid>
		<description><![CDATA[dear pinal ,
                  when i take full backup on during  that time some one delete table row .how can i recovery that in sql 2005]]></description>
		<content:encoded><![CDATA[<p>dear pinal ,<br />
                  when i take full backup on during  that time some one delete table row .how can i recovery that in sql 2005</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Julian</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-39121</link>
		<dc:creator><![CDATA[Julian]]></dc:creator>
		<pubDate>Tue, 10 Jun 2008 02:27:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-39121</guid>
		<description><![CDATA[Thank you!

I&#039;m understanding now.  So, To make a rollback over an alter data. I need to restore the last full backup and next the differential and log backup before to make the change?

I have any other way to rollback the sentence update?]]></description>
		<content:encoded><![CDATA[<p>Thank you!</p>
<p>I&#8217;m understanding now.  So, To make a rollback over an alter data. I need to restore the last full backup and next the differential and log backup before to make the change?</p>
<p>I have any other way to rollback the sentence update?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-31356</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Sun, 06 Jan 2008 04:59:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/26/sql-server-truncate-cant-be-rolled-back-using-log-files-after-transaction-session-is-closed/#comment-31356</guid>
		<description><![CDATA[Hello Andrew,

Thank you for posting clarification and as well we are in agreement. I respect your additional research as well writing about this on your blog http://www.siusic.com/wphchen/recover-data-using-transaction-log-144.html

You are always welcome to comment and participate here to help community. 

Kind Regards,
Pinal Dave ( http://www.SQLAuthority.com )]]></description>
		<content:encoded><![CDATA[<p>Hello Andrew,</p>
<p>Thank you for posting clarification and as well we are in agreement. I respect your additional research as well writing about this on your blog <a href="http://www.siusic.com/wphchen/recover-data-using-transaction-log-144.html" rel="nofollow">http://www.siusic.com/wphchen/recover-data-using-transaction-log-144.html</a></p>
<p>You are always welcome to comment and participate here to help community. </p>
<p>Kind Regards,<br />
Pinal Dave ( <a href="http://www.SQLAuthority.com" rel="nofollow">http://www.SQLAuthority.com</a> )</p>
]]></content:encoded>
	</item>
</channel>
</rss>
