ORACLE Database RMAN backup recovery

Source: Internet
Author: User
Restore databases in different locations

Restore databases in different locations

Machine:
Select instance_name from v $ instance;
Select name from v $ database;
Select name from v $ datafile;
Log query mode:
Archive log list;
Shutdown immediate;
Startup mount;
Change the log archive mode:
Alter database archivelog;
Alter database open;
Alter system archive log current;
Select name from v $ archived_log;
Open Control file tracking:
Alter database backup controlfile to trace;
View the location of the trail file:
Show parameter user_dump_dest
Cmd:
Set oracle_sid = orcl
Rman target sys/abc
Host "md c: \ back ";
Run
{
Backup database;
Format 'C: \ back \ % d _ % s _ % T_full.bak ';
}
Select file #, name from v $ datafile;
Transfer the following file to machine B:
C: \ back
D: \ oracle \ product \ 10.2.0 \ admin \ orcl
Create controlfile set database "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1 'e: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ redo01.log' SIZE 50 M,
GROUP 2 'e: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ REDO02.LOG 'SIZE 50 M,
GROUP 3 'e: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ REDO03.LOG 'SIZE 50 M
-- STANDBY LOGFILE
DATAFILE
'E: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ system01.dbf ',
'E: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ undotbs01.dbf ',
'E: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ sysaux01.dbf ',
'E: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ users01.dbf ',
'E: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORCL \ XM'
Character set ZHS16GBK

Machine B:
Create a directory for restoring oracle
E: \ oracle \ product \ 10.2.0 \ oradata \ orcl
E: \ oracle \ product \ 10.2.0 \ admin
E: \ oracle \ product \ 10.2.0 \ falsh_recovery_area
Put the received folder orcl in e: \ oracle \ product \ 10.2.0 \ admin.
Copy
E: \ oracle \ product \ 10.2.0 \ admin \ orcl \ pfile. The parameter file is in the db_1 \ database folder of your real database and renamed as initorcl. ora.
Open initorcl. ora
Change the path to the actual location of the oracle database.
D: \ is replaced by e :\
Cmd1:
Set oracle_sid = orcl
Oracle orcl
Wait until the prompt ctrl + c
Cmd2:
Set oracle_sid = orcl
Sqlplus/as sysdba
Startup nomount;
Cmd3:
Set oracle_sid = orcl
Rman target sys/abc
Restore controlfile from 'C: \ back \ ORCL_2_20090414_FULL.BAK ';
Cmd2:
Alter database mount;
Cmd3:
Run {
Set newname for datafile 1 to 'e: \ oracle \ product \ 10.2.0 \ oradata \ orcl \ system01.dbf ';
Set newname for datafile 2 to 'e: \ oracle \ product \ 10.2.0 \ oradata \ orcl \ undotbs01.dbf ';
Set newname for datafile 3 to 'e: \ oracle \ product \ 10.2.0 \ oradata \ orcl \ sysaux01.dbf ';
Set newname for datafile 4 to 'e: \ oracle \ product \ 10.2.0 \ oradata \ orcl \ users01.dbf ';
Set newname for datafile 5 to 'e: \ oracle \ product \ 10.2.0 \ oradata \ orcl \ XM ';
Restore database;
Switch datafile all;
}
Cmd2:
Select name from v $ database;
Shutdown immediate;
Startup mount;
Alter database backup controlfile to trace;
Find the trail file:
Redo control file: change the path to the correct path:
D: \ To e :\
Shutdown immediate;
Startup nomount;
Execute the statement to generate the control file; the execution money must first Delete the. ctl File
Alter database open resetlogs;
Select name from v $ database;
Select member from v $ logfile;
Related Article

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.