From: MikeTI on
Jan 26, 2010

Hi all

I am using VB Net 2008 and SQL 2008.

I am taking a backup of a local SQL Server Database using the following
code:

Dim backup As SQLDMO.Backup = New SQLDMO.BackupClass()
Dim sqlserver As SQLDMO.SQLServer = New SQLDMO.SQLServerClass()
sqlserver.LoginSecure = False
sqlserver.Connect("MIKETI-PC\sqlexpress", "sa", "sapassword")
backup.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database
backup.Database = "TestDataBase"

backup.Files = "C:\SQL_BACKUP\TestDataBase.bak"
backup.BackupSetName = "Test01"
backup.BackupSetDescription = "Database backup description"
backup.Initialize = True
backup.SQLBackup(sqlserver)

How can I take a backup of a remote SQL Server Database on my local PC ??

Regards
Mike TI



From: Joe Cool on
On Jan 26, 6:21 am, "MikeTI" <sunset...(a)hotmail.com> wrote:
> Jan 26, 2010
>
> Hi all
>
> I am using VB Net 2008 and SQL 2008.
>
> I am taking a backup of a local SQL Server Database using the following
> code:
>
>         Dim backup As SQLDMO.Backup = New SQLDMO.BackupClass()
>         Dim sqlserver As SQLDMO.SQLServer = New SQLDMO.SQLServerClass()
>         sqlserver.LoginSecure = False
>         sqlserver.Connect("MIKETI-PC\sqlexpress", "sa", "sapassword")
>         backup.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database
>         backup.Database = "TestDataBase"
>
>         backup.Files = "C:\SQL_BACKUP\TestDataBase.bak"
>         backup.BackupSetName = "Test01"
>         backup.BackupSetDescription = "Database backup description"
>         backup.Initialize = True
>         backup.SQLBackup(sqlserver)
>
> How can I take a backup of a remote SQL Server Database on my local PC ??
>

Use a standard SqlClient connection and execute a backup database
transact-sql command. It is my impression that you will only be able
to make a backup copy to a local disk, but you can make a backup to
network disk if SQL instance service is running under a domain/
workgroup account instead of the server's local SYSTEM account.

http://msdn.microsoft.com/en-us/library/ms186865.aspx
From: Rich P on
If you are working remotely, I think you can only run the backup
operation on the machine (the remote server) where the DB resides. Then
you can copy/FTP the .bak to your local computer. I think.

Rich

*** Sent via Developersdex http://www.developersdex.com ***