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.
Author |
Topic |
JaybeeSQL
Posting Yak Master
112 Posts |
Posted - 2012-07-27 : 09:31:25
|
Hi all,I've got a logfile with the extension .LMDF, not .ldf.Is this the correct sequence of steps to correct?1) Suspend log shipping (this is a secondary)2) Run this code:USE masterGOALTER DATABASE MyDBMODIFY FILE (NAME = MyCurrentLogsLogicalName, FILENAME = 'E:SQLData\templog.ldf')GO3) Take DB offline;4) Rename MyDB.lmdf file in Explorer file to MyDB.ldf5) Put DB back online;6) Resume log shipping.Btw, this is SS2K |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-27 : 10:06:26
|
I would do it via detach, rename, attachorbackup, drop, restoreWhatever you do make sure you take a backup first.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
komkrit
Yak Posting Veteran
60 Posts |
Posted - 2012-07-27 : 11:55:13
|
Hello JaybeeSQLIn log shipping secondary, database either in restoring state or stand by state.Both case, you could not ALTER DATABASE MODIFY FILE.Take DB Offline first, then ALTER DATABASE MODIFY FILE.Just be aware users are using the database. So add command to set single user mode to make sure you can take DB Offline without error.Here are my steps.<suspend log shipping SQL Agent Job>USE MASTERGOALTER DATABASE TestDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATEGOALTER DATABASE TestDatabaseSET OFFLINE; ALTER DATABASE TestDatabaseMODIFY FILE (NAME='TestDatabase_log', FILENAME='D:\Temp\TestDatabase_log_new.ldf'); GO <rename physical file>ALTER DATABASE TestDatabaseSET ONLINE; GO ALTER DATABASE TestDatabase SET multi_userGO<resume log shipping SQL Agent Job>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Komkrit YensirikulCurrently be a DBA in worldwide hotel reservation. Experienced in top leading banking environment. |
|
|
|
|
|
|
|