Q

Restoring a database without a backup

Don't have a backup of your database? Learn how to restore your database using .mdf, .ldf and .ndf files in this expert response.

How do I restore a database on SQL Server 7.0 using .mdf, .ldf and .ndf files? I have no backup database available, but I do have the following files: rf_ds_dat_1.mdf, rf_ds_dat_3.ndf , rf_ds_dat_4.ndf and rf_ds_log_2.ldf
Since you have these files and not a backup, you need to attach the database rather than perform a restore. Here is sample command based on your files above. You will need to specify the correct directory where these files exist. The example has the files in the C:SQL directory.
EXEC sp_attach_db @dbname = N'rs_ds',    
 @filename1 = N'C:SQLrs_ds_dat1.mdf', 
 @filename2 = N'C:SQLrs_ds_dat3.ndf',
 @filename3 = N'C:SQLrs_ds_dat4.ndf',
 @filename4 = N'C:SQLrs_ds_dat2.ldf'

Note: SQL Server 7.0 databases can be attached to both SQL Server 7.0 and SQL Server 2000 databases.


Do you have comments on this Ask the Expert Q&A? Let us know.
This was first published in September 2005

Dig deeper on SQL Server Backup and Recovery

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close