solidDB Help : solidDB reference : SQL: Statements : IMPORT
  
IMPORT
Note Applies to only solidDB Advanced Replication configurations.
IMPORT 'file‑name' [COMMITBLOCK number‑of‑rows]
   [{OPTIMISTIC | PESSIMISTIC}]
Access requirements
In replica: Valid master user
Usage
Use the IMPORT statement to import data to a replica database from a data file that was created by the EXPORT SUBSCRIPTION statement, see EXPORT SUBSCRIPTION.
Imported data is not valid in a replica until it is refreshed after the import. At the time a replica database makes its first REFRESH, the bookmark that was used to export the file must exist in the master database. If it does not exist, the REFRESH statement fails. In this case, you would have to create a new bookmark on the master database, re-export the data, and re-import the data to the replica database.
The IMPORT statement can only be executed on the replica database.
To use the IMPORT statement, autocommit mode must be switched off.
Parameters, clauses, keywords, and variables
file‑name: Import file name; a literal value that is enclosed in single quotation marks. The IMPORT statement can accept a single file name only so all the data to be imported must be contained in one file.
COMMITBLOCK: Indicates the number of rows that are processed before the data is committed. By default, the IMPORT statement commits all rows in the publication as one transaction. If the amount of data is large, for example, tens of thousands of rows, include the COMMITBLOCK keyword in order to commit the data in more than one transaction and ensure good performance for the operation.
The optimal value for the COMMITBLOCK size varies depending on various server resources but a reasonable value would be 1000 for an import file that contains 10,000 rows.
Back up replica databases before using the IMPORT statement. If a COMMITBLOCK option is used and fails, the imported data is only partially committed and you will need to restore the replica database from a backup file.
OPTIMISTIC | PESSIMISTIC: Include the PESSIMISTIC keyword so that the IMPORT statement uses table-level pessimistic locking when it is initially executed (see Pessimistic and optimistic concurrency controls). If the PESSIMISTIC mode is specified, all other concurrent access to the table is blocked until the import operation has completed. If you use OPTIMISTIC mode, the DROP SUBSCRIPTION statement might fail due to a concurrency conflict.
When a transaction acquires an exclusive lock to a table, the General.TableLockWaitTimeout parameter determines the wait period of the transaction after which the exclusive or shared lock is released, see General section.
Return values
 
Error code
Description
25007
Master master‑name not found.
25019
Database is not a replica database.
25069
Import file file‑name open failure.
13XXX
Table level error
13124
User id num not found
This message is generated, for example, if the user has been dropped.
10006
Concurrency conflict (simultaneous other operation)
13047
No privilege for operation
13056
Insert not allowed for pseudo column
21XXX
Communication error
25024
Master not defined
25026
Not a valid master user
25031
Transaction is active, operation failed
25036
Publication publication‑name not found or publication version mismatch
25040
User id user‑id is not found
While executing a message reply an attempt to map a master user to a local replica id failed.
25041
Subscription to publication publication‑name not found
25048
Publication publication‑name request info not found
25054
Table table‑name is not set for synchronization history
25056
Autocommit not allowed
25060
Column column‑name does not exist on publication publication‑name resultset in table table‑name
Example
IMPORT 'FINANCE.EXP';
Go up to
SQL: Statements