• 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