当前位置:网站首页>SQL Server 只有数据库文件,没有日志文件,恢复数据时报1813错误的解决方案
SQL Server 只有数据库文件,没有日志文件,恢复数据时报1813错误的解决方案
2022-07-28 23:11:00 【红烧柯基】
无法打开新数据库 'ASR'。CREATE DATABASE 中止。
文件激活失败。物理文件名称'E:\SqlServer\MSSQL\Data\ASR_log.LDF'可能不正确。
无法重新生成日志,原因是数据库关闭时存在打开的事务/用户,该数据库没有检查点或者该数据库是只读的。如果事务日志文件被手动删除或者由于硬件或环境问题而丢失,则可能出现此错误。 (Microsoft SQL Server,错误: 1813)
解决方案:
1、新建一个同名数据库。
2、停止数据库服务,覆盖新建的数据库主文件(小技巧:最好放在同一个磁盘里面,把新建的数据库主文件删掉或移开,再把要恢复的数据库主文件剪切过去,这样就可以节省时间。)
3、启动数据库服务,数据库变为置疑或可疑状态。然后在查询分析器中运行:
alter database 无日志文件的数据库名称 set emergency
设置为紧急状态。
4、再运行:
alter database 无日志文件的数据库名称 set single_user
或者:
Sp_dboption '无日志文件的数据库名称', 'single user', 'true'
设置为单用户模式。
5、检查并重建日志文件,运行:
dbcc checkdb('无日志文件的数据库名称',REPAIR_ALLOW_DATA_LOSS)
这个时间比较长。耐心等待!如果有错误提示,再运行:
dbcc checkdb('无日志文件的数据库名称',REPAIR_REBUILD)
进行修复。如果没有错误,可以跳过。
6、恢复成多用户模式
alter database 无日志文件的数据库名称 set multi_user
或者:
Sp_dboption '无日志文件的数据库名称', 'single user', 'false'
刷新数据库,你就可以看到已经修复好的数据库了。
边栏推荐
- Send SMS verification code asynchronously using Ronglian cloud celery
- [untitled]
- 软考 --- 数据库(4)SQL语句
- PTA (daily question) 7-71 character trapezoid
- 2022dasctfjuly empowerment competition (reappearance)
- PTA (daily question) 7-75 how many people in a school
- 15.模型评估和选择问题
- Data warehouse construction - DWT floor
- 17. Design of machine learning system
- Recursion / backtracking (middle)
猜你喜欢

ZABBIX deployment and monitoring

What are the skills of API interface optimization?
![[development tutorial 10] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - Bluetooth ble transceiver](/img/06/5e417bb97e309b6ee27dc693cabb85.png)
[development tutorial 10] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - Bluetooth ble transceiver

从零开始实现lmax-Disruptor队列(六)Disruptor 解决伪共享、消费者优雅停止实现原理解析

DRF -- authentication, authority, frequency source code analysis, global exception handling, automatic generation of interface documents, RBAC introduction

Router view cannot be rendered (a very low-level error)

DRF - paging, JWT introduction and principle, JWT quick use, JWT source code analysis, JWT custom return format, custom user issued token, custom token authentication class

PTA (daily question) 7-75 how many people in a school

关于ThreadPool的一些注意事项

PTA (daily question) 7-70 diamond
随机推荐
execute immediate 简单示例合集(DML)
PTA (daily question) 7-75 how many people in a school
Upload Excel files with El upload and download the returned files
【网络安全】通过iptables和ipset完成服务器防火墙黑名单和白名单功能
selenium对接代理与seleniumwire访问开发者工具NetWork
Anomaly detection and unsupervised learning (1)
【愚公系列】2022年07月 Go教学课程 020-Go容器之数组
About 1931cie -- conversion of XYZ color coordinate graph to RGB color coordinate relationship
DRF - paging, JWT introduction and principle, JWT quick use, JWT source code analysis, JWT custom return format, custom user issued token, custom token authentication class
[untitled]
Install mysql5.7 under Linux, super detailed complete tutorial, and cloud MySQL connection
【开发教程11】疯壳·开源蓝牙心率防水运动手环-整机功能代码讲解
PTA (daily question) 7-69 narcissus number
Flyway's quick start tutorial
主线程与守护线程
JWT token related configuration (global configuration identity authentication rewrites authenticate method)
【esn】 学习回声状态网络
How to learn R language
(20211130更新)关于jupyter notebook的下载安装及自己的配置、主题
Rk3399 9.0 driver add powser button