Oracle RMAN does not completely restore the database to the specified time point (Simple simulation), and the test database is not completely restored
Cmd> sqlplus/as sysdba;
SQL> shutdown immediate
SQL> alter database archivelog;
SQL> conn squirrel/squirrel;
SQL> CREATE TABLE a (id number (10) not null primary key, name varchar2 (20 ));
SQL> INSERT INTO a (id, name) values (1, zhangsan );
SQL> conn/as sysdba;
SQL> select * from squirrel.;
ID NAME
------------------------------
1 zhangsan
Set Time Format
SQL> alter session set nls_date_format = 'yyyy-mm-dd hh24: mi: ss ';
SQL> select sysdate from dual;
SYSDATE
-------------------
16:00:42
SQL> shutdown immediate;
SQL> startup mount;
SQL> exit
Cmd> rman target/
RMAN> backup database;
RMAN> exit;
Here we simulate accidental deletion of the T table (DDL-type TRUNCATE method)
SQL> truncate table squirrel.;
Then we cannot completely recover to the specified time 16:00:42
[Important Note] Before using RMAN to Complete Incomplete recovery based on time points, we 'd better back up the site. Here we only need to back up the control files and log files of the database. When the recovery does not meet our requirements, the control file and log file can be restored and then restored.
RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> SQL 'alter session set nls_date_format = "yyyy-mm-dd hh24: mi: ss "';
5> set until time = '2017-03-01 16:00:42 ';
6> restore database;
7> recover database;
8> alter database open resetlogs ;}
Use the target database control file to replace the recovery directory
Allocated channel: c1
Channel c1: sid = 156 devtype = DISK
Allocated channel: c2
Channel c2: sid = 155 devtype = DISK
SQL statement: alter session set nls_date_format = "yyyy-mm-dd hh24: mi: ss"
Executing command: SET until clause