B.2 Changing the options of the tables in the embedded database
When you specify the embedded database as the database for a scheduler service, the data storage area in the embedded database might become full faster than you expect depending on the JP1/AJS3 operation. This can occur even when the amount of data is not very large, when there is repeated addition and deletion of data, which creates invalid pages and segments reserved for tables.
This section describes the organization of the data area in the embedded database and the command that can be used to suppress the generation of invalid pages and segments.
- Organization of this subsection
(1) Organization of the data area in the embedded database
This subsection describes the organization of the data area in the embedded database.
The data in the embedded database is actually stored as pages. A group of pages is called a segment, each of which is associated with a table in the database for management purpose.
The following figure shows how the data area in the embedded database is managed.
|
When the embedded database is accessed, the data area is used based on the following rules:
-
One segment stores the information of only one table.
-
When all the pages in one segment are full, a new segment is allocated to the table.
-
When you delete records, pages and segments become invalid areas, and they are not usually available for automatic reuse.
-
Even if a reusable segment or page exists, priority is given to unused pages and segments.
The scheduler database of JP1/AJS3 has 11 tables. If one table holds many invalid pages and segments, other tables cannot acquire new pages and segments when data needs to be stored. If as a result there are insufficient pages and segments, an error might occur.
|
When all the segments are occupied as shown above, tables other than table A cannot acquire the unused segments even though there is new data to be stored. In this case, an error due to insufficient segments occurs, despite the existence of the invalid segments.
(2) Applying the free space reusage facility
Even when there are reusable segments, by default, the embedded database uses unallocated segments first.
The embedded database has a free space reusage facility that hastens the reuse of segments in the database area for each table. By using this functionality, the embedded database can reuse reserved segments (those that have been used and deleted) for the applicable table on a priority basis when a new segment is required and the preset number of segments is about to be exceeded.
For example, suppose you use this functionality to set a threshold value of about 50% of the number of segments for table A. When about half of the segments in the data area have been used, the embedded database temporarily stops expansion through the new allocation of segments and looks for reusable segments. As a result, the invalid segments of a specific table do not occupy free segments.
To enable the free space reusage facility during setup of the embedded database when you migrate from ISAM to the embedded database, you must specify the -ru option in the ajsembdbsetup command. For details about how to use the ajsembdbsetup command, see the description of ajsembdbsetup in 2. Commands Used during Setup.
To enable the free space reusage facility when you create an embedded database for a large-scale model, use the embedded database for the default scheduler service (AJSROOT1) on the physical host, and then execute the following command:
ajsembdbsetup -F AJSROOT1 -ru l
To enable the free space reusage facility in an environment in which setup to the embedded database has been completed, you need to execute ajsembdbreuse command. For details on the ajsembdbreuse command, see B.4 ajsembdbreuse.
- Example
-
Changing the definition of a table in an embedded database environment with -l option specified as the large data model size in ajsembdbbuild command
-
For a Windows host
(The embedded database installation previous directory is C:\program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0.)
ajsembdbreuse -i "C:\program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0" -l
-
For a UNIX host
(The embedded database installation previous directory is /opt/jp1ajs2/embdb/_JF0.)
ajsembdbreuse -i /opt/jp1ajs2/embdb/_JF0 -l
Note that if the backup enhancement function is enabled, you will need to execute the following command in addition to the above steps.
-
For a Windows host
(The embedded database installation previous directory is C:\program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0.)
ajsembdbreuse -i "C:\program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0" -l -b
-
For a UNIX host
(The embedded database installation previous directory is /opt/jp1ajs2/embdb/_JF0.)
ajsembdbreuse -i /opt/jp1ajs2/embdb/_JF0 -l -b
-
- Example
-
When the ajsembdbaddarea command of the embedded database is used to expand the database area (the total number of AJS2DATA segments is changed to 200,000) after the embedded database environment is set up
-
For a Windows host
(The embedded database installation previous directory is C:\Program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0.)
ajsembdbreuse -i "C:\Program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0" -n 200000
-
For a UNIX host
(The embedded database installation previous directory is /opt/jp1ajs2/embdb/_JF0.)
ajsembdbreuse -i /opt/jp1ajs2/embdb/_JF0 -n 200000
Note that if the backup enhancement function is enabled and the database area (AJS2DATA2) is extended, you will need to execute the following command. The following example is based on the total number of segments for AJS2DATA2 being 300.
-
For a Windows host
(The embedded database installation previous directory is C:\Program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0.)
ajsembdbreuse -i "C:\Program Files (x86)\HITACHI\JP1AJS2\embdb\_JF0" -n 300 -b
-
For a UNIX host
(The embedded database installation previous directory is /opt/jp1ajs2/embdb/_JF0.)
ajsembdbreuse -i /opt/jp1ajs2/embdb/_JF0 -n 300 -b
-
The free space reusage facility is effective for tables. It cannot be applied to the index area. You need to periodically maintain the index area to reclaim the invalid pages and segments that are generated in the index area. For details about how to maintain the index area, see 9.2.2(1) Executing the ajsembdbreclaim command automatically in the JP1/Automatic Job Management System 3 Administration Guide and 9.2.2(2) Executing the ajsembdbreclaim command manually in the JP1/Automatic Job Management System 3 Administration Guide.
Even if you enable the free space reusage facility, the number of occupied segments can still increase due to increased demand for services or unusual operations. For this reason, you still need to periodically monitor the unused segments in the data area.