[p4] Example Windows backup script?

Keith Graham - ID kgraham at uasc-id.com
Tue Aug 14 07:46:17 PDT 2007

Just as a note:

If you delete the old journals and checkpoints BEFORE you make a new
one, if the new one fails for some reason, you're in trouble. Hopefully
your backup is fine, but if it isn't, you're in trouble.

(We also run verify before creating the new checkpoint, so that we know
a valid database was used to create the checkpoint.)

After we create the new checkpoint, we then use "forfiles" to delete the
checkpoints and journals that are over a certain age.  (2 weeks in our
case.)  We have plenty of disk, so keeping 10 copies of the checkpoint
and journal isn't a problem, and acts as an extra backup in case one or
more of the files ends up corrupted.


-----Original Message-----
From: perforce-user-bounces at perforce.com
[mailto:perforce-user-bounces at perforce.com] On Behalf Of Sheizaf, Yariv
Sent: Tuesday, August 14, 2007 2:57 AM
To: perforce-user at perforce.com; steve at bstage.com
Subject: Re: [p4] Example Windows backup script?


Hereby is an old style BAT script I use for Perforce backup over the
last 10 years:

REM Perforce database is located in d:\p4server


cd d:\p4server

REM delete old checkpoint files
del checkpoint.*

REM delete old journal files, except the active journal file
del journal.1*
del journal.2*
del journal.3*
del journal.4*
del journal.5*
del journal.6*
del journal.7*
del journal.8*
del journal.9*

REM create new checkpoint file. Truncate journal file
p4d -jc -z

REM verify database integrity vs. repository
REM    Note: Can take a lot of time. In big databases run it separately
in a REM          different scheduled task
P4 verify -q //...

REM    Backup the checkpoint file, the truncated journal file and the
REM    repository files (RCS + gzip) to an external media, once the 
REM    checkpoint process is completed


Yariv Sheizaf
SAP - B1X Technical Services TL

perforce-user mailing list  -  perforce-user at perforce.com

More information about the perforce-user mailing list