Export Import Command Line Tools

There can be many occasions where we need to do an import or export of Alfresco data (user, groups, contents, rules, customization), thankfully, Alfresco supports and import/export tool which comes handy for such situations.

These Tools internally consume Alfresco Repository Foundation APIs. This means they execute stand-alone with an embedded Repository. To perform an export and/or import via these tools, you need to configure the repository to ensure the appropriate storage locations (e.g. database and file system directory) are used. The only thing we need to make sure is Alfresco database is up and running while we execute this tool.

Command to Start MySQL Database

start “MySQL” “%ALF_HOME%mysql\bin\mysqld” –defaults-file=”%ALF_HOME%mysql\my.ini” –basedir=”%ALF_HOME%mysql” –console

Command to Export User and User Groups are as follow

user groups:
===========

java -classpath classes/alfresco/module;../../../shared/classes;classes;lib/acegi-security-0.8.2_patched.jar;lib/activation.jar;lib/addressing-1.0.jar;lib/alfresco-core-3.2r2.jar;lib/alfresco-deployment-3.2r2.jar;lib/alfresco-linkvalidation.jar;lib/alfresco-mbeans-3.2r2.jar;lib/alfresco-remote-api-3.2r2.jar;lib/alfresco-repository-3.2r2.jar;lib/alfresco-web-client-3.2r2.jar;lib/ant.jar;lib/antlr-2.7.5H3.jar;lib/aopalliance.jar;lib/avalon-framework-4.2.0.jar;lib/bcel.jar;lib/bcprov-jdk15-137.jar;lib/bsf-2.4.0.jar;lib/bsh-1.3.0.jar;../../../lib/catalina.jar;lib/cglib-nodep-2.2_beta1.jar;lib/chiba-1.3.0-patched.jar;lib/commons-beanutils-1.7.0.jar;lib/commons-codec-1.3.jar;lib/commons-collections-3.1.jar;lib/commons-dbcp-1.2.2.jar;lib/commons-digester-1.6.jar;lib/commons-discovery-0.2.jar;lib/commons-el.jar;lib/commons-fileupload-1.1.1.jar;lib/commons-httpclient-3.1.jar;lib/commons-io-1.1.jar;lib/commons-jxpath-1.2.jar;lib/commons-lang-2.1.jar;lib/commons-logging-1.1.jar;lib/commons-modeler.jar;lib/commons-pool-1.4.jar;lib/commons-validator.jar;lib/cpool.jar;../../../lib/cryptix-jce-provider.jar;lib/dom4j-1.6.1.jar;lib/ehcache-1.4.1-patched.jar;lib/fontbox-0.8.0-incubating.jar;lib/fop-0.94.jar;lib/freemarker-2.3.13.jar;lib/guessencoding-1.0.jar;lib/hibernate-3.2.6-patched.jar;lib/hrtlib.jar;lib/hsqldb.jar;lib/htmlparser-1.6.jar;lib/icu4j_3_6_1.jar;lib/jakarta-oro-2.0.8.jar;lib/jaxen-1.1-beta-8.jar;lib/jaxrpc.jar;lib/jbpm-identity-3.3.1.jar;lib/jbpm-jpdl-3.3.1.jar;lib/jcr-1.0.jar;lib/jgroups-2.8.0-b2.jar;lib/jibx-bind.jar;lib/jibx-run.jar;lib/jid3lib-0.5.jar;lib/JMagick.jar;lib/joda-time-1.2.1.jar;lib/jooconverter-2.1.0.jar;lib/json.jar;lib/jstl-1.1.0.jar;lib/jta.jar;lib/jug-lgpl-2.0.0.jar;lib/jut.jar;lib/log4j-1.2.15.jar;lib/lucene-analyzers-2.4.1.jar;lib/lucene-core-2.4.1.jar;lib/lucene-snowball-2.4.1.jar;lib/mail.jar;lib/myfaces-api-1.1.5.jar;lib/myfaces-impl-1.1.5.jar;lib/naming-factory.jar;lib/naming-resources.jar;lib/odf_utils.jar;lib/odmg-3.0.jar;lib/openoffice-juh-2.0.3.jar;lib/openoffice-jurt-2.0.3.jar;lib/openoffice-ridl-2.0.3.jar;lib/openoffice-sandbox-2.0.3.jar;lib/openoffice-unoil-2.0.3.jar;lib/opensaml-1.0.1.jar;lib/pdfbox-0.8.0-incubating.jar;lib/poi-3.5-FINAL-20090928.jar;lib/portlet-api-lib.jar;lib/quartz-1.6.0.jar;lib/resolver.jar;lib/rhino-js-1.6R7.jar;lib/saaj.jar;lib/saxpath.jar;lib/spring-2.0.8.jar;lib/springmodules-jbpm31.jar;lib/standard.jar;../../../lib/tlc124.jar;lib/tm-extractors-1.0-patched.jar;../../../lib/tomcat-coyote.jar;../../../lib/tomcat-util.jar;lib/truezip.jar;../../../lib/truelicense-1_29.jar;../../../lib/truexml-1_29-patched.jar;lib/wsdl4j-1.6.2.jar;lib/wss4j.jar;lib/xercesImpl-2.8.0.jar;lib/xml-apis.jar;lib/xmlgraphics-commons-1.2.jar;lib/xmlsec-1.4.1.jar;lib/xpp3-1.1.3_8.jar;lib/xstream-1.2.2.jar;../../../lib/mysql-connector-java-5.1.7-bin.jar;../../../endorsed/serializer.jar;../../../endorsed/xalan.jar;lib/axis-1.4.jar;../../../lib/servlet-api.jar;lib/ibatis-2.3.4.726-patched.jar;../../share/WEB-INF/lib/alfresco-jlan-embed-3.2r2.jar;lib/subetha-smtp.jar;lib/xmlrpc.jar;lib/jsr107cache-1.0.jar;lib/alfresco-webscript-framework-3.2r2.jar;lib/abdera-client-0.4.0-incubating.jar;lib/abdera-core-0.4.0-incubating.jar;lib/abdera-extensions-json-0.4.0-incubating.jar;lib/abdera-i18n-0.4.0-incubating.jar;lib/abdera-parser-0.4.0-incubating.jar;lib/axiom-api-1.2.5.jar;lib/axiom-impl-1.2.5.jar;lib/greenmail-1.3-patched.jar;lib/alfresco-vti-3.2r2.jar;lib/jetty-util-6.1.14.jar;lib/jetty-6.1.14.jar org.alfresco.tools.Export -user admin -pwd admin -s workspace://SpacesStore -path /sys:system/sys:authorities -verbose -overwrite spacesStore-authorities

users:

===========

java -classpath classes/alfresco/module;../../../shared/classes;classes;lib/acegi-security-0.8.2_patched.jar;lib/activation.jar;lib/addressing-1.0.jar;lib/alfresco-core-3.2r2.jar;lib/alfresco-deployment-3.2r2.jar;lib/alfresco-linkvalidation.jar;lib/alfresco-mbeans-3.2r2.jar;lib/alfresco-remote-api-3.2r2.jar;lib/alfresco-repository-3.2r2.jar;lib/alfresco-web-client-3.2r2.jar;lib/ant.jar;lib/antlr-2.7.5H3.jar;lib/aopalliance.jar;lib/avalon-framework-4.2.0.jar;lib/bcel.jar;lib/bcprov-jdk15-137.jar;lib/bsf-2.4.0.jar;lib/bsh-1.3.0.jar;../../../lib/catalina.jar;lib/cglib-nodep-2.2_beta1.jar;lib/chiba-1.3.0-patched.jar;lib/commons-beanutils-1.7.0.jar;lib/commons-codec-1.3.jar;lib/commons-collections-3.1.jar;lib/commons-dbcp-1.2.2.jar;lib/commons-digester-1.6.jar;lib/commons-discovery-0.2.jar;lib/commons-el.jar;lib/commons-fileupload-1.1.1.jar;lib/commons-httpclient-3.1.jar;lib/commons-io-1.1.jar;lib/commons-jxpath-1.2.jar;lib/commons-lang-2.1.jar;lib/commons-logging-1.1.jar;lib/commons-modeler.jar;lib/commons-pool-1.4.jar;lib/commons-validator.jar;lib/cpool.jar;../../../lib/cryptix-jce-provider.jar;lib/dom4j-1.6.1.jar;lib/ehcache-1.4.1-patched.jar;lib/fontbox-0.8.0-incubating.jar;lib/fop-0.94.jar;lib/freemarker-2.3.13.jar;lib/guessencoding-1.0.jar;lib/hibernate-3.2.6-patched.jar;lib/hrtlib.jar;lib/hsqldb.jar;lib/htmlparser-1.6.jar;lib/icu4j_3_6_1.jar;lib/jakarta-oro-2.0.8.jar;lib/jaxen-1.1-beta-8.jar;lib/jaxrpc.jar;lib/jbpm-identity-3.3.1.jar;lib/jbpm-jpdl-3.3.1.jar;lib/jcr-1.0.jar;lib/jgroups-2.8.0-b2.jar;lib/jibx-bind.jar;lib/jibx-run.jar;lib/jid3lib-0.5.jar;lib/JMagick.jar;lib/joda-time-1.2.1.jar;lib/jooconverter-2.1.0.jar;lib/json.jar;lib/jstl-1.1.0.jar;lib/jta.jar;lib/jug-lgpl-2.0.0.jar;lib/jut.jar;lib/log4j-1.2.15.jar;lib/lucene-analyzers-2.4.1.jar;lib/lucene-core-2.4.1.jar;lib/lucene-snowball-2.4.1.jar;lib/mail.jar;lib/myfaces-api-1.1.5.jar;lib/myfaces-impl-1.1.5.jar;lib/naming-factory.jar;lib/naming-resources.jar;lib/odf_utils.jar;lib/odmg-3.0.jar;lib/openoffice-juh-2.0.3.jar;lib/openoffice-jurt-2.0.3.jar;lib/openoffice-ridl-2.0.3.jar;lib/openoffice-sandbox-2.0.3.jar;lib/openoffice-unoil-2.0.3.jar;lib/opensaml-1.0.1.jar;lib/pdfbox-0.8.0-incubating.jar;lib/poi-3.5-FINAL-20090928.jar;lib/portlet-api-lib.jar;lib/quartz-1.6.0.jar;lib/resolver.jar;lib/rhino-js-1.6R7.jar;lib/saaj.jar;lib/saxpath.jar;lib/spring-2.0.8.jar;lib/springmodules-jbpm31.jar;lib/standard.jar;../../../lib/tlc124.jar;lib/tm-extractors-1.0-patched.jar;../../../lib/tomcat-coyote.jar;../../../lib/tomcat-util.jar;lib/truezip.jar;../../../lib/truelicense-1_29.jar;../../../lib/truexml-1_29-patched.jar;lib/wsdl4j-1.6.2.jar;lib/wss4j.jar;lib/xercesImpl-2.8.0.jar;lib/xml-apis.jar;lib/xmlgraphics-commons-1.2.jar;lib/xmlsec-1.4.1.jar;lib/xpp3-1.1.3_8.jar;lib/xstream-1.2.2.jar;../../../lib/mysql-connector-java-5.1.7-bin.jar;../../../endorsed/serializer.jar;../../../endorsed/xalan.jar;lib/axis-1.4.jar;../../../lib/servlet-api.jar;lib/ibatis-2.3.4.726-patched.jar;../../share/WEB-INF/lib/alfresco-jlan-embed-3.2r2.jar;lib/subetha-smtp.jar;lib/xmlrpc.jar;lib/jsr107cache-1.0.jar;lib/alfresco-webscript-framework-3.2r2.jar;lib/abdera-client-0.4.0-incubating.jar;lib/abdera-core-0.4.0-incubating.jar;lib/abdera-extensions-json-0.4.0-incubating.jar;lib/abdera-i18n-0.4.0-incubating.jar;lib/abdera-parser-0.4.0-incubating.jar;lib/axiom-api-1.2.5.jar;lib/axiom-impl-1.2.5.jar;lib/greenmail-1.3-patched.jar;lib/alfresco-vti-3.2r2.jar;lib/jetty-util-6.1.14.jar;lib/jetty-6.1.14.jar org.alfresco.tools.Export -user admin -pwd admin -s workspace://SpacesStore -p /sys:system/sys:people -verbose -overwrite SpacesStore-people

NOTE: You need to changes in above command according to the environment in which you are executing this command. For Instance The classpath separator character is for Window is “;” while for Linux it is “:” Like wise there are many more things which are OS specific which you need to keep in mind while executing above commands.

You can find More information about Alfresco Import Export tool in following post

http://wiki.alfresco.com/wiki/Export_and_Import#Export_.26_Import_Command_Line_Tools

Hope this post will reduce Alfresco administrators and developers efforts and will help them in resolving common issue which we often face.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *