当我缩小数据库时,机器重新启动,从那时起SQL Server (MSSQLSERVER)
没有启动。在阅读博客后,我使用相同的文件替换了templates文件夹中的master.mdf
和mastlog.ldf
文件,假设master数据库已损坏,因为我正在缩小它。
但问题仍然存在,错误日志文件提供以下消息,
Starting up database 'msdb'.
Starting up database 'mssqlsystemresource'.
Error: 17204, Severity: 16, State: 1.
FCB::Open failed: Could not open file E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf for file number 1. OS error: 3(The system cannot find the path specified.).
Error: 5120, Severity: 16, State: 101.
Unable to open the physical file "E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf". Operating system error 3: "3(The system cannot find the path specified.)".
Error: 17207, Severity: 16, State: 1.
FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.
File activation failure. The physical file name "E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf" may be incorrect.
The resource database build version is 12.00.2000. This is an informational message only. No user action is required.
Starting up database 'model'.
我可以清楚地说我的机器上没有E:\
分区。你能帮我修一下我现在假设错误的路径吗?
答案 0 :(得分:0)
可能是与Windows相关的问题,其中没有相应的权限。请在这里查看:http://blog.sqlauthority.com/2016/06/27/sql-server-fcbopen-failed-not-open-file-file-number-2-os-error-5access-denied/
答案 1 :(得分:-1)
我不知道这是一个错误还是通常是SQL Server 2014的东西。 对数据库的一些引用将保持如下:
UITabBarController
所以你基本上必须直接在数据库中改变它们。
以管理员身份运行CMD控制台并访问您的数据库,如下所示:
E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf
如果你有一个实例,或者像这样:
SQLCMD -S .\
使用以下句子将文件重命名为默认位置:
SQLCMD –S .\INSTANCENAME
之后,你的sa用户将保持没有密码(它发生在我身上,不确定是否总是发生),只需再次登录到控制台并手动更改密码:
ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\model.mdf');
ALTER DATABASE model MODIFY FILE ( NAME = modellog, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\modellog.ldf');
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBData, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\MSDBData.mdf');
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\MSDBLog.ldf');
ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\temp.mdf');
ALTER DATABASE tempdb MODIFY FILE ( NAME = templog, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\temp.ldf');
GO
当我完成最后一步时,我遇到了问题,因为我的默认登录配置了Windows身份验证,所以说明:
ALTER LOGIN sa WITH PASSWORD = 'newpassword' UNLOCK
没有用,只需添加没有密码的sa用户:
SQLCMD -S .\
希望它有所帮助。
我在这里找到了解决方案: