P4D "-xr" Flag

Low-level database repair

Info & Tags

Article #:
619
Created:
12/13/06
Modified:
08/19/08
Tags:
p4

Related Articles

Warning: If you suspect Perforce database corruption you should call or contact Perforce support immediately. Attempting to address the issue on your own can result in the corruption or loss of your data.

SUMMARY

The "-xr" flag is used to attempt a low-level repair of the Perforce database.

This command should only be run at the direction of Perforce support. Since there is no guarantee that this command will not damage or lose table data, you should make copies of your Perforce database ("db.*") files before using it.

DETAILS

This flag was added to P4D (revision 2002.1 and later) to attempt the repair of corrupted "B-tree" structures in Perforce database tables.  This low-level repair cannot confirm if the data in those structures is valid or correct. Data loss will occur if corrupted sections are pruned from the tree.

The basic syntax is:
p4d -xr
The command processes each database table ("db.*") in turn, displaying the message:
Repairing db.name
Where "name" is the table a repair is being attempted.

Once the command completes, you should take a new checkpoint of the Perforce database. If the data in any of the tables is out of order, restoring this checkpoint will re-build the tables in the proper order. If you are unable to create a checkpoint using the repaired tables, the corrupted database may not be recoverable.

Note: 
After completing the command, it is possible that high level inter-table relationships will need to be rebuilt. See the KB section on the P4D "-xx" flag for more information.