Wednesday, October 7, 2009

Investigating the Data Entry Time using Flashback Query

 

On 5th October 2009, at 7:00AM, we have been reported of a problem which is pertaining to the Forecast for HAL. After through analysis, we found that this has occurred because there was double entry HAL records in the EXPECTED_RATIO. Our next concern was at what time this double entry was done.

 

Was it done by the Planning Engineers when they did the entry on 4th October in the EXPECTED_RATIO table for the forecast of 5th October or Was it done by the Engineers during the night shift as the problem started after the successful completion of the 1:00AM reading.

 

To Find out this, we are using the Flashback Query Feature of Oracle.

 

What is Flashback Query :

 

Flashback Query provides a simple, powerful and completely non-disruptive mechanism for recovering from human errors. It allows users to view the state of data at a point in time in the past without requiring any structural changes to the database.

 

Or in Simple Terms

Table data can be queried as it existed at a point in time.

 

We understood from the users that they were experiencing the problem since 2:00 AM. So, we gave the following Query on the Live Database on 7th October at 14:00hrs.

 

 

SQL> SELECT * FROM EXPECTED_RATIO AS OF TIMESTAMP TO_TIMESTAMP('05-OCT-2009 01:15:00','DD-MON-YYYY HH24:MI:SS') WHERE RATIO_DATE>'04-OCT-09'

 

 

RATIO_DAT RATIO_TIME AREA_ID    RATIO_PERCENTAGE  RATIO_SEQ

--------- ---------- ---------- ---------------- ----------

05-OCT-09 00:00      HAL                    1.01          1

05-OCT-09 00:00      QSM                   1.008          1

05-OCT-09 00:00      RUH                    .986          1

05-OCT-09 01:00      HAL              1.01948052          1

05-OCT-09 01:00      QSM               .99559859          1

05-OCT-09 01:00      RUH              1.00820853          1

05-OCT-09 02:00      HAL               .99044586          1

05-OCT-09 02:00      QSM               .99734748          1

05-OCT-09 02:00      RUH               .99171547          1

05-OCT-09 03:00      HAL               .97749196          1

05-OCT-09 03:00      QSM               .96631206          1

05-OCT-09 03:00      RUH               .97580297          1

05-OCT-09 04:00      HAL               .97039474          1

05-OCT-09 04:00      QSM               .96422018          1

05-OCT-09 04:00      RUH               .97830258          1

05-OCT-09 05:00      HAL               .99322034          1

05-OCT-09 05:00      QSM               .97240723          1

05-OCT-09 05:00      RUH               .96394086          1

05-OCT-09 06:00      HAL               .86006826          1

05-OCT-09 06:00      QSM               .94129159          1

05-OCT-09 06:00      RUH               .93817499          1

05-OCT-09 07:00      HAL               .97619048          1

05-OCT-09 07:00      QSM               .98960499          1

05-OCT-09 07:00      RUH              1.01351351          1

05-OCT-09 08:00      HAL              1.07723577          1

05-OCT-09 08:00      QSM              1.11239496          1

05-OCT-09 08:00      RUH              1.07209877          1

05-OCT-09 09:00      HAL              1.05660377          1

05-OCT-09 09:00      QSM              1.05288008          1

05-OCT-09 09:00      RUH              1.05419929          1

05-OCT-09 10:00      HAL              1.05714286          1

05-OCT-09 10:00      QSM              1.06457399          1

05-OCT-09 10:00      RUH              1.05913195          1

05-OCT-09 11:00      HAL              1.01013514          1

05-OCT-09 11:00      QSM              1.01179444          1

05-OCT-09 11:00      RUH              1.03492849          1

05-OCT-09 12:00      HAL              1.01003344          1

05-OCT-09 12:00      QSM               .97002498          1

05-OCT-09 12:00      RUH               .98937018          1

05-OCT-09 13:00      HAL               .99668874          1

05-OCT-09 13:00      QSM               .98798283          1

05-OCT-09 13:00      RUH              1.00993822          1

05-OCT-09 14:00      HAL              1.05980066          1

05-OCT-09 14:00      QSM              1.04604692          1

05-OCT-09 14:00      RUH              1.01023936          1

05-OCT-09 15:00      HAL              1.02821317          1

05-OCT-09 15:00      QSM              1.02574751          1

05-OCT-09 15:00      RUH              1.01171515          1

05-OCT-09 16:00      HAL               .96036585          1

05-OCT-09 16:00      QSM               .98218623          1

05-OCT-09 16:00      RUH               .97215717          1

05-OCT-09 17:00      HAL               .95555556          1

05-OCT-09 17:00      QSM               .98598516          1

05-OCT-09 17:00      RUH                .9760439          1

05-OCT-09 18:00      HAL               .96345515          1

05-OCT-09 18:00      QSM               .97073579          1

05-OCT-09 18:00      RUH               1.0076786          1

05-OCT-09 19:00      HAL              1.14137931          1

05-OCT-09 19:00      QSM              1.00861326          1

05-OCT-09 19:00      RUH              1.02054701          1

05-OCT-09 20:00      HAL               .96374622          1

05-OCT-09 20:00      QSM                .9675491          1

05-OCT-09 20:00      RUH               .96773333          1

05-OCT-09 21:00      HAL               .98119122          1

05-OCT-09 21:00      QSM                .9788173          1

05-OCT-09 21:00      RUH               .97451088          1

05-OCT-09 22:00      HAL               .99361022          1

05-OCT-09 22:00      QSM               .98016231          1

05-OCT-09 22:00      RUH               .99773788          1

05-OCT-09 23:00      HAL               .96784566          1

05-OCT-09 23:00      QSM               .97424103          1

05-OCT-09 23:00      RUH               .97775259          1

05-OCT-09 24:00      HAL              1.00996678          1

05-OCT-09 24:00      QSM              1.00849858          1

05-OCT-09 24:00      RUH               .98637681          1

 

75 rows selected.

 

 

SQL> SELECT * FROM EXPECTED_RATIO AS OF TIMESTAMP TO_TIMESTAMP('05-OCT-2009 02:15:00','DD-MON-YYYY HH24:MI:SS') WHERE RATIO_DATE>'04-OCT-09'

 

RATIO_DAT RATIO_TIME AREA_ID    RATIO_PERCENTAGE  RATIO_SEQ

--------- ---------- ---------- ---------------- ----------

05-OCT-09 00:00      HAL                    1.01          1

05-OCT-09 00:00      QSM                   1.008          1

05-OCT-09 00:00      RUH                    .986          1

05-OCT-09 01:00      HAL              1.01948052          1

05-OCT-09 01:00      QSM               .99559859          1

05-OCT-09 01:00      RUH              1.00820853          1

05-OCT-09 02:00      HAL               .99044586          1

05-OCT-09 02:00      QSM               .99734748          1

05-OCT-09 02:00      RUH               .99171547          1

05-OCT-09 03:00      HAL               .97749196          1

05-OCT-09 03:00      QSM               .96631206          1

05-OCT-09 03:00      RUH               .97580297          1

05-OCT-09 04:00      HAL               .97039474          1

05-OCT-09 04:00      QSM               .96422018          1

05-OCT-09 04:00      RUH               .97830258          1

05-OCT-09 05:00      HAL               .99322034          1

05-OCT-09 05:00      QSM               .97240723          1

05-OCT-09 05:00      RUH               .96394086          1

05-OCT-09 06:00      HAL               .86006826          1

05-OCT-09 06:00      QSM               .94129159          1

05-OCT-09 06:00      RUH               .93817499          1

05-OCT-09 07:00      HAL               .97619048          1

05-OCT-09 07:00      QSM               .98960499          1

05-OCT-09 07:00      RUH              1.01351351          1

05-OCT-09 08:00      HAL              1.07723577          1

05-OCT-09 08:00      QSM              1.11239496          1

05-OCT-09 08:00      RUH              1.07209877          1

05-OCT-09 09:00      HAL              1.05660377          1

05-OCT-09 09:00      QSM              1.05288008          1

05-OCT-09 09:00      RUH              1.05419929          1

05-OCT-09 10:00      HAL              1.05714286          1

05-OCT-09 10:00      QSM              1.06457399          1

05-OCT-09 10:00      RUH              1.05913195          1

05-OCT-09 11:00      HAL              1.01013514          1

05-OCT-09 11:00      QSM              1.01179444          1

05-OCT-09 11:00      RUH              1.03492849          1

05-OCT-09 12:00      HAL              1.01003344          1

05-OCT-09 12:00      QSM               .97002498          1

05-OCT-09 12:00      RUH               .98937018          1

05-OCT-09 13:00      HAL               .99668874          1

05-OCT-09 13:00      QSM               .98798283          1

05-OCT-09 13:00      RUH              1.00993822          1

05-OCT-09 14:00      HAL              1.05980066          1

05-OCT-09 14:00      QSM              1.04604692          1

05-OCT-09 14:00      RUH              1.01023936          1

05-OCT-09 15:00      HAL              1.02821317          1

05-OCT-09 15:00      QSM              1.02574751          1

05-OCT-09 15:00      RUH              1.01171515          1

05-OCT-09 16:00      HAL               .96036585          1

05-OCT-09 16:00      QSM               .98218623          1

05-OCT-09 16:00      RUH               .97215717          1

05-OCT-09 17:00      HAL               .95555556          1

05-OCT-09 17:00      QSM               .98598516          1

05-OCT-09 17:00      RUH                .9760439          1

05-OCT-09 18:00      HAL               .96345515          1

05-OCT-09 18:00      QSM               .97073579          1

05-OCT-09 18:00      RUH               1.0076786          1

05-OCT-09 19:00      HAL              1.14137931          1

05-OCT-09 19:00      QSM              1.00861326          1

05-OCT-09 19:00      RUH              1.02054701          1

05-OCT-09 20:00      HAL               .96374622          1

05-OCT-09 20:00      QSM                .9675491          1

05-OCT-09 20:00      RUH               .96773333          1

05-OCT-09 21:00      HAL               .98119122          1

05-OCT-09 21:00      QSM                .9788173          1

05-OCT-09 21:00      RUH               .97451088          1

05-OCT-09 22:00      HAL               .99361022          1

05-OCT-09 22:00      QSM               .98016231          1

05-OCT-09 22:00      RUH               .99773788          1

05-OCT-09 23:00      HAL               .96784566          1

05-OCT-09 23:00      QSM               .97424103          1

05-OCT-09 23:00      RUH               .97775259          1

05-OCT-09 24:00      HAL              1.00996678          1

05-OCT-09 24:00      QSM              1.00849858          1

05-OCT-09 24:00      RUH               .98637681          1

05-OCT-09 01:00      HAL                       0     202975

05-OCT-09 02:00      HAL                       0     202976

05-OCT-09 03:00      HAL                       0     202977

05-OCT-09 04:00      HAL                       0     202978

05-OCT-09 05:00      HAL                       0     202979

05-OCT-09 06:00      HAL                       0     202980

05-OCT-09 07:00      HAL                       0     202981

05-OCT-09 08:00      HAL                       0     202982

05-OCT-09 09:00      HAL                       0     202983

05-OCT-09 10:00      HAL                       0     202984

05-OCT-09 11:00      HAL                       0     202985

05-OCT-09 12:00      HAL                       0     202986

05-OCT-09 13:00      HAL                       0     202987

05-OCT-09 14:00      HAL                       0     202988

05-OCT-09 15:00      HAL                       0     202989

05-OCT-09 16:00      HAL                       0     202990

05-OCT-09 17:00      HAL                       0     202991

05-OCT-09 18:00      HAL                       0     202992

05-OCT-09 19:00      HAL                       0     202993

05-OCT-09 20:00      HAL                       0     202994

05-OCT-09 21:00      HAL                       0     202995

05-OCT-09 22:00      HAL                       0     202996

05-OCT-09 23:00      HAL                       0     202997

05-OCT-09 24:00      HAL                       0     202998

 

99 rows selected.

 

As can be seen from above, the changes did happen during the Night Shift after 1:00 AM.

 

 




Disclaimer: This message and its attachment, if any, are confidential and may contain legally privileged information. If you are not the intended recipient, please contact the sender immediately and delete this message and its attachment, if any, from your system. You should not copy this message or disclose its contents to any other person or use it for any purpose. Statements and opinions expressed in this e-mail are those of the sender, and do not necessarily reflect those of Saudi Electricity Company (SEC). SEC accepts no liability for damage caused by any virus transmitted by this email.

هذه الرسالة و مرفقاتها (إن وجدت) تمثل وثيقة سرية قد تحتوي على معلومات تتمتع بحماية وحصانة قانونية. إذا لم تكن الشخص المعني بهذه الرسالة يجب عليك تنبيه المُرسل بخطأ وصولها إليك، و حذف الرسالة و مرفقاتها (إن وجدت) من الحاسب الآلي الخاص بك. ولا يجوز لك نسخ هذه الرسالة أو مرفقاتها (إن وجدت) أو أي جزئ منها، أو البوح بمحتوياتها لأي شخص أو استعمالها لأي غرض. علماً بأن الإفادات و الآراء التي تحويها هذه الرسالة تعبر فقط عن رأي المُرسل و ليس بالضرورة رأي الشركة السعودية للكهرباء، ولا تتحمل الشركة السعودية للكهرباء أي مسئولية عن الأضرار الناتجة عن أي فيروسات قد يحملها هذا البريد.

No comments: