Tuesday, 23 January 2018

How to enable Flashback in oracle database 11g

How to enable Flashback in oracle database 11g


[oracle@dba1 ]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 23 20:27:54 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 1703624704 bytes
Fixed Size                  2229024 bytes
Variable Size             419433696 bytes
Database Buffers         1275068416 bytes
Redo Buffers                6893568 bytes
Database mounted.
Database opened.
SQL> !df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             8.8G  6.0G  2.3G  73% /
/dev/sda7             4.9G  153M  4.5G   4% /tmp
/dev/sda5             8.7G  7.0G  1.3G  86% /home
/dev/sda2              13G  5.7G  6.6G  47% /u01
/dev/sda1             4.9G  178M  4.5G   4% /boot
tmpfs                 2.7G     0  2.7G   0% /dev/shm

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Current log sequence           3
SQL> sho parameter db_recover

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_
                                                 area
db_recovery_file_dest_size           big integer 4122M
SQL>
SQL>
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

1) Database should be in archive log mode


SQL> startup mount;
ORACLE instance started.

Total System Global Area 1703624704 bytes
Fixed Size                  2229024 bytes
Variable Size             419433696 bytes
Database Buffers         1275068416 bytes
Redo Buffers                6893568 bytes
Database mounted.

SQL> 
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Next log sequence to archive   3
Current log sequence           3
SQL>
SQL>
SQL>
SQL> sho parameter db_recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_
                                                 area
db_recovery_file_dest_size           big integer 4122M
SQL>
SQL>
SQL>
SQL>
SQL> sho parameter undo

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1
SQL>
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

2)  Enable Flashback 

SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area 1703624704 bytes
Fixed Size                  2229024 bytes
Variable Size             419433696 bytes
Database Buffers         1275068416 bytes
Redo Buffers                6893568 bytes
Database mounted.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO

SQL>
SQL> alter database flashback on;

Database altered.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

SQL>
SQL> alter database open;

Database altered.

SQL>
SQL> select NAME,OPEN_MODE,FLASHBACK_ON,LOG_MODE from v$database;

NAME      OPEN_MODE            FLASHBACK_ON       LOG_MODE
--------- -------------------- ------------------ ------------
PRD       READ WRITE           YES                ARCHIVELOG


No comments:

Post a Comment