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?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.
精彩评论