solidDB Help : solidDB reference : SQL: Statements : EXPORT SUBSCRIPTION
  
EXPORT SUBSCRIPTION
Note Applies to only solidDB Advanced Replication configurations.
EXPORT SUBSCRIPTION publication‑name [(publication‑parameters)]
   TO 'filename'
   USING BOOKMARK bookmark‑name
   [WITH [NO] DATA]
Access requirements
In master database: Master user who has subscribe access to the publication.
Usage
Use the EXPORT SUBSCRIPTION statement to export data from a master database to a file. You can then use the IMPORT statement to import the data in the file into a replica database, see IMPORT.
Autocommit must be set to off when using the EXPORT SUBSCRIPTION statement.
The EXPORT SUBSCRIPTION statement is not available in a replica database.
The EXPORT SUBSCRIPTION statement exports a publication from the master database using REFRESH synchronization. If the publication uses input parameters, they are included in the REFRESH.
The statement is based on a given bookmark, which means that export data is consistent up to this bookmark. When you export data, the EXPORT SUBSCRIPTION statement includes all rows as in a full publication up to the bookmark. However, since the export is based on a given bookmark, the subsequent REFRESHes are incremental.
If a bookmark is created in a master database for the purpose of exporting and importing data, the bookmark must exist in the following conditions:
The EXPORT SUBSCRIPTION statement is executed on the master database.
The IMPORT statement is executed on all intended replicas and replicas receive their first set of data ("REFRESH").
During a file import, a connection to a master database is not required and the existence of the bookmark is not checked. However, if the bookmark does not exist at the time that a replica database receives its first REFRESH, the REFRESH fails and the import data is unusable. The remedy is to create a new bookmark on the master database, re-export the data, and then re-import the data.
For more details, see Exporting and importing subscriptions.
Parameters, clauses, keywords, and variables
filename: Export file name; a literal value that is enclosed in single quotation marks. Only one file is allowed. You can export several publications to a single file by specifying the same file name.
The file size of an export file depends on the underlying operating system. Make sure that the size of export file is also supported by the operating system for the replica database. Otherwise, the replica database is not able to accept the export file.
WITH DATA: Creates a replica with data, for example, when data is exported to an existing database that does not contain master data and requires a subset of data.
WITH NO DATA: Creates a replica with only the metadata, for example, when a subscription is imported to a database that already contains the data (for example, using a backup copy of an existing master).
By default, the export file is created using the WITH DATA option and includes all rows. If there is more than one publication specified, the exported file can have a combination of WITH DATA and WITH NO DATA.
Return values
 
Error code
Description
25056
Autocommit not allowed
25067
Bookmark is not found.
25068
Export file file‑name open failure.
25010
Publication name not found.
Example
EXPORT SUBSCRIPTION FINANCE_PUBLICATION(2004) TO 'FINANCE.EXP'
USING BOOKMARK BOOKMARK_FOR_FINANCE_DB WITH NO DATA;
Go up to
SQL: Statements