【生产问题】LDF丢失
参考 : https://www.cnblogs.com/gered/p/9450622.html
CREATE DATABASE db_logs ON PRIMARY ( NAME = N'db_logs_Data', FILENAME = N'D:\dandantang\data1\db_logs_Data1.mdf' , SIZE = 3072KB , FILEGROWTH = 10% ) LOG ON ( NAME = N'db_logs_log', FILENAME = N'E:\dandantang\dblog\db_logs_log1.ldf' , SIZE = 1024KB , FILEGROWTH = 10%) GO alter database db_logs set offline
--覆盖替换 重命名替换 alter database db_logs set online use db_logs alter database db_logs set emergency go --置数据库为单用户模式 alter database db_logs set single_user with rollback immediate go use master go --重建数据库日志文件 alter database db_logs Rebuild Log on (name=DataSource_Data_log,filename='E:\dandantang\dblog\db_logs_log.ldf') go --最后设置数据库为多用户模式。 alter database db_logs set multi_user
所有DB,都可能需要的操作
记住,运行之前一定要修改自增,不然会暴涨
alter database db_del modify file
( NAME = N'db_del_Data',FILEGROWTH = 113072KB )
alter database CQXX5000 set emergency alter database cqxx5000 set single_user with rollback immediate dbcc checkdb('cqxx5000',REPAIR_ALLOW_DATA_LOSS) alter database CQXX5000 set multi_user ALTER DATABASE CQXX5000 SET online