18. Incomplete Restoreation and write a automatic backup script - sayanbhattacharya1234/Oracle_DBA GitHub Wiki

Incomplete Restoreation

Incomplete recovery means suppose we create a table at 1.00 pm time, and anyhow my table deleted at 1.15PM. But that table was importent and i want that table get back, so we restore the database until 1.00 pm when my table was not affected and recover.

.

Incomplete Restoreation process are done by two ways

a) Incomplete restore with time , b) Incomplete restore with SCN

. Incomplete restore with time

Open database server > SQL > create a user on a tablespace and grant the session , table to that user.

Conn to that user and create a table,insert values (1 ,2 ,3) ,check and commit;

There is a view for time > select systimestamp from dual; from where we can see the time

drop that table by - drop table t1 purge; 1.15 pm

Now we want get back the table , so if we restore at 1.00.

SQL> conn as sys, shutdown and startup mount state > go to RMAN>

run { set until time "to_date('11-07-2026 13:00:00','dd-mm-yyyy hh24:mi:ss')"; >restore database; > recover database: } [ automatic restore and recover till that time ]

alter database open resetlogs; and check tables value by conn that user.

create user ronaldo identified by oracle quota unlimited on users;

now

. Incomplete restore with SCN

same process

Conn to that user and create a table,insert values (1 ,2 ,3) ,check and commit;

drop the user cascade with a current SCN

Now we want get back the user and table , so if we restore till that SCN

SQL> conn as sys, shutdown and startup mount state > go to RMAN>

run { set until scn 563245"; >restore database; > recover database: } [ automatic restore and recover till that time ]

alter database open resetlogs; and check tables value by conn that user.

Backup with script

vi backup.sh then write scripts for backup and run

in my case

save and exit