Operating System error 5(Access is Denied)

  • I am an intern working with two SQL Server 2005 instances on two Windows Server 2003. The servers are linked via crossover. I am using this setup to practice my log shipping before I move to the production databases. I am using the wizard to complete the log shipping. The primary server SQLCOM1 is to backup and restore the DB on the secondary server SQLCOM2\SQL_Data using the default folders after the restore. SQLCOM2\SQL_Data has been shared and I have permissions for most of the default SQL groups as well as a user 'connect' and the local admin. When I go to execute the log shipping it throws the following:

    BackupDiskFile::CreateMedia: Backup device '\\SQLCOM2\SQL_Data\AdventureWorks.bak' failed to create. Operating system error 5(Access is denied.).

    I am working with SQL Server 2005 Enterprise Edition SP1. (SP1 to replicate the production servers.)

     

    Additional info:

    I am logged in as Administrator on both machines.

    The Share Permissions has the following groups or user names:

    Administrator(SQLCOM2\Administrator)

    connect(SQLCOM2\connect)

    Everyone

    NETWORK

    NETWORK SERVICE

    Remote Desktop Users(SQLCOM2\Remote Desktop User)

    SERVICE

    SQLServer2005MSFTEUser$SQLCOM2$MSSQLSERVER

    SQLServer2005MSSQLUser$SQLCOM2$MSSQLSERVER

    SQLServer2005AgentUser$SQLCOM2$MSSQLSERVER

    SYSTEM

    Each of these users\groups has full control permissions.

    Thanks for any help,

    Ryan

  • Sweet!

    I changed the "log on as" to .\Administrator for SQL Server (MSSQLSERVER) and SQL Server Agent (MSSQLSERVER). In the SQL Server Configuration Manager and ran the Log Shipping wizard and all is well!

    Thank you very much for reading,

    Ryan

  • OS error 5 corrsponds to permissions issue on the file and folder paths. Check for the privileges whenever you get such an error.

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

  • Hi,

    i'm also having same problem..

    Here is the error , which i get while i attempt to restore my database:

    restored failed for server 'Horizon\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\Data\exper35_ExpertZoo.ldf' (Microsoft.SqlServer.Expres.Smo)

    I have attempted un-checking the ReadOnly attribute from the files and folders on this path. But, ReadOnly attribute of folders gets back to Checked as soon as i remove it. I attempted the procedure given here to permanently uncheck this attribute But it can work only for files, not folders.

    Can anyone please help me in this regard? I'm simply stuck on this issue.

    Thanks in advance

  • Thank you very very much.

    you help me very nice

    by

  • Ryan Wellman (5/16/2007)


    Sweet!

    I changed the "log on as" to .\Administrator for SQL Server (MSSQLSERVER) and SQL Server Agent (MSSQLSERVER). In the SQL Server Configuration Manager and ran the Log Shipping wizard and all is well!

    Thank you very much for reading,

    Ryan

    its bound to work running as an admin!

    as well as the share permissions did you check\set the security permissions too. This is most likely where the error 5 is being thrown from

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Ryan Wellman (5/16/2007)


    <SPAN class=spnMessageText id=msg><FONT color=#191970>Sweet!

    I changed the "log on as" to .\Administrator for SQL Server (MSSQLSERVER) and SQL Server Agent (MSSQLSERVER). In the SQL Server Configuration Manager and ran the Log Shipping wizard and all is well!

    Thank you very much for reading,

    Ryan</FONT>

    </SPAN>

  • We had the same "error5(Access is Denied)" message. I discovered the "logon as" account had lost its rights to the folder the backups were going to. I granted full rights and then the job executed with no errors.

    So make sure that your SQL account has the rights to write the backup, whether it be local or a remote share.

  • Thank you Ryan.

    My Access denied problem resolved.

  • Hi Kumar,

    I am able to access the share of destination....

  • Hi,

    I tried your theory but no luck, still same problem...

  • Hi,

    Could you explain me, what are things you changed in Server & destination server.....

    Thanks in advance...

    Satish

  • saidapurs (10/23/2011)


    Hi,

    Could you explain me, what are things you changed in Server & destination server.....

    Thanks in advance...

    Satish

    What errors are you getting?

    If you are getting the Operating System error 5(Access is Denied) error, then it is a file permission issue. Go to Run and launch services.msc. Find your SQL services and look at the Log On As field. Make sure that user account has file permissions to the folder where the database resides. I am not a fan of using administrator for running services, but that is my preference.

    If your Log On As account is in a domain, make sure you specify the domain name (Domain\LogOnAsUser)

  • Great It works for me thanks

  • I had the same problem. But All I had to do was create a new empty database, and restore to that with the overwrite option.

Viewing 15 posts - 1 through 15 (of 20 total)

You must be logged in to reply to this topic. Login to reply