检修

来源:互联网 发布:配货软件 编辑:程序博客网 时间:2024/04/28 14:07
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

  使用数据库的过程中,由于断电或其他原因,有可能导致数据库出现一些小错误,比如检索某些表特别慢,查询不到符合条件的数据等.

  出现这些情况的原因,往往是因为数据库有些损坏,或索引不完整.

  在ACCESS中,有个修复数据库的功能可以解决这个问题,在SQL企业管理器,没有这个功能,要用语句来完成,下面就介绍如何用SQL语句完成数据库的修复,需要注意的是,在进行下面的操作时,必须断开所有用户的连接:

  USEMASTER
  GO

  sp_dboption'你的数据库名','singleuser','true'
  Go

  DBCCCHECKDB('你的数据库名',REPAIR_REBUILD)
  Go

  USE你的数据库名
  go

  execsp_msforeachtable'DBCCCHECKTABLE(''?'',REPAIR_REBUILD)'
  go

  sp_dboption'你的数据库名','singleuser','false'
  Go

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击