Oracle 11GR2 using Rman duplicate to replicate databases

Source: Internet
Author: User

The 11g Rman duplicate personal feel is a lot more advanced than 10g, 10g needs to replicate on the basis of Rman backup, using Rman duplicate to create a database with identical data but dbid different. The 11g Rman duplicate can be implemented in two ways using active database duplicate and backup-based duplicate.
The Active database duplicate mode does not require an Rman backup of the target databases, as long as the target database is in archive mode and the database is copied directly over the network, and the copy completes automatically after the open database. This is particularly advantageous for big data, especially for T-level databases, where backups are not required before replication, reducing the time to backup and delivering backups, while saving backup space.
Case one: Active database duplicate mode for RMAN duplicate
1, the environment (the same machine test, the difference between the machine is not big)
Target DB (Ip:192.168.1.1;hostname:oradba;oraclesid:prod)
Auxiliary DB (Ip:192.168.1.1;hostname:oradba;oraclesid:stby)
2. Create auxiliary db parameter file, launch instance to Nomount state
Can be modified according to the target DB parameter file, the content is slightly, but the following should be noted:
db_file_name_convert= ('/u01/app/oracle/oradata/prod/', '/u01/app/oracle/oradata/stby/')
log_file_name_convert= ('/u01/app/oracle/oradata/prod/', '/u01/app/oracle/oradata/stby/')
For the same machine different instances, the parameter file must be added as above, otherwise the copy will be reported unable to create the data file, if the machine copy, and two instance data directory exactly the same, these two parameters can be omitted, and the same machine, the parameter file in the db_name can not be the same, if it is the same machine replication, db_ Name can be exactly the same.
3. Create the relevant directory in the parameter file and modify the permissions
mkdir/u01/app/oracle/oradata/stby/-PV
mkdir/u01/app/oracle/fast_recovery_area/stby/-PV
Chown Oracle:oinstall/u01-r
4. Start the instance to Nomount State
sql> startup Nomount pfile= '/u01/app/oracle/product/11.2.0/db_1/dbs/initstby.ora ';
5. Create password file, must keep target DB and auxiliary db password consistent
Here you choose to copy the password file for target DB: CP Orapwprod Orapwstby
6. Configure the Network
# Cat.. /network/admin/listener.ora
Sid_list_listener =
(Sid_list =
(Sid_desc =
(Oracle_home =/u01/app/oracle/product/11.2.0/db_1)
(Sid_name =prod)
)
(Sid_desc =
(Oracle_home =/u01/app/oracle/product/11.2.0/db_1)
(Sid_name =stby)
)
)
LISTENER =
(Description_list =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = oradba) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)

Adr_base_listener =/u01/app/oracle
# Cat.. /network/admin/tnsnames.ora
Prod =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = oradba) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = prod)
))

Stby =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = oradba) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = Stby)
))
7, start copying, you need to pay attention to the use of Nofilenamecheck parameters, if the two instance of the data directory structure is identical, you need to specify, otherwise it will be an error. No need to use it here.
$ export Oracle_sid=stby--------A different operation can omit this step
$rman target Sys/[email protected] auxiliary sys/[email protected]
/*rman> duplicate target database to Stby from active database nofilenamecheck;*/
Rman> duplicate target database to Stby from active database;
8. Inspection results
Select name from V$datafile;
Select status from V$instance;
Show parameter name
Show Parameter Pfile
The database is open, the parameters are normal, and the SPFile has been created and used! The entire replication process is complete!

Case TWO: backup-based duplicate mode of RMAN duplicate
Requirements: Modify the database that is stored with the file system to be stored in ASM mode.
Requirements implementation: can be implemented via Rman's backup as copy tablespace xx format ' +data ', using the duplicate method.
This test, is intended to be implemented in a single machine, that is, to create a file system PROD database, rman Backup, delete the file system mode of the PROD database, and then create the ASM storage PROD database, and then through the duplicate replication database. Note that it cannot be implemented on the production library. The approximate steps are as follows:
1) DBCA Create a database for file system storage PROD
2) Rman backup file system Storage database prod
3) Backup pfile, export control file to trace file
4) Delete the file system stored database prod
5) Create an ASM instance to create an ASM disk group
6) Create the desired directory of PROD data for ASM storage
7) Create an ASM storage mode for PROD database monitoring
8) Use the file system PROD database for full duplicate replication database

The procedure is as follows:
1. View the PROD database of file system mode
Select name from V$datafile;
Select name from V$tempfile;
Select member from V$logfile;
2. File system mode PROD database creation pfile
Create pfile= '/home/oracle/pfile ' from SPFile;
Modify Pfile to modify the control file path to ASM Disk group +data and +fra, modify the fast Recovery zone path to +fra
##*.control_files= '/u01/oradata/prod/control01.ctl ', '/u01/fast_recovery_area/prod/control02.ctl '
*.control_files= ' +data/prod/controlfile/control01.ctl ', ' +fra/prod/controlfile/control02.ctl '
##*.db_recovery_file_dest= '/u01/fast_recovery_area '
*.db_recovery_file_dest= ' +fra '
3, File system mode PROD database execution once fully prepared, save path is/home/oracle
run{
Allocate channel C1 device type disk;
Backup tag ' prod_db ' as compressed backupset format '/home/oracle/full_%u.bak ' database
Include current controlfile;
Backup tag ' prod_arch ' Archivelog all format '/home/oracle/arch_%u.bak ';
Release channel C1;
}
4, DBCA Way to delete the database, that is, the file system mode of the PROD database does not exist, you can create an ASM PROD database.
5. Create the desired directory for the ASM-mode PROD database
Mkdir-p $ORACLE _base/admin/prod/adump
6. Create prod database (i.e. auxiliary database) password file in ASM mode
$ orapwd file= $ORACLE _home/dbs/orapwprod password=oracle entries=5
7. Add a static listening connection for the auxiliary database under the grid user
$ vi/grid/app/11.2.0/grid/network/admin/listener.ora
LISTENER =
(Description_list =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP) (HOST = single) (PORT = 1521))
)
)
Sid_list_listener=
(sid_list=
(sid_desc=
(Sid_name=prod)
(oracle_home=/u01/oracle)
(Global_dbname=prod)))
Adr_base_listener =/grid

Enable_global_dynamic_endpoint_listener=on # added by Agent

8. The auxiliary database uses the modified pfile to start the database to Nomount state
Startup Nomount Pfile=/home/oracle/pfile;
9. Login Auxiliary Database with Rman
[Email protected] ~]$ Rman Auxiliary/
10. Using Rman to perform duplicate replication disaster recovery database
In this step the PROD database needs to be removed from the file system mode by using the ALTER DB backup controlfile to trace export script, which finds the path to the trace in use of the select value from V$diag_info. The database file path in the build control file script is referenced to write set newname for datafile N, because the previous database is the file system and is now intended to create an ASM-mode database. So we need set newname to modify the path.
run{
Allocate auxiliary channel DUP1 type disk;
Set newname for datafile 1 to ' +data ';
Set newname for datafile 2 to ' +data ';
Set newname for DataFile 3 to ' +data ';
Set newname for datafile 4 to ' +data ';
Set newname for Tempfile 1 to ' +data ';
Duplicate target database to PROD backup location '/home/oracle '
LogFile
Group 1 (' +data ') size 50m reuse,
Group 2 (' +data ') size 50m reuse,
Group 3 (' +data ') size 50m reuse;
}
11, verify the replication results of the auxiliary database, compare the previous file system target Library
Select name from V$datafile;
Select name from V$tempfile;
Select member from V$logfile;
Show parameter control_file;
Select Name,open_mode from V$database;
12. Auxiliary database create parameter file from memory to ASM disk Group +data/prod
Create spfile= ' +data/prod/spfileprod.ora ' from memory;
13. Create the auxiliary pfile file and specify the path to the SPFile. The Red font content is added.
$ VI $ORACLE _home/dbs/initprod.ora
Spfile= ' +data/prod/spfileprod.ora '
14. Start the auxiliary database with the newly created Initprod.ora
Shutdown immediate;
Startup
Show parameter SPFile;

Oracle 11GR2 using Rman duplicate to replicate databases

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.