Cannot open backup device. Operating System error 5

后端 未结 21 1197
小蘑菇
小蘑菇 2020-11-30 18:59

Below is the query that I am using to backup (create a .bak) my database.

However, whenever I run it, I always get this error message:

相关标签:
21条回答
  • 2020-11-30 19:24

    I experienced this problem when the .BAK file was temporarily stored in a folder encrypted with BitLocker. It retained the encryption after it was moved to a different folder.

    The NETWORK SERVICE account was unable to decrypt the file and gave this thoroughly informative error message.

    Removing BitLocker encryption (by unchecking "Encrypt contents to secure data" in the file properties) on the .BAK file resolved the issue.

    0 讨论(0)
  • 2020-11-30 19:25

    Go to the SQL server folder in start menu and click configuration tools Select SQL Server configuration manager On SQL server services, on the desired instance change the (Log On as) to local system

    0 讨论(0)
  • 2020-11-30 19:25

    Here is what I did to by-pass the issue.

    1) Go to backup

    2) Remove the destination file-path to disk

    3) Click on Add

    4) In the File name: check box manually type in the backup name after ..\backup like below where Yourdb.bak is the database backup name

    C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\Yourdb.bak

    5) Click on OK

    Hope this helps!

    0 讨论(0)
  • 2020-11-30 19:26

    Yeah I just scored this one.

    Look in Windows Services. Start > Administration > Services

    Find the Service in the list called: SQL Server (MSSQLSERVER) look for the "Log On As" column (need to add it if it doesn't exist in the list).

    This is the account you need to give permissions to the directory, right click in explorer > properties > Shares (And Security)

    NOTE: Remember to give permissions to the actual directory AND to the share if you are going across the network.

    Apply and wait for the permissions to propogate, try the backup again.

    NOTE 2: if you are backing up across the network and your SQL is running as "Local Service" then you are in trouble ... you can try assigning permissions or it may be easier to backup locally and xcopy across outside of SQL Server (an hour later).

    NOTE 3: If you're running as network service then SOMETIMES the remote machine will not recognize the network serivce on your SQL Server. If this is the case you need to add permissions for the actual computer itself eg. MyServer$.

    0 讨论(0)
  • 2020-11-30 19:30

    I know it is not an exact solution but using external drive paths solves this problem.

    BACKUP DATABASE AcinsoftDB
    TO DISK = 'E:\MyDB.Bak'
    WITH FORMAT,
    MEDIANAME = 'C_SQLServerBackups',
    NAME = 'Full Backup of MyDB';
    
    0 讨论(0)
  • 2020-11-30 19:33

    Hi you need to change the query from:

    BACKUP DATABASE AcinsoftDB
    TO DISK = 'C:\Users\Me\Desktop\Backup\MyDB.Bak'
    

    to

    BACKUP DATABASE AcinsoftDB
    TO DISK = N'C:\Users\Me\Desktop\Backup\MyDB.Bak'
    

    You have to add a N in front of the path works for me.

    0 讨论(0)
提交回复
热议问题