FASTBCP_APPLY_SOURCEDB_LOGS
Overview
A SQL Server full or differential backup holds more than its data pages: it carries the part of the transaction log written while it was being taken, and a .bak file can also hold log backups written to it (BACKUP LOG ... WITH NOINIT to the file of the full backup).
By default, --connectiontype backup_mssql reads a table as its pages are in the backup, without that log. Set FASTBCP_APPLY_SOURCEDB_LOGS to true to apply it: the table is read as it is at the end of the log the backup files hold, as a RESTORE would give it.
Log backups (.trn files) named by --database are always applied, whatever this variable says: see Log backups.
Syntax
- Windows
- Linux
$env:FASTBCP_APPLY_SOURCEDB_LOGS = "true"
export FASTBCP_APPLY_SOURCEDB_LOGS=true
Configuration
| Property | Value |
|---|---|
| Values | true or false, in any case. Any other value stops the run at startup with a message naming the variable |
| Default | Not set: false |
| Applies to | --connectiontype backup_mssql |
Files in --database | FASTBCP_APPLY_SOURCEDB_LOGS | The table is read |
|---|---|---|
.bak files only | Not set or false | As in the full backup and its differential |
.bak files only | true | At the end of the log the .bak files hold |
With .trn files | Not set or true | At the end of the last log backup given |
With .trn files | false | At the end of the last log backup given, with a warning |
The log is applied as one chain, from the backup read to the last log backup: with .trn files, the log the .bak files hold is part of it. To read a table without the log, leave the .trn files out of --database and this variable unset.
Example
export FASTBCP_APPLY_SOURCEDB_LOGS=true
./FastBCP \
--connectiontype backup_mssql \
--server "/var/opt/mssql/backup" \
--database "sales_full.bak" \
--sourceschema "dbo" \
--sourcetable "orders" \
--directory "/export/orders" \
--fileoutput "orders.parquet" \
--parallelmethod "Physical" \
--paralleldegree 8
What FastBCP Logs
At the start of each export:
Backup log : applied (adbc.arpemsbackup.restore_log=true): the tables are read as at the end of the log
or Backup log : not applied: the tables are read as in the full backup and its differential.
- What cannot be replayed fails the export, naming it: see Log backups.
- Do not set it to
trueto read the changes of a table (adbc.arpemsbackup.read_mode): that read mode reads the log backups as they are, and is refused with the log applied.
With --sourceconnectstring
An adbc.arpemsbackup.restore_log=true or false option in --sourceconnectstring wins over the variable and over the .trn files.