【生产环境】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

 

可能需要的操作

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

 

上一篇:Ubuntu安装完成后 启动菜单无高级选项和recovery选项


下一篇:SQL Server 紧急状态下的数据库恢复