Architecture of database application with robust online recoverability
First Claim
1. A method of creating an online point-in-time view of an application table of an active database having at least one before image table and at least one after image table, the method comprising:
- retrieving a retention time of the application table;
determining that a point-in-time is greater to or equal than the retention time; and
creating the point-in-time view of the application table, the view comprising a union of a set of rows from the after image table having a timestamp less than or equal to the point-in-time and a set of rows from the before image table having a timestamp less than or equal to the point-in-time and having a changing timestamp greater than the point-in-time.
3 Assignments
0 Petitions
Accused Products
Abstract
An architecture for efficiently identifying the scope and timeframe of database errors, providing online history images, creating online point-in-time views of application tables, reconstructing equivalent SQL statements of a committed transaction or of a user session, providing a selective audit trail report on demand, and permitting selective online rollbacks in an application database. The rollback can be done on a single row, a single transaction, a group transactions, a user session, or all user tables. The system includes after images tables and before images tables and tracks all before images of user application tables when a user performs an INSERT, UPDATE, or DELETE operation with respect to a row in a table. Also, the system is provided to generate history images of application tables at a point-in-time, and to selectively rollback, or undo whole or a portion of application tables, to generate a selective audit trail report on demand, and to manage the before images.
97 Citations
35 Claims
-
1. A method of creating an online point-in-time view of an application table of an active database having at least one before image table and at least one after image table, the method comprising:
-
retrieving a retention time of the application table;
determining that a point-in-time is greater to or equal than the retention time; and
creating the point-in-time view of the application table, the view comprising a union of a set of rows from the after image table having a timestamp less than or equal to the point-in-time and a set of rows from the before image table having a timestamp less than or equal to the point-in-time and having a changing timestamp greater than the point-in-time.
-
-
2. A method of creating an online point-in-time view of an application table of an active database having at least one before image table and at least one after image table, the method comprising:
-
retrieving a transaction id set associated with a transaction id that begins before or at a point-in-time and ends after the point-in-time;
retrieving a retention time of the application table;
determining that the point-in-time is greater than or equal to the retention time; and
creating the point-in-time view of the application table, the view comprising a union of a set of rows from the after image table having a timestamp that is less than or equal to the point-in-time and having a transaction id that is not a proper subset of the transaction id set, and a set of rows from the before image table having a timestamp less than or equal to the point-in-time, and having a transaction id that is not a proper subset of the transaction id set, and having a changing transaction id that is a proper subset of the transaction id set or having a changing timestamp that is greater than the point-in-time.
-
-
3. A method of rollbacking at least one table of an active database to a point-in-time, having at least one before image table and at least one after image table, the method comprising:
-
retrieving a retention time for each of the at least one table;
determining that none of the retention times for the at least one table is greater than the point-in-time;
locking all tables to be rollbacked and disabling all related integrity constraints;
deleting rows from each of the at least one after image table having a timestamp greater than the point-in-time;
inserting into each of the at least one after image table, rows from the associated before image table having a timestamp less than or equal to the point-in-time and having a changing timestamp greater than the point-in-time; and
enabling all related integrity constraints.
-
-
4. A method of rollbacking at least one table of an active database to a point-in-time, having at least one before image table and at least one after image table, the method comprising:
-
retrieving a retention time for each of the at least one table;
determining that none of the retention times for each of the at least one table is greater than the point-in-time;
retrieving a transaction id set associated with a transaction id that begins before or at the point-in-time and ends after the point-in-time;
locking all tables to be rollbacked and disabling all related integrity constraints;
deleting rows from each of the at least one after image table having a timestamp greater than the point-in-time or having a transaction id that is a proper subset of the transaction id set;
inserting into each of the at least one after image table, rows from the associated before image table having a timestamp less than or equal to the point-in-time and having a transaction id that is not a proper subset of the transaction id set, and having a changing transaction id that is a proper subset of the transaction id set or having a changing timestamp that is greater than the point-in-time; and
enabling all related integrity constraints.
-
-
5. A method of rollbacking selected rows in a table of an active database to a point-in-time, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving a retention time of the table;
determining that the point-in-time is greater than or equal to the retention time;
locking the table to be rollbacked and disabling all related integrity constraints;
deleting selected rows from the after image table having a timestamp greater than the point-in-time;
inserting into the after image table, selected rows from the before image table having a timestamp less than or equal to the point-in-time and having a changing timestamp that is greater than the point-in-time; and
enabling all related integrity constraints.
-
-
6. A method of rollbacking selected rows in a table of an active database to a point-in-time, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving a transaction id set associated with a transaction id that begins before or at the point-in-time and ends after the point-in-time;
retrieving a retention time of the table;
determining that the point-in-time time is greater than or equal to the retention time;
locking the table to be rollbacked and disabling all related integrity constraints;
deleting selected rows from the after image table having a timestamp greater than the point-in-time or having a transaction id that is a member of the transaction id set;
inserting into the after image table, selected rows from the before image table having a timestamp that is less than or equal to the point-in-time and having a transaction id that is not a proper subset of the transaction id set, and having a changing transaction id that is a proper subset of the transaction id set or having a changing timestamp that is greater than the point-in-time; and
enabling all related integrity constraints.
-
-
7. A method of obtaining a history of a single data row of a table of an active database, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving a data row set comprising the union of zero or one selected row from the after image table and zero or more selected deleted rows from the before image table;
determining that the data row set is not empty; and
recursively finding all associated parent rows for each data row in the data row set. - View Dependent Claims (8, 9)
-
-
10. A method of rollbacking a transaction id set in a group of tables of an active database, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving an earliest starting time of the transaction id set;
retrieving a latest retention time for all of the tables;
determining that the earliest starting time is greater than the latest retention time;
locking all tables to be rollbacked and disabling all related integrity constraints;
rollbacking the transaction id set in the group of tables; and
enabling all related integrity constraints. - View Dependent Claims (11, 12)
-
-
13. A method of rollbacking all transactions made in a user session of an active database, the method comprising:
-
retrieving selected parameters associated with the user session;
retrieving names of the tables used by a user and transaction ids made by the user during a session, the session being defined by a user login time and logout time;
retrieving an earliest starting time of the transaction id set;
retrieving a latest retention time for all of the tables;
determining that the earliest starting time is greater than the latest retention time; and
rollbacking the transaction set from the tables.
-
-
14. A system for use with an active database for performing at least one of online selectively rollbacking at least one application table or selected application data in at least one table, creating online point-in-time views of application tables, providing online history images associated with the database, reconstructing equivalent SQL statements of a committed transaction, reconstructing equivalent SQL statements of a user session, and providing a selective audit trail report on demand, the system comprising:
-
a plurality of user application after image tables, wherein each of the tables has one before image table to store before images, and one after image view;
a table comprising a table name field, a retention time field, and an export timestamp field;
an image manager that creates image views; and
a rollback manager that manages the first table. - View Dependent Claims (15, 16, 17, 18, 19, 20, 21)
-
-
22. A computer readable medium containing instructions for implementing application tables in a database and tracking images, wherein the instructions comprise executable instructions for implementing:
-
at least one after image table that stores current database images; and
a before image table associated with each of the at least one after image table that stores previous images of the current database images, wherein the at least one after image table and the before image table are available for online viewing. - View Dependent Claims (23, 24, 25)
-
-
26. A method of reconstructing equivalent SQL statements of a transaction id set in a group of tables of an active database, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving an earliest starting time of the transaction id set;
retrieving a latest retention time for all related tables;
determining that the earliest starting time is greater than the latest retention time;
creating a delete SQL statement for each deleted row in each of the before image tables having a changing transaction id that is a proper subset of the transaction id set;
creating an update SQL statement using the after image in one of the after image table or the before image table associated thereof by the relation that the timestamp and transaction id of an associated child row are equal to a changing timestamp and changing transaction id of an associated parent row, respectively, for each updated row in each of the before image tables having a changing transaction id that is a proper subset of the transaction id set;
creating an insert SQL statement for each row in each of the before image tables having a transaction id that is a proper subset of the transaction id set and an associated timestamp and transaction id do not exist in the before image as the changing timestamp, changing transaction id; and
creating an insert SQL statement for each row in each of the after image tables having a transaction id that is a proper subset of the transaction id set and an associated timestamp and transaction id do not exist in the before image as the changing timestamp, changing transaction id.
-
-
27. A method of reconstructing equivalent SQL statements of a transaction id set in a group of tables of an active database, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving an earliest starting time of the transaction id set;
retrieving a latest retention time for all related tables;
determining that the earliest starting time is greater than the latest retention time;
creating a delete SQL statement for each deleted row in each of the before image tables having a changing transaction id that is a proper subset of the transaction id set;
creating an update SQL statement using an after image of an associated child row in one of the after image table or the before image table for each updated row in each of the before image tables having a changing transaction id that is a proper subset of the transaction id set; and
creating an insert SQL statement for each row without an associated parent row in each of the before and after image tables having a transaction id that is a proper subset of the transaction id set.
-
-
28. A method of reconstructing equivalent SQL statements of all transactions made in a user session of an active database, the method comprising:
-
retrieving selected parameters associated with the user session;
retrieving names of tables used by a user and transaction ids made by the user during the session, the session being defined by a user login time and a user logout time;
retrieving an earliest starting time of the transaction id set;
retrieving a latest retention time for all of the tables;
determining that the earliest starting time is greater than the latest retention time; and
reconstructing equivalent SQL statements of the transaction id set from the tables.
-
-
29. A method of reconstructing equivalent SQL statements of all transactions made in a user session of an active database, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving selected parameters associated with the user session;
retrieving names of tables used by a user during the session, the session being defined by a user login time and a user logout time;
retrieving a latest retention time for all of the tables;
determining that the login time is greater than the latest retention time;
creating a delete SQL statement for each deleted row in the before image tables having a changing userid containing a user session id and a changing timestamp between the session starting timestamp and the session ending timestamp;
creating an update SQL statement using an after image of an associated child row in one of the after image tables or the before image tables for each updated row in the before image tables having a changing userid containing the user session id and a changing timestamp between the session starting timestamp and the session ending timestamp; and
creating an insert SQL statement for each row without an associated parent row in each of the before and after image tables having a userid containing the user session id and a timestamp between the session starting timestamp and the session ending timestamp.
-
-
30. A method of creating a selective audit trail report associated with activities of an application database user during a particular period, the activities including a plurality of database sessions, the method comprising:
-
retrieving userids and unique session ids associated with the user during the period;
retrieving names of any tables having any transactions made during the database sessions with one of retrieved unique session ids;
retrieving an earliest start time of the sessions;
retrieving a latest retention time for all of the tables whose names were retrieved;
determining that the starting time is greater than the latest retention time;
reconstructing equivalent SQL statements for all of the sessions;
associating each reconstructed update and delete statement with an associated changing session id, changing timestamp, and changing userid, and adding the changing transaction id to the association if the database provides the user with transaction id tracking; and
associating each reconstructed insert statement with an associated session id, timestamp, and userid, and adding the transaction id to the association if the database provides the user with transaction id tracking. - View Dependent Claims (35)
-
-
31. A method of rollbacking transactions made in a user session in a group of tables of an active database, the database having at least one before image table and at least one after image table, the method comprising:
-
retrieving a starting time, an ending time, a unique session id of the user session;
retrieving a latest retention time for all of the tables;
determining that the starting time is greater than the latest retention time;
locking all tables to be rollbacked and disabling all related integrity constraints;
rollbacking the transactions made in the user session in the group of tables; and
enabling all related integrity constraints. - View Dependent Claims (32, 33, 34)
-
Specification