• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

bring db back online .mdf

newbe sql2000 -  how do I bring db .mdf back online????

.mdf was copied over to a new fresh install of sql2000

thanks for your help
0
TokenHash
Asked:
TokenHash
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you can try to use the stored procedure sp_attach_db or sp_attach_single_file_db:
http://msdn2.microsoft.com/en-us/library/aa259610(SQL.80).aspx
http://msdn2.microsoft.com/en-us/library/aa259611(SQL.80).aspx
0
 
TokenHashAuthor Commented:
where would i run these commands =

Examples

This example attaches two files from pubs to the current server.

EXEC sp_attach_db @dbname = N'pubs',
   @filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
   @filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
0
 
matrix_aashCommented:
Right click databases in enterprise manager and you will find the option attach database. This will help you in bring the .mdf file online.

Please let me know if this helps.

Aash.
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
CragCommented:
If you just copied the MDF from another system I suspect that it will not be possible to bring it back online.
Did you detach the database on the source system first?
Do you have a database backup?
0
 
TokenHashAuthor Commented:
getting not a vaild sql file error ??  I have both the .mdf and ldf files
0
 
TokenHashAuthor Commented:
I have a database backup
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>I have a database backup
what kind of backup (and how comes you say that now?)
0
 
CragCommented:
From the error it sounds like you copied the files from a system without allowing SQL Server the time to prepare them - this is done using the detach database function.
If you have the backup then a restore is going to be easier.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now