SQL> select * from chenxy;
I
----------------------
10
20
|
SQL> shutdown immediate;
SQL> ! cp /u01/oradata/denver/*.dbf /u01/backup
|
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2009-05-05 23:23:11
SQL> truncate table t;
Table truncated.
|
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
|
SQL> startup mount;
ORACLE instance started.
Total System Global Area 420549952 bytes
Fixed Size 451904 bytes
Variable Size 385875968 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
|
SQL> ! cp /u01/backup/*.dbf /u01/oradata/denver/
|
SQL> select file#,to_char(time,'yyyy-mm-dd hh24:mi:ss') from v$recover_file;
FILE#
TO_CHAR(TIME,'YYYY-
--------
---
-- -------------------
1
2009-05-05 23:20:18
2
2009-05-05 23:20:18
3
2009-05-05 23:20:18
4
2009-05-05 23:20:18
5
2009-05-05 23:20:18
6
2009-05-05 23:20:18
|
SQL> recover database until time '2009-05-05 23:23:24';
Media recovery complete.
|
SQL> alter database open resetlogs;
Database altered.
SQL> select * from chenxy;
I
--------------------
10
20
|
SQL> shutdown immediate;
SQL> ! cp /u01/oradata/denver/*.dbf /u01/backup
SQL> ! cp /u01/oradata/denver/*.
ctl
/u01/backup
SQL>startup
SQL> alter system switch logfile;
|
SQL> startup
ORACLE instance started.
Total System Global Area 420549952 bytes
Fixed Size 451904 bytes
Variable Size 385875968 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
ORA-00338: log 2 of thread 1 is more recent than controlfile
ORA-00312: online log 2 thread 1: '/u01/oradata/denver/redo02.log'
|
SQL> alter database open resetlogs;
Database altered.
SQL> select status from v$instance;
STATUS
------------
OPEN
|
SQL> select current_scn from v$database;
#
或
SQL> select dbms_flashback.get_system_change_number scn from dual;
SCN
--------------------
1673513
|
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
|
SQL> startup mount;
ORACLE instance started.
Total System Global Area
420549952 bytes
Fixed Size 451904 bytes
Variable Size
385875968 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
|
SQL> ! cp /u01/backup/*.dbf /u01/oradata/denver/
|
SQL> select file#,change# from v$recover_file;
FILE# CHANGE#
---------- ----------
1
1673087
2
1673087
3
1673087
4
1673087
5
1673087
6
1673087
7
1673087
|
SQL> recover database until
change 1673513
;
Media recovery complete.
|
SQL> alter database open resetlogs;
Database altered.
SQL> select * from chenxy;
I
--------------------
10
20
|
SQL> shutdown immediate;
SQL> ! cp /u01/oradata/denver/*.dbf /u01/backup
SQL> ! cp /u01/oradata/denver/*.
ctl
/u01/backup
SQL>startup
SQL> alter system switch logfile;
|
SQL>shutdown immediate;
SQL>startup mount;
SQL>! cp /u01/backup/*.dbf /u01/oradata/denver/
SQL> recover database until
cancel;
Media recovery complete.
SQL>alter database open resetlogs;
|
SQL> drop tablespace chenxy including contents;
Tablespace dropped.
SQL> select * from chenxy;
select * from chenxy
ERROR at line 1:
ORA-00942: table or view does not exist
|
SQL> show parameter background_dump_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
background_dump_dest string /u01/admin/denver/bdump
SQL>! less /u01/admin/denver/bdump/alert_denver.log
Wed May 6 00:10:19 2009
drop tablespace chenxy including contents
Completed: drop tablespace chenxy including contents
|
SQL>shutdown immediate;
SQL>startup mount;
#
此
时
把控制文件也
复
制
过
来
SQL>! cp /u01/backup/*.dbf /u01/oradata/denver/
SQL>! cp /u01/backup/*.bak /u01/oradata/denver/
SQL>recover database until time '2009-05-05 23:50:24' using backup controlfile
SQL>alter database open resetlogs
|