A customer is concerned about the recovery of logical errors. The solution we recommend to him is to use the flashback Technology on the disaster recovery database. Below is a simple Linux script.
#! /Bin/bash
Export LOGIN_USER = test
Export LOGIN_PWD = test
######################################## # Function ###################################### #########
Flashscn ()
{
Echo-e "enter scn: \ c"
Read SCNNUM
STR1 = "flashback table $ OWNER. $ TABLE_NAME to scn $ SCNNUM ;"
Echo $ STR1
T1 = 'sqlplus-silent $ LOGIN_USER/$ LOGIN_USER <EOF
Set pagesize 0 feedback off verify off heading off echo off
Alter table $ OWNER. $ TABLE_NAME enable row movement;
$ STR1
Alter table $ OWNER. $ TABLE_NAME disable row movement;
EOF'
If [-z "$ T1"]; then
Echo "######"
Echo "flashback table $ TABLE_NAME OK! "
Else
Echo "######"
Echo "flashback tabel $ TABLE_NAME error :"
Echo $ T1 | awk-F "ORA-" '{print "ORA-" $ NF }'
Fi
}
Flashtime ()
{
Echo-e "enter time (example 20:34:21): \ c"
Read STIME
STR2 = "flashback table $ OWNER. $ TABLE_NAME to timestamp to_timestamp ('$ STIME', 'yyyy-mm-dd hh24: mi: ss ');"
Echo $ STR2
T2 = 'sqlplus-silent $ LOGIN_USER/$ LOGIN_USER <EOF
Set pagesize 0 feedback off verify off heading off echo off
Alter table $ OWNER. $ TABLE_NAME enable row movement;
$ STR2
Alter table $ OWNER. $ TABLE_NAME disable row movement;
EOF'
If [-z "$ T2"]; then
Echo "######"
Echo "flashback table $ TABLE_NAME OK! "
Else
Echo "######"
Echo "flashback tabel $ TABLE_NAME error :"
Echo $ T2 | awk-F "ORA-" '{print "ORA-" $ NF }'
Fi
}
######################################## #### Main start ################################## ############
Echo-e "enter flashback table owner: \ c"
Read OWNER
Echo-e "enter flashbackup table name: \ c"
Read TABLE_NAME
Echo-e "chose flashback type 1) time 2) scn 1 \ 2: \ c"
Read STYPE
Case $ STYPE in
1)
Flashtime
;;
2)
Flashscn
;;
*)
Echo "your enter is error, please enter 1 or 2 !!! "
Exit
;;
Esac
Recommended Editing:
Oracle 11g Flashback Data Archive (flash back Data archiving)
Oracle Flashback flash back Mechanism
Oracle Flashback database
Flashback table quick recovery of accidentally deleted data
Oracle backup recovery: Flashback flash back