Oracle rman heterogeneous database transplantation in the same system, detailed explanation of oracle rman backup and recovery
the
environment:
Origin server:
VM7.14 rhel5.5-32 oracle 11.2.0.0g
172.16.3.202
target server
VM7.14 rhel5.5-32 oracle 11.2.0.0g
172.16.3.204
the
Origin Server
the
1. Add validation tables and data to the database:
[oracle@ebs01 ~]$ sqlplus “/as sysdba”
SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 10 13:09:43 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
the
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create table addr1(city varchar(20), phone number);
Table created.
SQL> insert into addr1 values('beijing',1580118);
1 row created.
SQL> insert into addr1 values('shanghai',1501005);
1 row created. www.2cto.com
SQL> insert into addr1 values('nanjing',1598888);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from addr;
CITY PHONE
——————————–
beijing 1.5801E+10
shanghai 1.5010E+10
nanjing
the
2. Empty the backup directory, or create a new one, and back up the necessary files.
[oracle@ebs01 ~]$ cd /u01/backup
[oracle@ebs01 backup]$ rm *
the
1) Start backup, backup data files together with archive logs:
[oracle@ebs01 backup]$ rman target /
Recovery Manager: Release 11.2.0.1.0 – Production on Mon Jun 11 09:16:52 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1290854593)
RMAN> run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup incremental level 0
format '/u01/backup/db_full_%U.bkp'
tag '2012-06-11-FULL'
database plus archivelog;
release channel c1;
release channel c2;
} 2> 3> 4> 5> 6> 7> 8> 9> 10>
using target database control file instead of recovery catalog
allocated channel: c1 www.2cto.com
channel c1: SID=41 device type=DISK
allocated channel: c2
channel c2: SID=28 device type=DISK
the
Starting backup at 11-JUN-12
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=19 RECID=1 STAMP=784809253
input archived log thread=1 sequence=20 RECID=2 STAMP=784809551
input archived log thread=1 sequence=21 RECID=3 STAMP=785592038
channel c1: starting piece 1 at 11-JUN-12
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=1 sequence=22 RECID=4 STAMP=785592147
input archived log thread=1 sequence=23 RECID=5 STAMP=785595880
channel c2: starting piece 1 at 11-JUN-12
channel c1: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0mnd8mo1_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:08
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=24 RECID=6 STAMP=785668864
channel c1: starting piece 1 at 11-JUN-12
channel c2: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0nnd8mo1_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c2: backup set complete, elapsed time: 00:00:08
channel c1: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0ond8mo9_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-JUN-12
Starting backup at 11-JUN-12
channel c1: starting incremental level 0 datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
channel c1: starting piece 1 at 11-JUN-12 www.2cto.com
channel c2: starting incremental level 0 datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel c2: starting piece 1 at 11-JUN-12
channel c2: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0qnd8mob_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c2: backup set complete, elapsed time: 00:00:56
channel c2: starting incremental level 0 datafile backup set
channel c2: specifying datafile(s) in backup set
including current control file in backup set
channel c2: starting piece 1 at 11-JUN-12
channel c2: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0rnd8mq4_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c2: backup set complete, elapsed time: 00:00:09
channel c2: starting incremental level 0 datafile backup set
channel c2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c2: starting piece 1 at 11-JUN-12
channel c2: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0snd8mqs_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c2: backup set complete, elapsed time: 00:00:07
channel c1: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0pnd8mob_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:01:48
Finished backup at 11-JUN-12
Starting backup at 11-JUN-12
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=25 RECID=7 STAMP=785668983
channel c1: starting piece 1 at 11-JUN-12
channel c1: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/db_full_0tnd8mro_1_1.bkp tag=2012-06-11-FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-JUN-12
released channel: c1
released channel: c2
the
2) Back up the current control file:
RMAN> backup current controlfile format '/u01/backup/controlfile20120611.bak';
Starting backup at 11-JUN-12 www.2cto.com
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 11-JUN-12
channel ORA_DISK_1: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/controlfile20120611.bak tag=TAG20120611T093224 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 11-JUN-12
3) Backup parameter file
RMAN> backup spfile format '/u01/backup/spfile20120611.bak';
Starting backup at 11-JUN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 11-JUN-12
channel ORA_DISK_1: finished piece 1 at 11-JUN-12
piece handle=/u01/backup/spfile20120611.bak tag=TAG20120611T093402 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-JUN-12
RMAN>
the
target server
1. Preliminary preparation
1) Check the ORACLE_BASE directory of the newly installed database software, there are only two directories, there are no flash_recovery_area, oradata, admin and other directories, these are added to create the database
[oracle@localhost app]$ cd oracle
[oracle@localhost oracle]$ ls
checkpoints product
[oracle@localhost oracle]$ mkdir -p /u01/app/oracle/admin/orcl/{adump,bdump,cdump,dpdump,udump,pfile}–created separately
[oracle@localhost oracle]$ ls
admin checkpoints product
[oracle@localhost oracle]$ cd admin/
[oracle@localhost admin]$ ls
orcl
[oracle@localhost admin]$ cd orcl/
[oracle@localhost orcl]$ ls
adump bdump cdump dpdump pfile udump
[oracle@localhost orcl]$ cd ..
[oracle@localhost admin]$ ls
orcl
[oracle@localhost admin]$ cd ..
[oracle@localhost oracle]$ ls
admin checkpoints product
[oracle@localhost oracle]$ cd ~
[oracle@localhost ~]$ mkdir -p /u01/app/oracle/oradata/orcl
[oracle@localhost oracle]$ mkdir -p /u01/app/oracle/flash_recover_area/ORCL –The upper and lower case depends on the oracle_sid or database name, or the metabase control file parameter file
[oracle@localhost oracle]$ ls
admin checkpoints flash_recover_area oradata product
[oracle@localhost oracle]$ cd oracle
bash: cd: oracle: No such file or directory
[oracle@localhost oracle]$ cd oradata/
[oracle@localhost oradata]$ ls
orcl www.2cto.com
[oracle@localhost oradata]$ cd ..
[oracle@localhost oracle]$ ls
admin checkpoints flash_recover_area oradata product — may also be flash_recovery_area, a difference of y
[oracle@localhost oracle]$ cd admin/
[oracle@localhost admin]$ ls
orcl
[oracle@localhost admin]$ cd ..
[oracle@localhost oracle]$ ls
admin checkpoints flash_recover_area oradata product
[oracle@localhost oracle]$ cd flash_recover_area/
[oracle@localhost flash_recover_area]$ ls
ORCL
[oracle@localhost flash_recover_area]$ echo 'db_name=orcl' > $ORACLE_HOME/dbs/initorcl.ora
–The newly installed database has only one init.ora, here we need to generate a default pfile——initorcl.ora, with only one parameter
[oracle@localhost flash_recover_area]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ls
init.ora initorcl.ora
[oracle@localhost dbs]$ cat initiatorcl.ora
db_name=orcl — there is only one parameter in it
[oracle@localhost dbs]$ cd ~
[oracle@localhost ~]$ echo $ORACLE_SID
orcl
the
2. Data transmission
Log in to the target server and copy the backup data from the source server to the target machine:
[oracle@localhost backup]$ scp -rp 172.16.3.202:/u01/backup/* /u01/backup/
[email protected]'s password:
controlfile20120611.bak 100% 9568KB 869.8KB/s 00:11
db_full_0mnd8mo1_1_1.bkp
db_full_0nnd8mo1_1_1.bkp
db_full_0ond8mo9_1_1.bkp
db_full_0pnd8mob_1_1.bkp
db_full_0qnd8mob_1_1.bkp
db_full_0rnd8mq4_1_1.bkp
db_full_0snd8mqs_1_1.bkp
db_full_0tnd8mro_1_1.bkp 100% 8192 8.0KB/s 00:00 www.2cto.com
spfile20120611.bak 100% 96KB 96.0KB/s 00:00
the
3. Start the recovery process
1) The database starts to nomount
[oracle@localhost ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 – Production on Mon Jun 11 10:13:09 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> set dbid=1290854593 — this dbdi is recorded from the source database, but select dbdi from v$DATABASE found
executing command: SET DBID
RMAN> startup nomount
Oracle instance started
Total System Global Area 146472960 bytes
Fixed Size
Variable Size
Database Buffers 50331648 bytes
Redo Buffers 2531328 bytes
2) First restore the parameter file
RMAN> restore spfile from '/u01/backup/spfile20120611.bak';
Starting restore at 11-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
channel ORA_DISK_1: restoring spfile from AUTOBACKUP/u01/backup/spfile20120611.bak
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 11-JUN-12
3) Second, restore the control file
The database must first be forced to start to the nomount state, which means to make the spfile just restored take effect, as follows:
RMAN> startup nomount force;
Oracle instance started
Total System Global Area 539848704 bytes
Fixed Size
Variable Size 406849132 bytes
Database Buffers
Redo Buffers 5832704 bytes
the
RMAN> restore controlfile from '/u01/backup/controlfile20120611.bak';
Starting restore at 11-JUN-12
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output file name=/u01/app/oracle/oradata/orcl/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 11-JUN-12
4) Start the database to mount state,
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> restore database;
Starting restore at 11-JUN-12
Starting implicit crosscheck backup at 11-JUN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
Crosschecked 27 objects www.2cto.com
Finished implicit crosscheck backup at 11-JUN-12
Starting implicit crosscheck copy at 11-JUN-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 11-JUN-12
searching for all files in the recovery area
cataloging files…
no files cataloged
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 00002 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/db_full_0qnd8mob_1_1.bkp
channel ORA_DISK_1: piece handle=/u01/backup/db_full_0qnd8mob_1_1.bkp tag=2012-06-11-FULL
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:06:17
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 00001 to /u01/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/db_full_0pnd8mob_1_1.bkp
channel ORA_DISK_1: piece handle=/u01/backup/db_full_0pnd8mob_1_1.bkp tag=2012-06-11-FULL
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:31
Finished restore at 11-JUN-12
the
I don’t understand why the next step is wrong, but restore alter database open resetlogs; the database can be opened, and the verification is correct.
RMAN> recover database;
Starting recover at 11-JUN-12
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=25 www.2cto.com
channel ORA_DISK_1: reading from backup piece /u01/backup/db_full_0tnd8mro_1_1.bkp
channel ORA_DISK_1: piece handle=/u01/backup/db_full_0tnd8mro_1_1.bkp tag=2012-06-11-FULL
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_06_11/o1_mf_1_25_7xbtjhnv_.arc thread=1 sequence=25
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_06_11/o1_mf_1_25_7xbtjhnv_.arc RECID=8 STAMP=785677583
unable to find archived log
archived log thread=1 sequence=26
RMAN-00571: ================================================== ==============
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ================
RMAN-00571: ================================================== ==============
RMAN-03002: failure of recover command at 06/11/2012 11:46:28
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 26 and starting SCN of 1191327
RMAN> alter database open resetlogs;
database opened
RMAN>
the
Fourth, log in to SQL authentication:
the
[oracle@localhost database]$ sqlplus “/as sysdba”
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 11 08:13:42 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup www.2cto.com
SQL> select * from addr;
CITY PHONE
——————————–
beijing 1.5801E+10
shanghai 1.5010E+10
nanjing
SQL> SQL> select member from v$logfile;
MEMBER
————————————————– ——————————
/u01/app/oracle/oradata/orcl/redo03.log
/u01/app/oracle/oradata/orcl/redo02.log
/u01/app/oracle/oradata/orcl/redo01.log
SQL>
SQL> select file_name from dba_data_files;
FILE_NAME
————————————————– ——————————
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/example01.dbf
SQL>
the
the
Author huzia
bsp;RMAN>
the
Fourth, log in to SQL authentication:
the
[oracle@localhost database]$ sqlplus “/as sysdba”
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 11 08:13:42 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup www.2cto.com
SQL> select * from addr;
CITY PHONE
——————————–
beijing 1.5801E+10
shanghai 1.5010E+10
nanjing
SQL> SQL> select member from v$logfile;
MEMBER
————————————————– ——————————
/u01/app/oracle/oradata/orcl/redo03.log
/u01/app/oracle/oradata/orcl/redo02.log
/u01/app/oracle/oradata/orcl/redo01.log
SQL>
SQL> select file_name from dba_data_files;
FILE_NAME
————————————————– ——————————
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/example01.dbf
SQL>
the
the
Author huzia
The same system oraclerman heterogeneous database transplantation, oraclerman backup and recovery detailed explanation
This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/the-same-system-oraclerman-heterogeneous-database-transplantation-oraclerman-backup-and-recovery-detailed-explanation/