Home All Groups Group Topic Archive Search About

Table Truncated (Urgent)

Author
8 Aug 2006 1:56 AM
Chandrasekar
Hi All ,


I did accidently  truncated one table from sql server. when i check the
backup deveice  not working.

Is there any way to restore  the data from ldf  file.

Please  help me anyone know about this.


Thanks &  regards
Sekar.

Author
8 Aug 2006 2:19 AM
Hari Prasad
Hi,

You can do a POINT_IN_TIME recovery if your rcovery model is FULL and if you
have a full database backup and subsequent transaction log backup.
See the below command to identify the recover model.

select databasepropertyex('DBANAEM','recovery')
1. Take a backup transaction log in current database
2. Create a new database
3. Restore with full backup file with NORECOVERY (Use below command)


   RESTORE database new_dbname from disk='file' with NORECOVERY,
   MOve 'logical_mdf' to 'physical_mdf',
   MOve 'logical_ldf'  to  'physical_ldf'


4. Restore the transaction log backup taken in step-1 with RECOVERY and
STOPAT option


   RESTORE log new_dbname from disk='tran_backup_file' with RECOVERY, STOPAT
= ''Aug 05, 2006 03:44 AM'


Thanks

Hari

SQL ServerMVP

Show quote
"Chandrasekar" <se***@sic.edu.sg> wrote in message
news:uKot22ouGHA.976@TK2MSFTNGP05.phx.gbl...
>
> Hi All ,
>
>
> I did accidently  truncated one table from sql server. when i check the
> backup deveice  not working.
>
> Is there any way to restore  the data from ldf  file.
>
> Please  help me anyone know about this.
>
>
> Thanks &  regards
> Sekar.
>
>
Author
8 Aug 2006 3:45 AM
Chandrasekar
Hi  hari

thanks for your help.
still i am confuse

my current database Name :  SMART
current database file name : SMART_DATA.MDF, SMART_LOG.LDF

the new  database  as created Now : NEWDB
Current database Transaction Log : TLOG

i am confusing step 3 and 4

Can you please explain more ?


Thanks & regards
sekar.


Show quote
"Hari Prasad" <hari_prasa***@hotmail.com> wrote in message
news:uDBEZFpuGHA.1288@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> You can do a POINT_IN_TIME recovery if your rcovery model is FULL and if
you
> have a full database backup and subsequent transaction log backup.
> See the below command to identify the recover model.
>
> select databasepropertyex('DBANAEM','recovery')
> 1. Take a backup transaction log in current database
> 2. Create a new database
> 3. Restore with full backup file with NORECOVERY (Use below command)
>
>
>    RESTORE database new_dbname from disk='file' with NORECOVERY,
>    MOve 'logical_mdf' to 'physical_mdf',
>    MOve 'logical_ldf'  to  'physical_ldf'
>
>
> 4. Restore the transaction log backup taken in step-1 with RECOVERY and
> STOPAT option
>
>
>    RESTORE log new_dbname from disk='tran_backup_file' with RECOVERY,
STOPAT
> = ''Aug 05, 2006 03:44 AM'
>
>
> Thanks
>
> Hari
>
> SQL ServerMVP
>
> "Chandrasekar" <se***@sic.edu.sg> wrote in message
> news:uKot22ouGHA.976@TK2MSFTNGP05.phx.gbl...
> >
> > Hi All ,
> >
> >
> > I did accidently  truncated one table from sql server. when i check the
> > backup deveice  not working.
> >
> > Is there any way to restore  the data from ldf  file.
> >
> > Please  help me anyone know about this.
> >
> >
> > Thanks &  regards
> > Sekar.
> >
> >
>
>
Author
8 Aug 2006 12:50 PM
Hari Prasad
Hello,

Do you have full database backup and the sub sequent Transaction log file
backups taken before the accidental deletion of table.
Kindly confirm.

If yes then:-

1. restore the full database backup first into a new db with NORecovery
2. restore he log backps one by one using Norecovery until last backup file
3. restore the last transaction log backup using Recovery and Stopat option.
[Just before table deletion]


Thanks
Hari
SQL Server MVP


Show quote
"Chandrasekar" <se***@sic.edu.sg> wrote in message
news:eUw8O0puGHA.2120@TK2MSFTNGP03.phx.gbl...
> Hi  hari
>
> thanks for your help.
> still i am confuse
>
> my current database Name :  SMART
> current database file name : SMART_DATA.MDF, SMART_LOG.LDF
>
> the new  database  as created Now : NEWDB
> Current database Transaction Log : TLOG
>
> i am confusing step 3 and 4
>
> Can you please explain more ?
>
>
> Thanks & regards
> sekar.
>
>
> "Hari Prasad" <hari_prasa***@hotmail.com> wrote in message
> news:uDBEZFpuGHA.1288@TK2MSFTNGP02.phx.gbl...
>> Hi,
>>
>> You can do a POINT_IN_TIME recovery if your rcovery model is FULL and if
> you
>> have a full database backup and subsequent transaction log backup.
>> See the below command to identify the recover model.
>>
>> select databasepropertyex('DBANAEM','recovery')
>> 1. Take a backup transaction log in current database
>> 2. Create a new database
>> 3. Restore with full backup file with NORECOVERY (Use below command)
>>
>>
>>    RESTORE database new_dbname from disk='file' with NORECOVERY,
>>    MOve 'logical_mdf' to 'physical_mdf',
>>    MOve 'logical_ldf'  to  'physical_ldf'
>>
>>
>> 4. Restore the transaction log backup taken in step-1 with RECOVERY and
>> STOPAT option
>>
>>
>>    RESTORE log new_dbname from disk='tran_backup_file' with RECOVERY,
> STOPAT
>> = ''Aug 05, 2006 03:44 AM'
>>
>>
>> Thanks
>>
>> Hari
>>
>> SQL ServerMVP
>>
>> "Chandrasekar" <se***@sic.edu.sg> wrote in message
>> news:uKot22ouGHA.976@TK2MSFTNGP05.phx.gbl...
>> >
>> > Hi All ,
>> >
>> >
>> > I did accidently  truncated one table from sql server. when i check the
>> > backup deveice  not working.
>> >
>> > Is there any way to restore  the data from ldf  file.
>> >
>> > Please  help me anyone know about this.
>> >
>> >
>> > Thanks &  regards
>> > Sekar.
>> >
>> >
>>
>>
>
>
Author
10 Aug 2006 2:18 AM
Chandrasekar
Hi  Hari

I don't have any backups before accidential deletion of table.

My mdf file size 17 MB , LDF SIZE 147 MB

Is  there any way to retrive the data from LDF file.


Thanks & regards
Sekar.







Show quote
"Hari Prasad" <hari_prasa***@hotmail.com> wrote in message
news:uc2APluuGHA.4356@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> Do you have full database backup and the sub sequent Transaction log file
> backups taken before the accidental deletion of table.
> Kindly confirm.
>
> If yes then:-
>
> 1. restore the full database backup first into a new db with NORecovery
> 2. restore he log backps one by one using Norecovery until last backup
file
> 3. restore the last transaction log backup using Recovery and Stopat
option.
> [Just before table deletion]
>
>
> Thanks
> Hari
> SQL Server MVP
>
>
> "Chandrasekar" <se***@sic.edu.sg> wrote in message
> news:eUw8O0puGHA.2120@TK2MSFTNGP03.phx.gbl...
> > Hi  hari
> >
> > thanks for your help.
> > still i am confuse
> >
> > my current database Name :  SMART
> > current database file name : SMART_DATA.MDF, SMART_LOG.LDF
> >
> > the new  database  as created Now : NEWDB
> > Current database Transaction Log : TLOG
> >
> > i am confusing step 3 and 4
> >
> > Can you please explain more ?
> >
> >
> > Thanks & regards
> > sekar.
> >
> >
> > "Hari Prasad" <hari_prasa***@hotmail.com> wrote in message
> > news:uDBEZFpuGHA.1288@TK2MSFTNGP02.phx.gbl...
> >> Hi,
> >>
> >> You can do a POINT_IN_TIME recovery if your rcovery model is FULL and
if
> > you
> >> have a full database backup and subsequent transaction log backup.
> >> See the below command to identify the recover model.
> >>
> >> select databasepropertyex('DBANAEM','recovery')
> >> 1. Take a backup transaction log in current database
> >> 2. Create a new database
> >> 3. Restore with full backup file with NORECOVERY (Use below command)
> >>
> >>
> >>    RESTORE database new_dbname from disk='file' with NORECOVERY,
> >>    MOve 'logical_mdf' to 'physical_mdf',
> >>    MOve 'logical_ldf'  to  'physical_ldf'
> >>
> >>
> >> 4. Restore the transaction log backup taken in step-1 with RECOVERY and
> >> STOPAT option
> >>
> >>
> >>    RESTORE log new_dbname from disk='tran_backup_file' with RECOVERY,
> > STOPAT
> >> = ''Aug 05, 2006 03:44 AM'
> >>
> >>
> >> Thanks
> >>
> >> Hari
> >>
> >> SQL ServerMVP
> >>
> >> "Chandrasekar" <se***@sic.edu.sg> wrote in message
> >> news:uKot22ouGHA.976@TK2MSFTNGP05.phx.gbl...
> >> >
> >> > Hi All ,
> >> >
> >> >
> >> > I did accidently  truncated one table from sql server. when i check
the
> >> > backup deveice  not working.
> >> >
> >> > Is there any way to restore  the data from ldf  file.
> >> >
> >> > Please  help me anyone know about this.
> >> >
> >> >
> >> > Thanks &  regards
> >> > Sekar.
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Author
10 Aug 2006 10:04 PM
Erland Sommarskog
Chandrasekar (se***@sic.edu.sg) writes:
> Hi  Hari
>
> I don't have any backups before accidential deletion of table.
>
> My mdf file size 17 MB , LDF SIZE 147 MB
>
> Is  there any way to retrive the data from LDF file.

If you actually did TRUNCATE TABLE, then I believe your prospects are
very bleak.

If you used the DELETE command, a log-reader tool can help you. Examples
of such are Lumigent Log Exploer and LOG PI. http://www.lumigent.com,
http://www.logpi.com/.

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button