Monday, 5 October 2015

How to solve Error 5 (Access is denied.) while restoring SQL Server 2008 Database.

Today I experienced a scenario where I was trying to restore a SQL Server 2008 Database and I was getting the error below.Apparently it was because of permissions.

Restore failed for Server 'localhost\sqlexpress'.  (Microsoft.SqlServer.Express.Smo)
Additional information:
System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'c:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\[my database name].mdf'. (Microsoft.SqlServer.Express.Smo)

How I solved it
I solved it by running sql management studio as administrator and I was able to restore the database successfully.Hope this saves some one's day because I spent 2 days trying to resolve this.

No comments:

Post a Comment

Ugandan Telecoms: Were you ready for this Simcard Re-registration Ocassion!!!!

There was a recent directive from Uganda communications commission calling upon Ugandans to re-register their simcards this time using thei...