Backup to disk not on the domain

  • I am running SQL Server 2008 and I wish to backup a database to a server that is on the network but not a member of the domain. A username and password must be provided to access the disk. In the example below, can I provide the necessary credentials? If so, what is the syntax?

    BACKUP DATABASE AdventureWorks2008R2

    TO DISK = '\\evy14\itdept\SQL_Backups\test.bak'

    WITH FORMAT;

    GO

  • yes it's possible because of the way the NET USE command can allow you to map a drive with someones credentials

    exec master.dbo.xp_cmshell 'NET USE G: \\UNCPath\d$ /user:domain\user password'

    something like this would work for what you are asking:

    exec master.dbo.xp_cmshell 'NET USE Z: \\evy14\itdept\SQL_Backups\ /user:mydomain\lowell NotTheRealPassword'

    BACKUP DATABASE AdventureWorks2008R2

    TO DISK = 'Z:test.bak'

    WITH FORMAT;

    EXEC master.dbo.xp_cmdshell 'NET USE Z: /DELETE'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Works great. Thanks for the help.

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

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