当前位置:网站首页>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'
刷新数据库,你就可以看到已经修复好的数据库了。
边栏推荐
- About 1931cie -- conversion of XYZ color coordinate graph to RGB color coordinate relationship
- 第二轮1000个Okaleido Tiger,再次登录Binance NFT 1小时售罄
- 手把手教你安装Latex(保姆级教程)
- armeabi-v7a架构(sv7a)
- [basic course of flight control development 8] crazy shell · open source formation uav-i2c (laser ranging)
- Anomaly detection and unsupervised learning (1)
- PTA (daily question) 7-72 calculate the cumulative sum
- 15.模型评估和选择问题
- ZABBIX deployment and monitoring
- rk3399 9.0驱动添加Powser按键
猜你喜欢

Html+css+php+mysql realize registration + login + change password (with complete code)

Techo Hub 福州站干货来袭|与开发者共话工业智能新技术

ZABBIX deployment and monitoring

PTA (daily question) 7-69 narcissus number

会议OA项目之会议通知&会议反馈&反馈详情功能

Outlier detection and open set identification (1)

PTA (daily question) 7-70 diamond

NPM run serve stuck at 40%

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

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
随机推荐
What are the skills of API interface optimization?
Statistical analysis of time series
COPU陆首群教授应邀在开放原子全球开源峰会上做主旨演讲
Tips for API interface optimization
从零开始实现lmax-Disruptor队列(六)Disruptor 解决伪共享、消费者优雅停止实现原理解析
How to solve Oracle not available
Recursion / backtracking (Part 2)
C语言括号匹配(栈括号匹配c语言)
[development tutorial 10] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - Bluetooth ble transceiver
mysql时间按小时格式化_mysql时间格式化,按时间段查询的MySQL语句[通俗易懂]
"Food alliance ordering system"
我不建议你使用SELECT *
NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作
Breadth first search (BFS) and its matlab code
【esn】 学习回声状态网络
Jupyter notebook中5个有趣的魔法命令
IMG tags prohibit dragging pictures
NPM run serve stuck at 40%
保护性拷贝&无状态
Application and principle of distributed current limiting redistribution rratelimiter