Cloning a database from an rman heterogeneous machine

Source: Internet
Author: User

When using Rman for replication, Rman connects to the target database and the secondary instance, and if a catalog backup is used, the recovery directory is also connected. Rman connects to the target database to gain access to the details of the backups recorded in its control file, the connection helper instance is able to allocate one or more channel processes on the secondary instance, the channel is automatically created at 9i, and a pfile parameter file is required to connect the secondary instance to start the secondary instance first. By the target database Creata pfile from SPFile, because there is no control file, so can only boot into the nomount phase, Rman will generate a SYSDBA connection to this secondary instance. After connecting the target library and the secondary instance, you can use the duplicate command to replicate the database, which is generally divided into the following stages: 1,rman determine the status and location of the backup 2,rman assign a secondary channel on the secondary instance, 3, restore the data file on the secondary instance, 4, build a new control file 5,rman restores the archive log and recovers 6,rman resets the dbid of the secondary library (uniquely identifies a database) and opens the database with open resetlogs.


Platform Preparation:
Oraclelinux + Oracle 11G
Target Library:
Oracle_home=/uoracle/app
Oracle_base=/orabase
Oracle_sid= ORCL
ip:192.168.0.45
Auxiliary libraries:
Oracle_home=/uoracle/app
Oracle_base=/orabase
Oracle_sid=orcl
ip:192.168.0.46

Operation Steps (the same machine and the same machine copy, the steps are basically the same):
1: The server running the secondary instance needs to install the corresponding Oracle client first, and the Oracle_base and Oracle_home directories and target libraries are the same;
2: Construct the Auxiliary database directory structure;
3: Create the parameter file, copy it, and make the corresponding modification;
4: Create secondary instance password file, orapwd
5: Configure monitoring and Tnsname files
6: The target library is backed up and copied to the secondary instance service, or mounted in the past with NFS;
7: Use Pfile to start the secondary instance to Nomount and exit the session;
8:duplicate command Copy database;
9: Create SPFile

Specific implementation:
1: Install the client
2: Build the secondary database directory structure (build the directory structure of the secondary library according to the directory involved in the parameter file)

[Email protected] ~]$ echo $ORACLE _base
/orabase
[Email protected] ~]$ cd/orabase
[Email protected] orabase]$ mkdir./oradata/orcl-p
[[email protected] orabase] $mkdir./fast_recovery_area/orcl-p # Rebuild the control file and store the control file
[Email protected] orabase]$ pwd
/orabase
[Email protected] orabase]$ mkdir./admin/orcl-p
[[Email protected] orabase]$ CD./admin/orcl/
[Email protected] orcl]$ mkdir {a,b,c,d,u}dump
[Email protected] orcl]$ mkdir pfile

3: Create a parameter file, copy it, and modify it accordingly .
3.1: Create a pfile on the target library and copy it to the secondary library? /dbs directory (must be $oracle_home/dbs directory, otherwise not recognized)
sql> create pfile= '/tmp/initorcl.ora ' from SPFile;
Sql> Scp/tmp/initorcl.ora 192.168.0.46:/oracle/home/dbs
3.2: Modify the parameter file accordingly
Since this is a copy of the machine, the directory structure and the instance name are the same, so there is no modification
3.3: Use Pfile to start the database to the Nomount state, test it, and create a SPFile

sql> startup pfile= '/uoracle/app/dbs/initorcl.ora ' >oracle instance started.
Total System Global area 1.0055E+10 bytes
Fixed Size 2237008 bytes
Variable Size 3154120112 bytes
Database buffers 6878658560 bytes
Redo buffers 19767296 bytes
Database mounted.
Database opened.
Sql> create SPFile from Pfile;
File created.

4: Create a password file for the secondary instance, the password is consistent with the source library
[email protected] bin]$ pwd
/uoracle/app/bin
[Email protected] bin]$ orapwd file= $ORACLE _HOME/DBS/ORAPWORCL password=admin123;
[Email protected] bin]$
[Email protected] bin]$ LS/UORACLE/APP/DBS/ORAPWORCL
/UORACLE/APP/DBS/ORAPWORCL


5: Configure monitoring and Tnsname files

On the Source library:
[Email protected] ~]# Cat/uoracle/app/network/admin/listener.ora
# Listener.ora Network Configuration File:/uoracle/app/network/admin/listener.ora
# Generated by Oracle configuration tools.


ORCL =
(Description_list =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.45) (PORT = 1521))
)
)


Adr_base_listener =/orabase


[Email protected] ~]# Cat/uoracle/app/network/admin/tnsnames.ora
# Tnsnames.ora Network Configuration File:/uoracle/app/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.


ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST =192.168.0.45) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = ORCL)
)
)


AUXORCL =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.46) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = ORCL)
)
)


On the secondary library:
TARGETORCL =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.45) (PORT = 1521))
)
(Connect_data =
(service_name = ORCL)
)
)
ORCL =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.78) (PORT = 1521))
)
(Connect_data =
(service_name = ORCL)
)
)


6: The target library is backed up and copied to the secondary instance service, or mounted in the past with NFS;
rman> RUN {
2> Allocate channel C1 type disk;
3> Allocate channel C2 type disk;
4> Backup Database format '/backup/orcl_%u_%t ' skip inaccessible filesperset 5 tag Orcl_bak;
5> SQL ' alter system archive log current ';
6> Backup Archivelog All Delete input format '/backup/arch_%u_%t ' skip inaccessible filesperset 5;
7> Backup current controlfile format '/backup/ctl_%u_%t ' tag= ' Ctl_bak ';
8> backup spfile format '/backup/orcl_spfile_%u_%t ' tag= ' spfile ';
9> release channel C2;
10> release channel C1;
11>}
Note: Because the Nocatalog backup method is used here, the backup information is written to the control file, so the control file is backed up separately

On the target library:

[email protected] ~]# Cat/etc/exports
/backup 192.168.0.78 (Rw,async)
[[email protected] ~]#/etc/init.d/nfs start
Starting NFS services: [OK]
Starting NFS mountd: [OK]
Stopping RPC IDMAPD: [OK]
Starting RPC IDMAPD: [OK]
Starting NFS daemon: [OK]
On the secondary library:
# Create the same directory as the target library
Mkdir/backup
Chown Oracle.oinstall/backup-r
chmod 775/backup
SHOWMOUNT-E 192.168.0.45
Mount-t NFS 192.168.0.45:/backup/bakup


7: Use Pfile to start the secondary instance to Nomount and exit the session;
sql> startup Nomount pfile= '/uoracle/app/dbs/initorcl.ora '
ORACLE instance started.
Total System Global area 1.0055E+10 bytes
Fixed Size 2237008 bytes
Variable Size 3154120112 bytes
Database buffers 6878658560 bytes
Redo buffers 19767296 bytes
Sql> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
With the partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real application testing options


8:duplicate command Copy database;
On the target library:
[Email protected] ~]$ Rman target Sys/[email protected] auxiliary sys/[email protected];
Recovery manager:release 10.2.0.1.0-production on Sun Jul 18 20:41:19 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to target DATABASE:ORCL (dbid=1248423599)
Connected to auxiliary DATABASE:ORCL (not mounted)
Rman> duplicate target database to ORCL Nofilenamecheck
LogFile
'/orabase/oradata/orcl/redo01.log ' size 100M,
'/orabase/oradata/orcl/redo02.log ' size 100M,
'/orabase/oradata/orcl/redo03.log ' size 100M;


9: Create the SPFile and restart
create SPFile from Pfile;
Shutdown immeidate;
Startup
Verify that the database is replicated successfully


This article is from the "Dbguy" blog, make sure to keep this source http://dbguy.blog.51cto.com/8921728/1569359

Cloning a database from an rman heterogeneous machine

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.