1. Field of the Invention
The present invention relates to an apparatus and a method for controlling an operation of acquiring a snapshot of a database built on an external storage of a computer system.
2. Background Art
In operating a database, a mismatch can occur between contents of the database because of a bug in an application that uses the database, an operational error of an operation, or the like. In general, a fault as described above is called a logic fault. In the case of a logic fault, since a database management system (hereinafter referred to as a DBMS) has properly completed the process according to the input, the fault can not be detected by a fault detecting function of the DBMS. A logic fault as described above is detected by database users such as a system manager or operator.
When a logic fault as described above has occurred, a manager or operator must identify the point in time when the logic fault occurred and restore the contents of the database up to a point in time which precedes the identified time of occurrence of the fault and at which data has consistency.
When it is stated that data has consistency, what is meant is that the data has been updated in conformity to an operation log recorded in an operation log file managed by a DBMS. A common DBMS reserves a buffer area for temporarily saving the contents of an update on a cache memory of the host computer on which the DBMS is operating, or the like. Even when an operator or the like makes a data update, the contents of the update is not immediately reflected on a data file and is held in the buffer area. In order to bring about a state in which data has consistency, the contents of all updates held on the buffer area must be reflected on the data file that is held in a storage or the like. Since the DBMS assumes that a fault has occurred in the data file when there is no consistency of data, the data file cannot be opened.
In order to restore the contents of the database up to a point in time when the data has consistency, a snapshot must be acquired in advance in a state in which data has consistency. For this purpose, it is necessary to staticize the database and acquire a snapshot thereof in a state in which data has consistency. Snapshot is to maintain data to be snapshot at a certain point in time in an external storage, and it is a function provided by most storage systems.
Staticizing a database is to stop a process of updating a data file in the database. Unless the database is staticized, since an update process may be performed on data to be snapshot, data consistency is lost and, even if the snapshot is acquired, it will be data which cannot be used for data recovery.
In a nonstop-operated database system in which a database is accessed 24 hours, it is difficult to staticize the database. For this reason, some DBMS provide a function to staticize a database virtually while executing access to a data file (hereinafter referred to as a virtual database staticizing function). However, since the virtual database staticizing function is executed by a DBMS, it increases the load on the host computer on which the DBMS operates. Further, since database stacisization must be executed until data snapshot is completed, it is very much difficult to use it in a large-scale database or environment under a heavy load when influences on regular tasks are taken into consideration.
As a method for solving to the above-described problems, a method is under study, in which a DBMS cooperates with software operating on a host computer or an external storage to reduce the load on the host computer at the time of data snapshot as much as possible.
A typical approach is to staticize a virtual database using a virtual database staticizing function of a DBMS and to create a snapshot of a file or logical volume which is to be snapshot at the point in time when the database is staticized. When the creation of the snapshot is completed, the virtual database staticization is canceled, and the DBMS returns to a normal operation. Next, backup software or the like is used to make a copy of the snapshot in a backup device.
A snapshot can be created by using an LVM (Logical Volume Manager) of an OS, software provided by various vendors, or a snapshot creating function provided by an external storage.
When a snapshot is to be acquired by an automatic operation utilizing an application such as scheduling software according to this method, the application must request the DBMS to staticize the database to put the database in a consistent state, at a time when a snapshot is to be acquired, and it must create a snapshot while the database is staticized.
When the LVM or software is used, the LVM or software must have means for requesting a DBMS to staticize a database. The DBMS is also required to have the database staticizing function or an application interface which allows database staticization to be executed according to a request from an external application. This places a limit on software and DBMSs that can be used or necessitates modifications of software or DBMS.
Further, since the LVM and software operate on a host computer, loads are placed on the host computer not only when a snapshot is created but also by management of the snapshot or the like.
In order to mitigate the above-described problems, methods for acquiring a snapshot having consistency without placing an unduly heavy load on a host computer are under study. For example, a method may be employed in which a snapshot function provided by some external storages is used. In this case, a host computer requests an external storage to create a snapshot through an interface provided by the external storage; the external storage creates a snapshot upon receipt of the request; and the management of the snapshot is thus conducted by the external storage. As a result, the host computer is freed from loads other than a load associated with the issue of the snapshot creation request.
The use of a snapshot acquired according to the above method makes it possible to restore consistent data when a logic fault or the like has occurred. This schematically illustrated in
According to the above-described method, in general, a system manager or a program or batch job operating on a host computer requests a DBMS to staticisize the database, and the system manager or the like issues a snapshot creation request to an external memory while the database is staticized. When the creation of a snapshot is completed, the system manager or the like cancels the database staticization and acquires the snapshot. The database staticization is executed by the DBMS. Therefore, a load is placed on the host computer on which the DBMS operates when the database is staticized.
The above-described method makes it possible to restore data having consistency before the occurrence of a logic fault.
However, in a nonstop-operated database system, since a reduction in processing performance attributable to a virtual database staticizing process performed for each snapshot can be a problem, it is necessary to acquire snapshots by selecting a time zone in which the host computer has a relatively light load or to keep the frequency of the database staticizing process as low as possible. Such a restriction reduces the number of points at which a logic fault can be recovered. When the number of points where recovery is enabled is reduced, a problem arises in that a long time is required to execute a roll forward process from the data of a snapshot until a state immediately before the occurrence of a logic fault.
Further, since the database staticizing process may involve a separate interface for each DBMS and some DBMS may not have required functions, it is difficult to manage backup and restoration in an environment where various platforms exist.
It is therefore an object of the invention to make it possible to acquire a snapshot using a method which does not involve staticization.
It is another object of the invention to set as large number of points where recovery of the snapshot due to the logic fault is enabled as possible.
It is another object of the invention to manage backup and restoration in an environment where various platforms exist.
A snapshot acquisition controller according to one aspect of the invention cooperates with a computer system having a host computer on which a database management program (hereinafter referred to as DBMS) is operating, an external storage which stores data managed by DBMS, and a snapshot function unit for acquiring a snapshot of data on the external storage upon receipt of a snapshot acquisition request, the DBMS intermittently executing a checkpoint process for temporarily storing update data for updating data on the external storage in a buffer and outputting all update data accumulated in the buffer to the external storage according to timing controlled by itself. The snapshot acquisition controller has checkpoint detection means which detects the execution of the checkpoint process that the DBMS intermittently executes according to timing controlled by itself and snapshot acquisition request means which transmits the snapshot acquisition request to the snapshot function unit when the execution of the checkpoint is detected by the checkpoint detection means.
In a preferred embodiment, the checkpoint detection means detects the execution of the checkpoint process by monitoring an operation or information that the DBMS externally exhibits.
In a preferred embodiment, the checkpoint detection means detects the execution of the checkpoint process by monitoring an operation performed on the external storage by the DBMS or information output to the external storage by the same.
In a preferred embodiment, the checkpoint detection means detects the execution of the checkpoint process by monitoring an operation log that is a record of history of operations including the checkpoint process executed by the DBMS.
In a preferred embodiment, when the DBMS has a user interface for a manager and outputs information regarding the checkpoint process to the user interface for a manager, the checkpoint detection means detects the execution of the checkpoint process by monitoring information output by the DBMS to the user interface for a manager.
In a preferred embodiment, when the DBMS executes the checkpoint process at a first time interval, the checkpoint detection means performs a monitoring operation for detecting the checkpoint process at a second time interval shorter than the first time interval.
In a preferred embodiment, the snapshot acquisition request is transmitted without requesting the DBMS to staticize a database or to staticize a virtual database.
In a preferred embodiment, the snapshot acquisition controller further has identification information storing means which stores checkpoint identification information for identifying a detected checkpoint process and snapshot identification information for identifying an acquired snapshot in association with each other when the snapshot is acquired as a result of detection of the execution of the checkpoint process.
In a preferred embodiment, the snapshot acquisition controller further has snapshot restoration instructing means which, upon receipt of a snapshot recovery instruction including the specification of arbitrary checkpoint identification information, acquires snapshot identification information stored in association with the specified checkpoint identification information from the identification information storing means and which transmits a restoration request for a snapshot identified by the acquired snapshot identification information to the snapshot function unit or a predetermined functional unit having a snapshot restoring function.
A computer program for controlling acquisition of a snapshot according to another aspect of the invention is used in conjunction with a computer system having a host computer on which a DBMS is operating, an external storage which stores data managed by DBMS, and a snapshot function unit for acquiring a snapshot of data on the external storage upon receipt of a snapshot acquisition request, the DBMS intermittently executing a checkpoint process for temporarily storing update data for updating data on the external storage in a buffer and outputting all update data accumulated in the buffer to the external storage according to timing controlled by itself. The computer program causes a computer in or out of the computer system to execute the steps of detecting the execution of the checkpoint process that the DBMS intermittently executes according to timing controlled by itself and transmitting the snapshot acquisition request to the snapshot function unit when the execution of the checkpoint is detected at the step of detecting a checkpoint.
A storage system used in conjunction with a host computer on which a DBMS operates according to another aspect of the invention has an external storage which stores data in a database managed by the DBMS, a snapshot function unit which acquires a snapshot of data on the external storage upon receipt of a snapshot acquisition request, and a snapshot acquisition control unit for controlling the acquisition of the snapshot. When the DBMS is adapted to temporarily store update data for updating the data on the external storage in a buffer and to intermittently execute a checkpoint process for outputting all update data accumulated in the buffer to the external storage at timing controlled by itself, the snapshot acquisition control unit has checkpoint detecting means which detects the execution of the checkpoint process that the DBMS intermittently executes at timing controlled by itself and snapshot acquisition requesting means which transmits the snapshot acquisition request to the snapshot function means when the execution of the checkpoint is detected by the checkpoint detection means.
An embodiment of the invention will now be described using the drawings.
A schematic configuration of a database system which is an embodiment of the invention will be described using
The DBMS 11 is a system which manages a database. The DBMS 11 executes a process of updating the database in the external storage 20 according to a request from a client such as a host application or a user which is not shown. The procedure of updating the database is as follows. Specifically, the DBMS 11 stores and accumulates data in a buffer 12 in the host computer 10. The DBMS 11 collectively outputs update data in the buffer to the external storage 20 at points in time that come in a discrete manner according to timing controlled by itself to update the data table 31, the Redo log 32, and the operation log 33 in the external storage 20 (
The process of updating the data in the external storage 20 by flushing the data in the buffer 12 in such an intermittent manner is referred to as a checkpoint process. Thus, the data on the buffer 12 of the host computer 10 and the data stored in the external storage are put in a consistent state. The timing for the checkpoint process may be controlled based on a condition set by the user for the DBMS 11 (e.g., a timer setting) or may be controlled based on a particular condition of the DBMS 11 (e.g., buffer full). In either case, the timing is only required to be controlled internally to the DBMS 11, and the DBMS 11 is not required to have any. special interface for externally providing information on the control of the timing. This allows various existing DBMSs to be used as the DBMS 11 and the embodiment to be implemented in an environment where various platforms exit.
The snapshot acquisition control program 13 continuously monitors whether the DBMS 11 has executed the checkpoint process or not (
When the snapshot acquisition control program 13 detects the execution of a new checkpoint process, it requests acquisition of a snapshot as described above (
The snapshot acquisition control program 13 performs the above-described control each time the execution of a checkpoint process is detected. Thus, snapshots immediately after points in time when a checkpoint process is executed (points in time when the database is made consistent) are acquired one after another, and there is no need for separately requesting the DBMS 11 to staticize or virtually staticize the database.
When the snapshot acquisition control program 13 receives a restoration request message including a checkpoint ID to be restored from the system manager at an arbitrary point in time, it refers to the CP-SH correspondence management table 30 to acquire the snapshot ID associated with the checkpoint ID (
The external storage 20 has the data table 31, the Redo log 32, the operation log 33, the CP-SH correspondence management table 30, and the snapshot management table (hereinafter referred to as SH management table) 40 for managing snapshots.
As described above, main data of the database are recorded in the data table 31, and information on data processing such as update and deletion of data, i.e., information on all changes made to the database is recorded in the Redo log 32. Information on operations of the database such as recording of snapshots and recording of checkpoints is recorded in the operation log 33. For example, the operation log 33 has records of an operation ID (e.g., a checkpoint ID) for identifying each process such as a snapshot process or checkpoint process, a time at which the process has been performed, and so on.
Checkpoint IDs and snapshot IDs are stored in association with each other in the CP-SH correspondence management table 30.
The snapshot function unit 41 acquires (
While the function of acquiring a snapshot is provided as a function of the external storage 20 in the present embodiment, it may be provided by software operating on the host computer 10 such as an LVM (Logical Volume Manager) loaded on an operating system of a host apparatus such as the host computer 10.
In the SH management table 40, the snapshot IDs, the addresses of snapshots 31a of the data table, the addresses of snapshots 32a of the Redo log, and the addresses of snapshots 33a of the operation log are recorded in association with each other.
Operations of the database system until it acquires a snapshot will be described using
When a checkpoint event occurs, the DBMS 11 executes a checkpoint process (
The snapshot acquisition control program 13 checks the operation log 33 at intervals of T seconds (
When the external storage 20 receives the snapshot acquisition request from the snapshot acquisition control program 13 (
The snapshot acquisition control program 13 receives the snapshot completion report from the external storage 20 (
A recovery process at the occurrence of a fault will now be described using
In
The DBMS 11 executes checkpoint processes at preset time intervals of t seconds. The snapshot acquisition program 13 checks the contents of the operation log 33 at intervals of T seconds. Although the check interval T may be arbitrarily set as the user specifies, T<t must be true.
At the time ty, the detection of the logic fault is reported to the system manager according to a report or the like from a database user or an application (
The system manager checks the Redo log 32 and identifies a process performed at the time tx to be the cause of the logic fault. Further, the system manager acquires the time t1 of the checkpoint immediately before the process at the time tx and the checkpoint ID for the same from the operation log 33 (
The input of the checkpoint to the snapshot acquisition control program 13 is carried out by using an interface such as a GUI provided by the same program. The input may alternatively be made from another program using an API provided by the same program.
When the snapshot restoration request event occurs (
The external storage 20 receives the snapshot restoration request from the snapshot acquisition control program 13 (
Strictly speaking, the data table for which the snapshot restoring process has been competed is in the state at a time t1 ′which is a time later than the time t1 rather than the state at the time t1 (
The data contents may have been updated between the time t1 and the time t1′. When the system manager receives the snapshot restoring process completion report from the snapshot acquisition control program 13 (
While a preferred embodiment of the invention has been described above, the examples are only illustrative of the invention, and it is not intended to limit the scope of the invention to this embodiment. The invention may therefore be carried out in various other modes.
For example, while the data table 31, the Redo log 32, and the operation log 33 are stored in the external storage 20 in the present embodiment, each of them may be stored in a storage other than the external storage 20 or stored on a network on a distributed basis.
While the data table 31 and the snapshots 31a of the data table are stored in the external storage 20 in the present embodiment, the snapshots may be stored in a storage separate from the external storage 20 in which the data table 31 is stored. While the Redo log 32 and the snapshots 32a of the Redo log 32 are stored in the external storage 20, the snapshots may be stored in a storage separate from the external storage 20 in which the Redo log 32 is stored. Further, while the operation log file 33 and the snapshots 33a of the operation log file are stored in the external storage 20, the snapshots may be stored in a storage separate from the external storage 20 in which the operation log file 33 is stored.
While the operation log 33 in the external storage 20 is monitored as means for detecting a checkpoint in the present embodiment, the checkpoint process may be monitored using any method such as direct monitoring of the DBMS 11 or monitoring of a checkpoint execution log of the console. In this case, however, it is sufficient to monitor the operation of the external storage 20, and there is no need to know the timing control over the checkpoint process or to conduct the control internally.
While snapshots of the data table 31, the Redo log 32, and the operation log 33 are acquired in the present embodiment, snapshots may be acquired only for the data table.
A program other than the system manager or the snapshot acquisition control program 13 may request the snapshot 41 to restore a snapshot based on a checkpoint ID identified by the system manager from the Redo log 32 and using a snapshot ID detected by the snapshot acquisition control program 13.
The invention makes it possible to acquire a snapshot without conducting staticization or virtual staticization and to acquire snapshots at the same frequency as that of the points in time of checkpoints which constitute the shortest units in which a database can be recovered from a logic fault. Thus, the database can be restored in a short time up to the point in time closest to the time of occurrence of the logic fault.
According to the invention, since checkpoints and snapshots are managed in association with each other, a database manager or management program can automatically select a necessary snapshot only by specifying a checkpoint, which allows processes to be simplified.
According to the invention, it is possible to utilize the logic fault recovery function, i.e., the function of restoring to a checkpoint that DBMSs generally have without relying upon specific functions such as a staticizing process or specific interfaces that some DBMSs have.
Number | Date | Country | Kind |
---|---|---|---|
2003-281759 | Jul 2003 | JP | national |
This application is a Continuation of U.S. application Ser. No. 10/768,173filed on Feb. 2, 2004, and claims priority from U.S. application Ser. No. 10/768,173 filed on Feb. 2, 2004, which claims priority from Japanese Patent Application No. 2003-281759 filed on Jul. 29, 2003, the entire disclosure of which is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | 10768173 | Feb 2004 | US |
Child | 11329076 | Jan 2006 | US |