Files
chill_notes/数据库知识库/工具脚本/无日志文件附加数据库失败解决.md
2026-04-16 00:28:41 +08:00

8 lines
1.2 KiB
Markdown
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
==第一步先建立一个同名数据库停止SQL SERVER200====8====,将原来的.mdf====数据库文件====覆盖刚新建的.mdf====数据库文件====,重新启动数据库第二步:查询分析器执行,==
| | |
|---|---|
|1 <br>2 <br>3 <br>4 <br>5 <br>6 <br>7|**alter** **database** NEWDBNAME **set** emergency   <br>**declare** @databasename **varchar**(255) <br>**set** @databasename='NEWDBNAME' <br>**exec** sp_dboption @databasename, N'single', N'true' <br>dbcc checkdb(@databasename,REPAIR_ALLOW_DATA_LOSS) --将目标数据库置为单用户状态 <br>dbcc checkdb(@databasename,REPAIR_REBUILD) <br>**exec** sp_dboption @databasename, N'single', N'false'|
==第三步:以上代码请同时运行,可能会出现“数据库其他多个文件与数据库主文件不匹配....”错误,请多次重试执行以上代码 。==
> 来自 <[https://zhidao.baidu.com/question/1754918389526048868.html?qbl=relate_question_0&word=sql2008%C8%D5%D6%BE%CE%C4%BC%FE%D3%EB%D6%F7%CE%C4%BC%FE%B2%BB%C6%A5%C5%E4](https://zhidao.baidu.com/question/1754918389526048868.html?qbl=relate_question_0&word=sql2008%C8%D5%D6%BE%CE%C4%BC%FE%D3%EB%D6%F7%CE%C4%BC%FE%B2%BB%C6%A5%C5%E4)>