I want to change a database to different physical file. So i try the following step:
Detach the database
Attach the new different file
But i get an error "....... SQL server, error:5133".
It still needs the original file.
How to solve this problem?
many-many thanks,
JRLiem
Have you tried something like this?
USE MyDatabaseGO
ALTER DATABASE MyDatabase
MODIFY FILE (NAME = MyDatabase, FILENAME = 'H:SQLData\MyDatabase.mdf')
GO
ALTER DATABASE MyDatabase
MODIFY FILE (NAME = Mylog, FILENAME = 'G:SQLlogs\MyDatabase_log.ldf')
GO
Restart SQL Server
||||||a database has at least two files
the .mdb and the .ldf files
you have to specify where these files are located during the attach
Thanks, Andy.
It works.
|||Actually, the LDF file is really not necessary in some cases if you specify to SQL Server to generate a new LDF file during the attach process (provided that the MDF file is not severely damaged)|||Actually the LDF file is only needed if the database was not clearly shutdown. After a clean shutdown, the database is in a consistent state and can be "recovered" by adding another "clean" logfile.HTH, jens Suessmeyer.
http://www.sqlserver2005.de
No comments:
Post a Comment