Interface MaintenanceManager
- 
- All Superinterfaces:
- ServiceManager
 - All Known Implementing Classes:
- FBMaintenanceManager
 
 public interface MaintenanceManager extends ServiceManager AMaintenanceManageris responsible for replicating the functionality provided by thegfixcommand-line tool.Among the responsibilities of this class are: - Database shutdown
- Extended database shutdown/online modes
- Changing database mode to read-only or read-write
- Enabling or disabling forced writes in the database
- Changing the dialect of the database
- Setting the cache size at database-level
- Mending databases and making minor repairs
- Sweeping databases
- Displaying, committing, or recovering limbo transactions
- Activating and killing shadow files
- Configuring page fill
 - Author:
- Gabriel Reid, Thomas Steinmaurer
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intACCESS_MODE_READ_ONLYDatabase read-only modestatic intACCESS_MODE_READ_WRITEDatabase read-write modestatic byteOPERATION_MODE_FULL_SHUTDOWNOperation mode full shutdown.static byteOPERATION_MODE_MULTIOperation mode multi shutdown/online.static byteOPERATION_MODE_NORMALOperation mode normal online.static byteOPERATION_MODE_SINGLEOperation mode single shutdown/online.static intPAGE_FILL_FULLFully fill pages when inserting records.static intPAGE_FILL_RESERVEWhile inserting records, reserve 20% of each page for later record deltasstatic intSHUTDOWN_ATTACHDon't allow new connections while waiting to shut down.static intSHUTDOWN_FORCEForced database shutdown.static intSHUTDOWN_TRANSACTIONALDon't allow new transactions while waiting to shut down.static intSHUTDOWNEX_ATTACHMENTSShutdown attachments.static intSHUTDOWNEX_FORCEForce shutdown.static intSHUTDOWNEX_TRANSACTIONSShutdown transactions.static intVALIDATE_FULLDo a full check on record and pages structures, releasing unassigned record fragments.static intVALIDATE_IGNORE_CHECKSUMIgnore checksums during repair operations.static intVALIDATE_READ_ONLYOnly report corrupt or misallocated structures, don't fix.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidactivateShadowFile()Activate a database shadow file to be used as the actual database.voidbringDatabaseOnline()Bring a shutdown database online.voidbringDatabaseOnline(byte operationMode)Bring a shutdown database online with enhanced operation modes (FB 2.5 or higher).voidcommitTransaction(long transactionId)Commit a limbo transaction based on its ID.long[]getLimboTransactions()Retrieve the ID of each limbo transaction as an array of longs.voidkillUnavailableShadows()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.voidlistLimboTransactions()Deprecated.UselimboTransactionsAsList()orgetLimboTransactions()instead; this method will be removed in Jaybird 5.voidmarkCorruptRecords()Mark corrupt records in the database as unavailable.voidrollbackTransaction(long transactionId)Rollback a limbo transaction based on its ID.voidsetDatabaseAccessMode(int mode)Set the database to have read-write or read-only access.voidsetDatabaseDialect(int dialect)Set the database's dialect.voidsetDefaultCacheBuffer(int pageCount)Set the default page-buffer count to be cached in the database.voidsetForcedWrites(boolean forced)Enable or disable forced (synchronous) writes in the database.voidsetPageFill(int pageFill)Set the page fill strategy for when inserting records.voidsetSweepThreshold(int transactions)Set the database automatic sweep interval to a given number of transactions.voidshutdownDatabase(byte operationMode, int shutdownModeEx, int timeout)Shutdown the current database with enhanced modes (FB 2.5 or higher).voidshutdownDatabase(int shutdownMode, int timeout)Shutdown the current database.voidsweepDatabase()Perform an immediate sweep of the database.voidvalidateDatabase()Locate and release database pages that are allocated but unassigned to any data structures.voidvalidateDatabase(int options)Locate and release database pages that are allocated but unassigned to any data structures.- 
Methods inherited from interface org.firebirdsql.management.ServiceManagergetAuthPlugins, getCharSet, getDatabase, getDbCryptConfig, getHost, getLogger, getPassword, getPort, getServerVersion, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setDatabase, setDbCryptConfig, setHost, setLogger, setPassword, setPort, setUser, setWireCompression, setWireCrypt
 
- 
 
- 
- 
- 
Field Detail- 
ACCESS_MODE_READ_WRITEstatic final int ACCESS_MODE_READ_WRITE Database read-write mode- See Also:
- Constant Field Values
 
 - 
ACCESS_MODE_READ_ONLYstatic final int ACCESS_MODE_READ_ONLY Database read-only mode- See Also:
- Constant Field Values
 
 - 
SHUTDOWN_ATTACHstatic final int SHUTDOWN_ATTACH Don't allow new connections while waiting to shut down.- See Also:
- Constant Field Values
 
 - 
SHUTDOWN_TRANSACTIONALstatic final int SHUTDOWN_TRANSACTIONAL Don't allow new transactions while waiting to shut down.- See Also:
- Constant Field Values
 
 - 
SHUTDOWN_FORCEstatic final int SHUTDOWN_FORCE Forced database shutdown.- See Also:
- Constant Field Values
 
 - 
VALIDATE_READ_ONLYstatic final int VALIDATE_READ_ONLY Only report corrupt or misallocated structures, don't fix.- See Also:
- Constant Field Values
 
 - 
VALIDATE_IGNORE_CHECKSUMstatic final int VALIDATE_IGNORE_CHECKSUM Ignore checksums during repair operations.- See Also:
- Constant Field Values
 
 - 
VALIDATE_FULLstatic final int VALIDATE_FULL Do a full check on record and pages structures, releasing unassigned record fragments.- See Also:
- Constant Field Values
 
 - 
PAGE_FILL_FULLstatic final int PAGE_FILL_FULL Fully fill pages when inserting records.- See Also:
- Constant Field Values
 
 - 
PAGE_FILL_RESERVEstatic final int PAGE_FILL_RESERVE While inserting records, reserve 20% of each page for later record deltas- See Also:
- Constant Field Values
 
 - 
OPERATION_MODE_NORMALstatic final byte OPERATION_MODE_NORMAL Operation mode normal online.To be used with the shutdownDatabase(byte, int, int)method.- Since:
- Firebird 2.5
- See Also:
- shutdownDatabase(byte, int, int), Constant Field Values
 
 - 
OPERATION_MODE_MULTIstatic final byte OPERATION_MODE_MULTI Operation mode multi shutdown/online.To be used with the shutdownDatabase(byte, int, int)method.- Since:
- Firebird 2.5
- See Also:
- shutdownDatabase(byte, int, int), Constant Field Values
 
 - 
OPERATION_MODE_SINGLEstatic final byte OPERATION_MODE_SINGLE Operation mode single shutdown/online.To be used with the shutdownDatabase(byte, int, int)method.- Since:
- Firebird 2.5
- See Also:
- shutdownDatabase(byte, int, int), Constant Field Values
 
 - 
OPERATION_MODE_FULL_SHUTDOWNstatic final byte OPERATION_MODE_FULL_SHUTDOWN Operation mode full shutdown.To be used with the shutdownDatabase(byte, int, int)method.- Since:
- Firebird 2.5
- See Also:
- shutdownDatabase(byte, int, int), Constant Field Values
 
 - 
SHUTDOWNEX_FORCEstatic final int SHUTDOWNEX_FORCE Force shutdown.To be used with the shutdownDatabase(byte, int, int)method.- Since:
- Firebird 2.5
- See Also:
- shutdownDatabase(byte, int, int), Constant Field Values
 
 - 
SHUTDOWNEX_ATTACHMENTSstatic final int SHUTDOWNEX_ATTACHMENTS Shutdown attachments.To be used with the shutdownDatabase(byte, int, int)method.- Since:
- Firebird 2.5
- See Also:
- shutdownDatabase(byte, int, int), Constant Field Values
 
 - 
SHUTDOWNEX_TRANSACTIONSstatic final int SHUTDOWNEX_TRANSACTIONS Shutdown transactions.To be used with the shutdownDatabase(byte, int, int)method.- Since:
- Firebird 2.5
- See Also:
- shutdownDatabase(byte, int, int), Constant Field Values
 
 
- 
 - 
Method Detail- 
setDatabaseAccessModevoid setDatabaseAccessMode(int mode) throws java.sql.SQLExceptionSet the database to have read-write or read-only access.- Parameters:
- mode- Must be either- ACCESS_MODE_READ_WRITEor- ACCESS_MODE_READ_ONLY
- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
setDatabaseDialectvoid setDatabaseDialect(int dialect) throws java.sql.SQLExceptionSet the database's dialect.- Parameters:
- dialect- The database dialect, must be either 1 or 3
- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
setDefaultCacheBuffervoid setDefaultCacheBuffer(int pageCount) throws java.sql.SQLExceptionSet the default page-buffer count to be cached in the database.- Parameters:
- pageCount- The number of pages to be cached, must be a positive
- Throws:
- java.sql.SQLException- If the given page count cannot be set, or a database access error occurs
 
 - 
setForcedWritesvoid setForcedWrites(boolean forced) throws java.sql.SQLExceptionEnable or disable forced (synchronous) writes in the database.Note, it is considered to be a very bad idea to disable forced writes on Windows platforms. - Parameters:
- forced- If- true, forced writes will be used in the database, otherwise buffered writes will be used.
- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
setPageFillvoid setPageFill(int pageFill) throws java.sql.SQLExceptionSet the page fill strategy for when inserting records.pageFillcan be one of:- PAGE_FILL_FULLFully fill database pages
- PAGE_FILL_RESERVEReserve 20% of page space for later record deltas
 - Parameters:
- pageFill- The page-filling strategy, either- PAGE_FILL_FULLor- PAGE_FILL_RESERVE
- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
shutdownDatabasevoid shutdownDatabase(int shutdownMode, int timeout) throws java.sql.SQLExceptionShutdown the current database.Shutdown 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.
 - Parameters:
- shutdownMode- One of- SHUTDOWN_ATTACH,- SHUTDOWN_TRANSACTIONAL, or- SHUTDOWN_FORCE.
- timeout- The maximum amount of time allocated for the operation, in seconds
- Throws:
- java.sql.SQLException- if the requested operation cannot be completed within the given timeout, or a database access error occurs
 
 - 
shutdownDatabasevoid shutdownDatabase(byte operationMode, int shutdownModeEx, int timeout) throws java.sql.SQLExceptionShutdown the current database with enhanced modes (FB 2.5 or higher).There 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.
 - Parameters:
- operationMode- one of- OPERATION_MODE_*operation modes listed above
- shutdownModeEx- one of- SHUTDOWNEX_*extended shutdown modes listed above
- timeout- The maximum amount of time allocated for the operation, in seconds. 0 = immediately.
- Throws:
- java.sql.SQLException- if the requested operation cannot be completed within the given timeout, or a database access error occurs
- Since:
- Firebird 2.5
 
 - 
bringDatabaseOnlinevoid bringDatabaseOnline() throws java.sql.SQLExceptionBring a shutdown database online.- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
bringDatabaseOnlinevoid bringDatabaseOnline(byte operationMode) throws java.sql.SQLExceptionBring a shutdown database online with enhanced operation modes (FB 2.5 or higher).There 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.
 - Throws:
- java.sql.SQLException- if a database access error occurs
- Since:
- Firebird 2.5
 
 - 
markCorruptRecordsvoid markCorruptRecords() throws java.sql.SQLExceptionMark corrupt records in the database as unavailable.This operation ensures that the corrupt records are skipped (for example, during a subsequent backup). - Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
validateDatabasevoid validateDatabase() throws java.sql.SQLExceptionLocate and release database pages that are allocated but unassigned to any data structures. This method also reports corrupt structures.- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
validateDatabasevoid validateDatabase(int options) throws java.sql.SQLExceptionLocate and release database pages that are allocated but unassigned to any data structures. This method also reports corrupt structures.The value supplied for optionsmust be one of the following:- 0 - Simple validation
- VALIDATE_READ_ONLY- read-only validation, no repair
- VALIDATE_FULL- full validation and repair
 The value for optionscan additionally be combined in a bitmask withVALIDATE_IGNORE_CHECKSUMto ignore checksums while performing validation.- Parameters:
- options- Either 0,- VALIDATE_READ_ONLY, or- VALIDATE_FULL
- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
setSweepThresholdvoid setSweepThreshold(int transactions) throws java.sql.SQLExceptionSet the database automatic sweep interval to a given number of transactions.The Firebird default value is 20,000. If transactionsis 0, automatic sweeping is disabled.- Parameters:
- transactions- The interval of transactions between automatic sweeps of the database. Can be set to 0, which disables automatic sweeping of the database.
- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
sweepDatabasevoid sweepDatabase() throws java.sql.SQLExceptionPerform an immediate sweep of the database.- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
activateShadowFilevoid activateShadowFile() throws java.sql.SQLExceptionActivate a database shadow file to be used as the actual database.This method is the equivalent of gfix -activate.- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
killUnavailableShadowsvoid killUnavailableShadows() throws java.sql.SQLExceptionRemove references to unavailable shadow files.This method is the equivalent of gfix -kill.- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
listLimboTransactions@Deprecated void listLimboTransactions() throws java.sql.SQLExceptionDeprecated.UselimboTransactionsAsList()orgetLimboTransactions()instead; this method will be removed in Jaybird 5.Retrieve the ID of each limbo transaction. The output of this method is written to the logger.- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
limboTransactionsAsListjava.util.List<java.lang.Long> limboTransactionsAsList() throws java.sql.SQLExceptionRetrieve the ID of each limbo transaction as a List of Long objects.- Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
getLimboTransactionslong[] getLimboTransactions() throws java.sql.SQLExceptionRetrieve the ID of each limbo transaction as an array of longs.In Firebird 3, transactions are (unsigned) 48 bit longs. - Throws:
- java.sql.SQLException- if a database access error occurs
 
 - 
commitTransactionvoid commitTransaction(long transactionId) throws java.sql.SQLExceptionCommit a limbo transaction based on its ID.The transaction id is expected to be a positive long. If you have a negative int, convert the int to an unsigned long usingNumericHelper.toUnsignedLong(int)- Parameters:
- transactionId- The ID of the limbo transaction to be committed (must be- > 0)
- Throws:
- java.sql.SQLException- if a database access error occurs or the given transaction ID is not valid
 
 - 
rollbackTransactionvoid rollbackTransaction(long transactionId) throws java.sql.SQLExceptionRollback a limbo transaction based on its ID.The transaction id is expected to be a positive long. If you have a negative int, convert the int to an unsigned long usingNumericHelper.toUnsignedLong(int)- Parameters:
- transactionId- The ID of the limbo transaction to be rolled back (must be- > 0)
- Throws:
- java.sql.SQLException- if a database access error occurs or the given transaction ID is not valid
 
 
- 
 
-