Oracle 11g rman:active Database duplication for standby database create DG command interpretation

Source: Internet
Author: User

Production-based duplicate replication, if there is no manual configuration of Pfile (set memory, process, DG-related configuration parameters, database-related path parameters), there will be a variety of parameters can not be converted;
Because duplicate will automatically copy pfile from production, control files, password files, if the main library and the standby environment is different (database software path, data file storage path)
If the parameters of the new environment repository are not fully specified in the duplicate command, the parameters in the SPFile that are copied from the main library are used by default (the default configuration of Oracle customization is ignored: for example, the ADR is placed under the oracle_base in the capital. , all parameters are configured with the SPFile of the main library copy.

This configuration is not recommended for those classmates who are not particularly knowledgeable about the original main library environment and the Oracle database parameters!

-------Note If the $oracle_base/of the repository and the main library are different $ORACLE _home/data storage path, you must configure the 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 200M
#SET Sga_target 185M
Nofilenamecheck;
}


These storage directories: Flash back directory, ADR directory, audit log directory, oracle-managed data file directory and so on, must pay attention to AH

------------here to explain the principle of initializing the repository with the above command, using the date output of the class above command execution:

$rman target Sys/[email protected] auxiliary sys/[email protected]
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: Allocation 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 main Library 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 '-----modified

Contents of Memory Script:-----------------------Here Rman automatically generates the following script based on setting some of the parameter settings we spfile in the run 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; ----------------because when you create a repository in this way, we only need to configure a three parameter that contains db_name,db_unique_name,block_size and boot the repository into the Nomount state. The main purpose is to have Rman copy the SPFile and password files of the master library
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 copying the standby control file and uploading it to the appropriate location in the repository
{
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 Repository, ready to modify the initialized data file path and copy it to the standby library

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 to update the new data file path 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 repository environment has been fully initialized, eliminating the need for us to manually configure the Pfile parameter file, manually copy the password file to the repository, create the standby control and copy to the standby, copy the data file backup to the repository and so on. But see here, there is a puzzled Oracle How to directly copy those password files, parameter files, control files, data files to the repository? This is supposed to call the Rman some interface, said the straightforward point is and nbu those third-party data backup software use of the trick, now Oracle himself think these interfaces can also be used, and thus in 11g (11.1.0.6 start) introduced Active-database Duplicate about this feature Oracle officially says:
Active Database duplication copies the live target databaseOver the networkto the auxiliary destination and then creates the duplicate database.
The duplication work was performed by an auxiliary channel. This channel corresponds to a server session on the auxiliary instance on the auxiliary host.


Here are the things that Rman did during the 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

Oracle 11g rman:active Database duplication for standby database create DG command interpretation

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.