Sunday, March 25, 2012

Database backup using T-Sql

Can anyone help me out here..I am experimenting with backing up a db using Transact-Sql Backup.
I want to backup the database to a local drive say c:\databaseBk and a remote Server.

I tried

BACKUP DATABASE Mydb TO AlternativeServer but am getting errors here.
I know there is more to it and I also tried as below...
Even backup to remote for now would be perfect...if anyone has the code to do this locally that would be great also...
I got this from BooksOnline.....

USE Mydb
EXEC sp_addumpdevice 'disk', AlternativeServer,
DISK ='c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\Mydb.dat'

-- Back up
BACKUP DATABASE MyNwind TO MyNwind_1I've got another one for your collection:

DUMP DATABASE dbname TO device WITH NOUNLOAD , INIT , NOSKIP

Where is the problem lays?

Regards,
OBRP|||As far as I know you can not backup DB on the remote server - only on a local device (tape or drive).|||You can backup on a remote computer by :

backup database dbname to disk='\\remote\server\path\filename.dbk' with init,noskip,NOUNLOAD

This should help you to backup it up to a remote computer without any problem.

Thanks.|||Make sure yours sqlserver runs on domain wide account, or account with write rights on remore compute.

HTH,
OBRP|||Thanks for that...

No comments:

Post a Comment