0

I am trying to restore a database from a backup I got on the hosting server. I have checked the logical names using:

restore FILELISTONLY from 
disk = 'c:\DBBackup2_17092013.bak'

and used them to perform the following query:

restore database StadlerTest
from disk = 'c:\DBBackup2_17092013.bak'
with replace,
move 'Stadler_base' to 'C:\Program Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\StadlerTest.mdf',
move 'Stadler_base_log' to 'C:\Program Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\StadlerTest.ldf'

I run the above two queries from master after I created the empty database StadlerTest but I am getting a series of error that sound like these (translation from italian):

""Message 3634, level 16, state 1, row 1 The operating system returned error '5(Access denied.)' during the attempt to 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\StadlerTest.mdf'.""

I am doing something wrong but I do not know what is wrong, I already checked several answers given on SO and other sites but I am not getting it right. Some help will be appreciated. Thanks.

4

1 回答 1

0

听起来像是权限错误。SQL Server 可能没有在那里创建文件的权限。请记住,SQL Server 试图在其服务帐户下创建数据库,而不是您的 Windows 登录名。检查 SQL Server 帐户的权限,在管理工作室的 Security -> Logins 下找到所有其他登录名。

但是,您不应该在 C 驱动器上创建数据库。如果它们增长并且 C 驱动器空间不足,那么您的整个计算机和操作系统将会崩溃。如果可能,请将数据库文件放在不同的驱动器上。如果这只是用于个人测试,那很好,但不适用于任何重要的系统。

于 2013-09-21T15:49:23.257 回答