惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
博客园_首页
H
Help Net Security
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
GbyAI
GbyAI
Scott Helme
Scott Helme
D
Docker
Hacker News: Ask HN
Hacker News: Ask HN
P
Privacy & Cybersecurity Law Blog
Jina AI
Jina AI
雷峰网
雷峰网
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
G
GRAHAM CLULEY
C
Cisco Blogs
The Hacker News
The Hacker News
F
Full Disclosure
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
Recent Announcements
Recent Announcements
G
Google Developers Blog
量子位
K
Kaspersky official blog
Cisco Talos Blog
Cisco Talos Blog
The Cloudflare Blog
A
About on SuperTechFans
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
T
Tenable Blog
P
Palo Alto Networks Blog
H
Heimdal Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Schneier on Security
Schneier on Security
The Register - Security
The Register - Security
F
Fortinet All Blogs
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
N
News and Events Feed by Topic
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
V
V2EX
爱范儿
爱范儿

博客园 - 心愿

IIS上启用Gzip对网页进行压缩(图文) 健康养生:掌握规律,合理睡眠 Windows补丁:安装程序不能验证Update.inf文件的完整性,请确定加密服务正在此计算机上运行 使用URLRewriter重写后,相同后缀后的真实静态文件无法访问的解决办法 Sql server WaitType 日志 【转载】办公室禁止QQ登录的用法 [转]SQL Server 2005新特性 [转]艾瑞咨询:网络招聘的顺势突围之道 [收藏]sql查询性能调试,用SET STATISTICS IO和SET STATISTICS TIME 关于未能创建 Mutex 问题的解决 二级域名共享Cookie时碰到的问题:Padding is invalid and cannot be removed [摘录]Windows Server十大隐患服务 [收集]自己编写一个SQL Server中用的lastindexof函数 [收集|整理]优化SQL Server数据库相关注意事项 [收集]精典诗词改篇:沁园春 车票 [转]NUnit2.0详细使用方法 [转]利用UrlRewriter 实现二级域名 熬夜——健康的天敌 Asp.net中基于Forms验证的角色验证授权
SQL Server 数据库出现 置疑的处理方法 .
心愿 · 2012-07-03 · via 博客园 - 心愿

2012-07-03 17:46  心愿  阅读(449)  评论()    收藏  举报

SQL Server 数据库出现置疑时的处理方法,此时,数据库使用不了。

只需把下面代码  COPY 到数据库 IDE 中 ,把 数据库名称 改为 置疑 的那个数据库的名称,

把 数据库日志存放路径改为 本机实际存放绝对物理地址, 然后执行即可

------------------------------  代码开始 ---------------------------------
--置数据库的紧急模式
alter database 数据库名称 set emergency
go

--置数据库为单用户模式
alter database 数据库名称 set single_user with rollback immediate
go
use master
go

--重建数据库日志文件
alter database 数据库名称 Rebuild Log on  
(name=数据库名称_log,filename='数据库日志存放路径\数据库名称_log.LDF')
go

--最后设置数据库为多用户模式。
alter database 数据库名称 set multi_user  

--检测数据库
dbcc checkdb 
 
--通过以上方法修复数据库后,可以dbcc checkdb一下数据库,如果发现页级错误,可以通过以下命令修复。

dbcc checkdb(数据库名称,REPAIR_ALLOW_DATA_LOSS)  

dbcc checkdb(数据库名称,REPAIR_REBUILD)

------------------------代码结束-----------------------------------------