Oracle 11g RMAN: Interpretation of the command for creating dg in Active Database Duplication for standby database, rmanduplication

Source: Internet
Author: User

Oracle 11g RMAN: Interpretation of the command for creating dg in Active Database Duplication for standby database, rmanduplication
If the production-based duplicate replication is not manually configured with pfile (set memory, process, dg-related configuration parameters, database-related path parameters), various parameters cannot be converted;
Because duplicate will automatically copy pfile, control file, and password files from production. If the environment of the master database is different from that of the slave database (database software path and data file storage path)
If the path and conversion parameters of the new environment standby database are not completely specified in the duplicate command, the spfile parameter settings copied from the master database are used by default (oracle custom default configurations are ignored. For example, the default adr settings are placed under ORACLE_BASE, all parameter configurations are based on the spfile copied from the master database );

We do not recommend this configuration for those who are not particularly familiar with the original master database environment and oracle Database parameters!

------- Note that if = the backup database and the master database's $ ORACLE_BASE/$ ORACLE_HOME/Data Storage path are different, you must configure the following parameters:
Run {
Allocate channel prmy1 type disk;
Allocate channel prmy2 type disk;
Allocate channel prmy3 type disk;
Allocate channel prmy4 type disk;
Allocate auxiliary channel stby type disk;

Duplicate target database for standby from active database
Dorecover
Spfile
Parameter_value_convert 'ora11g', 'lixora'
Set db_unique_name = 'orcl'
Set standby_file_management = 'auto'
SET FAL_SERVER = "ora11g"
SET LOG_ARCHIVE_DEST_1 = 'location =/oracle/app/oracle/oradata/arch VALID_FOR = (ALL_LOGFILE, ALL_ROLE) DB_UNIQUE_NAME = lixora'
Set log_archive_dest_2 = 'service = ora11g ASYNC valid_for = (ONLINE_LOGFILE, PRIMARY_ROLE) db_unique_name = ora11g'
SET CONTROL_FILES '/oracle/app/oracle/oradata/control01.ctl'
Set diagnostic_dest = '/oracle/app/oracle'
Set audit_file_dest = '/oracle/app/oracle'
Set DB_FILE_NAME_CONVERT = '/u01/app/ora11/oradata/ORA11G/datafile/', '/oracle/app/oracle/oradata /'
SET LOG_FILE_NAME_CONVERT '/u01/app/ora11/oradata/ORA11G/onlinelog/', '/oracle/app/oracle/oradata /'
Set db_create_file_dest = '/oracle/app/oracle/oradata /'
Set db_recovery_file_dest = '/oracle/app/oracle/oradata /'
# SET SGA_MAX_SIZE 200 M
# SET SGA_TARGET 185 M
NOFILENAMECHECK;
}


Note the following storage directories: the flashback directory, the adr Directory, the audit log directory, and the Oracle-managed data file directory.

------------ Here I will explain the daily output after the above commands are executed to understand the principle of initializing the slave database using the above commands:

$ Rman target sys/sys @ chicago auxiliary sys/sys @ boston
Connected to target database: CHICAGO (DBID = 761464750)
Connected to auxiliary database: CHICAGO (not mounted)
RMAN> run {
Allocate channel prmy1 type disk;
Allocate channel prmy2 type disk;
Allocate channel prmy3 type disk;
Allocate channel prmy4 type disk;
Allocate auxiliary channel stby type disk;
Duplicate target database for standby from active database
Spfile
Parameter_value_convert 'Chicago ', 'boston'
Set db_unique_name = 'boston'
Set db_file_name_convert = '/chicago/', '/boston /'
Set log_file_name_convert = '/chicago/', '/boston /'
Set control_files = '/u01/app/oracle/oradata/control01.ctl'
Set log_archive_max_processes = '5'
Set fal_client = 'boston'
Set fal_server = 'Chicago'
Set standby_file_management = 'auto'
Set log_archive_config = 'dg _ config = (chicago, boston )'
Set log_archive_dest_2 = 'service = chicago ASYNCvalid_for = (ONLINE_LOGFILE, PRIMARY_ROLE) db_unique_name = chicago'
;
}

Using target database control file instead of recovery catalog
Allocated channel: prmy1 --------- this is not much to say: allocate channel
Channel prmy1: SID = 147 device type = DISK
Allocated channel: prmy2
Channel prmy2: SID = 130 device type = DISK
Allocated channel: prmy3
Channel prmy3: SID = 137 device type = DISK
Allocated channel: prmy4
Channel prmy4: SID = 170 device type = DISK
Allocated channel: stby
Channel stby: SID = 98 device type = DISK


Starting Duplicate Db at 19-MAY-08
Contents of Memory Script:
{
Backup as copy reuse ------------- copy the master database password file, spfile parameter file
File '/u02/app/oracle/product/11.1.0/db_1/dbs/orapwcore 'auxiliary format'/u02/app/oracle/product/11.1.0/db_1/dbs/orapwcore1'
File '/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore. ora 'auxiliary format'/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore1.ora ';
SQL clone "alter system set spfile =''/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore1.ora ''";
}
Executing Memory Script ----

Starting backup at 19-MAY-08
Finished backup at 19-MAY-08

SQL statement: alter system set spfile = ''/u02/app/oracle/product/11.1.0/db_1/dbs/spfilecore1.ora'' ----- modify

Contents of Memory Script: ----------------------- here, according to the settings we set some parameter settings marked by spfile in the run Script, RMAN will automatically generate the following Script
{
SQL clone "alter system set audit_file_dest =''/u02/app/oracle/admin/boston/adump '''comment = ''' scope = spfile ";
SQL clone "alter system set dispatchers ='' (PROTOCOL = TCP) (SERVICE = core1XDB) ''comment = ''' scope = spfile ";
SQL clone "alter system set log_archive_dest_2 ='' service = core11 arch async VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) db_unique_name = boston ''comment = ''''

Scope = spfile ";
SQL clone "alter system set db_unique_name = ''boston'' comment = ''' scope = spfile ";
SQL clone "alter system set db_file_name_convert =''/chicago/'',''/boston/''comment = ''' scope = spfile ";
SQL clone "alter system set log_file_name_convert =''/chicago/'',''/boston/''comment = ''' scope = spfile ";
SQL clone "alter system set control_files =''/u01/app/oracle/oradata/control01.ctl ''comment = ''' scope = spfile ";
SQL clone "alter system set log_archive_max_processes = 5 comment = ''' scope = spfile ";
SQL clone "alter system set fal_client = ''boston'' comment = ''' scope = spfile ";
SQL clone "alter system set fal_server = ''chicago'' comment = ''' scope = spfile ";
SQL clone "alter system set standby_file_management = ''auto'' comment = '''' scope = spfile ";
SQL clone "alter system set log_archive_config ='' dg _ config = (chicago, boston) ''comment = ''' scope = spfile ";
SQL clone "alter system set log_archive_dest_2 ='' service = chicago ASYNC valid_for = (ONLINE_LOGFILE, PRIMARY_ROLE) db_unique_name = chicago '''comment = ''' scope = spfile ";
Shutdown clone immediate; ---------------- when using this method to create a slave database, we only need to configure three parameters, including db_name, db_unique_name, and block_size, start the slave database to the nomount state. The main purpose is to allow rman to copy the spfile and password files of the master database.
Startup clone nomount;
}
Executing Memory Script


SQL statement: alter system set audit_file_dest = ''/u02/app/oracle/admin/boston/adump '''comment = ''' scope = spfile
SQL statement: alter system set dispatchers = ''(PROTOCOL = TCP) (SERVICE = core1XDB)'' comment = ''' scope = spfile
SQL statement: alter system set log_archive_dest_2 = ''service = core11 arch async VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) db_unique_name = boston ''comment = ''''


Scope = spfile
SQL statement: alter system set db_unique_name = ''boston ''comment = ''' scope = spfile
SQL statement: alter system set db_file_name_convert = ''/chicago/'', ''/boston/''comment = ''' scope = spfile
SQL statement: alter system set log_file_name_convert = ''/chicago/'', ''/boston/''comment = ''' scope = spfile
SQL statement: alter system set control_files = ''/u01/app/oracle/oradata/control01.ctl'' comment = ''' scope = spfile
SQL statement: alter system set log_archive_max_processes = 5 comment = ''' scope = spfile
SQL statement: alter system set fal_client = ''boston ''comment = ''' scope = spfile
SQL statement: alter system set fal_server = ''chicago ''comment = ''' scope = spfile
SQL statement: alter system set standby_file_management = 'auto' 'comment = ''' scope = spfile
SQL statement: alter system set log_archive_config = ''dg _ config = (chicago, boston)'' comment = ''' scope = spfile
SQL statement: alter system set log_archive_dest_2 = ''service = chicago ASYNC valid_for = (ONLINE_LOGFILE, PRIMARY_ROLE) db_unique_name = chicago'' comment = ''''

Scope = spfile

Oracle instance shut down -------------- restart here to use the updated spfile

Connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 845348864 bytes

Fixed Size 1303188 bytes
Variable Size 482348396 bytes
Database Buffers 356515840 bytes
Redo Buffers 5181440 bytes
Contents of Memory Script: --------------- start to copy the standby control file and upload it to the corresponding location of the standby Database
{
Backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/control01.ctl ';
SQL clone 'alter database mount standby database ';
}
Executing Memory Script

Starting backup at 19-MAY-08
Channel prmy1: starting datafile copy
Copying standby control file
Output file name =/u02/app/oracle/product/11.1.0/db_1/dbs/snapcf_chicago.f tag = TAG20080519T173406 RECID = 2 STAMP = 655148053
Channel prmy1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 19-MAY-08
SQL statement: alter database mount standby database -------------------- mount the standby database, prepare to modify the initialized data file path, and copy it to the standby database

Contents of Memory Script:
{
Set newname for tempfile 1 to "/u02/app/oracle/oradata/boston/temp01.dbf ";
Switch clone tempfile all;
Set newname for datafile 1 to "/u02/app/oracle/oradata/boston/system01.dbf ";
Set newname for datafile 2 to "/u02/app/oracle/oradata/boston/sysaux01.dbf ";
Set newname for datafile 3 to "/u02/app/oracle/oradata/boston/undotbs01.dbf ";
Set newname for datafile 4 to "/u02/app/oracle/oradata/boston/users01.dbf ";
Backup as copy reuse
Datafile 1 auxiliary format "/u02/app/oracle/oradata/boston/system01.dbf"
Datafile 2 auxiliary format "/u02/app/oracle/oradata/boston/sysaux01.dbf"
Datafile 3 auxiliary format "/u02/app/oracle/oradata/boston/undotbs01.dbf"
Datafile 4 auxiliary format "/u02/app/oracle/oradata/boston/users01.dbf ";
SQL 'alter system archive log current ';
}
Executing Memory Script

Executing command: SET NEWNAME

Renamed tempfile 1 to/u02/app/oracle/oradata/boston/temp01.dbf in control file

Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME

Starting backup at 19-MAY-08
Channel prmy1: starting datafile copy
Input datafile file number = 00001 name =/u02/app/oracle/oradata/chicago/system01.dbf
Channel prmy2: starting datafile copy
Input datafile file number = 00002 name =/u02/app/oracle/oradata/chicago/sysaux01.dbf
Channel prmy3: starting datafile copy
Input datafile file number = 00003 name =/u02/app/oracle/oradata/chicago/undotbs01.dbf
Channel prmy4: starting datafile copy
Input datafile file number = 00004 name =/u02/app/oracle/oradata/chicago/users01.dbf
Output file name =/u02/app/oracle/oradata/boston/undotbs01.dbf tag = TAG20080519T173421 RECID = 0 STAMP = 0
Channel prmy3: datafile copy complete, elapsed time: 00:00:24
Output file name =/u02/app/oracle/oradata/boston/users01.dbf tag = TAG20080519T173421 RECID = 0 STAMP = 0
Channel prmy4: datafile copy complete, elapsed time: 00:00:16
Output file name =/u02/app/oracle/oradata/boston/system01.dbf tag = TAG20080519T173421 RECID = 0 STAMP = 0
Channel prmy1: datafile copy complete, elapsed time: 00:02:32
Output file name =/u02/app/oracle/oradata/boston/sysaux01.dbf tag = TAG20080519T173421 RECID = 0 STAMP = 0
Channel prmy2: datafile copy complete, elapsed time: 00:02:32
Finished backup at 19-MAY-08

SQL statement: alter system archive log current

Contents of Memory Script:
{
Switch clone datafile all; --------- modify the standby control file and update the path of the new data file in the standby Control File
}
Executing Memory Script

Datafile 1 switched to datafile copy
Input datafile copy RECID = 2 STAMP = 655148231 file name =/u02/app/oracle/oradata/boston/system01.dbf
Datafile 2 switched to datafile copy
Input datafile copy RECID = 3 STAMP = 655148231 file name =/u02/app/oracle/oradata/boston/sysaux01.dbf
Datafile 3 switched to datafile copy
Input datafile copy RECID = 4 STAMP = 655148231 file name =/u02/app/oracle/oradata/boston/undotbs01.dbf
Datafile 4 switched to datafile copy
Input datafile copy RECID = 5 STAMP = 655148231 file name =/u02/app/oracle/oradata/boston/users01.dbf
Finished Duplicate Db at 19-MAY-08
Released channel: prmy1
Released channel: prmy2
Released channel: prmy3
Released channel: prmy4



The backup database environment has been fully initialized, eliminating the need to manually configure the pfile parameter file in the backup database and manually copy the password file to the backup database, create a standby control and copy it to the slave database, copy the data file and back it up to the slave database, and so on. But here we still have a question: How does oracle directly copy those password files and parameter files, control File, data file to slave database? Here, I guess some interfaces of rman are called. The straightforward point is the method used with the third-party Data Backup Software of nbu. Now oracle thinks these interfaces can be used as well, since the release of active-database duplicate in 11g (starting from 11.1.0.6), the official statement about this feature oracle is as follows:
Active database duplication copies the live target database over the network to the auxiliary destination and then creates the duplicate database.
The duplication work is performed med by an auxiliary channel. This channel corresponds to a server session on the auxiliary instance on the auxiliary host.


The following are the tasks that rman does during Basic Steps to ACTIVE database duplication:
As part of the duplicating operation, RMAN automates the following steps:
1. Creates a control file for the duplicate database
2. Restarts the auxiliary instance and mounts the duplicate control file
3. Creates the duplicate datafiles and recovers them with incremental backups and archived redo logs.
4. Opens the duplicate database with the RESETLOGS option

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.