Oracle Active Database Duplication

Source: Internet
Author: User

Active Database Duplication


Brief introduction
---------
The Active database duplication feature is a new feature introduced from 11g that compares the backup set-based replication database functionality in previous versions.

The following is a brief review of the Oracle Duplicate database function, Duplicate database can be divided into 2 types of use, one is Duplicate database, the second is Duplicate standby Database, this article mainly introduces duplicate database function, will be introduced in the future duplicate standby database.

Duplicate database can also be divided into 2 ways depending on the source of the copied data: Active database duplication (replicating data from the running databases) and backup-based Duplication (data replication based on backup sets)

1. backup-based duplication is divided into the following 3 forms:
o The replication process is not connected to the source database, and Rman obtains backup information from the catalog database.

o The replication process does not connect to the source database or to the catalog database, and Rman obtains backup information from the existing backup set.

o The replication process connects to the source database, and Rman obtains backup information from the source database's control files.

2. Active Database Duplication
This replication database requires the source database to be open or mount state, the process of replication must be connected to the source database, Rman directly from the source library to replicate the database to the duplication server, this way does not need to back up the source library in advance.

Duplicate Database Features
------------------------
1. The replicated database is automatically assigned a new dbid, different from the dbid of the source database, so that the duplicate database and the source library can be registered to the same catalog.
The newly created database and source library are the same dbid if you use the command of the operating system to perform a copy recovery of the machine.

2. The replicated database can be either a full mirror of the source library or a subset of the source library.

3. The replicated database and source library must be the same operating system platform, we believe that the same platform 32-bit and 64-bit are the same platform, such as Linux IA (32-bit) and Linux ia (64-bit), that is the same platform that can be implemented duplicate function, but in the end, be sure to run the following script to convert PL/sql:
Oracle_home/rdbms/admin/utlirp.sql

Active Database Duplication and backup-based duplication comparison
-------------------------------------------------------------
The active database duplication directly copies the source databases, transmits the database to the replication server over the network, and therefore has a certain pressure on the source library when replicating, and requires high network conditions for data transmission.

Backup-based duplication: You need to back up the database in advance, the disk space size can meet the needs of backup.




Active Database Duplication principle
-------------------------------------
1. Manually create a temporary pfile file, the Pfile file includes at least one parameter db_name, and then boots to the Nomount state.
2. Rman copies the SPFile file from the source library to the replication database, and modifies the name of the SPFile.
3. Rman copies the latest control file from the source library to the replication database, and mount copies the database.
4. Rman copies datafile and necessary archive logs from the source library to the replication database.
5. Rman does not perform a complete recovery.
6. Rman creates a new control file and sets a new dbid.
7. Open the replicated database in Resetlogs mode.



If you use SPFile, you only need to set a db_name parameter in the Pfile file, and the other parameters will be set yourself in the Duplicate command.

If you use pfile, you need to set the following parameters:

<1> db_name

<2> Control_files

<3> db_block_size

<4> Db_file_name_convert

<5> Log_file_name_convert

<6> Db_recovery_file_dest



Create password file files in the auxiliary library

It is not required for backup-based Duplication,password file, but it is required for active Database Duplication,password file.
Because active database duplication connects directly to the auxiliary library using the same sysdba password. Therefore, it is important to make sure that the target and auxiliary library's SYSDBA password are the same.



Of course, we can also add the password file option (also the default value) in the duplicate command, so that Rman will copy the password file from the target library when it is copied,
If password file already exists on the auxiliary library, the operation overrides that file.

Such as:

Rman> DUPLICATE TARGET DATABASE to Dave

2> from ACTIVE DATABASE

3> Nofilenamecheck

4> PASSWORD FILE

5> SPFILE;




Experimental steps:
SOURCE Library: 10.6.0.207 test
Target Library: 10.6.0.179 aaa (originally wanted to use Test, but in Rman that step will be error)


Preparatory work
1.config Tnsnames.ora
2.create Password file
3.mkdir Necessary Folder
4.create SPFile to Startup Nomount
5.config Duplicate Database Listener.ora
6.duplicate a Database



Rman> duplicate target database to newdb
From active database
Db_file_name_convert '/nf/', '/duptest/'
SPFile
Parameter_value_convert '/db/', '/newdb/'
Set Log_file_name_convert '/db/', '/newdb/'





1. Create a pfile on the source library and SCP to the target library
sql> create pfile= '/tmp/pfile20151022.ora ' from SPFile;

Scp/tmp/pfile20151022.ora [Email Protected]:/u01/app/oracle/12.1.0.1/db_1/dbs/inittest.ora



On the target library


Sql> select name from V$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/system01.dbf
/u01/app/oracle/oradata/test/sysaux01.dbf
/u01/app/oracle/oradata/test/undotbs01.dbf
/u01/app/oracle/oradata/test/users01.dbf
/u01/app/oracle/oradata/test/qwerty.dbf
/u01/app/oracle/oradata/test/testbig.dbf
/u01/app/oracle/oradata/test/data_01.dbf
/u01/app/oracle/oradata/test/cai.dbf




Sql> select MEMBER from V$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/redo01.log
/u01/app/oracle/oradata/test/redo02.log
/u01/app/oracle/oradata/test/redo03.log


Configuring the Linstener.ora of the source library

[email protected] admin]$ cat Listener.ora
Sid_list_listener =
(Sid_list =
(Sid_desc =
(global_dbname = test)
(Oracle_home =/u01/app/oracle/12.1.0.1/db_1)
(sid_name = test)
)
)

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = Test) (PORT = 1521))
)



Configure the Tnsname.ora on the source library
[email protected] admin]$ cat Tnsnames.ora
Test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.6.0.207) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = test)
)
)

Test2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.6.0.179) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = test)
)
)









Because the source library and the target library data files, log files, control file location is not the same, so to modify the target library on the Pfile,
Add Db_file_name_convert and Log_file_name_convert


Modify Pfile on the target library

Vi/u01/app/oracle/12.1.0.1/db_1/dbs/inittest.ora

Modifying the Controlfile Path

Increase
Db_file_name_convert= '/u01/app/oracle/oradata/test ', '/u01/app/oracle/oradata/test/datafile '
Log_file_name_convert= '/u01/app/oracle/oradata/test ', '/u01/app/oracle/oradata/test/onlinelog '




Configure the Listener.ora on the target library
Sid_list_listener =
(Sid_list =
(Sid_desc =
(global_dbname = test)
(Oracle_home =/u01/app/oracle/12.1.0.1/db_1)
(sid_name = test)
)
)

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.6.0.179) (PORT = 1521))
)








Configure the Tnsname.ora on the target library
[email protected] admin]$ cat Tnsnames.ora
Test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.6.0.207) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = test)
)
)

Test2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.6.0.179) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = test)
)
)








Rman target Sys/[email protected] auxiliary sys/[email protected]



--rman here there is a limit to the test character, plus single quotes to solve the problem


Rman>duplicate target database to ' test ' from active database;

Starting Duplicate Db at 22-oct-15
Using target database control file instead of recovery catalog
Allocated Channel:ora_aux_disk_1
Channel ORA_AUX_DISK_1:SID=12 Device Type=disk
Current log Archived

Contents of Memory Script:
{
SQL Clone "Create SPFile from memory";
}
Executing Memory Script

SQL Statement:create SPFile from memory

Contents of Memory Script:
{
Shutdown clone Immediate;
Startup clone Nomount;
}
Executing Memory Script

Oracle instance shut down

Connected to auxiliary database (not started)
Oracle instance started

Total System Global area 838860800 bytes
.....

DataFile 2 switched to datafile copy
Input datafile copy recid=1 stamp=893782472 file name=/u01/app/oracle/oradata/test/datafile/sysaux01.dbf
DataFile 3 switched to datafile copy
Input datafile copy recid=2 stamp=893782472 file name=/u01/app/oracle/oradata/test/datafile/undotbs01.dbf
DataFile 4 switched to datafile copy
Input datafile copy recid=3 stamp=893782472 file name=/u01/app/oracle/oradata/test/datafile/users01.dbf

Contents of Memory Script:
{
Alter Clone database open resetlogs;
}
Executing Memory Script

Database opened
Cannot remove created server parameter file
Finished Duplicate Db at 22-oct-15

Rman> exit



The above is the active Database duplication testing process

This article is from the "SYSDBA" blog, make sure to keep this source http://sysdba.blog.51cto.com/10492366/1705317

Oracle Active Database Duplication

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.