If you have created subscriptions in your database and bookmarks to reference the state of the database you want to export, you can export a version of the data from a master database to a replica database or to a disk file. If the data is exported to a disk file, it can be imported into a replica database.
There are two different ways to export data from a master database to a replica database.
▪ To export subscription data from the master database to a file for later import to one or more replicas, use the EXPORT SUBSCRIPTION statement, see EXPORT SUBSCRIPTION.
An export file can contain more than one subscription. If there is more than one publication specified, the exported file can have a combination of subscriptions with data and subscriptions without data.
After the export operation to a file has completed, the data of the file can be imported to a replica database by using the IMPORT statement, see IMPORT.
▪ To export data from a master database directly to specified existing replica database, use the EXPORT SUBSCRIPTION TO REPLICA statement, see EXPORT SUBSCRIPTION TO REPLICA.
The EXPORT SUBSCRIPTION TO REPLICA statement does not use files as the means to transfer data from master to replica database. Instead, it writes the data to the replica database directly. Hence, no separate import step is needed. The replica database must exist and be available in the network.
The concept and procedures for using the EXPORT SUBSCRIPTION statement are similar to those for refreshing from a publication. You use the EXPORT SUBSCRIPTION statement (instead of the MESSAGE APPEND REFRESH or REFRESH statement) in the following circumstances:
▪ You need to create a large replica database from an existing master database.
▪ You want to export specific versions of the data to a replica database.
▪ You want to export only the metadata information and not the actual row data.
Note the differences between using the EXPORT SUBSCRIPTION statement and refreshing from a publication with MESSAGE APPEND REFRESH or REFRESH statements:
▪ The EXPORT SUBSCRIPTION statement is executed in the master database, whereas a refresh is requested from a replica database.
▪ The export output is saved to a user-specified file, whereas the output of a REFRESH statement is stored in an Advanced Replication reply message.
▪ An export file can be created with no data (where actual rows are not included in output) as well as with data.
▪ An export file is never incremental. For example, if the data for the export contains rows, all rows are included in the export file.
▪ An export file is based on a given bookmark; this means that export data is consistent up to a given bookmark and refreshes of data based on incremental publications are possible from that bookmark.