471,310 Members | 1,087 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

backup/restore from Program

How can I backup and restore a SQLServer DB from a .net VB program?
Thanks,
G
Nov 18 '05 #1
1 1387
You can do pretty much anything with T-SQL script. See SQL books online for more info.

I copied this examples right out from BO:

USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_2',
'c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MyNwind_2.dat'

--Create the log backup device.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwindLog1',
'c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MyNwindLog1.dat'

-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_2

-- Update activity has occurred since the full database backup.

-- Back up the log of the MyNwind database.
BACKUP LOG MyNwind
TO MyNwindLog1

RESTORE DATABASE MyNwind
FILE = 'MyNwind_data_1',
FILE = 'MyNwind_data_2',
FILEGROUP = 'new_customers'
FROM MyNwind_1
WITH NORECOVERY
-- Restore the log backup.
RESTORE LOG MyNwind
FROM MyNwindLog1

"G. Dean Blake" wrote:
How can I backup and restore a SQLServer DB from a .net VB program?
Thanks,
G

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Spieg | last post: by
1 post views Thread by gcetti | last post: by
2 posts views Thread by anton.aleksandrov | last post: by
6 posts views Thread by Eric Herber | last post: by
4 posts views Thread by Hardy | last post: by
3 posts views Thread by UnixSlaxer | last post: by
1 post views Thread by wolphie | last post: by
4 posts views Thread by Bootstrap Bill | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.