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 2005 Forums
 Transact-SQL (2005)
 How to replace the backup

Author  Topic 

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-03 : 09:58:00
Hi guys,

How do i replace the already backup db

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-03 : 09:59:02
replace? do you mean restore your db with last backup?
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-03 : 10:05:04
Thanks visakh16,
No, i have to backup db using script. So every week the backup script run. So i have to replace or delete exist backup db and creating new backpu.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-03 : 10:17:42
quote:
Originally posted by rudba

Thanks visakh16,
No, i have to backup db using script. So every week the backup script run. So i have to replace or delete exist backup db and creating new backpu.



Add INIT to Backup script
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-03 : 10:23:10
Yes, I did like this:

BACKUP DATABASE TestDb TO DISK = 'E:\Db_Backup\TestDb.bak' WITH RETAINDAYS = 7, INIT

got this error:
Msg 4030, Level 16, State 1, Line 1
The medium on device 'E:\Db_Backup\TestDb.bak' expires on Feb 4 2009 10:10:27:000AM and cannot be overwritten.
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-03 : 10:26:20
Probably you set expire data while backing up. It should be left as default.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-03 : 10:27:17
http://www.sqlserverdba.co.cc/2008/12/medium-on-device-bak-expires-on-and.html
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-03 : 10:29:37
thanks guys,

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-03 : 10:30:56
refer the link. try using SKIP
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-03 : 10:31:40
You can't replace unexpired backup.Copy that backup to other location or tape and start fresh new backup.
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-03 : 10:34:27
Thanks guys.
Go to Top of Page
   

- Advertisement -