Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Database Backup based on Date

Author  Topic 

prakashdotc
Starting Member

25 Posts

Posted - 2006-09-19 : 03:19:15
Hi All,

I need to backup database between a particular date, i.e database backup from <some Date> to <some Date>, Programmatically in vb.net. Is it possible to do it, if so can any one guide me, thanks in advance

Prakash.C

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-09-19 : 03:26:41
what do you mean?


do you just want the data that has changed during that window?



-ec
Go to Top of Page

prakashdotc
Starting Member

25 Posts

Posted - 2006-09-19 : 06:33:32
Hi ec,

yes i have to backup the data including structure of table if there's any changes between the dates given...

-Prakash.C
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-19 : 06:35:35
In BOOKS ONLINE, the BACKUP command is described as
quote:
Backing up an entire database:

BACKUP DATABASE { database_name | @database_name_var }
TO < backup_device > [ ,...n ]
[ WITH
[ BLOCKSIZE = { blocksize | @blocksize_variable } ]
[ [ , ] DESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] DIFFERENTIAL ]
[ [ , ] EXPIREDATE = { date | @date_var }
| RETAINDAYS = { days | @days_var } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] FORMAT | NOFORMAT ]
[ [ , ] { INIT | NOINIT } ]
[ [ , ] MEDIADESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] NAME = { backup_set_name | @backup_set_name_var } ]
[ [ , ] { NOSKIP | SKIP } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] RESTART ]
[ [ , ] STATS [ = percentage ] ]
]
Logon as an user with backup privileges. Switch to MASTER database. Then run the backup command, with parameters described above.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-09-19 : 07:29:35
"Switch to MASTER database"

Optional I think?

Kristen
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-19 : 07:32:41
I hade trouble backup a database once, when having a connection open to that database.
So nowadays I always "USE Master" before backing up using code.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-09-19 : 08:29:17
I doubt doing a USE MASTER will free up the connectivity that was causing the problem would it? (equally I think that "sitting in the database" isn't going to influence the backup - but I'm happy to learn differently!

ALTER DATABASE MyDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

would fix it though!

Kristen
Go to Top of Page

prakashdotc
Starting Member

25 Posts

Posted - 2006-09-21 : 01:44:43
Thank U Peso, Kristen for U'r reply's. i'll try as u said.
Go to Top of Page
   

- Advertisement -