Oracle 11g闪回flashback(八)

2015-02-02 13:37:22 · 作者: · 浏览: 84
ame from v$tablespace;


NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
TESTTS
TEMP2
TEMP3
UNDOTBS2
TEST_TRAN_TS


11 rows selected.


SQL> create tablespace test_flashback_database datafile '/u01/app/oracle/oradata/jiagulun/test_flashback_database.dbf' size 10m;


Tablespace created.


SQL>? select name from v$tablespace;


NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
TESTTS
TEMP2
TEMP3
UNDOTBS2
TEST_TRAN_TS


NAME
------------------------------
TEST_FLASHBACK_DATABASE


12 rows selected.


SQL>
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>? flashback database to timestamp to_date('20150124 23:47:01','yyyymmdd hh24:mi:ss');


Flashback complete.


SQL> startup force
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.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open



SQL> alter database open resetlogs;--为什么会要求open为resetlog?
因为:数据库被闪回了,那么从闪回前在到闪回点的重做日志对于数据库来说已经是无效的了。所以要求重设日志。
SQL> alter database open read only;--有两种模式:read only、read write;之所以为这种状态,因为数据库在闪回后,就不是现在的数据库了


数据库的状态发生了改变,不希望其他用户登录进来防止出现问题


Database altered.


SQL> select name from v$tablespace;


NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
TESTTS
TEMP2
TEMP3
UNDOTBS2
TEST_TRAN_TS


TEST_FLASHBACK_DATABASE--已经不存在了,被闪回了
11 rows selected.


SQL>


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
? 2? ;


Database altered.


SQL>
SQL> archive log list;
Database log mode? ? ? ? ? ? ? Archive Mode
Automatic archival? ? ? ? ? ? Enabled
Archive destination? ? ? ? ? ? /u01/app/oracle/archive/archive02/
Oldest online log sequence? ? 1
Next log sequence to archive? 1
Current log sequence? ? ? ? ? 1
SQL>? alter database noarchivelog;--归档变成非归档
alter database noarchivelog
*
ERROR at line 1:
ORA-38774: cannot disable media recovery - flashback database is enabled


--表示在flashback状态不能变成非归档


SQL> alter database flashback off;--关闭flashback


Database altered.


SQL>? alter database noarchivelog;--再进行归档到非归档的切换


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? ? 1
Current log sequence? ? ? ? ? 1


SQL> alter database open;


Database altered.


SQL>


相关阅读: