[oracle@tbrac01 admin]$ vi tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TBRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.140)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.141)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = tbrac) (UR=A)
)
)
TBRACPHY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.133)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.134)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = tbrac) (UR=A)
)
)
主库:
SQL> startup mount;
ORACLE instance started.
Total System Global Area 6714322944 bytes
Fixed Size 2239192 bytes
Variable Size 3741320488 bytes
Database Buffers 2952790016 bytes
Redo Buffers 17973248 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database force logging;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter system set standby_file_management = auto scope=both;
System altered.
SQL> alter system set log_archive_config='DG_CONFIG=(tbrac,tbracphy)' scope=both;
System altered.
SQL> alter system set log_archive_dest_1 ='LOCATION=+FLA/tbrac/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tbrac' scope=both;
System altered.
SQL> alter system set log_archive_dest_2 ='SERVICE=tbracphy LGWR ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=tbracphy' scope=both;
System altered.
SQL> alter system set fal_server=tbracphy scope=both;
System altered.
SQL> alter system set fal_client=tbrac scope=both;
System altered.
创建主库pfile 修改成备库的配置
*.log_archive_dest_1='LOCATION=+LOG/tbrac/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tbrac'
tbrac1.__db_cache_size=2952790016
tbrac2.__db_cache_size=3019898880
tbrac1.__java_pool_size=16777216
tbrac2.__java_pool_size=16777216
tbrac1.__large_pool_size=16777216
tbrac2.__large_pool_size=16777216
tbrac1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
tbrac2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
tbrac1.__pga_aggregate_target=2701131776
tbrac2.__pga_aggregate_target=2701131776
tbrac1.__sga_target=4043309056
tbrac2.__sga_target=4043309056
tbrac1.__shared_io_pool_size=0
tbrac2.__shared_io_pool_size=0
tbrac1.__shared_pool_size=1006632960
tbrac2.__shared_pool_size=939524096
tbrac1.__streams_pool_size=0
tbrac2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/tbrac/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATA/tbrac/controlfile/current.260.908030047'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='tbrac'
*.db_unique_name='tbracphy'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=tbracXDB)'
*.fal_client='TBRACPHY'
*.fal_server='TBRAC'
tbrac1.instance_number=1
tbrac2.instance_number=2
*.log_archive_config='DG_CONFIG=(tbrac,tbracphy)'
*.db_file_name_convert='+DATA/tbrac','+DATA/tbrac'
*.log_file_name_convert='+DATA/tbrac/onlinelog/','+DATA/tbrac/onlinelog/'
tbrac1.log_archive_dest_1='LOCATION=+LOG/tbrac/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tbracphy'
tbrac2.log_archive_dest_1='LOCATION=+LOG/tbrac/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tbracphy'
*.log_archive_dest_1='LOCATION=+LOG/tbrac/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tbracphy')
*.log_archive_dest_2='SERVICE=tbrac LGWR ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=tbrac'
*.memory_target=6731857920
*.open_cursors=300
*.processes=150
*.remote_listener='rac-scan:1521'
*.remote_login_passwordfile='exclusive'
*.standby_file_management='AUTO'
tbrac2.thread=2
tbrac1.thread=1
tbrac1.undo_tablespace='UNDOTBS1'
tbrac2.undo_tablespace='UNDOTBS2'
SQL> create spfile='+DATA/tbrac/spfiletbrac.ora' from pfile='/home/oracle/tbracpfile.ora';
File created.
SQL> startup nomount;
ORACLE instance started.
主库开始同步!
[oracle@tbrac01 admin]$ sqlplus sys/oracle@TBRACPHY as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Thu Apr 7 16:42:56 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> exit
[oracle@tbrac01 admin]$ rman target sys/oracle@tbrac auxiliary sys/oracle@tbracphy
Recovery Manager: Release 11.2.0.2.0 - Production on Thu Apr 7 16:45:02 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TBRAC (DBID=1002740510)
connected to auxiliary database: TBRAC (not mounted)
RMAN> duplicate target database for standby from active database nofilenamecheck;
Starting Duplicate Db at 07-APR-16
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=10 instance=tbrac1 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwtbrac1' auxiliary format
'/u01/app/oracle/product/11.1.0/db_1/dbs/orapwtbrac1' ;
}
executing Memory Script
Starting backup at 07-APR-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=75 instance=tbrac1 device type=DISK
Finished backup at 07-APR-16
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/tbracphy/controlfile/current.292.908556639'' comment=
''Set by RMAN'' scope=spfile";
backup as copy current controlfile for standby auxiliary format '+DATA/tbracphy/controlfile/current.293.908556639';
sql clone "alter system set control_files =
''+DATA/tbracphy/controlfile/current.293.908556639'' comment=
''Set by RMAN'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set control_files = ''+DATA/tbracphy/controlfile/current.292.908556639'' comment= ''Set by RMAN'' scope=spfile
Starting backup at 07-APR-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_tbrac1.f tag=TAG20160407T165039 RECID=3 STAMP=908556639
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 07-APR-16
sql statement: alter system set control_files = ''+DATA/tbracphy/controlfile/current.293.908556639'' comment= ''Set by RMAN'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 6714322944 bytes
Fixed Size 2239192 bytes
Variable Size 3741320488 bytes
Database Buffers 2952790016 bytes
Redo Buffers 17973248 bytes
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.
contents of Memory Script:
{
set newname for tempfile 1 to
"+data";
switch clone tempfile all;
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 datafile 5 to
"+data";
backup as copy reuse
datafile 1 auxiliary format
"+data" datafile
2 auxiliary format
"+data" datafile
3 auxiliary format
"+data" datafile
4 auxiliary format
"+data" datafile
5 auxiliary format
"+data" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to +data in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 07-APR-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/tbrac/datafile/sysaux.257.908029935
output file name=+DATA/tbracphy/datafile/sysaux.294.908556675 tag=TAG20160407T165113
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/tbrac/datafile/system.256.908029933
output file name=+DATA/tbracphy/datafile/system.295.908556689 tag=TAG20160407T165113
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/tbrac/datafile/undotbs1.258.908029935
output file name=+DATA/tbracphy/datafile/undotbs1.296.908556705 tag=TAG20160407T165113
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/tbrac/datafile/undotbs2.264.908030185
output file name=+DATA/tbracphy/datafile/undotbs2.297.908556707 tag=TAG20160407T165113
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/tbrac/datafile/users.259.908029935
output file name=+DATA/tbracphy/datafile/users.298.908556709 tag=TAG20160407T165113
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 07-APR-16
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=908556712 file name=+DATA/tbracphy/datafile/system.295.908556689
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=908556712 file name=+DATA/tbracphy/datafile/sysaux.294.908556675
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=908556712 file name=+DATA/tbracphy/datafile/undotbs1.296.908556705
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=908556712 file name=+DATA/tbracphy/datafile/users.298.908556709
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=908556712 file name=+DATA/tbracphy/datafile/undotbs2.297.908556707
Finished Duplicate Db at 07-APR-16
[oracle@trac02 ~]$ srvctl add database -d tbrac -o $ORACLE_HOME -p +DATA/tbrac/spfiletbrac.ora
[oracle@trac02 ~]$ srvctl add instance -d tbrac -i tbrac1 -n trac01
[oracle@trac02 ~]$ srvctl add instance -d tbrac -i tbrac2 -n trac02
备库
alter database add standby logfile thread 1 group 10 '+LOG/tbrac/redo/redo01_std01.log' size 50M;
alter database add standby logfile thread 1 group 11 '+LOG/tbrac/redo/redo01_std02.log' size 50M;
alter database add standby logfile thread 1 group 12 '+LOG/tbrac/redo/redo01_std03.log' size 50M;
alter database add standby logfile thread 1 group 13 '+LOG/tbrac/redo/redo01_std04.log' size 50M;
alter database add standby logfile thread 1 group 14 '+LOG/tbrac/redo/redo01_std05.log' size 50M;
alter database add standby logfile thread 2 group 15 '+LOG/tbrac/redo/redo02_std01.log' size 50M;
alter database add standby logfile thread 2 group 16 '+LOG/tbrac/redo/redo02_std02.log' size 50M;
alter database add standby logfile thread 2 group 17 '+LOG/tbrac/redo/redo02_std03.log' size 50M;
alter database add standby logfile thread 2 group 18 '+LOG/tbrac/redo/redo02_std04.log' size 50M;
alter database add standby logfile thread 2 group 19 '+LOG/tbrac/redo/redo02_std05.log' size 50M;
主库
alter database add standby logfile thread 1 group 10 '+FLA/tbrac/redo/redo01_std01.log' size 50M;
alter database add standby logfile thread 1 group 11 '+FLA/tbrac/redo/redo01_std02.log' size 50M;
alter database add standby logfile thread 1 group 12 '+FLA/tbrac/redo/redo01_std03.log' size 50M;
alter database add standby logfile thread 1 group 13 '+FLA/tbrac/redo/redo01_std04.log' size 50M;
alter database add standby logfile thread 1 group 14 '+FLA/tbrac/redo/redo01_std05.log' size 50M;
alter database add standby logfile thread 2 group 15 '+FLA/tbrac/redo/redo02_std01.log' size 50M;
alter database add standby logfile thread 2 group 16 '+FLA/tbrac/redo/redo02_std02.log' size 50M;
alter database add standby logfile thread 2 group 17 '+FLA/tbrac/redo/redo02_std03.log' size 50M;
alter database add standby logfile thread 2 group 18 '+FLA/tbrac/redo/redo02_std04.log' size 50M;
alter database add standby logfile thread 2 group 19 '+FLA/tbrac/redo/redo02_std05.log' size 50M;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29320885/viewspace-2077296/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29320885/viewspace-2077296/