Microsoft SQL Server Management Studio - Creating a backup file

  • I am manually creating a SQL backup file and the backup failed for server: domain\NamedDB. (Microsoft.SqlServer.SmoExtended)

    Additional information:

    system.Data.SqlClient.SQlError: Read on D:\Program Files (x86)\Microsoft SQL Server\MSSQL12.NamedDDB\MSSQL\Data\NamedDB.mdf failed: 1(Incorrect function).

    (Microsoft.SqlServer.smo)

    Any ideas on how to go around this error so that I can make successful SQL backup?

  • I personally have not seen that error before, but my first thought here is going to be either permissions or a typo.

    First step that I would do is if you are using the GUI to do your backup, switch to TSQL.  If you are not 100% sure on the syntax, there are a lot of good resources online, or you can use the GUI to generate the TSQL.  Load up the GUI interface, set all of the options like you are going to do your backup, and then click on the SCRIPT button.

    The biggest reason I recommend scripting it (if you are not already) is the errors are MUCH easier to copy-paste into sites like this or even into google.  Plus, if you get a script working with it, you can put it into a stored procedure later or a SQL job in the event you need to re-run it.

    Having said all that, are you doing the backup with an account that has permissions to do the backup?  If that isn't the issue, could you post the full error?  Having the full error (including error number) can make solving problems like this a whole lot easier.

    When I say "typo", I am referring to the possibility that the path you specified does not exist on the server you ran the backup command on.  Or, another potential typo, you are trying to make a backup of your MDF file and giving the backup name the exact same path/name as your MDF file and thus trying to overwrite the MDF with the backup.

    My last thought is that something is wrong with the file in that location such as the mdf file doesn't exist or file is corrupted.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 2 posts - 1 through 1 (of 1 total)

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