Oracle-RMAN full recovery

Source: Internet
Author: User
1. concepts related to RMAN full recovery 1. In RMAN full recovery, we mainly use two Commands: restore and recover. 2. Data can be restored at three levels: database, tablespace, and data file. 3. In RMAN, you can use the user management recovery command to help solve the problem in various situations. Ii. completely restore the test using RMAN (I)

1. concepts related to RMAN full recovery 1. In RMAN full recovery, we mainly use two Commands: restore and recover. 2. Data can be restored at three levels: database, tablespace, and data file. 3. In RMAN, you can use the user management recovery command to help solve the problem in various situations. Ii. completely restore the test using RMAN (I)

1. concepts related to RMAN full recovery


1. In RMAN full recovery, two commands are used: restore and recover.


2. Data can be restored at three levels: database, tablespace, and data file.


3. In RMAN, you can use the user management recovery command to help solve the problem in various situations.


Ii. RMAN completely resumes the experiment


(1) Use RMAN for three backups of the data file app1_01.dbf. One is full backup, the other is Zero backup, and the other is Level 1 backup.


1. Complete backup of data files. The command is as follows,

RMAN>? Backup? Datafile ?? '/U01/oradata/wilson/app1_01.dbf '? Format? '/U01/backup/app1 _ % U ';


2. Perform level 0 backup. The command is as follows,

RMAN>? Backup? Incremental? Level? 0 ?? Datafile? '/U01/oradata/wilson/app1_01.dbf '?? Format? '/U01/backup/all_0 _ % U ';


3. Perform Level 1 backup. The command is as follows,

RMAN>? Backup? Incremental? Level? 1 ?? Datafile? '/U01/oradata/wilson/app1_01.dbf '?? Format? '/U01/backup/all_1 _ % U ';


4. Close the database and delete the data file append 01.dbf,

[Oracle @ oracle11g? Wilson] $? Rm ??? -F ???? App1_01.dbf


5. Place the database in the mount state, connect RMAN, restore and restore data files, and open the database,

RMAN>? Restore ??? Datafile ?? '/U01/oradata/wilson/app1_01.dbf ';


Starting? Restore? At? 01-SEP-13

Using? Channel? ORA_DISK_1

Channel? ORA_DISK_1 :? Starting? Datafile? Backup? Set? Restore

Channel? ORA_DISK_1 :? Specifying? Datafile (s )? To? Restore? From? Backup? Set

Channel? ORA_DISK_1 :? Restoring? Datafile? 00012? To? /U01/oradata/wilson/app1_01.dbf

Channel? ORA_DISK_1 :? Reading? From? Backup? Piece? /U01/backup/all_0_04oiptg4_1_1

Channel? ORA_DISK_1 :? Piece? Handle =/u01/backup/all_0_04oiptg4_1_1? Tag = TAG20130901T230228

Channel? ORA_DISK_1 :? Restored? Backup? Piece? 1

Channel? ORA_DISK_1 :? Restore? Complete ,? Elapsed? Time :? 00:00:08

Finished? Restore? At? 01-SEP-13


Through the restore command, we can see that the database uses level 0 backup preferentially during restoration.


RMAN>? Recover ??? Datafile ??? '/U01/oradata/wilson/app1_01.dbf ';

RMAN>? Alter? Database? Open;

Database? Opened



(2) In the (1) experiment, the restored data file is still in the original directory. If the disk is damaged, it cannot be stored in the original directory. What should I do?


1. Close the database, delete a data file, and restore it to another directory,

[Oracle @ oracle11g? Wilson] $? Rm? -F ?? App1_01.dbf? (Delete the app1_01.dbf data file)


2. Open the database and go to the mount status. You can check the views v $ recover_file and v $ datafile to determine which file is faulty,

SQL>? Select? *? From? V $ recover_file;

????? FILE #? ONLINE ?? ONLINE _? ERROR ????????????????? CHANGE #? TIME

----------? -------? -------? ------------------? ----------? ---------

????????? 12? ONLINE ?? ONLINE ?? FILE? NOT? FOUND ?????????????? 0

SQL>? Select? File #, name? From? V $ datafile;

????? FILE #? NAME

----------? -----------------------------------

????????? 1? /U01/oradata/wilson/system01.dbf

????????? 2? /U01/oradata/wilson/sysaux01.dbf

????????? 3? /U01/oradata/wilson/undotbs01.dbf

????????? 4? /U01/oradata/wilson/users01.dbf

????????? 5? /U01/oradata/wilson/example01.dbf

????????? 6? /U01/oradata/wilson/app2_01.dbf

????????? 7? /U01/oradata/wilson/app3_01.dbf

????????? 8? /U01/oradata/wilson/smallundo1.dbf

???????? 12? /U01/oradata/wilson/app1_01.dbf

9? Rows? Selected.

It can be seen that the file number is 12.



3. Restore and restore the data file on the RMAN connection,


RMAN>? Run {

2>? Set? Newname? For? Datafile? 12? To? '/U01/oradata/app1_01.dbf'; (Restore file 12 to another directory)

3>? Restore? Datafile? 12;

4>? Switch? Datafile? 12; (using this command will update the control file)

5>? Recover? Datafile? 12;

6>? Alter? Database? Open ;}

So you can see this file in/u01/oradata,


[Oracle @ oracle11g? Oradata] $? Ll

Total? 102540

-Rw-r -----? 1? Oracle? Oinstall? 104865792? Sep ?? 1? 23: 51? App1_01.dbf

Restore the data file to another directory.



(3) Restore tablespaces


1. Delete the appenders 01.dbf file when the database is open,

[Oracle @ oracle11g? Wilson] $? Rm ??? -F ????? App1_01.dbf?


To view the table Dave. t,

SQL>? Select? *? From? Dave. t;

Select? *? From? Dave. t

??????????????????? *

ERROR? At? Line? 1:

ORA-01116 :? Error? In? Opening? Database? File? 12

ORA-01110 :? Data? File? 12 :? '/U01/oradata/wilson/app1_01.dbf'

ORA-27041 :? Unable? To? Open? File

Linux? Error :? 2 :? No? Such? File? Or? Directory

Additional? Information :? 3


Because the data file does not exist, it cannot be found.


When viewing the view v $ recover_file, there will be no records, and the view must be shutdown? Abort closes the database and then enables the data to enter the mount state. Then, you can view the view v $ recover_file,


SQL>? Select? *? From ?? V $ recover_file;

????? FILE #? ONLINE ?? ONLINE _? ERROR ????????????????? CHANGE #? TIME

----------? -------? -------? ------------------? ----------? ---------

??????????????? 12? ONLINE ?? ONLINE ?? FILE? NOT? FOUND ?????????????? 0

It can be seen that the file number is 12.


2. Connect to RMAN to restore the data file,


RMAN>? Run {

2>? SQL? 'Alter? Database? Datafile? 12 ?? Offline ';

3>? Restore? Tablespace? App1;

4>? Recover? Tablespace? App1;

5>? SQL? 'Alter ?? Database ?? Datafile? 12 ?? Online ';}

After the recovery is successful, check the table Dave. t,


SQL>? Select? *?? From? Dave. t;

???????? ID? NAME

----------? -----------------------------------

????????? 3? Wound

????????? 4? Mm

????????? 0? Dave. Sun

????????? 1? Sunshine

????????? 2? Sunny

As you can see, the tablespace is successfully restored.


In the preceding example, the restored tablespace is still in the original directory. If the disk is damaged, it cannot be stored in the original directory. What should I do? The method provided in (2) is the same. You only need to change the data file to a tablespace.

Author: sunwei335 published on 23:17:40 Original article link

Read: 96 comments: 0 view comments

Original article address: Oracle-RMAN completely recovered. Thank you for sharing it with me.

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.