Friday , July 21 2017
Home / Oracle DBA / FLASHBACK FEATURES

FLASHBACK FEATURES

FLASHBACK FEATURES

FLASHBACK QUERY
—————————–
  1. CREATE TABLE flashback_query_test (  id  NUMBER(10));
  1. SELECT current_scn, TO_CHAR(SYSTIMESTAMP, ‘YYYY-MM-DD HH24:MI:SS’) FROM v$database;
CURRENT_SCN TO_CHAR(SYSTIMESTAM
———– ——————-
    722452 2004-03-29 13:34:12
  1. INSERT INTO flashback_query_test (id) VALUES (1);
  2. COMMIT;
  1. SELECT COUNT(*) FROM flashback_query_test;
COUNT(*)
———-
        1
  1. SELECT COUNT(*) FROM flashback_query_test AS OF TIMESTAMP TO_TIMESTAMP(‘2004-03-29 13:34:12’, ‘YYYY-MM-DD HH24:MI:SS’);
COUNT(*)
———-
        0
  1. SELECT COUNT(*) FROM flashback_query_test AS OF SCN 722452;
COUNT(*)
———-
        0

FLASHBACK VERSION QUERY
——————————————–

  1. CREATE TABLE flashback_version_query_test (  id           NUMBER(10),
description  VARCHAR2(50));
  1. INSERT INTO flashback_version_query_test (id, description) VALUES (1, ‘ONE’);
  1. COMMIT;
  1. SELECT current_scn, TO_CHAR(SYSTIMESTAMP, ‘YYYY-MM-DD HH24:MI:SS’) FROM v$database;
  1. UPDATE flashback_version_query_test SET description = ‘TWO’ WHERE id = 1;
  1. COMMIT;
  1. UPDATE flashback_version_query_test SET description = ‘THREE’ WHERE id = 1;
  1. COMMIT;
  1. SELECT current_scn, TO_CHAR(SYSTIMESTAMP, ‘YYYY-MM-DD HH24:MI:SS’) FROM v$database;
COLUMN versions_startscn FORMAT 99999999999999999
COLUMN versions_starttime FORMAT A24
COLUMN versions_endscn FORMAT 99999999999999999
COLUMN versions_endtime FORMAT A24
COLUMN versions_xid FORMAT A16
COLUMN versions_operation FORMAT A1
COLUMN description FORMAT A11
SET LINESIZE 200
  1. SELECT versions_startscn, versions_starttime,
versions_endscn, versions_endtime,
versions_xid, versions_operation,
description
      FROM   flashback_version_query_test
      VERSIONS BETWEEN TIMESTAMP TO_TIMESTAMP(‘2004-03-29 14:59:08’, ‘YYYY-MM-DD HH24:MI:SS’)
      AND TO_TIMESTAMP(‘2004-03-29 14:59:36’, ‘YYYY-MM-DD HH24:MI:SS’)
WHERE  id = 1;
  1. SELECT versions_startscn, versions_starttime,
versions_endscn, versions_endtime,
versions_xid, versions_operation,
description
      FROM flashback_version_query_test
      VERSIONS BETWEEN SCN 725202 AND 725219

WHERE  id = 1;

View More:
ORACLE INSTANCE TUNING WITH REPORTS
ORACLE DATABASE TUNING WITH EXAMPLES
PERFORMANCE TUNING IN ORACLE

Comments

comments

Check Also

DATA BASE LINKS

DATABASE LINKS: What are the db links? create a link from one database to another …

Leave a Reply

Your email address will not be published. Required fields are marked *