Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » UltraLite - Database Management and Reference » UltraLite Database Reference » UltraLite connection parameters


UltraLite MIRROR_FILE connection parameter

Specifies the name of the database mirror file to which all database writes will be issued (at the same time as they are to the main database file).




UltraLite provides basic database file mirroring to improve fault tolerance on potentially unreliable storage systems. This is accomplished using the mirror file. All database writes are issued to the mirror file at the same time as they are to the main database file (write overhead is therefore doubled; read overhead is not affected). If a corrupt page is read from the database file, the page is recovered by reading from the mirror file.

Mirroring is supported on all platforms using a file-based store, including Palm VFS, but not on Palm record databases.

When the mirror_file= option is specified when you start the database, UltraLite will open the named file and verify that it matches the main database file before continuing. If the mirror file does not exist, it is created at that point by copying the main file. If the mirror is not a database file, or is corrupt, an error is reported and the database will not start until the file is removed or a different mirror is specified. If the mirror does not match the database, SQLE_MIRROR_FILE_MISMATCH is generated and the database will not start. When a corrupt page is recovered, the warning SQLE_CORRUPT_PAGE_READ_RETRY is generated. (Without mirroring, or if the mirror file is also corrupt, the error SQLE_DEVICE_ERROR is generated and the database is halted.)

To effectively protect against media failures, page checksums must be enabled when you use a mirror file. (With or without mirroring, page checksums allow UltraLite to detect page corruption as soon as the page is loaded and avoid referencing corrupt data.) Specify the checksum_level database creation option to enable checksums. UltraLite will generate the warning SQLE_MIRROR_FILE_REQUIRES_CHECKSUMS if checksums are not enabled when using a mirror file. See UltraLite checksum_level creation parameter.

Note that because the mirror is an exact copy of the database file, it can be started directly as a database. The ulvalid utility will report corrupt pages. See UltraLite Validate Database utility (ulvalid).

See also

The following example creates a new connection and creates a mirror file:

Connection = DatabaseMgr.OpenConnection("DBF=c:\Dbfile.udb; UID=JDoe;PWD=ULdb;