RMAN cold Backup Recovery from different machines and rman recovery

Source: Internet
Author: User

RMAN cold Backup Recovery from different machines and rman recovery

1. Prepare the environment

Install the ORACLE instance on the new server. During the installation process, ensure that the ORACLE_SID of the source server is consistent with that of the target server, and ensure that the installation path is consistent with the Source Path (not only the installation directory, even include the data file, control file directory, and directory where online redo log files are stored ). If they are inconsistent, You need to modify the spfile.

2: RMAN for cold backup

Use cold_backup.sh to back up the database to the/u04/migration directory.

Mkdir-p/u04/migration
Mkdir-p/u04/migration/log

Cat/u04/migration/cold_backup.sh

export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=SCM2
export CATALOG=NOCATALOG
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
rman target / log=/u04/migration/log/rman_coldbackup_db_EELSCM2_20150510.log <<EOF
sql 'alter system checkpoint';
shutdown immediate;
startup mount;
sql  "create pfile=''/u04/migration/pfile`date +%d%m%Y`.ora'' from spfile";
RUN {
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/u04/migration/%U';
ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT '/u04/migration/%U';
ALLOCATE CHANNEL disk3 DEVICE TYPE DISK FORMAT '/u04/migration/%U';
BACKUP AS COMPRESSED BACKUPSET DATABASE;
BACKUP CURRENT CONTROLFILE FORMAT '/u04/migration/cntrl_%s_%p_%t';
RELEASE CHANNEL disk1;
RELEASE CHANNEL disk2;
RELEASE CHANNEL disk3;
}

3: RMAN for restoration

1: first copy the backup file to the target server, as shown below:

 
[oracle@DB-Server migration]$ ls -lrt
total 25205332
-rw-r----- 1 oracle oinstall 1378779136 May 10 18:56 4eq6j632_1_1
-rw-r----- 1 oracle oinstall 1971355648 May 10 19:33 4fq6j6dr_1_1
-rw-r----- 1 oracle oinstall  993918976 May 10 19:52 4jq6j6v2_1_1
-rw-r----- 1 oracle oinstall    9338880 May 10 19:53 4mq6j79h_1_1
-rw-r----- 1 oracle oinstall 2445590528 May 10 20:39 4bq6j5gu_1_1
-rw-r----- 1 oracle oinstall 1682866176 May 10 21:12 4hq6j6rj_1_1
-rw-r----- 1 oracle oinstall 2082570240 May 10 21:53 4gq6j6ea_1_1
-rw-r----- 1 oracle oinstall 1440210944 May 10 22:22 4dq6j629_1_1
-rw-r----- 1 oracle oinstall   21495808 May 10 22:22 cntrl_16535_1_879337140
drwxr-xr-x 2 oracle oinstall       4096 May 11 00:20 log
-rw-r----- 1 oracle oinstall 6072287232 May 11 00:20 4aq6j5gu_1_1
-rwxr-xr-x 1 oracle oinstall        814 May 11 01:10 cold_backup.sh
-rw-r----- 1 oracle oinstall 2605039616 May 11 01:10 4cq6j5gu_1_1
-rw-r----- 1 oracle oinstall 1613660160 May 11 01:41 4kq6j771_1_1
-rw-r----- 1 oracle oinstall 1230159872 May 11 02:05 4iq6j6tb_1_1
-rw-r----- 1 oracle oinstall 2237693952 May 11 02:48 4lq6j784_1_1
-rw-r--r-- 1 oracle oinstall       1542 May 11 10:03 pfile20150510.ora
-rw-r--r-- 1 oracle oinstall        195 May 11 11:28 restore.sh
[oracle@getlnx14 migration]$ 

2: grant related permissions to the corresponding directory of the oracle account.

2.1 because some data files are located under the/u02,/u03,/u04 directories, create these directories under the root directory and grant permissions to ORACLE users.

Mkdir/u02

Mkdir/u03

Mkdir/u04

Chown-R oracle: oinstall/u02/u03/u04

2.2 Because "Only install database software" is selected during installation, you need to set the following path according to the directory of the source server.

[oracle@DB-Server oracle]$ ls
oraInventory  product
[oracle@DB-Server oracle]$ mkdir admin
[oracle@DB-Server oracle]$ cd admin/
[oracle@DB-Server admin]$ mkdir SCM2
[oracle@DB-Server admin]$ cd SCM2/
[oracle@DB-Server SCM2]$ ls
[oracle@DB-Server SCM2]$ mkdir udump
[oracle@DB-Server SCM2]$ mkdir adump
[oracle@DB-Server SCM2]$ mkdir cdump
[oracle@DB-Server SCM2]$ mkdir dpdump
[oracle@DB-Server SCM2]$ mkdir pfile
[oracle@DB-Server SCM2]$ mkdir bdump

Case 1:

RMAN> @restore.sh
 
RMAN> run
2> {
3> startup pfile='/u04/migration/pfile20150510.ora' nomount;
4> restore controlfile from 'cntrl_16535_1_879337140';
5> alter database mount;
6> restore database;
7> alter database open resetlogs;
8> }
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 05/12/2015 15:48:00
RMAN-04014: startup failed: ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated
ORA-07286: sksagdi: cannot obtain device information.
Linux-x86_64 Error: 2: No such file or directory
 
RMAN> 
RMAN> **end-of-file**

Check the LOG_ARCHIVE_DEST_1 parameter in the source database and find that the archived logs of online redo logs are in/u04/backup/archive. The target server does not have the directory/u04/backup/archive. You need to create a directory.

SQL> show parameter LOG_ARCHIVE_DEST_1
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string      LOCATION=/u04/backup/archive
log_archive_dest_10                  string
SQL> 

Case 2:

The above error occurs because "Only install database software" is selected during installation, and the corresponding background_dump_dest and audit_file_dest directories do not exist. Check the pfile file and create the corresponding directory to solve the problem.

[oracle@DB-Server oracle]$ ls
oraInventory  product
[oracle@DB-Server oracle]$ mkdir admin
[oracle@DB-Server oracle]$ cd admin/
[oracle@DB-Server admin]$ mkdir SCM2
[oracle@DB-Server admin]$ cd SCM2/
[oracle@DB-Server SCM2]$ ls
[oracle@DB-Server SCM2]$ mkdir udump
[oracle@DB-Server SCM2]$ mkdir adump
[oracle@DB-Server SCM2]$ mkdir cdump
[oracle@DB-Server SCM2]$ mkdir dpdump
[oracle@DB-Server SCM2]$ mkdir pfile
[oracle@DB-Server SCM2]$ mkdir bdump

Case 3:

RMAN> @restore.sh
 
RMAN> run
2> {
3> startup pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/pfile20150510.ora' nomount;
4> restore controlfile from 'cntrl_16535_1_879337140';
5> alter database mount;
6> restore database;
7> alter database open resetlogs;
8> }
Oracle instance started
 
Total System Global Area   12884901888 bytes
 
Fixed Size                     2105920 bytes
Variable Size               9328135616 bytes
Database Buffers            3506438144 bytes
Redo Buffers                  48222208 bytes
 
Starting restore at 12-MAY-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=987 devtype=DISK
 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/12/2015 15:59:27
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece
 
RMAN> 
RMAN> **end-of-file**
 
RMAN> 

This error occurs because the path of the control file is accidentally ignored during editing. The actual cause is: restore controlfile from '/u04/migration/cntrl_16535_424879337140 ';

run
{
startup pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/pfile20150510.ora' nomount;
restore controlfile from '/u04/migration/cntrl_16535_1_879337140';
alter database mount;
restore database;
alter database open resetlogs;
}

 

After restoration, set the database parameters, for example, creating a spfile from the pfile file. In addition, adjust some SGA Parameters Based on server configurations!


References:

 

Http://blog.itpub.net/11411056/viewspace-733456/

Http://blog.csdn.net/edwzhang/article/details/8933372

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.