Oracle 11g闪回flashback(8)


SQL>
SQL> select * from address;
        ID NAME
----------- --------------------
          1 jiangxi
          2 hunan


SQL> alter session set recyclebin = off;--关闭回收站
Session altered


SQL> drop table address;
Table dropped


SQL> select * from user_recyclebin;--回收站为空的
OBJECT_NAME        ORIGINAL_NAME        OPERATION TYPE                  TS_NAME                CREATETIME DROPTIME      DROPSCN PARTITION_NAME      CAN_UNDROP CAN_PURGE    RELATED BASE_OBJECT PURGE_OBJECT      SPACE
------------------------------ -------------------------------- --------- ------------------------- ------------------------------ ------------------- ------------------- ---------- -------------------------------- ---------- --------- ---------- ----------- ------------ ----------


SQL> 

闪回数据库:
如果数据库出现逻辑错误,无法采用闪回表的方式进行恢

复,或者数据库的结构发生了改变,可以通过闪回数据库的

方式把整个数据库回退到出错前的时间点上。步骤:

1,配置数据库为归档模式

2,配置闪回恢复区

3,配置闪回保留时间

4,启用数据库闪回 alter database flashback on;

5,进行闪回数据库

flashback database to timestamp |scn


SQL> show user
USER is "SYS"
SQL> archive log list;--查看是否是归档模式
Database log mode              Archive Mode
Automatic archival            Enabled
Archive destination            /u01/app/oracle/archive/archive02/
Oldest online log sequence    362
Next log sequence to archive  365
Current log sequence          365
SQL> alter system set log_archive_start = false scope =spfile;--设置为不是自动归档(在9i后失效了,归档模式就是自动的)

System altered.

SQL> shutdown immediate--关闭数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount--打开数据库到mount状态
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area  400846848 bytes
Fixed Size                  2213776 bytes
Variable Size            276826224 bytes
Database Buffers          117440512 bytes
Redo Buffers                4366336 bytes
Database mounted.
SQL> alter database noarchivelog--修改为非归档模式
  2  ;

Database altered.

SQL> alter database open--打开数据库
  2  ;

------------------------------------前面是修改数据库为非归档模式------------------
Database altered.

SQL> archive log list;--查看是否归档
Database log mode              No Archive Mode
Automatic archival            Disabled
Archive destination            /u01/app/oracle/archive/archive02/
Oldest online log sequence    362
Current log sequence          365
SQL> clear
SQL> !clear

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival            Disabled
Archive destination            /u01/app/oracle/archive/archive02/
Oldest online log sequence    362
Current log sequence          365
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area  400846848 bytes
Fixed Size                  2213776 bytes
Variable Size            276826224 bytes
Database Buffers          117440512 bytes
Redo Buffers                4366336 bytes
Database mounted.
SQL> alter database archivelog;--修改为归档模式

Database altered.

SQL> alter database open;

Database altered.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/647f086b6eb914738c7dda51df50b04b.html