A method and apparatus for data recovery are disclosed. Undo tablespace size is calculated for user-specified undo retention time based on system statistics collected over a period of time specified by a history time parameter.
|
13. An apparatus comprising:
a processor; and
an undo tablespace advisor module, implemented using the processor, to calculate undo tablespace size for user-specified undo retention time based on system statistics collected over a period of time specified by a history time parameter, and to store the calculated undo tablespace size.
23. A method comprising:
calculating a best possible undo retention time using a processor based at least in part on a fixed undo tablespace size and system activity level during a user-specified history time;
storing the calculated best possible undo retention time in a device; and
providing the calculated best possible undo retention time as a recommendation to a user or for use by the user.
35. An apparatus comprising:
a processor; and
an undo retention advisor, implemented using the processor, to calculate a best possible undo retention time based at least in part on a fixed undo tablespace size and system activity level during a user-specified history time, to store the calculated best possible undo retention time, and to provide the calculated best possible undo retention time as a recommendation to a user or for use by the user.
41. An article of manufacture comprising:
a non-transitory computer-readable medium comprising a volatile or non-volatile medium having stored therein instructions, an execution of which results in a performance of a method by a processing system, the method comprising:
calculating a best possible undo retention time using a processor based at least in part on a fixed undo tablespace size and system activity level during a user-specified history time;
storing the calculated best possible undo retention time; and
providing the calculated best possible undo retention time as a recommendation to a user or for use by the user.
1. A method comprising:
obtaining a user-specified undo retention time;
obtaining a history time parameter;
accessing system statistics collected over a period of time specified by the history time parameter;
calculating undo tablespace size using a processor for the user-specified undo retention time based at least in part on the user-specified undo retention time and on the system statistics collected over the period of time specified by the history time parameter;
storing the calculated undo tablespace size in a device; and
providing the calculated undo tablespace size as a recommendation to a user or for use by the user.
17. An article of manufacture comprising:
a non-transitory computer-readable medium comprising a volatile or non-volatile medium having stored therein instructions, an execution of which results in a performance of a method by a processing system, the method comprising:
obtaining a user-specified undo retention time;
obtaining a history time parameter;
accessing system statistics collected over a period of time specified by the history time parameter;
calculating undo tablespace size using a processor for the user-specified undo retention time based at least in part on the user-specified undo retention time and on the system statistics collected over the period of time specified by the history time parameter;
storing the calculated undo tablespace size; and
providing the calculated undo tablespace size as a recommendation to a user or for use by the user.
2. The method of
3. The method of
4. The method of
5. The method of
6. The method of
7. The method of
8. The method of
9. The method of
10. The method of
11. The method of
12. The method of
14. The apparatus of
15. The apparatus of
16. The apparatus of
18. The article of manufacture of
19. The article of manufacture of
20. The article of manufacture of
21. The article of manufacture of
22. The article of manufacture of
24. The method of
25. The method of
26. The method of
27. The method of
28. The method of
29. The method of
30. The method of
31. The method of
32. The method of
33. The method of
34. The method of
36. The apparatus of
37. The apparatus of
38. The apparatus of
39. The apparatus of
40. The apparatus of
42. The article of manufacture of
43. The article of manufacture of
44. The article of manufacture of
45. The article of manufacture of
|
Embodiments of the invention relate to computer systems, and more particularly to data recovery.
In database systems, a “transaction” refers to an atomic set of operations performed against a database, which may access, create, modify or delete database data or metadata. A “commit” occurs when the transaction has completed its processing and any changes to the database by the transaction are ready to be permanently implemented in the database system.
Transaction log records can be maintained in a database system to allow data recovery in the event of an error, that may include hardware failure, network failure, process failure, database instance failure, data access conflicts, user errors, and statement failures in database access programs.
Various types of transaction log records can be maintained in a database system for data recovery. One type of log record that may be maintained is the “undo” record. Undo records contain information about changes that were introduced into the database system. For example, if a row in a table was modified, the changes will be stored in the undo record identifying the block of the database system that includes the modified table row.
Memory or disk space needs to be allocated for storage of undo records. Database managers usually set the undo tablespace size by predicting how much undo records may be generated. Often there is not enough statistical information available for database administrators to use in order to arrive at an accurate prediction of undo records generation. Incorrect undo tablespace size may cause errors in the system, as not enough undo records may be available. Alternatively, allocating too much memory or disk space for storing undo records is inefficient.
Moreover, database administrators need to predict how many undo records need to be maintained. Database system activity levels may fluctuate, for example during regular business hours activity levels may be higher than at night. Not only predicting how many undo records need to be maintained is difficult since database administrators do not have access to a lot of statistical information, changing that parameter as system activity levels change becomes almost impossible, as it requires someone to constantly monitor system activity and change the parameter as needed.
What is needed, therefore, is a solution that overcomes these and other shortcomings of the prior art.
Methods and apparatuses for data recovery are described. Embodiment of the invention include calculating undo tablespace size for user-specified undo retention time based on system statistics collected over a period of time specified by a history time parameter.
The invention is illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements and in which:
Methods and apparatuses for data recovery are described. Note that in this description, references to “one embodiment” or “an embodiment” mean that the feature being referred to is included in at least one embodiment of the invention. Further, separate references to “one embodiment” in this description do not necessarily refer to the same embodiment; however, neither are such embodiments mutually exclusive, unless so stated and except as will be readily apparent to those skilled in the art. Thus, the invention can include any variety of combinations and/or integrations of the embodiments described herein.
In one embodiment of the invention, a user of a database system requests via a user interface 100 of
Undo Retention Tablespace Size Recommendation
In one embodiment of the invention, at 300 of
In response to the user's request, at 310 the undo tablespace size advisor 130 accesses the statistics table 120 to perform necessary calculations using the user-specified history time parameter. In one embodiment if the user does not specify the history time parameter, the undo tablespace size advisor 130 retrieves statistics information collected over the past seven days, otherwise the undo tablespace size advisor 130 retrieves statistics information collected over a period of time specified by the history time parameter.
At 320 the undo tablespace size advisor calculates the sum of undo blocks generated over a period of time equal to the user-specified undo retention time parameter starting with the most recent statistics interval. A statistics interval is a period of time associated with each statistics table entry. For example, if statistics interval is 10 minutes, then each statistics table entry includes an average of data collected over a 10 minute interval, and a set of statistics table entries includes statistics data collected over a number of consecutive 10 minute intervals. Thus, if the undo retention time parameter is 3 hours, then the undo tablespace size advisor 130 calculates the amount of undo tablespace size that is necessary to store the undo blocks generated over the 3 hour period by calculating the sum of undo retention blocks entries in the statistics table starting with the most recent entry in the statistics table and ending with the statistics table entry recorded 3 hours prior to the most recent one.
Upon storing the result of the summation operation, at 330 the undo tablespace size advisor 130 performs the same summation operation starting with the second most recent entry in the statistics table and ending with the entry recorded 3 hours prior to the second most recent one. Upon storing the result of this second summation operation, the undo tablespace size advisor 130 performs the same operation starting with the third most recent entry in the table and so on, until all entries recorded during a time interval equal to the history time parameter have been used in the calculations. For example, continuing with the example introduced above, if the history time parameter was specified to be 3 days, then the undo advisor performs summation operations until all statistics entries recorded in the last three days have been used.
It will be appreciated that the undo retention time and history time parameters may be specified to any value and the values of 3 hours and 3 days were used for exemplary purposes only in order to facilitate understanding of the invention.
In one embodiment of the invention, the undo tablespace size advisor selects the maximum sum from all the summation results and provides the user with the recommendation to set the undo tablespace size to the value of the maximum sum. In alternative embodiment, the undo tablespace size advisor provides the user with the recommendation to set the undo tablespace size to the value of 110% of the maximum sum. In one embodiment, the undo tablespace size advisor provides the user with the recommendation to set the undo tablespace size to the value of the average of all the sums. In one embodiment, the recommended undo tablespace size is presented to the user via a graphical user interface, an example of which is illustrated in
In one embodiment, upon acceptance of the recommendation by the user, the undo tablespace size is set to the recommended value.
Best Possible Undo Retention Indication
In one embodiment of the invention, at 500 of
In one embodiment, at 530 upon storing the calculated length of time during which the system generated undo retention blocks that would fill up the current undo tablespace size, the undo retention advisor 140 performs the same calculation operation starting with the second most recent entry in the statistics table and so on, until all the entries recorded during the specified history time have been used.
In one embodiment, the undo retention advisor 140 provides the user with the recommendation to set the best undo retention time parameter to the minimum value from the plurality of generation time parameters. In another embodiment, the undo retention advisor provides the user with the recommendation to set the best undo retention time parameter to the value equal to 90% of the minimum value of the plurality of generation time parameters. In yet another embodiment, the undo retention advisor provides the user with the recommendation to set the best undo retention time parameter to the average of the values of the plurality of generation time parameters.
In one embodiment, the best undo retention indication is presented to the user via a graphical user interface, an example of which is illustrated in
Auto-Tuning of Undo Retention
Undo retention records are not only used to recover data, but also to ensure successful execution of database queries. In one embodiment of the invention, every query is associated with a timestamp indicating system time at which the query was issued. In order for the query to succeed, the state of the database objects that the query accesses has to be available as of the query timestamp. For example, if the query was issued at 2 p.m., and it accesses Table 1 and Table 2, the state of Table 1 and Table 2 as of 2 p.m., or the as of the system time associated with 2 p.m., needs to be available for the query to succeed. Thus, the changes that are made to Table 1 and Table 2 since the issuance of the query and stored in associated undo records need to be available in the system for the duration of the query to allow recovery of the database objects states as of the query issuance time when the query accesses the database objects, e.g. Table 1 and Table 2.
In one embodiment of the invention, the undo retention parameter is automatically set based on the length of the longest running query in the system. In addition, the undo retention parameter is dynamically auto-tuned based on system activity.
Embodiments are described further with references to
In one embodiment, the query is inactive if it does not access consistent read blocks associated with it. Consistent read blocks include database objects that the query accesses in the state as of the query timestamp.
In one embodiment, the query tracking module 600 maintains a query tracking data structure 610, for example, a table, in which a start time is recorded for each query. Alternatively, the start time may be recorded in the cursor of the query. This start time is then utilized by the query tracking module 600 to calculate the longest running query.
In one embodiment, at 710 the query tracking module 600 periodically, for example, every 1 minute, calculates current running time of each active query by comparing the timestamp of the query stored in the query tracking structure 610 with the current system time. Then, at 720, the query tracking module 600 selects the longest query duration and computes the required undo retention duration necessary to support this longest running query at 730 by adding to the query length a safety parameter which includes the time period and latency in the startup of the tuning process. For example, if the tuning time period is 1 minute and the latency of the startup of the tuning process is 1.5 minutes, then the safety parameter is (1.5*time period). Thus, the required undo retention duration is equal to
tracked query length+safety parameter.
For example, if the time period is 1 minute and the current longest query length is 30 minutes, then the required undo retention is 45 minutes.
In one embodiment, at 740, a query length determination module 620 compares the required undo retention duration to the best undo retention and to the user-specified undo retention parameter. In one embodiment, the user may specify the low threshold of undue retention and the tuning process described above tunes the retention above this low threshold as long as the undo tablespace supports such retention. At 750 based on comparison results the query length determination module 620 directs the system to sets system's undo retention. For example, if the required undo retention parameter is less than the best undo retention parameter and less than the user-specified low threshold, then the query length determination module 620 directs the system to set the system's undo retention to the user-specified low threshold. If the required undo retention parameter is less than the best possible retention parameter but greater than the user-specified low threshold, then the query length determination module 620 directs the system to set the system's undo retention to the calculated undo retention value, or alternatively, to the best undo retention. Generation of undo retention records cannot exceed the size of the undo tablespace, and thus, the system sets the undo retention of the system to the value of the best undo retention, if the calculated undo retention duration value is greater than the best undo retention and greater than the user-specified low threshold. In addition, if the required undo retention is greater than the value of the best undo retention, which in turn is greater than the value of the user-specified low threshold, then the query length determination module directs the system to set the undo retention to the best possible retention. If the user-specified low threshold is greater than the required undo retention, which in turn is greater than the best possible retention, then the query length determination module 620 directs the system to set the system's undo retention to best possible retention. In this situation, the longest running query may fail due to lack of necessary undo records.
General
It will be appreciated that physical processing systems, which embody components of database system described above, may include processing systems such as conventional personal computers (PCs), embedded computing systems and/or server-class computer systems according to one embodiment of the invention.
The processor(s) 800 may include one or more conventional general-purpose or special-purpose programmable microprocessors, digital signal processors (DSPs), application specific integrated circuits (ASICs), or programmable logic devices (PLD), or a combination of such devices. The mass storage device 830 may include any one or more devices suitable for storing large volumes of data in a non-volatile manner, such as magnetic disk or tape, magneto-optical storage device, or any of various types of Digital Video Disk (DVD) or Compact Disk (CD) based storage or a combination of such devices.
The data communication device(s) 860 each may be any device suitable to enable the processing system to communicate data with a remote processing system over a data communication link, such as a wireless transceiver or a conventional telephone modem, a wireless modem, an Integrated Services Digital Network (ISDN) adapter, a Digital Subscriber Line (DSL) modem, a cable modem, a satellite transceiver, an Ethernet adapter, Internal data bus, or the like.
The term “computer-readable medium”, as used herein, refers to any medium that provides information or is usable by the processor(s). Such a medium may take many forms, including, but not limited to, non-volatile and volatile media. Non-volatile media, i.e., media that can retain information in the absence of power, includes ROM, CD ROM, magnetic tape and magnetic discs. Volatile media, i.e., media that cannot retain information in the absence of power, includes main memory.
Thus, methods and apparatuses for data recovery in database systems have been described. Although the invention has been described with reference to specific exemplary embodiments, it will be evident that various modifications and changes may be made to these embodiments without departing from the broader spirit and scope of the invention as set forth in-the claims. Accordingly, the specification and drawings are to be regarded in an illustrative sense rather than a restrictive sense.
Ganesh, Amit, Sinha, Bipul, Yang, Wanli
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
4674039, | Oct 09 1984 | Method for determining whether a given value is included in an ordered table of values stored in a computer readable memory | |
5129070, | Oct 06 1989 | BULL S A A CORPORATION OF FRANCE | Method of using the memory in an information processing system of the virtual addressing type, and apparatus for performing the method |
5761672, | Feb 08 1994 | Telefonaktiebolaget LM Ericsson | Distributed data base system |
5890000, | Dec 04 1996 | International Business Machines Corporation | Cooperation of global and local register allocators for better handling of procedures |
5907848, | Mar 14 1997 | VISION SOLUTIONS, INC | Method and system for defining transactions from a database log |
6185577, | Jun 23 1998 | Oracle International Corporation | Method and apparatus for incremental undo |
6192377, | May 13 1998 | Oracle International Corporation | Method and apparatus for determing whether a transaction can use a version of a data item |
6272612, | Sep 04 1997 | Bull S.A. | Process for allocating memory in a multiprocessor data processing system |
6574717, | May 31 2001 | Oracle International Corporation | Techniques for time-based retention of a reusable resource |
6587847, | Aug 24 1999 | Stream International, Inc. | Method and system for monitoring knowledge use |
6591298, | Apr 24 2000 | Dynatrace LLC | Method and system for scheduling measurement of site performance over the internet |
6631374, | Sep 29 2000 | ORACLE INTERNATIONAL CORPORATION OIC | System and method for providing fine-grained temporal database access |
6694340, | Sep 24 1998 | International Business Machines Corporation | Technique for determining the age of the oldest reading transaction with a database object |
6976022, | Sep 16 2002 | ORACLE INTERNATIONAL CORPORATION OIC | Method and mechanism for batch processing transaction logging records |
6981004, | Sep 16 2002 | ORACLE INTERNATIONAL CORPORATION OIC | Method and mechanism for implementing in-memory transaction logging records |
7035990, | Oct 27 1999 | DR JOHANNES HEIDENHAIN GMBH | Method for dynamic memory management |
7047386, | May 31 2001 | Oracle International Corporation | Dynamic partitioning of a reusable resource |
7110998, | Oct 13 1998 | Virtual Gold, Inc.; VIRTUAL GOLD, INC | Method and apparatus for finding hidden patterns in the context of querying applications |
7127456, | Dec 05 2002 | TERADATA US, INC | System and method for logging database queries |
7305422, | Sep 26 2002 | Oracle International Corporation | Performing computationally intensive calculations within a database server that provides a recovery mechanism |
7574419, | May 13 2004 | Oracle International Corporation | Automatic tuning of undo retention |
7885939, | Oct 11 2005 | Oracle International Corporation | Longest query duration for auto tuning undo retention |
20020091694, | |||
20040054643, | |||
20040054644, | |||
20050015563, | |||
20050114409, | |||
20050120062, | |||
20050120064, | |||
20050125430, | |||
20050131966, | |||
20050182658, | |||
20050240633, | |||
20050256829, | |||
20050256849, | |||
20070083488, | |||
20070083566, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
May 13 2004 | YANG, WANLI | Oracle International Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 015342 | /0281 | |
May 13 2004 | SINHA, BIPUL | Oracle International Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 015342 | /0281 | |
May 13 2004 | GANESH, AMIT | Oracle International Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 015342 | /0281 | |
May 14 2004 | Oracle International Corporation | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
Nov 30 2017 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Dec 01 2021 | M1552: Payment of Maintenance Fee, 8th Year, Large Entity. |
Date | Maintenance Schedule |
Jun 17 2017 | 4 years fee payment window open |
Dec 17 2017 | 6 months grace period start (w surcharge) |
Jun 17 2018 | patent expiry (for year 4) |
Jun 17 2020 | 2 years to revive unintentionally abandoned end. (for year 4) |
Jun 17 2021 | 8 years fee payment window open |
Dec 17 2021 | 6 months grace period start (w surcharge) |
Jun 17 2022 | patent expiry (for year 8) |
Jun 17 2024 | 2 years to revive unintentionally abandoned end. (for year 8) |
Jun 17 2025 | 12 years fee payment window open |
Dec 17 2025 | 6 months grace period start (w surcharge) |
Jun 17 2026 | patent expiry (for year 12) |
Jun 17 2028 | 2 years to revive unintentionally abandoned end. (for year 12) |