错误5173 不能使文件与不同的数据库相关

今天在SQL Server中attach数据库时出现如下错误:

错误5173 不能使文件与不同的数据库相关

该问题可以尝试用如下步骤解决:

1.新建一个同名的数据库

2.再停掉sql server(注意不要分离数据库)

3.用要附加的数据文件覆盖掉这个新建的数据库

4.再重启sql server

5.此时打开企业管理器时会出现置疑,先不管,执行下面的语句(注意修改其中的数据库名)
USE MASTER
GO
SP_CONFIGURE ‘ALLOW UPDATES’,1
GO
RECONFIGURE WITH OVERRIDE
GO
UPDATE SYSDATABASES SET STATUS =32768 WHERE NAME=’置疑的数据库名’
Go
sp_dboption ‘置疑的数据库名’, ’single user’, ‘true’
Go
DBCC CHECKDB(’置疑的数据库名’)
Go
update sysdatabases set status =28 where name=’置疑的数据库名’
Go
sp_configure ‘allow updates’, 0
GO
reconfigure with override
Go
sp_dboption ‘置疑的数据库名’, ’single user’, ‘false’
Go

6.完成后一般就可以访问数据库中的数据了,这时,数据库本身一般还要问题,解决办法是,利用数据库的脚本创建一个新的数据库,并将数据导进去就行了.

  
« FAT32引起的ORA-01653错误            Home            截断事物日志的几种方法 »

No Comments

Be the first to comment on this entry.

Leave a comment

Name(required)
Mail (will not be published)(required)
Website

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://www.dbifan.com),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.

    搜索本站

    站点日历

    4月 2006
    « 3   5 »
     12
    3456789
    10111213141516
    17181920212223
    24252627282930

    订阅本站

    文章分类

    最新日志

    热点文章

    日志存档

    常用标签