ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 闪回数据库操作流程

闪回数据库操作流程

原创 Linux操作系统 作者:whuisszjy 时间:2013-03-31 15:33:29 0 删除 编辑
SQL> show parameter db_recovery_file_dest_size;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest_size           big integer 2600M
SQL> show parameter db_recovery_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/flash_recovery
                                                 _area
db_recovery_file_dest_size           big integer 2600M
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             239078488 bytes
Database Buffers           67108864 bytes
Redo Buffers                6336512 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database flashback on;

Database altered.

SQL> select name , log_mode,flashback_on from v$database;

NAME      LOG_MODE     FLASHBACK_ON
--------- ------------ ------------------
ORCL      ARCHIVELOG   YES

SQL> alter database open;

Database altered.

SQL> alter session set nls_date_formate='yyyy-mm-dd hh24:mi:ss';
alter session set nls_date_formate='yyyy-mm-dd hh24:mi:ss'
*
ERROR at line 1:
ORA-00922: missing or invalid option


SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

Session altered.

SQL> select sysdate ,current_scn from v$database;

SYSDATE             CURRENT_SCN
------------------- -----------
2013-03-31 15:25:48     1054061

SQL> drop user scott cascade;

User dropped.

SQL> select sysdate , current_scn from $vdatabase;
select sysdate , current_scn from $vdatabase
                                  *
ERROR at line 1:
ORA-00911: invalid character


SQL> select sysdate , current_scn from v$database;

SYSDATE             CURRENT_SCN
------------------- -----------
2013-03-31 15:26:45     1054249

SQL> select * from v$flashback_database_log;

OLDEST_FLASHBACK_SCN OLDEST_FLASHBACK_TI RETENTION_TARGET FLASHBACK_SIZE ESTIMATED_FLASHBACK_SIZE
-------------------- ------------------- ---------------- -------------- ------------------------
             1053838 2013-03-31 15:22:25             1440        8192000       0

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             239078488 bytes
Database Buffers           67108864 bytes
Redo Buffers                6336512 bytes
Database mounted.
SQL> flashback database to timestape to_date('2013-03-31 15:26:45','yyyy-mm-dd hh24:mi:ss');
flashback database to timestape to_date('2013-03-31 15:26:45','yyyy-mm-dd hh24:mi:ss')
                      *
ERROR at line 1:
ORA-38724: Invalid option to the FLASHBACK DATABASE command.


SQL> flashback database to timestamp to_date('2013-03-31 15:26:45','yyyy-mm-dd hh24:mi:ss');

Flashback complete.

SQL> alter database open read only;

Database altered.

SQL> select * from scott.test_query;
select * from scott.test_query
                    *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             239078488 bytes
Database Buffers           67108864 bytes
Redo Buffers                6336512 bytes
Database mounted.
SQL>  flashback database to timestamp to_date('2013-03-31 15:23:45','yyyy-mm-dd hh24:mi:ss');

Flashback complete.

SQL> alter database open read only;

Database altered.

SQL> select * from scott.test_query;

        ID NAME           SALARY
---------- ---------- ----------
         4 Chris            4400
         3 Lisa             7700
         2 William          6600
         1 John             5500

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             239078488 bytes
Database Buffers           67108864 bytes
Redo Buffers                6336512 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15874751/viewspace-757505/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-01-26

  • 博文量
    9
  • 访问量
    9247