当前位置:网站首页>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'
刷新数据库,你就可以看到已经修复好的数据库了。
边栏推荐
- Andriod6.0 low power mode (turn off WiFi, Bluetooth, GPS, screen brightness, etc.)
- AQS原理
- [untitled]
- Shell programming specifications and variables
- 手把手教你安装Latex(保姆级教程)
- Anomaly detection and unsupervised learning (2)
- About 1931cie -- conversion of XYZ color coordinate graph to RGB color coordinate relationship
- MySQL stored procedure
- I was asked several questions about string in the interview. Can you answer them?
- Outlier detection and open set identification (1)
猜你喜欢

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

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

NPM run serve stuck at 40%

Outlier detection and open set identification (1)

手把手教你安装Latex(保姆级教程)

Upload Excel files with El upload and download the returned files

"Food alliance ordering system"

Teach you how to install latex (nanny level tutorial)

IMG tags prohibit dragging pictures

Router view cannot be rendered (a very low-level error)
随机推荐
Html+css+php+mysql realize registration + login + change password (with complete code)
I don't know how lucky the boy who randomly typed the log is. There must be a lot of overtime!
How to solve the problems of MQ message loss, duplication and backlog?
【网络安全】通过iptables和ipset完成服务器防火墙黑名单和白名单功能
Application and principle of distributed current limiting redistribution rratelimiter
@Detailed explanation of the use of transactional annotation
软考 --- 数据库(4)SQL语句
[develop low code platform] low code rendering
[ESN] learning echo state network
2022dasctfjuly empowerment competition (reappearance)
保护性拷贝&无状态
MySQL的隔离级别、可能出现的问题(脏读、不可重复读、幻读)及其解决方法
MySQL sub database and sub table and its smooth expansion scheme
Installation and use of pnpm
数学建模及其基础知识详解(化学常考知识点)
Some operations of Ubuntu remote server configuration database (unable to locate package MySQL server, steps of installing mysql, unable to enter password when logging in MySQL)
IMG tags prohibit dragging pictures
总结:POD与容器的区别
SAP vl02n delivery note posting function WS_ DELIVERY_ UPDATE
Recursion / backtracking (Part 2)