473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Applying tranaction log to old data file

Hi,
on my SQL Server data file is corrupted. Unfortunately last backup was
made about half year ago. Transaction log seems to be ok.
Is it possible to restore data file from old backup and apply
transactions from current transaction log?

regards
Jun 27 '08 #1
6 1782
As Erland said, you need to first backup the transaction log with
NO_TRUNCATE. *For example:

BACKUP LOG MyDatabase
TO DISK = 'C:\MyDatabase_Log.bak'
WITH NO_TRUNCATE;
Thanks for your response, but how can I make log backup, if my
transactiong log is not mounted. Should I restore old backup, manually
copy current transaction log and then create log backup or there is
other procedure?
Jun 27 '08 #2
Thanks for your response, but how can I make log backup, if my
transactiong log is not mounted. Should I restore old backup, manually
copy current transaction log and then create log backup or there is
other procedure?
You should be able to backup the transaction log using the TRUNCATE_ONLY
option even if the data file(s) is unavailable.

--
Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

<ko****@gmail.comwrote in message
news:78**********************************@d77g2000 hsb.googlegroups.com...
As Erland said, you need to first backup the transaction log with
NO_TRUNCATE. For example:

BACKUP LOG MyDatabase
TO DISK = 'C:\MyDatabase_Log.bak'
WITH NO_TRUNCATE;
Thanks for your response, but how can I make log backup, if my
transactiong log is not mounted. Should I restore old backup, manually
copy current transaction log and then create log backup or there is
other procedure?

Jun 27 '08 #3
>
You should be able to backup the transaction log using the TRUNCATE_ONLY
option even if the data file(s) is unavailable.
DO NOT DO TRUNCATE ONLY - YOU WILL LOOSE YOUR LOGS FOR GOOD!!!!!!!

The procedure you need is in 3 parts:-

Firstly you need to dump the 24gb transaction log - ie take it out of the
database onto a file system file. Read up on "dump tran...no_truncate".
This will work even if the data is stuffed as long as the log is intact.

Secondly you use you old dump from yonks ago to reset up the database. If
the disks are ok you can just use "load database"

Thirdly you apply the transaction log that you saved in the first step. read
up on "load tran"

The secret is in the planning of the recovery. If you've got space you can
create a whole new databse and do the recovery to that and when you are
happy rename the databases and cycle the server.

Jun 27 '08 #4
Dan Guzman (gu******@nospam-online.sbcglobal.net) writes:
>Thanks for your response, but how can I make log backup, if my
transactiong log is not mounted. Should I restore old backup, manually
copy current transaction log and then create log backup or there is
other procedure?

You should be able to backup the transaction log using the TRUNCATE_ONLY
option even if the data file(s) is unavailable.
You are thinking of NORECOVERY, aren't you? TRUNCATE_ONLY is not a very
good choice, as pointed out sybaseguru.

But it appears koszuf does not have his database attached, and in that
case, it's more difficult, since you cannot attach a broken MDF.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 27 '08 #5
DO NOT DO TRUNCATE ONLY - YOU WILL LOOSE YOUR LOGS FOR GOOD!!!!!!!

Yes, I meant NO_TRUNCATE as in the original example I posted. I don't
believe the TRUNCATE_ONLY option is allowed when the data files are
inaccessible.

Thanks for the correction.

--
Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"Sybaseguru" <co****@usenet.cnntp.orgwrote in message
news:48***********************@read.cnntp.org...
>>
You should be able to backup the transaction log using the TRUNCATE_ONLY
option even if the data file(s) is unavailable.
DO NOT DO TRUNCATE ONLY - YOU WILL LOOSE YOUR LOGS FOR GOOD!!!!!!!

The procedure you need is in 3 parts:-

Firstly you need to dump the 24gb transaction log - ie take it out of the
database onto a file system file. Read up on "dump tran...no_truncate".
This will work even if the data is stuffed as long as the log is intact.

Secondly you use you old dump from yonks ago to reset up the database. If
the disks are ok you can just use "load database"

Thirdly you apply the transaction log that you saved in the first step.
read
up on "load tran"

The secret is in the planning of the recovery. If you've got space you can
create a whole new databse and do the recovery to that and when you are
happy rename the databases and cycle the server.
Jun 27 '08 #6
You are thinking of NORECOVERY, aren't you? TRUNCATE_ONLY is not a very
good choice, as pointed out sybaseguru.
Yes, I meant NO_TRUNCATE as in the original example I posted and NORECOVERY
during the full backup restore.

--
Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"Erland Sommarskog" <es****@sommarskog.sewrote in message
news:Xn*********************@127.0.0.1...
Dan Guzman (gu******@nospam-online.sbcglobal.net) writes:
>>Thanks for your response, but how can I make log backup, if my
transactiong log is not mounted. Should I restore old backup, manually
copy current transaction log and then create log backup or there is
other procedure?

You should be able to backup the transaction log using the TRUNCATE_ONLY
option even if the data file(s) is unavailable.

You are thinking of NORECOVERY, aren't you? TRUNCATE_ONLY is not a very
good choice, as pointed out sybaseguru.

But it appears koszuf does not have his database attached, and in that
case, it's more difficult, since you cannot attach a broken MDF.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: RooLoo | last post by:
Hey all! Using VB.Net... How can I save the font properties of a textbox to an ASCII file and later read the file and apply the properties back to the textbox? Users use multiple workstations,...
5
by: Ken Cox [Microsoft MVP] | last post by:
MS has posted this here: http://www.asp.net/faq/ms03-32-issue.aspx Fix for: 'Server Application Unavailable' Error after Applying Security Update for IE...
7
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme...
2
by: booksnore | last post by:
..eh I was stuck thinking up a subject title for this post for a while.. So I am processing a really big file (scary big). Each record is fixed length, I need to test conditions on certain fields...
6
by: Orgun | last post by:
Hi, I sent this message to the moderated c++ group too but it is waiting for moderator approval and I wanted to send here too. I am new to Design Patterns. I want to write a simple...
3
by: eighthman11 | last post by:
Hi everyone: We received a error message "Log File to Database is Full. Backup the transaction log to free up space." I have a Access 2000 application that calls a Stored Procedure that...
2
by: milecimm | last post by:
Hello, I need some help to solve the following problem (if it is possible, that's it): I'm using a xpath expression to programatically get data from my xml file. I want to transform ONLY the...
0
by: steven acer | last post by:
Hi i'm trying to sign a file and verify its signature with a DSA key. But i don't know if i'm doing it the right way !. I tried 2 different ways but i either got an error or simply the...
6
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
Hi - I have 4 webservers in my webfarm. All Win2k3 web edition. Before yesterday, none of them were service packed. I have now applied SP2 to two of them, and I'm getting a very weird MSDTC...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.