Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 modify location of .mdf file fails

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-05-30 : 04:02:09
hi,
The procedure below shows how I modify the location of the file...
I have used this step for several databases but it does not work for one of the databases and the error is:
MODIFY FILE failed. File 'beta3' does not exist.

Do you see why please?
Thanks

ALTER DATABASE DBName SET OFFLINE
GO
ALTER DATABASE DBName
MODIFY FILE( NAME = DBName , FILENAME = 'D:\SQLServer\Data\DBName.mdf' )
GO

---Copy the file to the destination

ALTER DATABASE DBName SET ONLINE

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2012-05-30 : 04:49:20
Well..the error message is pretty obvious isn't it? Run this query in your database to find all active data file names and their locations:

select name, physical_name from sys.database_files



- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-05-30 : 05:13:55
Thanks
Go to Top of Page
   

- Advertisement -