cant get backup on drive C:\

  • I write this query for getting backup of DB.when i want to save it on Drive c or desktop it give me error but on other drive it complete succefully.what is the reason?

    the query:

    USE [MohitZistDB]

    GO

    /****** Object: StoredProcedure [dbo].[DB_Backup] Script Date: 05/09/2012 11:09:09 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER procedure [dbo].[DB_Backup]

    @path nvarchar(255),

    @Name nvarchar(255)

    as

    begin

    BACKUP DATABASE [MohitZistDB]

    TO DISK = @path

    WITH NOFORMAT, INIT, NAME =@Name

    end

    this the error:

    Msg 3201, Level 16, State 1, Procedure DB_Backup, Line 6

    Cannot open backup device 'c:\\backup.bak'. Operating system error 5(failed to retrieve text for this error. Reason: 15105).

    Msg 3013, Level 16, State 1, Procedure DB_Backup, Line 6

    BACKUP DATABASE is terminating abnormally.

  • vahid.arr (5/9/2012)


    I write this query for getting backup of DB.when i want to save it on Drive c or desktop it give me error but on other drive it complete succefully.what is the reason?

    the query:

    USE [MohitZistDB]

    GO

    /****** Object: StoredProcedure [dbo].[DB_Backup] Script Date: 05/09/2012 11:09:09 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER procedure [dbo].[DB_Backup]

    @path nvarchar(255),

    @Name nvarchar(255)

    as

    begin

    BACKUP DATABASE [MohitZistDB]

    TO DISK = @path

    WITH NOFORMAT, INIT, NAME =@Name

    end

    this the error:

    Msg 3201, Level 16, State 1, Procedure DB_Backup, Line 6

    Cannot open backup device 'c:\\backup.bak'. Operating system error 5(failed to retrieve text for this error. Reason: 15105).

    Msg 3013, Level 16, State 1, Procedure DB_Backup, Line 6

    BACKUP DATABASE is terminating abnormally.

    Have you tried creating a directory in C:\ drive & then taking the backup on that?

    What about this:

    BACKUP DATABASE YourDatabaseName TO DISK = 'C:\BackupDirectory\YourDatabaseName.BAK'

    WITH STATS=1

    See if this works fine.


    Sujeet Singh

  • Windows has some restrictions about files in the root of a drive, especially C drive. Rather create a folder and write the backup into that. Make sure that the SQL Server service has full control over whatever folder you use. Operating system error 5 is Access Denied.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • i want to create backup on desktop.i test it give that error and i check c drive it give me error.i want to exactly put file in desktop.what can i do?

  • ensure that the account which is running the SQL service has the nessesary rights to write a file into the locations you wish for it to go.

  • The desktop is not C:\.

    The desktop is a folder C:\Users\<logged in user>\Desktop. So that's where you need to write the backup, and you need to ensure that the SQL Server service has full control of that folder (and that there are no other security restrictions from windows)

    Why does it have to be the desktop?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • where can i check this?and change this?i want both of this:

    on win 7 and win XP service pack2

  • is the database stored on many different computers or is it on one central server?

    if its on a server and you want it to backup to a users workstation you will have to use UNC paths and start sharing folders and assign the nessesary rights.

    if its many different db copies on many different machines, then you need to go into services.msc, find the account running SQL SERVER, and then ensure that account has the correct access to the folders which you can do by right clicking the folder then looking at the security tab.

  • yes the database is central and is in the server but i cant Find Sql Account on security tab.where exactly is that?

Viewing 9 posts - 1 through 8 (of 8 total)

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