If I lose my data file (MDF) in SQL 7 I can't backup the log to recover to a point in time - why not?

A. A small oversight on MS's part - which will be fixed in the next major (not service-pack) release of SQL.

Under 6.5 you would do BACKUP LOG <dbname> TO <device> WITH NO_TRUNCATE.

Under SQL 7 this gets you an error
Server: Msg 3446, Level 16, State 1
Primary file not available for database <xx>

This is because the metadata that tells SQL where the files are for the database are in the primary file - in SQL 6.5 this info was held in system tables in master.

A workaround for this is :-

1. Use only ONE file in the primary file group (the primary file), and place this file on the same drive (mirrored) as your log files. This gives it the same protection as the log.

2. Add another file group, with one or more files for data - obviously this goes on different disks to the log. Mark this second file group as the default (Alter database)

3. Then, when your data file is lost , backup no_truncate will work because the primary file with the metadata in (but no user data) is still available.


Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering SharePoint 2013: Succeeding, Not Just Surviving

Building on the success of the “Mastering SharePoint 2010” seminars, the presenters have updated the content to cover the latest and greatest SharePoint product: SharePoint 2013. While SharePoint 2013 is relatively new on the marketplace, the presenters have been working with SharePoint 2013 for well over a year, and have implemented it with a number of clients in production environments.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.