Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2008
    Posts
    28

    Unanswered: error about sql server 2005 , why can't backup to c:\

    this is code:
    Dim strSQL As String
    Dim strCon As String
    strCon = "Data Source=NITHI;Initial Catalog=master;Integrated Security=True"
    Dim cmdBackup As SqlClient.SqlCommand = New SqlClient.SqlCommand


    Cursor = Cursors.WaitCursor
    Try
    strSQL = "BACKUP DATABASE Northwind "
    strSQL &= "TO DISK = 'G:\mybackup.bak' "
    strSQL &= "WITH FORMAT, "
    strSQL &= "NAME = 'myBackup'"
    cmdBackup.Connection = conn

    cmdBackup.CommandText = strSQL
    cmdBackup.ExecuteNonQuery()
    MsgBox("finish")
    Catch ex As Exception
    MsgBox("Error")
    End Try


    if i back up to G:\ ,it is Ok
    but when i backup to C:\ ,it's not OK
    what happen?

    (about my computer)
    i have 2 harddisk
    partition G is slave harddisk
    and partition C is master harddisk


    this is error: "Cannot open backup device 'C:\mybackup.bak'. Operating system error 5(error not found).
    BACKUP DATABASE is terminating abnormally."


    please help me

  2. #2
    Join Date
    Apr 2007
    Posts
    183
    Error 5 most often means a security error has occured, such as you have no permission to c: drive.

  3. #3
    Join Date
    Aug 2008
    Posts
    28
    do you mean can't backup to every drive have window?
    true or false?

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Error 5 = Access denied. As a general rule, - create a dedicated directory to store backups, and set SQL Server service and SQL Agent service to have WRITE permissions on that folder. Once you move to Win2K8 server - those tricks of being able to backup to any location without appropriate permissions won't fly.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    I will guess this is a clustered SQL server.

    You can not back up a database to a non-shared drive on a cluster.

  6. #6
    Join Date
    Aug 2008
    Posts
    28
    and can only restore from C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup

    what happen?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •