First, read and understand P4toDB Getting Started Guide
That KB describes the background as to how P4ToDB works.
Problem 1) the number of tables to replicate are too many for P4ToDB's config table
Problem 2) P4D release 2016.2 introduced new Perforce server internal datatypes that p4todb 2012.1 cannot handle.
This KB article assume you have no P4ToDB related tables and the config table P4TODB_CONFIG does not exists.
Step 1) Create the table P4TODB_CFG
This step is to workaround Problem 1.
Generate the DDL, send to a file:
p4todb --config-file <properties file> --print-ddl --checkpoint <checkpoint #> > tables.ddl
Edit file table.ddl to extract one row.
Near the bottom is a line to CREATE TABLE "P4TODB_CFG" --> change column TABLES length to be 800 as it was a too small 500.
this one table using your database's client program of choice.
CREATE TABLE "P4TODB_CFG" ( "REPL_ID" VARCHAR2(100), "MODIFIED" TIMESTAMP , "IS_JOURNAL" NUMBER, "AT_JNL_END" NUMBER, "JNL_XACT_TIME" NUMBER, "JNL_XACT_PID" NUMBER, "NUMBER" NUMBER, "OFFSET" NUMBER, "LINES" NUMBER, "TABLES" VARCHAR2(800) );
Step 2) Ignore specific tables that P4ToDB cannot handle or you don't need
Ideally, you should only replicate the tables you need. For the tables you need, see our schema. The current release is at https://www.perforce.com/perforce/doc.current/schema/
. For earlier p4d releases, substitute "rNN.N" (for example, r16.2) for "doc.current'.)
The tables to replicate are defined in your properties file, property DB_TO_REPL.
Alternately you can exclude tables using property DB_NO_REPL.
The following Helix server 2016.2+ tables cannot be replicated with p4tob 2012.1: object, ref, refhist.
Either list these tables in DB_NO_REPL or
exclude them from DB_TO_REPL.
Step 3) create the tables and initialize p4todb_config
p4todb --config-file <properties file> --checkpoint <checkpoint> --init-and-quit
Step 4) Verify table creation
Use your sql client to verify the tables were created and that there is one row in p4todb_config:
select * from P4TODB_CFG;
One row should be returned.
Step 5) Load the checkpoint
p4todb --config-file <properties file> --one-shot
Step 6) Check that the checkpoint was loaded
For example, count the number of changelists:
select count(*) from <TBL_PREFIX>CHANGE;
Step 7) Replicate journals
This loads all journals since the last checkpoint and runs forever: p4todb --config-file <properties file>
Or you can load the journals one at a time: p4todb --config-file <properties file> --one-shot