View Source

h2. Storage Tool

The Storage Tool is a small app for scanning & repairing a GraphDB repository.
The tool is available since GraphDB 6.1 (only for SE editions) and works only on repository images that are not in use (i.e. the Tomcat is stopped).
Let's assume that the GraphDB is already deployed into a folder like \*/home/username/dev/tomcat/webapps/openrdf-sesame. The example code below assumes that current dir is \*/home/username/dev/tomcat/webapps/openrdf-sesame/WEB-INF.
{code}java -cp "lib/*" com.ontotext.trree.util.convert.storage.StorageTool --help{code}
the output is the man page for the tool set:
{code}Usage:
java -jar ... StorageTool --help ==> prints this message
java -jar ... StorageTool <options> ==> executes the command from the options
{code}

h5. Options:
{code}
-command=<operation to be executed, MANDATORY>
-storage=<absoluth path to repo storage dir, MANDATORY>
-esize=<size of entity id 32 or 40, DEFAULT 32>
-statusPrintInterval=<the interval between current status printing in seconds, DEFAULT 30 seconds>
-srcIndex=<one of pso, pos, pcso, pcos>
-destIndex=<one of pso, pos, pcso, pcos>
-origURI=<original existing URI in the repo>
-replURI=<new non-existing URI in the repo>
{code}

h5. Supported commands:
{code}
scan scan repo index(es) and print statistic of the number of statements

rebuild use source index(srcIndex) to rebuild destination index(destIndex) or in case of srcIndex null and non stmt destIndex just
rebuild the destIndex(at the moment support only predicates index)

replace replace an existing(-origURI) entity with a non-existing one(-replURI)

mergeindex merge pso and pos indexes(make union), rebuild context indexes if any, note that there is no data backup

check if no index spcified check all indexes for consistency, else check only specified index for consistency and additionally scan
it for corrupt statements, one statement is corrupt if one of its parts(s,p,o,c) is not present in the entity pool
{code}

h5. Examples:

* scan pso index

{code}
-command=scan -storage=/repo/storage -esize=40 -srcIndex=pso
{code}

* scan all indexes, print status on every 60 seconds

{code}-command=scan -storage=/repo/storage -esize=40 -statusPrintInterval=60{code}

* compact pso index(self rebuild equals to compacting)

{code}-command=rebuild -storage=/repo/storage -esize=40 -srcIndex=pso -destIndex=pso{code}

* rebuild pos from pso index and compact pos

{code}-command=rebuild -storage=/repo/storage -esize=40 -srcIndex=pso -destIndex=pos{code}

* rebuild predicates statistics index

{code}-command=rebuild -storage=/repo/storage -esize=40 -destIndex=predicates{code}

* replace <[http://onto.com#e1]> with <[http://onto.com#e2]>

{code}-command=replace -storage=/repo/storage -origURI=<http://onto.com#e1> -replURI=<http://onto.com#e2> {code}

* check pos consistency and additioaly scan it for corrupt statements

{code}-command=check -storage=/repo/storage -srcIndex=pos{code}