[docs] User-submitted change to Transfer a catalog
docs@icdevgroup.org
docs@icdevgroup.org
Fri Apr 11 00:41:01 2003
code: xfer.main
title: Transfer a catalog
body of change
---------------
This function creates a compressed tar file and a suitable restore
script for transferring a catalog from one server or location to
another.
<p>
It will only work properly with a "foundation" style setup with
appropriate variables set properly. These include:
<ul>
<li> SERVER_NAME
<li> SECURE_SERVER
<li> CGI_URL
<li> IMAGE_DIR
<li> SQLDSN
<li> SQLUSER
<li> SQLPASS
<li> DOCROOT
<li> ORDERS_TO
<li> SAMPLEHTML
<li> SAMPLEURL
</ul>
Also, this is designed for Linux systems or other systems with
the GNU utility set. It relies on GNU <tt>tar</tt> and <tt>gzip</tt>.
This only works for the default database, Mysql, and Postgres.
If you are using a SQL database on one DSN defined in <b>SQLDSN</b>, it
will dump the database using the mysqldump or pg_dump utilities; they
must be available in your <b>PATH</b>.
<p>
If you have more than one DSN, it will do the dumps but not create the
restore script for those dumps; that must be done manually.
<p>
It exports all non-Postgres/MySQL database files to text files and does NOT
transfer their associated <tt>.gdbm</tt>, <tt>.db</tt> or <tt>.sql</tt> files.
This may suffice to transfer other SQL databases depending on how they
were defined in the <tt>dbconf/</tt> directory.
<p>
It puts the database dumps and exports in the directory "xfer".
Finally, it creates a tar file named CATALOGNAME.tar.gz, where
CATALOGNAME is equal to IC's name for your catalog.
<p>
To restore the catalog, create the target directory where the
catalog will be, then change directory there and restore the
tar file.
<blockquote>
<PRE>
mkdir -p /var/lib/interchange/newcat
cd /var/lib/interchange/newcat
tar -xzf /tmp/oldcat.tar.gz
</PRE>
</blockquote>
If the directory already exists, move it somewhere else for backup
purposes (or delete it entirely if you are sure it is safe to do so).
<P>
>From that directory, inspect the shell script <tt>xfer/restore.sh</tt>
and make appropriate changes; this may include authorization or path information
for the restoring calls to <tt>mysql</tt> or <tt>psql</tt>. Once you have
made any changes, run the shell script:
<blockquote>
<PRE>
cd /var/lib/interchange/newcat
xfer/restore.sh
</PRE>
</blockquote>
You will have to set any permissions separately if the resturing user ID does not
have them.