https://docs.oracle.com/en/database/oracle/oracle-database/19/adfns/flashback.html#GUID-28F62D88-B5DF-4A09-9D72-6605F9A56308

oralce 开启闪回

https://www.yuque.com/yongle-okrsc/kb/ti9m0a

1.创建闪回归档

By default, the system has no default Flashback Data Archive. If you are logged on as SYSDBA, you can specify default Flashback Data Archive in either of these ways:

  1. ####创建默认闪回#######
  2. CREATE FLASHBACK ARCHIVE DEFAULT fla1 TABLESPACE users
  3. QUOTA 10G RETENTION 1 YEAR;
  4. #####创建普通闪回############
  5. CREATE FLASHBACK ARCHIVE fla2 TABLESPACE tbs2 RETENTION 2 YEAR;

2.修改默认闪回归档

  1. ALTER FLASHBACK ARCHIVE fla1 SET DEFAULT;

3.添加表空间到指定闪回归档并限制配额

  1. ALTER FLASHBACK ARCHIVE fla1 ADD TABLESPACE tbs3 QUOTA 5G;

4.添加表空间到指定闪回归档

  1. ALTER FLASHBACK ARCHIVE fla1 ADD TABLESPACE tbs4;
  • y

    5.修改指定闪回归档对指定表空间的空间配额

    1. ALTER FLASHBACK ARCHIVE fla1 MODIFY TABLESPACE tbs3 QUOTA 20G;
  • 6op

    6.修改闪回归档的表空间属性

    1. ALTER FLASHBACK ARCHIVE fla1 MODIFY TABLESPACE tbs1;
  • y

    7.修改闪回归档的保留时间

  • opy

    1. ALTER FLASHBACK ARCHIVE fla1 MODIFY RETENTION 2 YEAR;

    8.从闪回归档移除特定表空间

    1. ALTER FLASHBACK ARCHIVE fla1 REMOVE TABLESPACE tbs2;
  • (Tablespace tbs2 is not dropped.)

    9.删除特定闪回归档的全部日志

    1. ALTER FLASHBACK ARCHIVE fla1 PURGE ALL;

    10.删除特定时间点之后的闪回归档日志

    1. ALTER FLASHBACK ARCHIVE fla1 PURGE BEFORE TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' DAY);

    11.删除特定scn之后的闪回归档日志

    1. ALTER FLASHBACK ARCHIVE fla1 PURGE BEFORE SCN 728969;

    12.删除特定闪回归档

    ``` DROP FLASHBACK ARCHIVE fla1;

  1. <a name="EZ7bK"></a>
  2. #### 13.建表使用默认闪回归档

CREATE TABLE employee (EMPNO NUMBER(4) NOT NULL, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4)) FLASHBACK ARCHIVE;

  1. <a name="qZt9O"></a>
  2. #### 14.建表使用指定闪回归档

CREATE TABLE employee (EMPNO NUMBER(4) NOT NULL, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4)) FLASHBACK ARCHIVE fla1;

  1. <a name="Cw27C"></a>
  2. #### 15.表启用默认闪回归档

ALTER TABLE employee FLASHBACK ARCHIVE;

  1. <a name="a2xzh"></a>
  2. #### 16.表指定闪回归档

ALTER TABLE employee FLASHBACK ARCHIVE fla1;

  1. <a name="JPis9"></a>
  2. #### 17.表禁用默认闪回归档

ALTER TABLE employee NO FLASHBACK ARCHIVE; ```