简体   繁体   English

SQL Server 2014数据库还原失败

[英]SQL Server 2014 database restore fails

I have clustered version of SQL Server 2014 for production, and for development I use SQL Server 2014 2014 Express edition. 我已将SQL Server 2014的群集版本用于生产,对于开发,我使用了SQL Server 2014 2014 Express版。

I am facing problem while restore database backup from .bak . .bak恢复数据库备份时.bak

I get the following error every time I try to restore 每次尝试还原时都会出现以下错误

TITLE: Microsoft SQL Server Management Studio 标题:Microsoft SQL Server Management Studio

Restore failed for Server 'WEBDESIGNINA\\SQLEXPRESS2014'. 服务器“ WEBDESIGNINA \\ SQLEXPRESS2014”的还原失败。 (Microsoft.SqlServer.SmoExtended) (Microsoft.SqlServer.SmoExtended)

ADDITIONAL INFORMATION: 附加信息:

An exception occurred while executing a Transact-SQL statement or batch. 执行Transact-SQL语句或批处理时发生异常。 (Microsoft.SqlServer.ConnectionInfo) (Microsoft.SqlServer.ConnectionInfo)

The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\\Program Files\\Microsoft SQL Server\\MSSQL12.SQLEXPRESS2014\\MSSQL\\DATA\\Database_Name.mdf'. 尝试在C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL12.SQLEXPRESS2014 \\ MSSQL \\ DATA \\ Database_Name.mdf”。

File 'Database_Name' cannot be restored to 'C:\\Program Files\\Microsoft SQL Server\\MSSQL12.SQLEXPRESS2014\\MSSQL\\DATA\\Database_Name.mdf'. 文件'Database_Name'无法还原到'C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL12.SQLEXPRESS2014 \\ MSSQL \\ DATA \\ Database_Name.mdf'。 Use WITH MOVE to identify a valid location for the file. 使用WITH MOVE标识文件的有效位置。

The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\\Program Files\\Microsoft SQL Server\\MSSQL12.SQLEXPRESS2014\\MSSQL\\DATA\\Database_Name.ldf'. 尝试在C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL12.SQLEXPRESS2014 \\ MSSQL \\ DATA \\ Database_Name.ldf'。

File 'Database_Name_log' cannot be restored to 'C:\\Program Files\\Microsoft SQL Server\\MSSQL12.SQLEXPRESS2014\\MSSQL\\DATA\\Database_Name.ldf'. 文件'Database_Name_log'无法恢复到'C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL12.SQLEXPRESS2014 \\ MSSQL \\ DATA \\ Database_Name.ldf'。 Use WITH MOVE to identify a valid location for the file. 使用WITH MOVE标识文件的有效位置。

Problems were identified while planning for the RESTORE statement. 在计划RESTORE语句时发现了问题。 Previous messages provide details. 以前的消息提供了详细信息。
RESTORE DATABASE is terminating abnormally. RESTORE DATABASE异常终止。 (Microsoft SQL Server, Error: 3634) (Microsoft SQL Server,错误:3634)

Only way to get around this problem is to delete the database & then restore to new database. 解决此问题的唯一方法是删除数据库,然后还原到新数据库。

How can I overwrite this database without error 如何覆盖该数据库而不会出现错误

Happened with me too. 也发生在我身上。 Never seen this before. 以前从未见过。 I took the DB offline, renamed the mdf/ldf, and started the restore, it is working now. 我使数据库脱机,重命名了mdf / ldf,然后开始了还原,它现在可以正常工作。 Not sure if it is a good idea or not. 不知道这是一个好主意。 But somehow I had to get this DB restored and move on. 但是我不得不以某种方式恢复该数据库并继续前进。

I had this problem on a VPS with SQL 2014 Express. 我在使用SQL 2014 Express的VPS上遇到此问题。 There was not enough security permission to a do a restore from the default backup directory: C:\\Program Files\\Microsoft SQL Server\\MSSQL12.MSSQLSERVER\\MSSQL\\Backup (although backups worked fine) 没有足够的安全权限才能从默认备份目录进行还原:C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL12.MSSQLSERVER \\ MSSQL \\ Backup(尽管备份工作正常)

The error was: C:\\Program Files\\Microsoft SQL Server\\MSSQL12.MSSQLSERVER\\MSSQL\\Backup Cannot access the specified path or file on the server. 错误是:C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL12.MSSQLSERVER \\ MSSQL \\ Backup无法访问服务器上的指定路径或文件。 Verify that you have the necessary security privileges and that the path or file exists. 验证您具有必要的安全特权,并且路径或文件存在。

Actually, you can follow these steps to change the authority:Log in to SSMS using Windows Authentication Navigate to Security->Logins Either double Click, or Right Click and select Properties on the user you're interested in . 实际上,您可以按照以下步骤更改权限:使用Windows身份验证登录到SSMS导航到“安全”->“登录”双击或右键单击并在您感兴趣的用户上选择“属性”。 In the "Select a page" box, select "Server Roles" Make sure that the "sysadmin" role is selected Press Ok to save the change and close the dialog Exit SSMS Reopen SSMS and login as the User you wanted, and you should now have sufficient Privileges 在“选择页面”框中,选择“服务器角色”,确保已选择“ sysadmin”角色。单击“确定”以保存更改并关闭对话框。退出SSMS重新打开SSMS并以所需的用户身份登录,现在应该有足够的特权

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM