Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore a database with a backup having a damage transaction log.

Status
Not open for further replies.

EM1107

IS-IT--Management
Apr 24, 2002
153
CA
Good day Guys

I hope that someone can help me on that one.

I have to restore a database that does not yet exist in my environment and I was provided a backup with a damage transaction log file.

Does anyone know if that backup can still be restored even if the transaction log is damaged?
 
There is a way to do it, but it doesn't always work. Often times it depends on what was happening in the db at the time the damage occurred.

in SQL:

Code:
Create Database [YourDatabaseName]
ON (
   FILENAME = 'C:\Path\To\Database.mdf'
   )
FOR ATTACH_REBUILD_LOG;

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
The way you display is to create a database without any log file.
In my case the database does not exist and I require to create it from a backup file.
The log file in the backup is corrupted.
What I asked was to restore that backup and forget about the log file and simply create a new log file.
 
You cannot have a database without a log file. The statement I show above does not specify a log file, but does include "FOR ATTACH_REBUILD_LOG" which basically says,

Create a database from the specified mdf file, and in the process create a new log file.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top