首页 > 代码库 > 验证undo切换后,还能不能查处以前的数据
验证undo切换后,还能不能查处以前的数据
实验步骤整理:
conn scott/tiger
drop table t;
create table t as select * from dept;
查看有几个undo表空间
select tablespace_name,contents,extent_management from dba_tablespaces;
set time on
show parameter undo确认当前使用的undo表空间,删掉不用的undo表空间,防止混乱
conn scott/tiger
delete from t;
commit;
alter system checkpoint;
alter system flush buffer_cache;
select * from t as of timestamp to_timestamp(‘2016-12-08 17:04:05‘,‘yyyy-mm-dd hh24:mi:ss‘);此时可以查到数据
#select tablespace_name,block_size,status,contents,segment_space_management from dba_tablespaces;
alter system checkpoint;
alter system flush buffer_cache;
create undo tablespace undotbs datafile ‘/u01/app/oracle/oradata/ORA11GR2/undotbs.dbf‘ size 10m reuse;建立新的undo表空间
alter system set undo_tablespace=‘UNDOTBS2‘;
#select tablespace_name,block_size,status,contents,segment_space_management from dba_tablespaces;
alter tablespace undotbs1 offline;
drop tablespace undotbs1 including contents and datafiles;
show parameter undo
conn scott/tiger
select * from t as of timestamp to_timestamp(‘2016-12-08 17:04:05‘,‘yyyy-mm-dd hh24:mi:ss‘);
经验证如果我不删除undotbs1,那么发现切换前的数据仍然能查到,不解
验证undo切换后,还能不能查处以前的数据