Home Database Mysql Tutorial SQL Server里附加数据库出错的解决方法_MySQL

SQL Server里附加数据库出错的解决方法_MySQL

Jun 01, 2016 pm 01:51 PM
database equipment

bitsCN.com

     在QA里执行sp_attach_db或者sp_attach_single_file_db,出现提示:错误1813:未能打开新数据库’dbname’,create database 将终止。设备激活错误。物理文件名’d:sql servermssqldatadbname _log.ldf’可能有误!

 

后来到baidu里找到相关的方法,不错,问题解决了。

 

按下面的步骤处理:

 

1.新建一个同名的数据库2.再停掉sqlserver服务(注意不要分离数据库)

 

3.用原数据库的数据文件覆盖掉这个新建的数据库4.再重启sqlserver服务

 

5.此时打开企业管理器时会出现置疑,先不管,执行下面的语句(注意修改其中的数据库名)6.完成后一般就可以访问数据库中的数据了。这时,数据库本身一般还有问题,解决办法是:利用数据库的脚本创建一个新的数据库,然后通过DTS将数据导进去就行了

 

 

use master

go

sp_configure ’allow updates’,1 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 reconfigure with override

go

sp_dboption ’置疑的数据库名’, ’single user’, ’false’

go

 

bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

How does Go language implement the addition, deletion, modification and query operations of the database?

What should I do if there is no sound in the system after win11 update? How to solve the problem of no sound in win11 device What should I do if there is no sound in the system after win11 update? How to solve the problem of no sound in win11 device Jun 25, 2024 pm 05:19 PM

What should I do if there is no sound in the system after win11 update? How to solve the problem of no sound in win11 device

Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Aug 10, 2024 pm 09:45 PM

Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

Detailed tutorial on establishing a database connection using MySQLi in PHP

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

How does Hibernate implement polymorphic mapping?

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos

How to stop your iPad from ringing when your iPhone rings How to stop your iPad from ringing when your iPhone rings Apr 17, 2024 pm 01:50 PM

How to stop your iPad from ringing when your iPhone rings

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

An in-depth analysis of how HTML reads the database

See all articles