A table is a software application where data misuse are cleared, and now want to recover between emptying, such as at 14:13 on August 2013, before the date should be how to operate?
It can trigger a series of a series of knowledge through this problem.
1, if you can use open flashback flash back to the table.
How to view my database have not turned flashback
flashback database requires that the database must be in archive mode , and must be used after resetlogs Flashback open the database
view database archiving and flashback mode is enabled
SQL> the SELECT log_mode, open_mode, flashback_on from v $ Database;
LOG_MODE open_mode FLASHBACK_ON
------ ------------- ----------------- -------------------- ----
ARCHIVELOG the READ WRITE NO
FLASHBACK_ON to NO, it means Flashback features not enabled
oracle database archiving mode
Oracle Database has an online redo log, the log is a record modifications made to the database, such as insert, delete, update data, these operations will be recorded in the online redo log.
Mode Introduction
How to view the current oracle in archive mode or non-archive mode
1、
selectname, log_mode, open_mode from v $ Database;
NAME LOG_MODE open_mode
--------- ------------ ---------------- -
CKDB ARCHIVELOG the READ WRITE
if filing mode, LOG_MODE = ARCHIVELOG
if the non-filing mode, LOG_MODE = NOARCHIVELOG
2、
Input: archive log list Enter, you can see whether the archive mode
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 31
Current log sequence 33
How oracle database is open archives
If you do not open oracle database archiving mode, for misuse it would be disastrous, and impossible to restore. Here's how to verify whether the oracle archive models and methods how to turn filing mode is turned on.
- Open archive mode
1> First, open the cmd command window: sqlplus / as sysdba login database
2> After a successful login to the database, enter the command: select log_mode from v $ database used to check filing mode
3> After the query can see log_ mode is noarchivelog explain archive mode is not archiving mode
4> with shutdown immediate shutdown normal or close the database
5> Wait database normally closed
6> After the database is closed, starting the database with startup mount, load an instance of the database but Close
7> use the command: alter database archivelog; open the log file, the database returns the message has been changed after the successful execution of the command
8> use the command: alter database open; open the database to complete the overall operation
9> alter system archive log start; (enable automatic archiving)
10> exit (exit)
11> Verify the archive logs. Repeating the first step, execute the command: select log_mode v $ database, see the execution result archivelog
Do a full backup, because the non-archive log backup log mode generated for archiving model has been unusable. This step is very important non-!
2. Change archive mode to the non-archive mode:
Check oracle is turned flashback to view delete records
Check oracle flashback function is turned on,
--FLASHBACK_ON to NO, it means Flashback features not enabled
select log_mode,open_mode,flashback_on from v$database;
View deleting records oracle
select * from user_recyclebin;
After a difficult process described above, the following operate Flashback:
(One)
If you turn on flashback can use the Flashback Table.
select log_mode, flashback_on from v $ database ;
if the result is below the opening flashback
LOG_MODE FLASHBACK_ON
------------ ------------------
ARCHIVELOG YES
Can execute the command
alter table table enable row movement; - turn table row moving
flashback table to_timestamp timestamp table to ( '20,130,813 14:00:00', 'YYYYMMDD HH24: mi The: SS');
- flash back at 14:00 on August 13 2013
If you do not open, logical backup can use imp command to import data.
If useless logical backup, open archive mode, the physical backup can be shut down, data loss, it can be employed not fully restored
by rman login
rman target /
execute command
RUN {the shutdown immediate;
Startup Mount;
SET an until Time = "TO_DATE ( '20,130,813 14:00:00', 'YYYYMMDD HH24: mi The: SS') ";
Restore Database;
Recover Database;
ALTER Open Database RESETLOGS;}
remember! Before doing anything more than make a backup, or a problem with regret.
And I suggest you contact your database administrator to deal with this problem.
(two)
If only one table, then it is quite simple.
Below is an example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
SQL>
CREATE
TABLE
test_fb_table (
2 ID
int
,
3 VAL VARCHAR2(10)
4 );
Table
created.
SQL>
INSERT
INTO
test_fb_table
VALUES
(1,
'TEST'
);
1 row created.
SQL>
commit
;
Commit
complete.
假如 数据被错误的删除/更新
需要检索某个时间点上,表原有的数据。
SQL>
SELECT
TO_CHAR(sysdate,
'yyyy-mm-dd hh24:mi:ss'
)
FROM
dual;
TO_CHAR(SYSDATE,
'YYYY-MM-DDHH24:MI:SS'
--------------------------------------
2010-11-07 13:01:37
这里删除掉数据。
SQL>
delete
from
test_fb_table;
1 row deleted.
SQL>
commit
;
Commit
complete.
确认数据已经被删除。
SQL>
select
*
from
test_fb_table;
no
rows
selected
|
1
2
3
4
5
6
7
|
这里检索出,指定时间点上,指定表的数据情况。
SQL>
select
*
from
test_fb_table
2
AS
OF
TIMESTAMP
TO_TIMESTAMP(
'2010-11-07 13:01:37'
,
3
'yyyy-mm-dd hh24:mi:ss'
);
ID VAL
---------- --------------------
1 TEST
|
For you, that is, you need to
Temporary table CREATE TABLE AS
select * from your table that deleted data
AS OF TIMESTAMP TO_TIMESTAMP('2013-08-13 14:00:00', 'yyyy-mm-dd hh24:mi:ss');
In this way, had put on that point in time, that table data copied to a temporary table inside.
after that
INSERT INTO that your deleted data table SELECT * FROM temporary table;
Note: You need to determine what, that deleted data table above, there is no trigger or something.
Yes, you may need to temporarily disable the swap, insert data recovery over again.
(C) (no dba privileges)
If you have a database backup and log backup, in order to solve your problem, to restore data to a point in time.
Otherwise it is impossible to achieve.
If you have a backup, you can let the DBA to help restore a new database, and then copy the data you out of this table to the original database.
(D) (dba no permission)
Need to use the flash back to the table flashback table, you can not do, find it dba