Link to home
Start Free TrialLog in
Avatar of BPWALKIN
BPWALKIN

asked on

Change backup to an incremental from full

I have the following code in a batch file to run a backup

"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe" -S rrsdb1 -E -Q "BACKUP DATABASE rrsnet TO DISK='\\rrsstore1\S\BU\Databases\rrsnet\%timestamp%rrsnet.bak' WITH

FORMAT"

How can I change that to just do an incremental backup?
Avatar of Ady Foot
Ady Foot
Flag of United Kingdom of Great Britain and Northern Ireland image

BACKUP DATABASE mydata TO DISK = 'd:\backup.bak' WITH DIFFERENTIAL

No such thing as incremental it's differential :-)

The following page will help you a lot with these commands:  http://www.datasprings.com/Resources/ArticlesInformation/BackupRestoreDatabasesusingMSDE.aspx

Regards,

Ady
Avatar of BPWALKIN
BPWALKIN

ASKER

I am getting an error

It says that I do not have a "full" backup therefore no differential can be created.

So I run the full omitting " WITH DIFFERENTIAL" and then try to run again with " WITH DIFFERENTIAL" and continue to get the same error.

Yeah it's because the timestamp means you have a different filename each time.  The filename needs to be the same I think.

Regards,

Ady
I did change that when I did the full. so it is butest.bak
did I need to wait a period of time?
Perhaps this would help you as it achieves the same thing, you can use your batch file, but it is a seemingly simpler way to do it:
http://www.sqldbatips.com/showarticle.asp?ID=27

Regards,

Ady
I see that has a better feature set. I downloaded the ExpressMaint.  program where to I put the file in order for it to work properly.
You need to use the script to create the stored procedure on your database server.  Is that what you were asking?

Regards,

Ady
The second page of the link
http://www.sqldbatips.com/showarticle.asp?ID=29

has a .exe file that allows you to run a script. I did not think you needed the SP if you use the .exe
Ah OK - you use the exe file to make the commands instead of sqlcmd.exe.  



expressmaint -S (local)\SQLExpress -D ALL_SYSTEM -T DB -R c:\reports -RU WEEKS -RV 1 -B c:\backups -BU DAYS -BV 1 -V

Open in new window

yes- this seems more straight forward to me. Where do i save it? it does not say, do I just save it in the same dir as the script i write?
ASKER CERTIFIED SOLUTION
Avatar of Ady Foot
Ady Foot
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your HELP !! !