Delete Additional Logfiles
If you restore a database to a secondary location and wants to delete extra log files which are not needed anyway then use the below script
USE <ENTER DATBASE NAME> GO SELECT 'ALTER DATABASE ['+DB_NAME()+'] set recovery simple GO dbcc shrinkfile('+name +',EMPTYFILE) GO alter database ['+DB_NAME()+'] remove file '+NAME +' go' FROM SYS.database_files WHERE type_desc = 'LOG' and file_id > (SELECT min(file_id)FROM SYS.database_files WHERE type_desc = 'LOG') |
No comments:
Post a Comment