[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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