public class FBMaintenanceManager extends FBServiceManager implements MaintenanceManager
FBMaintenanceManager class is responsible for replicating the functionality provided by
 the gfix command-line tool.
 Among the responsibilities of this class are:
BUFFER_SIZEACCESS_MODE_READ_ONLY, ACCESS_MODE_READ_WRITE, OPERATION_MODE_FULL_SHUTDOWN, OPERATION_MODE_MULTI, OPERATION_MODE_NORMAL, OPERATION_MODE_SINGLE, PAGE_FILL_FULL, PAGE_FILL_RESERVE, SHUTDOWN_ATTACH, SHUTDOWN_FORCE, SHUTDOWN_TRANSACTIONAL, SHUTDOWNEX_ATTACHMENTS, SHUTDOWNEX_FORCE, SHUTDOWNEX_TRANSACTIONS, VALIDATE_FULL, VALIDATE_IGNORE_CHECKSUM, VALIDATE_READ_ONLY| Constructor and Description | 
|---|
| FBMaintenanceManager()Create a new instance of  FBMaintenanceManagerbased on the default GDSType. | 
| FBMaintenanceManager(GDSType gdsType)Create a new instance of  FBMaintenanceManagerbased on a given GDSType. | 
| FBMaintenanceManager(java.lang.String gdsType)Create a new instance of  FBMaintenanceManagerbased on a given GDSType. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | activateShadowFile()Activate a database shadow file to be used as the actual database. | 
| void | bringDatabaseOnline()Bring a shutdown database online. | 
| void | bringDatabaseOnline(byte operationMode)Bring a shutdown database online with enhanced operation modes (FB 2.5 or
 higher). | 
| void | commitTransaction(long transactionId)Commit a limbo transaction based on its ID. | 
| void | fixIcu()Update or rebuild ICU-dependent collations and indexes when ICU version changed. | 
| long[] | getLimboTransactions()Retrieve the ID of each limbo transaction as an array of longs. | 
| void | killUnavailableShadows()Remove references to unavailable shadow files. | 
| java.util.List<java.lang.Long> | limboTransactionsAsList()Retrieve the ID of each limbo transaction as a List of Long objects. | 
| void | markCorruptRecords()Mark corrupt records in the database as unavailable. | 
| void | rollbackTransaction(long transactionId)Rollback a limbo transaction based on its ID. | 
| void | setDatabaseAccessMode(int mode)Set the database to have read-write or read-only access. | 
| void | setDatabaseDialect(int dialect)Set the database's dialect. | 
| void | setDefaultCacheBuffer(int pageCount)Set the default page-buffer count to be cached in the database. | 
| void | setForcedWrites(boolean forced)Enable or disable forced (synchronous) writes in the database. | 
| void | setPageFill(int pageFill)Set the page fill strategy for when inserting records. | 
| void | setSweepThreshold(int transactions)Set the database automatic sweep interval to a given number of
 transactions. | 
| void | shutdownDatabase(byte operationMode,
                int shutdownModeEx,
                int timeout)Shutdown the current database with enhanced modes (FB 2.5 or higher). | 
| void | shutdownDatabase(int shutdownMode,
                int timeout)Shutdown the current database. | 
| void | sweepDatabase()Perform an immediate sweep of the database. | 
| void | upgradeOds()Perform minor ODS upgrade. | 
| void | validateDatabase()Locate and release database pages that are allocated but unassigned to
 any data structures. | 
| void | validateDatabase(int options)Locate and release database pages that are allocated but unassigned to
 any data structures. | 
attachDatabase, attachServiceManager, connectionPropertyValues, createRequestBuffer, executeServicesOperation, executeServicesOperation, getAuthPlugins, getBooleanProperty, getCharSet, getDatabase, getDbCryptConfig, getExpectedDb, getHost, getIntProperty, getLogger, getPassword, getPort, getPortNumber, getProperty, getServerName, getServerVersion, getServiceName, getUser, getWireCrypt, getWireCryptAsEnum, isWireCompression, queueService, setAuthPlugins, setBooleanProperty, setCharSet, setDatabase, setDbCryptConfig, setExpectedDb, setHost, setIntProperty, setLogger, setPassword, setPort, setPortNumber, setProperty, setServerName, setServiceName, setType, setUser, setWireCompression, setWireCryptAsEnumclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDatabase, getHost, getLogger, getPort, getServerVersion, getWireCryptAsEnum, setDatabase, setHost, setLogger, setPort, setWireCryptAsEnumgetExpectedDb, getServiceName, setExpectedDb, setServiceNamegetAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setType, setUser, setWireCompression, setWireCryptconnectionPropertyValues, getBooleanProperty, getBooleanProperty, getIntProperty, getIntProperty, getProperty, getProperty, setBooleanProperty, setIntProperty, setPropertypublic FBMaintenanceManager()
FBMaintenanceManager based on the default GDSType.public FBMaintenanceManager(java.lang.String gdsType)
FBMaintenanceManager based on a given GDSType.gdsType - type must be PURE_JAVA, EMBEDDED, or NATIVEpublic FBMaintenanceManager(GDSType gdsType)
FBMaintenanceManager based on a given GDSType.gdsType - The GDS implementation type to usepublic void setDatabaseAccessMode(int mode)
                           throws java.sql.SQLException
MaintenanceManagersetDatabaseAccessMode in interface MaintenanceManagermode - Must be either ACCESS_MODE_READ_WRITE or ACCESS_MODE_READ_ONLYjava.sql.SQLException - if a database access error occurspublic void setDatabaseDialect(int dialect)
                        throws java.sql.SQLException
MaintenanceManagersetDatabaseDialect in interface MaintenanceManagerdialect - The database dialect, must be either 1 or 3java.sql.SQLException - if a database access error occurspublic void setDefaultCacheBuffer(int pageCount)
                           throws java.sql.SQLException
MaintenanceManagersetDefaultCacheBuffer in interface MaintenanceManagerpageCount - The number of pages to be cached, must be a positivejava.sql.SQLException - If the given page count cannot be set, or a database access error occurspublic void setForcedWrites(boolean forced)
                     throws java.sql.SQLException
MaintenanceManagerNote, it is considered to be a very bad idea to disable forced writes on Windows platforms.
setForcedWrites in interface MaintenanceManagerforced - If true, forced writes will be used in the database, otherwise buffered writes will be used.java.sql.SQLException - if a database access error occurspublic void setPageFill(int pageFill)
                 throws java.sql.SQLException
MaintenanceManager
 pageFill can be one of:
 
PAGE_FILL_FULL Fully fill database pages
 PAGE_FILL_RESERVE Reserve 20% of page space for later
 record deltas
 setPageFill in interface MaintenanceManagerpageFill - The page-filling strategy, either PAGE_FILL_FULL or PAGE_FILL_RESERVEjava.sql.SQLException - if a database access error occurspublic void shutdownDatabase(int shutdownMode,
                             int timeout)
                      throws java.sql.SQLException
MaintenanceManagerShutdown can be done in three modes:
SHUTDOWN_ATTACH - No new non-owner connections will be allowed to the database during the shutdown,
 and shutdown is cancelled if there are still processes connected at the end of the timeout.SHUTDOWN_TRANSACTIONAL - No new transactions can be started during the timeout period, and shutdown
 is cancelled if there are still active transactions at the end of the timeout.SHUTDOWN_FORCE - Forcefully shuts down the database at the end of the timeout.shutdownDatabase in interface MaintenanceManagershutdownMode - One of SHUTDOWN_ATTACH, SHUTDOWN_TRANSACTIONAL, or SHUTDOWN_FORCE.timeout - The maximum amount of time allocated for the operation, in secondsjava.sql.SQLException - if the requested operation cannot be completed within the given timeout, or a database access error
         occurspublic void shutdownDatabase(byte operationMode,
                             int shutdownModeEx,
                             int timeout)
                      throws java.sql.SQLException
MaintenanceManagerThere are three operation modes for shutdown available:
OPERATION_MODE_MULTI - Multi-user maintenance. Unlimited SYSDBA/database owner connections are
 allowed.OPERATION_MODE_SINGLE - Single-user maintenance. Only one SYSDBA/database owner connection is
 allowed.OPERATION_MODE_FULL_SHUTDOWN - Full shutdown. Full exclusive shutdown. No connections are allowed.There are three extended shutdown modes for shutdown available:
SHUTDOWNEX_FORCE - Force shutdown.SHUTDOWNEX_ATTACHMENTS - Shutdown attachments.SHUTDOWNEX_TRANSACTIONS - Shutdown transactions.shutdownDatabase in interface MaintenanceManageroperationMode - one of OPERATION_MODE_* operation modes listed aboveshutdownModeEx - one of SHUTDOWNEX_* extended shutdown modes listed abovetimeout - The maximum amount of time allocated for the operation, in seconds. 0 = immediately.java.sql.SQLException - if the requested operation cannot be completed within the given timeout, or a database access error
         occurspublic void bringDatabaseOnline()
                         throws java.sql.SQLException
MaintenanceManagerbringDatabaseOnline in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void bringDatabaseOnline(byte operationMode)
                         throws java.sql.SQLException
MaintenanceManagerThere are three operation modes for bringing a database online available:
OPERATION_MODE_NORMAL - Normal operation modes.OPERATION_MODE_MULTI - Multi-user maintenance. Unlimited SYSDBA/database owner connections are
 allowed.OPERATION_MODE_SINGLE - Single-user maintenance. Only one SYSDBA/database owner connection is
 allowed.bringDatabaseOnline in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void markCorruptRecords()
                        throws java.sql.SQLException
MaintenanceManagerThis operation ensures that the corrupt records are skipped (for example, during a subsequent backup).
markCorruptRecords in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void validateDatabase()
                      throws java.sql.SQLException
MaintenanceManagervalidateDatabase in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void validateDatabase(int options)
                      throws java.sql.SQLException
MaintenanceManager
 The value supplied for options must be one of the following:
 
VALIDATE_READ_ONLY - read-only validation, no repairVALIDATE_FULL - full validation and repair
 The value for options can additionally be combined in a bitmask with VALIDATE_IGNORE_CHECKSUM to
 ignore checksums while performing validation.
 
validateDatabase in interface MaintenanceManageroptions - Either 0, VALIDATE_READ_ONLY, or VALIDATE_FULLjava.sql.SQLException - if a database access error occurspublic void setSweepThreshold(int transactions)
                       throws java.sql.SQLException
MaintenanceManager
 The Firebird default value is 20,000. If transactions is 0, automatic sweeping is disabled.
 
setSweepThreshold in interface MaintenanceManagertransactions - The interval of transactions between automatic sweeps of the database. Can be set to 0, which disables
         automatic sweeping of the database.java.sql.SQLException - if a database access error occurspublic void sweepDatabase()
                   throws java.sql.SQLException
MaintenanceManagersweepDatabase in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void activateShadowFile()
                        throws java.sql.SQLException
MaintenanceManager
 This method is the equivalent of gfix -activate.
 
activateShadowFile in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void killUnavailableShadows()
                            throws java.sql.SQLException
MaintenanceManager
 This method is the equivalent of gfix -kill.
 
killUnavailableShadows in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic java.util.List<java.lang.Long> limboTransactionsAsList()
                                                       throws java.sql.SQLException
MaintenanceManagerlimboTransactionsAsList in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic long[] getLimboTransactions()
                            throws java.sql.SQLException
MaintenanceManagerIn Firebird 3, transactions are (unsigned) 48 bit longs.
getLimboTransactions in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void commitTransaction(long transactionId)
                       throws java.sql.SQLException
MaintenanceManager
 The transaction id is expected to be a positive long. If you have a negative int, convert the int to
 an unsigned long using NumericHelper.toUnsignedLong(int)
 
commitTransaction in interface MaintenanceManagertransactionId - The ID of the limbo transaction to be committed (must be > 0)java.sql.SQLException - if a database access error occurs or the given transaction ID is not validpublic void rollbackTransaction(long transactionId)
                         throws java.sql.SQLException
MaintenanceManager
 The transaction id is expected to be a positive long. If you have a negative int, convert the int to
 an unsigned long using NumericHelper.toUnsignedLong(int)
 
rollbackTransaction in interface MaintenanceManagertransactionId - The ID of the limbo transaction to be rolled back (must be > 0)java.sql.SQLException - if a database access error occurs or the given transaction ID is not validpublic void upgradeOds()
                throws java.sql.SQLException
MaintenanceManagerRequires Firebird 5.0 or higher.
upgradeOds in interface MaintenanceManagerjava.sql.SQLException - if a database access error occurspublic void fixIcu()
            throws java.sql.SQLException
MaintenanceManagerRequires Firebird 3.0 or higher.
fixIcu in interface MaintenanceManagerjava.sql.SQLException - if a database access error occursCopyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.