Oracle RMAN does not completely restore the database to the specified time point

Source: Internet
Author: User

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

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.