Hi,
I need to move the transaction log for a database I have just created using aspnet_regsql.
Is it possible to move the transaction log using sqlcmd or any other command line tool?
kind regards,
Hi,
I need to move the transaction log for a database I have just created using aspnet_regsql.
Is it possible to move the transaction log using sqlcmd or any other command line tool?
kind regards,
You can always do what you want in the Management Studio and let it generate the SQL Statements for your action.
You can do so with the ALTER DATABASE command, but you still have to move the file manually. The ALTER commands look like this:
ALTER DATABASE YourDb SET OFFLINE;
ALTER DATABASE YourDb
MODIFY FILE (Name = YourDb_Log,
Filename = 'g:\NewDir\YourDb.ldf')
<At this point, move the file in the filesystem>
ALTER DATABASE YourDb SET ONLINE;
RECONFIGURE
See this SqlServer Central article for more information, and a complete script to execute the move.