一、注意点
1、背景:如果数据库做了分离操作,把数据文件和日志文件拷贝到其他存储的过程中,日志文件损坏,而数据文件可用的情况下,做数据库的附加,并重新生成日志文件。
2、通过该种方式附加数据库会自动创建日志文件,日志文件的大小是0.5M,也就是2个VLF,自动增长10%,因此需要手动设置一下日志的大小,避免出现太多VLF的情况。
二、操作步骤
1、重新附加数据库并重新生成日志文件
USE [master]
GO
CREATE DATABASE [test2] ON
( FILENAME = N'D:sqldata est2.mdf' )
FOR ATTACH_REBUILD_LOG
GO