Friday, March 9, 2012

How to get Remote Backup

Is there any way that i can get backup from other(Remote) location on LAN

Thanks

You can use Transact-SQL to do this using UNC naming, like this:

RESTORE DATABASE [my_database] FROM DISK = N'\\LanServer\MSSQL\BACKUP\my_database_backup.bak' WITH FILE = 1, NOUNLOAD, STATS = 10
GO

|||

Could you write me source code

Thanks

|||

Hi,
you already did this in your other post:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1194939&SiteID=1

BackupDeviceItem bkpDevice = new BackupDeviceItem(openBackupDialog.FileName, DeviceType.File);


Replace the openBackupDialog.FileName with the UNC name.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

Sir i can use SMO on computer where sql server installed, but when i access sqlserver from other computer (from my client application which i have developed using C#) then i get an exception.

Thanks

|||Which one do you get ? if you want to deploy the application with SMO functionality you will have to package the SMO classes as well.

http://www.microsoft.com/downloads/details.aspx?FamilyID=7A9AD90F-7F95-4369-A206-E84053D63FD3&

HTH, jens K. Suessmeyer.

http://www.sqlserver2005.de|||

when i created setup by default all sqlserver smo dlls were added with setup, and when i installed on other computer following dll were also isntalled with it

Microsoft.SqlServer.BatchParser.dll

Microsoft.SqlServer.ConnectionInfo.dll

Microsoft.SqlServer.RegSvrEnum.dll

Microsoft.SqlServer.Replication.dll

Microsoft.SqlServer.Rmo.dll

Microsoft.SqlServer.ServiceBrokerEnum.dll

Microsoft.SqlServer.Smo.dll

Microsoft.SqlServer.SmoEnum.dll

Microsoft.SqlServer.SqlEnum.dll

Microsoft.SqlServer.WmiEnum.dll

is still i am missing some redistributable

Thanks

|||Which error do you get ?

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||************** Exception Text **************
Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server 'xyz,1433'. > Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. > System.Data.SqlClient.SqlException: Cannot open backup device 'C:\Program Files\abcd\Setup1\Backup\asdasd.bak'. Operating system error 3(The system cannot find the path specified.).
BACKUP DATABASE is terminating abnormally.|||YOu will have to aware that the backup file has to be reachable from the relative location of the server NOT the client. If you want to use a backup file on the client you will either have to copy it first to a server-reachable destination OR define the backup path to the client share.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment