Link to home
Start Free TrialLog in
Avatar of TokenHash
TokenHash

asked on

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
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

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
Avatar of TokenHash
TokenHash

ASKER

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'
ASKER CERTIFIED SOLUTION
Avatar of matrix_aash
matrix_aash
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
getting not a vaild sql file error ??  I have both the .mdf and ldf files
I have a database backup
>I have a database backup
what kind of backup (and how comes you say that now?)
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.