SQL> create user me identified by oracle;User created.SQL> grant dba to me;Grant succeeded.SQL> connect me/oracle Connected. SQL> create table test (f1 varchar2(10));Table created.SQL> insert into test values ('hello');1 row created.SQL> commit;Commit complete.SQL> conn / as sysdba Connected. SQL> select to_char(sysdate,'yyyymmddhh24miss') from dual;TO_CHAR(SYSDAT -------------- 20090915124126SQL> drop user me; drop user me * ERROR at line 1: ORA-01922: CASCADE must be specified to drop 'ME' SQL> drop user me cascade;User dropped.SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount; ORACLE instance started.Total System Global Area 1157627904 bytes Fixed Size 2072224 bytes Variable Size 419430752 bytes Database Buffers 721420288 bytes Redo Buffers 14704640 bytes Database mounted.SQL> flashback database to timestamp to_timestamp('20090915124126','yyyymmddhh24miss');Flashback complete.SQL> alter database open resetlogs;Database altered.SQL> conn me/oracle Connected. SQL> select * from test;F1 ---------- hello flashback database 就是利用undo中的紀錄進行“倒帶”。
SQL> create user me identified by oracle;User created.SQL> grant dba to me;Grant succeeded.SQL> connect me/oracle
Connected.
SQL> create table test (f1 varchar2(10));Table created.SQL> insert into test values ('hello');1 row created.SQL> commit;Commit complete.SQL> conn / as sysdba
Connected.
SQL> select to_char(sysdate,'yyyymmddhh24miss') from dual;TO_CHAR(SYSDAT
--------------
20090915124126SQL> drop user me;
drop user me
*
ERROR at line 1:
ORA-01922: CASCADE must be specified to drop 'ME'
SQL> drop user me cascade;User dropped.SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.Total System Global Area 1157627904 bytes
Fixed Size 2072224 bytes
Variable Size 419430752 bytes
Database Buffers 721420288 bytes
Redo Buffers 14704640 bytes
Database mounted.SQL> flashback database to timestamp to_timestamp('20090915124126','yyyymmddhh24miss');Flashback complete.SQL> alter database open resetlogs;Database altered.SQL> conn me/oracle
Connected.
SQL> select * from test;F1
----------
hello
flashback database 就是利用undo中的紀錄進行“倒帶”。
在flashback开启的情况下,而且有足够的flashback log的前提下,是可以通过flashback database 闪回drop掉的用户的。但是2楼的说法不对,不是用undo表空间,而是使用的flashback的日志,所以必须flashback已经打开,而且日志充足。