I have ne useful new features of Oracle 10g below ,but i have't mentioned many important things ..
Flashback Versions Query
SQL> desc rates
Name Null? Type
----------------- -------- ------------
CURRENCY VARCHAR2(4)
RATE NUMBER(15,10)
This table shows the exchange rate of US$ against various other currencies as shown in the CURRENCY column. In the financial services industry,
exchange rates are not merely updated when changed; rather, they are recorded in a history. This approach is required because bank transactions
can occur as applicable to a "past time," to accommodate the loss in time because of remittances. For example, for a transaction that occurs at
10:12AM but is effective as of 9:12AM, the applicable rate is that at 9:12AM, not now.
Up until now, the only option was to create a rate history table to store the rate changes, and then query that table to see if a history is available.
Another option was to record the start and end times of the applicability of the particular exchange rate in the RATES table itself. When the change
occurred, the END_TIME column in the existing row was updated to SYSDATE and a new row was inserted with the new rate with the END_TIME
as NULL.
In Oracle Database 10g, however, the Flashback Versions Query feature may obviate the need to maintain a history table or store start and end
times. Rather, using this feature, you can get the value of a row as of a specific time in the past with no additional setup. Bear in mind, however,
that it depends on the availability of the undo information in the database, so if the undo information has been aged out, this approach will fail.
For example, say that the DBA, in the course of normal business, updates the rate several timesor even deletes a row and reinserts it:
insert into rates values ('DOLL',1.1012) ;
commit;
update rates set rate = 1.1014;
commit;
update rates set rate = 1.1013;
commit;
delete rates;
commit;
insert into rates values ('DOLL',1.1016) ;
commit;
update rates set rate = 1.1011;
commit;
After this set of activities, the DBA would get the current committed value of RATE column by
SQL> select * from rates;
CURR RATE
---- -----
DOLL 1.1011
This output shows the current value of the RATE, not all the changes that have occurred since the first time the row was created. Thus using
Flashback Query, you can find out the value at a given point in time; but we are more interested in building an audit trail of the changessomewha t
like recording changes through a camcorder, not just as a series of snapshots taken at a certain point.
The following query shows the changes made to the table:
select versions_startt ime, versions_endtim e, versions_xid,
versions_operat ion, rate
from rates versions between timestamp minvalue and maxvalue
order by VERSIONS_STARTT IME
/
VERSIONS_STARTT IME VERSIONS_ENDTIM E VERSIONS_XID V RATE
Let's examine each of these columns carefully. There may be more than one long running operation in the sessionespecia lly because the view
contains the history of all long running operations in previous sessions. The column OPNAME shows that this record is for "Transactio n Rollback,"
which points us in the right direction. The column TIME_REMAINING shows the estimated remaining time in seconds, described earlier and the
column ELAPSED_SECONDS shows the time consumed so far.
So how does this table offer an estimate of the remaining time? Clues can be found in the columns TOTALWORK, which shows the total amount of
"work" to do, and SOFAR, which shows how much has been done so far. The unit of work is shown in column UNITS. In this case, it's in blocks;
therefore, a total of 10,234 blocks have been rolled back so far, out of 20,554. The operation so far has taken 77 seconds. Hence the remaining
blocks will take:
77 * ( 10234 / (20554-10234) ) ??77 seconds
But you don't have to take that route to get the number; it's shown clearly for you. Finally, the column LAST_UPDATE_TIM E shows the time as of
which the view contents are current, which will serve to reinforce your interpretation of the results.
SQL Statement
Another important new piece of information is the identifier of the SQL statement that is being rolled back. Earlier, the SQL_ADDRESS and
SQL_HASH_VALUE were used to get the SQL statement that was being rolled back. The new column SQL_ID corresponds to the SQL_ID of the
view V$SQL as shown below:
SELECT SQL_TEXT
FROM V$SQL
WHERE SQL_ID = <value of SQL_ID from V$SESSION_LONGO PS>;
This query returns the statement that was rolled back, thereby providing an additional check along with the address and hash value of the SQL
statement.
Parallel Instance Recovery
If the DML operation was a parallel operation, the column QCSID shows the SID of the parallel query server sessions. In the event of a parallel
rollback, such as during instance recovery and subsequent recovery of a failed transaction, this information often comes in handy.
For example, suppose that during a large update the instance shuts down abnormally. When the instance comes up, the failed transaction is rolled
back. If the value of the initialization parameter for parallel recovery is enabled, the rollback occurs in parallel instead of serially, as it occurs in
regular transaction rollback. The next task is to estimate the completion time of the rollback process.
The view V$FAST_START_TR ANSACTIONS shows the transaction(s) occurring to roll-back the failed ones. A similar view, V
$FAST_START_SER VERS, shows the number of parallel query servers working on the rollback. These two views were available in previous
versions, but the new column XID, which indicates transaction identifier, makes the joining easier. In Oracle9i Database and below, you would have
had to join the views on three columns (USN - Undo Segment Number, SLT - the Slot Number within the Undo Segment, and SEQ - the sequence
number). The parent sets were shown in PARENTUSN, PARENTSLT, and PARENTSEQ. In Oracle Database 10g, you only need to join it on the
XID column and the parent XID is indicated by an intuitive name: PXID.
The most useful piece of information comes from the column RCVSERVERS in V$FAST_START_TR ANSACTIONS view. If parallel rollback is
going on, the number of parallel query servers is indicated in this column. You could check it to see how many parallel query processes started:
select rcvservers from v$fast_start_tr ansactions;
If the output shows just 1, then the transaction is being rolled back serially by SMON process--obviously an inefficient way to do that. You can
modify the initialization parameter RECOVERY_PARALL ELISM to value other than 0 and 1 and restart the instance for a parallel rollback. You can
then issue ALTER SYSTEM SET FAST_START_PARA LLEL_ROLLBACK = HIGH to create parallel servers as much as 4 times the number of
CPUs.
If the output of the above query shows anything other than 1, then parallel rollback is occurring. You can query the same view (V
$FAST_START_TRA NSACTIONS) to get the parent and child transactions (parent transaction id - PXID, and child - XID). The XID can also be
used to join this view with V$FAST_START_SE RVERS to get additional details.
Conclusion
In summary, when a long-running transaction is rolling back in Oracle Database 10gbe it the parallel instance recovery sessions or a user issued
rollback statementall you have to do is to look at the view V$SESSION_LONGO PS and estimate to a resolution of a second how much longer it
Comment