mssql2000 Log.LDF日志文件丢失怎么办
【同一数据库服务器的情况】 如果您的mdf文件是当前数据库产生的,那么很侥幸,也许你使用sp_attach_db或者sp_attach_single_file_db可以恢复数据库,但是会出现类似下面的提示信息 设备激活错误。物理文件名 'C:Program FilesMicrosoft sql serverMSSQLdata
【同一数据库服务器的情况】
如果您的mdf文件是当前数据库产生的,那么很侥幸,也许你使用sp_attach_db或者sp_attach_single_file_db可以恢复数据库,但是会出现类似下面的提示信息
设备激活错误。物理文件名 'C:Program FilesMicrosoft sql serverMSSQLdatatest_Log.LDF' 可能有误。
已创建名为 'C:Program FilesMicrosoft SQL ServerMSSQLDatatest_log.LDF' 的新日志文件。
【不同数据库服务器的情况】
如果您的数据库文件是从其他计算机上复制过来的,那么很不幸,也许上述办法就行不通了。你也许会得到类似下面的错误信息
服务器: 消息 1813,级别 16,状态 2,行 1
未能打开新数据库 'test'。CREATE DATABASE 将终止。
设备激活错误。物理文件名 'd:test_log.LDF' 可能有误。
怎么办呢?别着急,下面我们举例说明恢复办法。
A.使用默认方式建立一个供恢复使用的数据库(test)。
B.停掉数据库服务器。
C.将刚才生成的数据库的日志文件test_log.ldf删除,用要恢复的数据库mdf文件覆盖刚才生成的数据库数据文件test_data.mdf。
D.启动数据库服务器。此时会看到数据库test的状态为“置疑”。这时候不能对此数据库进行任何操作。
E.设置数据库允许直接操作系统表。此操作可以在SQL Server Enterprise Manager里面选择数据库服务器,按右键,选择“属性”,在“服务器设置”页面中将“允许对系统目录直接修改”一项选中。
F.设置test为紧急修复模式
update sysdatabases set status=-32768 where dbid=DB_ID('test')
此时可以在SQL Server Enterprise Manager里面看到该数据库处于“只读置疑脱机紧急模式”可以看到数据库里面的表,但是仅仅有系统表。
G.下面执行真正的恢复操作,重建数据库日志文件
dbcc rebuild_log('test','C:Program FilesMicrosoft SQL ServerMSSQLDatatest_log.ldf')
执行过程中,如果遇到下列提示信息:
服务器: 消息 5030,级别 16,状态 1,行 1
未能排它地锁定数据库以执行该操作。
DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。
说明您的其他程序正在使用该数据库,如果刚才您在F步骤中使用SQL Server Enterprise Manager打开了test库的系统表,,那么退出SQL Server Enterprise Manager就可以了。
正确执行完成的提示应该类似于:
警告: 数据库 'test' 的日志已重建。已失去事务的一致性。应运行 DBCC CHECKDB 以验证物理一致性。将必须重置数据库选项,并且可能需要删除多余的日志文件。
DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。
此时打开在SQL Server Enterprise Manager里面会看到数据库的状态为“只供DBO使用”。此时可以访问数据库里面的用户表了。
H.验证数据库一致性(可省略)
dbcc checkdb('test')
一般执行结果如下:
CHECKDB 发现了 0 个分配错误和 0 个一致性错误(在数据库 'test' 中)。
DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。
I.设置数据库为正常状态
sp_dboption 'test','dbo use only','false'
如果没有出错,那么恭喜,现在就可以正常的使用恢复后的数据库啦。
J.最后一步,我们要将步骤E中设置的“允许对系统目录直接修改”一项恢复。因为平时直接操作系统表是一件比较危险的事情。当然,我们可以在SQL Server Enterprise Manager里面恢复,也可以使用如下语句完成
-SQL
sp_configure 'allow updates',0
go
reconfigure with override
go

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In the Web3 world, although it is free, it is full of dangers. Therefore, the first step in the security of Ouyi wallet is to protect the private key and mnemonic phrase. Everyone knows the importance of private keys, and today the emphasis is on mnemonics. The mnemonic phrase can be understood as another form of presentation of the private key. Having the mnemonic phrase is equivalent to owning the private key and controlling the wallet assets. It is also thought that its presence is lower than that of the private key, and users may forget the mnemonic phrase of Ouyi Wallet. So what should I do if I forget the mnemonic phrase of Ouyi Wallet? Can I still retrieve my Ouyi Wallet mnemonic if I forget it? Issues that users need to pay attention to. Generally speaking, if the mnemonic phrase is forgotten, it cannot be retrieved, but try to contact the relevant customer service personnel for help. The editor below will tell you in detail. What should I do if I forget my Ouyi Wallet mnemonic phrase? If you forget the mnemonic phrase of Ouyi Wallet, please try to recall it or contact us.

The Internet has become an indispensable part of people's lives in today's information age. But we can't get online, and sometimes we encounter some troubles. However, for example, the broadband is already connected. And take corresponding solution measures, we need to troubleshoot the problem step by step to restore the network connection in this case. Confirm the device connection status: Whether the mobile phone and other devices have been correctly connected to the broadband network, check the computer to ensure that the wireless network or wired network connection is normal. 2. Restart the broadband device: Reset the device and re-establish the connection, wait a few minutes and then turn it back on again. Try turning off the broadband router or modem. 3. Check the broadband account number and password: To avoid being unable to access the Internet due to incorrect account or password, make sure the broadband account number and password entered are correct. 4. Check D

In our daily lives, TV, as an important entertainment device, often suffers from snowflakes, which affects our viewing experience. This article will introduce you to practical methods to solve the TV snow problem and help you enjoy TV programs better. 1. Analysis of the causes of snowflake problems Snowflakes appearing on TVs are generally caused by signal interference, antenna problems or TV signal sources. 2. Check whether the antenna connection is loose. First, check whether the connection between the TV and the antenna is firm. If it is loose, plug it in again. 3. Choose a suitable antenna to ensure that the position and direction of the antenna are correct. Choosing an antenna with good performance can improve the signal reception quality. 4. Adjust the direction of the antenna. Find the best signal reception direction by rotating or adjusting the angle of the antenna. 5. Use indoor antenna signals

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box "Error 0x80004005: Unspecified Error" will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

Quark Netdisk and Baidu Netdisk are currently the most commonly used Netdisk software for storing files. If you want to save the files in Quark Netdisk to Baidu Netdisk, how do you do it? In this issue, the editor has compiled the tutorial steps for transferring files from Quark Network Disk computer to Baidu Network Disk. Let’s take a look at how to operate it. How to save Quark network disk files to Baidu network disk? To transfer files from Quark Network Disk to Baidu Network Disk, you first need to download the required files from Quark Network Disk, then select the target folder in the Baidu Network Disk client and open it. Then, drag and drop the files downloaded from Quark Cloud Disk into the folder opened by the Baidu Cloud Disk client, or use the upload function to add the files to Baidu Cloud Disk. Make sure to check whether the file was successfully transferred in Baidu Cloud Disk after the upload is completed. That's it

Recently, many netizens have asked the editor, what is the file hiberfil.sys? Can hiberfil.sys take up a lot of C drive space and be deleted? The editor can tell you that the hiberfil.sys file can be deleted. Let’s take a look at the details below. hiberfil.sys is a hidden file in the Windows system and also a system hibernation file. It is usually stored in the root directory of the C drive, and its size is equivalent to the size of the system's installed memory. This file is used when the computer is hibernated and contains the memory data of the current system so that it can be quickly restored to the previous state during recovery. Since its size is equal to the memory capacity, it may take up a larger amount of hard drive space. hiber

Detailed explanation of the role of .ibd files in MySQL and related precautions MySQL is a popular relational database management system, and the data in the database is stored in different files. Among them, the .ibd file is a data file in the InnoDB storage engine, used to store data and indexes in tables. This article will provide a detailed analysis of the role of the .ibd file in MySQL and provide relevant code examples to help readers better understand. 1. The role of .ibd files: storing data: .ibd files are InnoDB storage

With the advancement of technology and people's increasing demand for high-definition picture quality, TV has become an indispensable part of home entertainment. However, sometimes you may hear an annoying rustling sound while watching TV, which not only affects the viewing experience, but may also cause the TV to malfunction. This article will introduce some methods to solve the rustling sound during TV playback, so that you can enjoy a higher quality movie viewing experience. 1: Check whether the audio cable connection is loose. If there is a rustling sound when the TV is playing, first check whether the audio cable connection is firm. Make sure both ends of the audio cable are plugged into the correct connectors and check for loose connections or poor connections. Two: Adjust the TV volume and audio device settings. Appropriately adjusting the TV volume and audio device settings will help eliminate rustling sounds. try
