13 Logging on a Separate Device
System administrators can improve the performance for update-intensive, large databases by putting a database's log on a separate device, which reduces I/O contention.
By default, the transaction log is in the log subdirectory of the database directory. If you want to store this log subdirectory in another location, do either of the following:
- Specify the non-default location using the logDevice attribute on the database connection URL when you create the database.
- If the database is already created, move the log manually and update the service.properties file.
Using the logDevice Property
To specify a non-default location for the log directory, set the logDevice attribute on the database connection URL when you create the database. (This attribute is meaningful only when you are creating a database.) You can specify logDevice as either an absolute path or a path relative to the directory where the JVM is being executed.
Setting logDevice on the database connection URL adds an entry to the service.properties file. If you ever move the log manually, alter the entry in service.properties. If you move the log back to the default location, remove the logDevice entry from service.properties.
To check the log location for an existing database, you can retrieve the logDevice attribute as a database property. Issue the following statement:
VALUES PropertyInfo.getDatabaseProperty('logDevice')
Example of Creating a Log in a Non-Default Location
The following database connection URL creates a database in the directory d:/mydatabases but puts the database log directory in h:/janets/tourslog:
jdbc:cloudscape:d:/mydatabases/toursDB; create=true;logDevice=h:/janets/tourslog
Example of Moving a Log Manually
If you later want to move the log to g:/bigdisk/tourslog, move the log with operating system commands:
move h:\janets\tourslog\log\*.* g:\bigdisk\tourslog\log
and alter the logDevice entry in service.properties to read as follows:
logDevice=g:/bigdisk/toursLog
NOTE: You can use a single forward slash for a path separator.
If you later want to move the log back to its default location (in this case, d:/mydatabases/toursDB/log), move the log manually as follows:
move g:\bigdisk\tourslog\log\*.* d:/mydatabases/toursDB/log
and delete the logDevice entry from service.properties.
NOTE: This example uses commands specific to the Windows NT operating system. Use commands appropriate to your operating system to copy a directory and all contents to a new location.
Issues for Logging in a Non-Default Location
When the log is not in the default location, backing up and restoring a database may require extra steps. See Chapter 12, "Backing Up and Restoring Databases" for details.
|