The procedure for copying a database includes three basic steps:
exporting data out of the source database to an OS file
deleting any data in the destination database
importing data into the destination database from the OS file
The base class for the Oracle Commerce Platform database copying facility is atg.adapter.gsa.DBCopier
. It is important to note that DBCopiers
use vendor-specific bulk copy and SQL utilities for speed, rather than using JDBC. This is accomplished by executing these commands in separate processes.
If the native bulk copy program operates on one table at a time, the DBCopier
imports table data in the order in which the tables are specified and deletes table data in the reverse order. Thus, if there are foreign key constraints among the tables, the copy operation can still work if the tables are specified in dependency order. The various subclasses of DBCopier
implement copying for different database vendors, using different vendor tools.
To use a DBCopier
, follow these steps:
Create a
DBCopier
component. See Creating a DBCopier Component.Configure
DBConnectionInfo
components for your source and destination databases. See Configuring the DBConnectionInfo.Configure the
DBCopier
component as described in Configuring the DBCopier.Set the SQL environment variables as described in Setting the Native SQL Environment.
Run the
DBCopier
by invoking itscopy()
method. For an example, see the Core Commerce Programming Guide.