SQL 数据库“x”的日志不可用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15771371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The log for database "x" is not available
提问by user2235692
I tried to use the registration page for my site after not changing anything, and suddenly this error message appeared:
我在未更改任何内容后尝试使用我网站的注册页面,突然出现此错误消息:
The log for database "x" is not available. Check the event log for related error messages. Resolve any errors and restart the database.
数据库“x”的日志不可用。检查事件日志以获取相关错误消息。解决所有错误并重新启动数据库。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
I tried to reopen the program & database, tried to refresh the database, but nothing worked. What can be the problem?
我尝试重新打开程序和数据库,尝试刷新数据库,但没有任何效果。可能是什么问题?
回答by Eric Higgins
- Take the database offline.
- Bring it back online.
- Run DBCC checkdb to make sure everything is good.
- Set Auto Close = False.
- 使数据库脱机。
- 让它重新上线。
- 运行 DBCC checkdb 以确保一切正常。
- 设置自动关闭 = False。
回答by Aaron Bertrand
It is possible that the database was set to AutoClose, or was set OFFLINE, or while the SQL Server service wasn't running, an .ldf file was deleted or corrupted/compressed by other people or tools.
有可能数据库被设置为 AutoClose,或者被设置为 OFFLINE,或者当 SQL Server 服务没有运行时,一个 .ldf 文件被其他人或工具删除或损坏/压缩。
Make a copy of the MDF file and you can try to attach it using:
制作 MDF 文件的副本,您可以尝试使用以下方法附加它:
CREATE DATABASE mydb_copy ON (filename = 'C:\path to.mdf')
FOR ATTACH_REBUILD_LOG;
Otherwise, start looking for a backup...
否则,开始寻找备份...
回答by Milan Matějka
Too many things can cause this. I had same problem, you can try take database offline and bring back online (or restart MSSQL). Usually it could help. If this won't help you try these solutions:
太多的事情会导致这种情况。我遇到了同样的问题,您可以尝试使数据库脱机并重新联机(或重新启动 MSSQL)。通常它会有所帮助。如果这对您没有帮助,请尝试以下解决方案:
- For SQL Server 2008 and 2005 try install the latest SP
- Run DBCC CHECKDB ('DatabaseName')and review founded errors
- Check Windows Log and SQL Server Logs for more specific Error code
- Some people find solution of setting Auto Close option on database to FALSE
- Reason behind this scenario could be due to poor IO or memory of your server
- 对于 SQL Server 2008 和 2005,请尝试安装最新的 SP
- 运行DBCC CHECKDB ('DatabaseName')并检查发现的错误
- 检查 Windows 日志和 SQL Server 日志以获取更具体的错误代码
- 有些人找到了将数据库上的自动关闭选项设置为 FALSE 的解决方案
- 这种情况背后的原因可能是由于服务器的 IO 或内存不佳