- All Superinterfaces:
AttachmentProperties
,BaseProperties
,ServiceConnectionProperties
,ServiceManager
- All Known Implementing Classes:
FBBackupManager
,FBBackupManagerBase
,FBStreamingBackupManager
Implements the backup and restore functionality of Firebird Services API.
- Author:
- Roman Rokytskyy, Steven Jardine
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Backup external files as tables.static final int
No data compression.static final int
Ignore checksums.static final int
Ignore in-limbo transactions.static final int
Backup metadata only.static final int
Do not collect garbage during backup.static final int
Use non-transportable backup format.static final int
Save old style metadata descriptions.static final int
Deactivate indices during restore.static final int
Do not restore shadow database.static final int
Do not restore validity constraints.static final int
Commit after completing restore of each table.static final int
Do not reserve 20% on each page for the future versions, useful for read-only databases. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBackupPath
(String path) Add backup file to the list.void
addBackupPath
(String path, int size) Add the file to the backup of the specified size.void
addRestorePath
(String path, int size) Add the file to the multi-file database of the specified size for restore operation.void
Perform the backup operation.void
backupDatabase
(int options) Perform the backup operation.void
Perform the backup operation, metadata only.void
Clear the information about backup paths.void
Clear the information about restore paths.void
Perform the restore operation.void
restoreDatabase
(int options) Perform the restore operation.void
setBackupPath
(String backupPath) Sets the location of the backup file.void
setDatabase
(String path) Set the path to the database.void
setRestorePageBufferCount
(int bufferCount) Set the default number of pages to be buffered (cached) by default in a restored database.void
setRestorePageSize
(int pageSize) Set the page size that will be used for a restored database.void
setRestoreReadOnly
(boolean readOnly) Set the read-only attribute on a restored database.void
setRestoreReplace
(boolean replace) Set the restore operation to create a new database, as opposed to overwriting an existing database.void
setVerbose
(boolean verbose) Set whether the operations of thisBackupManager
will result in verbose logging to the configured logger.Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentProperties
getAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEnableProtocol, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSocketFactory, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEnableProtocol, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSocketFactory, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
Methods inherited from interface org.firebirdsql.jaybird.props.BaseProperties
connectionPropertyValues, getBooleanProperty, getBooleanProperty, getIntProperty, getIntProperty, getProperty, getProperty, setBooleanProperty, setIntProperty, setProperty
Methods inherited from interface org.firebirdsql.jaybird.props.ServiceConnectionProperties
getExpectedDb, getServiceName, setExpectedDb, setServiceName
Methods inherited from interface org.firebirdsql.management.ServiceManager
getDatabase, getHost, getLogger, getPort, getServerVersion, getWireCryptAsEnum, setHost, setLogger, setPort, setWireCryptAsEnum
-
Field Details
-
BACKUP_IGNORE_CHECKSUMS
static final int BACKUP_IGNORE_CHECKSUMSIgnore checksums.- See Also:
-
BACKUP_IGNORE_LIMBO
static final int BACKUP_IGNORE_LIMBOIgnore in-limbo transactions.- See Also:
-
BACKUP_METADATA_ONLY
static final int BACKUP_METADATA_ONLYBackup metadata only.- See Also:
-
BACKUP_NO_GARBAGE_COLLECT
static final int BACKUP_NO_GARBAGE_COLLECTDo not collect garbage during backup.- See Also:
-
BACKUP_OLD_DESCRIPTIONS
static final int BACKUP_OLD_DESCRIPTIONSSave old style metadata descriptions.- See Also:
-
BACKUP_NON_TRANSPORTABLE
static final int BACKUP_NON_TRANSPORTABLEUse non-transportable backup format.- See Also:
-
BACKUP_CONVERT
static final int BACKUP_CONVERTBackup external files as tables.- See Also:
-
BACKUP_EXPAND
static final int BACKUP_EXPANDNo data compression.- See Also:
-
RESTORE_DEACTIVATE_INDEX
static final int RESTORE_DEACTIVATE_INDEXDeactivate indices during restore.- See Also:
-
RESTORE_NO_SHADOW
static final int RESTORE_NO_SHADOWDo not restore shadow database.- See Also:
-
RESTORE_NO_VALIDITY
static final int RESTORE_NO_VALIDITYDo not restore validity constraints.- See Also:
-
RESTORE_ONE_AT_A_TIME
static final int RESTORE_ONE_AT_A_TIMECommit after completing restore of each table.- See Also:
-
RESTORE_USE_ALL_SPACE
static final int RESTORE_USE_ALL_SPACEDo not reserve 20% on each page for the future versions, useful for read-only databases.- See Also:
-
-
Method Details
-
setBackupPath
Sets the location of the backup file. This method is used to set the path to the backup consisting of a single file. It is not possible to add multiple files or specify the max. size of the file using this method. It is also not possible to calladdBackupPath(String, int)
method after calling this one.- Parameters:
backupPath
- the location of the backup file.- See Also:
-
addBackupPath
Add the file to the backup of the specified size. Firebird allows splitting the backup into multiple files, limiting the size of the backup file. This can be useful for example for creating a backup on CD or DVD.- Parameters:
path
- path to the backup file.size
- max size of the file in bytes.
-
addBackupPath
Add backup file to the list. This method is used only during restoring the database to specify multi-file backups. The call is equivalent to passing the size -1 toaddBackupPath(String, int)
call.If application invokes backup operation, an error is generated in that call.
- Parameters:
path
- path to the backup file.
-
clearBackupPaths
void clearBackupPaths()Clear the information about backup paths. This method undoes all parameters set in theaddBackupPath(String, int)
oraddBackupPath(String)
methods. -
setDatabase
Set the path to the database. This method is used both for backup and restore operation.- Specified by:
setDatabase
in interfaceServiceManager
- Parameters:
path
- path to the database file.In case of backup, value specifies the path of the existing database on the server that will be backed up.
In case of restore, value specifies the path of the single-file database where the backup will be restored to.
-
addRestorePath
Add the file to the multi-file database of the specified size for restore operation.- Parameters:
path
- path to the backup file.size
- max size of the database file in pages.
-
clearRestorePaths
void clearRestorePaths()Clear the information about restore paths. This method undoes all parameters set in theaddRestorePath(String, int)
orsetDatabase(String)
methods. -
backupDatabase
Perform the backup operation.- Throws:
SQLException
- if a database error occurs during the backup
-
backupMetadata
Perform the backup operation, metadata only.- Throws:
SQLException
- if a database error occurs during the backup
-
backupDatabase
Perform the backup operation.- Parameters:
options
- a bitmask combination of theBACKUP_*
constants for the backup operation- Throws:
SQLException
- if a database error occurs during the backup
-
setVerbose
void setVerbose(boolean verbose) Set whether the operations of thisBackupManager
will result in verbose logging to the configured logger.- Parameters:
verbose
- Iftrue
, operations will be logged verbosely, otherwise they will not be logged verbosely
-
setRestorePageBufferCount
void setRestorePageBufferCount(int bufferCount) Set the default number of pages to be buffered (cached) by default in a restored database.- Parameters:
bufferCount
- The page-buffer size to be used, a positive value
-
setRestorePageSize
void setRestorePageSize(int pageSize) Set the page size that will be used for a restored database. The value forpageSize
must be one of: 1024, 2048, 4096, 8192 or 16384. The default value depends on the Firebird version.- Parameters:
pageSize
- The page size to be used in a restored database, one of 1024, 2048, 4196, 8192 or 16384- See Also:
-
setRestoreReplace
void setRestoreReplace(boolean replace) Set the restore operation to create a new database, as opposed to overwriting an existing database.- Parameters:
replace
- Iftrue
, the restore operation will attempt to create a new database if it does not exit or overwrite an existing one when it exists,false
when restore should fail if database already exist (if it doesn't, a database will be successfully created).
-
setRestoreReadOnly
void setRestoreReadOnly(boolean readOnly) Set the read-only attribute on a restored database.- Parameters:
readOnly
- Iftrue
, a restored database will be read-only, otherwise it will be read-write.
-
restoreDatabase
Perform the restore operation.- Throws:
SQLException
- if a database error occurs during the restore
-
restoreDatabase
Perform the restore operation.- Parameters:
options
- A bitmask combination ofRESTORE_*
constants- Throws:
SQLException
- if a database error occurs during the restore
-