Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore using actual data files? 1

Status
Not open for further replies.

jballum

MIS
Jul 10, 2000
161
CA
Hi,

I am sitting in front of a server that was reinstalled with SQL Server. This is a customer's test server and no backups were done. They have their data files backed up (.mdf and .ldf) though.

Anyway, is their any possibility of tricking SQL server using these data files? Or restoring from these data files?

Thanx,

JB
 
Terry thanks for the prompt response,

I thought this would work only if it was detached originally?

Anyway, as it turns out someone erased these files as well so they are SOL. ;-)

Thanks anyway

JB
 
You're welcome.

Files can be attached even if they were not detached, at least in SQL 7. It is a good idea to update logical file names in the sysfiles1 table after attaching the database. However, we haven't encountered any problems if we don't update the names.

Use the following T-SQL to update the logical names:

exec sp_configure 'allow updates','1'
reconfigure with override
go

update sysfiles1 set name=
case name
when 'oldname' then 'newname'
else 'newname_log'
end
go

exec sp_configure 'allow updates','0'
reconfigure with override
go

This query works for a databse with two files. If you have more, you'll need to modify the query accordingly. Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top