About an incomplete recovery of doubt

Source: Internet
Author: User

Recently discussed the resumption of a lot of posts, so I also took a discussion, the restoration of the scene is: misoperation delete table, and the control file is also damaged, the discussion is only to thoroughly understand the internal original amount, to avoid the next time make the same mistake!

Here are my detailed experimental steps:

The first step: the recovery process has a row of data by observing the T1 table under the user Gyj.

Idle> Conn Gyj/gyj Connected.

Gyj@ocm> select * from T1;

ID NAME

---------- ----------------------------------------------------------------------------------------------------

1 bbbbbbbb

The second step: normal shutdown database, do the whole library of cold standby

Gyj@ocm> Conn/as SYSDBA

Connected.

Sys@ocm> select * from V$dbfile;

file# NAME

---------- -------------------------------

6/u01/app/oracle/oradata/ocm/undotbs01.dbf

5/u01/app/oracle/oradata/ocm/example01.dbf

3/u01/app/oracle/oradata/ocm/tp1.dbf

2/u01/app/oracle/oradata/ocm/sysaux01.dbf

1/u01/app/oracle/oradata/ocm/system01.dbf

4/u01/app/oracle/oradata/ocm/tp2.dbf

6 rows selected.

sys@ocm> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

[ORACLE@OCM ~]$ cp-rf/u01/app/oracle/oradata/ocm/*/backup/cold/

Step three: Start the library, login user Gyj, insert a data into the T1 table

Sys@ocm> Startup

ORACLE instance started.

Total System Global area 581750784 bytes

Fixed Size 1337860 bytes

Variable Size 243271164 bytes

Database buffers 314572800 bytes

Redo buffers 22568960 bytes

Database mounted.

Database opened.

Sys@ocm> Conn Gyj/gyj

Connected.

gyj@ocm> INSERT INTO T1 values (2, ' aaaaaaa ');

1 row created.

Gyj@ocm> commit;

Commit complete.

Fourth step: Check the current database system time

Gyj@ocm> Select To_char (sysdate, ' Yyyy-mm-dd:hh24:mi:ss ') from dual;

To_char (sysdate, ' YY

-------------------

2013-05-01:20:11:39

Fifth step: Check another data to T1 table

gyj@ocm> INSERT INTO T1 values (3, ' CCCCCCCCC ');

1 row created.

Gyj@ocm> commit;

Commit complete.

Sixth step: Simulate the user misoperation, made drop, the T1 table should not drop to kill the!!!!

gyj@ocm> drop table T1;

Table dropped.

Step seventh: Suppose my control file is damaged at this time.

[ORACLE@OCM ocm]$ RM-RF control0*

Step eighth: The database will be down soon.

sys@ocm> shutdown abort;

ORACLE instance shut down.

Nineth Step: Suppose I'm going to do not complete recovery now, and I do the incomplete recovery based on time, revert to 2013-05-01:20:11:39

Expected results, incomplete recovery after the table should be two records:

Gyj@ocm> select * from T1;

ID NAME

---------- ----------------------------------------------------------------------------------------------------

1 bbbbbbbb

2 AAAAAAA

Step Tenth: Start the recovery

(1) Restore control files

[ORACLE@OCM ~]$ cp/backup/cold/*.ctl/u01/app/oracle/oradata/ocm/

(2) Restore data files

[ORACLE@OCM ~]$ cp/backup/cold/*.dbf/u01/app/oracle/oradata/ocm/

(3) Start database to mount

sys@ocm> startup Mount;

ORACLE instance started.

Total System Global area 581750784 bytes

Fixed Size 1337860 bytes

Variable Size 243271164 bytes

Database buffers 314572800 bytes

Redo buffers 22568960 bytes

Database mounted.

(4) Incomplete recovery

sys@ocm> recover database until time ' 2013-05-01:20:11:39 ';

Media recovery complete.

(5) Open the database with Resetlogs

sys@ocm> ALTER DATABASE open resetlogs;

Database altered.

Step 11th: Verify that the results of the T1 table are not two records

Sys@ocm> Conn Gyj/gyj

Connected.

Gyj@ocm> select * from T1;

ID NAME

---------- ----------------------------------------------------------------------------------------------------

1 bbbbbbbb

Only one record, what is the situation?????????????????????????

The problem should be in step tenth: Start Recovery (4) Do not fully recover this step if the restore command at this step is changed to:

Recover database until time ' 2013-05-01:20:11:39 ' using Backup controlfile;

On it, but why Oracle here does not prompt the error, under the user management to the backup control file restore should be added using Backup controlfile.

But I don't have a using backup Controlfile why didn't you add it, the recovery is still successful, but the result is not what you want!!!

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.