Oracle12c_DataGuard_part_2_far_sync

在上面的基础上配置Far Sync .这里不实现Far sync的高可用.dg的数据配置恢复参考
Oracle12c_DataGuard_part_1

一、系统环境:

	数据库	操作系统	Ip		Service_name	db_unique_name	备注
	orcl	RHEL6.5	192.168.56.92	orcl		orcl		Primary DB
	orcl	RHEL6.5	192.168.56.94	orcl,orcldg	orcldg		Physical Standby DB
	orcl	RHEL6.5	192.168.56.93	orcl		orclfs		Far Sync Instance

二、配置primary/standby :
2.1 配置强制归档

	SQL> shutdown immediate
	SQL> startup mount
	SQL> alter database archivelog;
	SQL> alter database open;
	SQL> alter database force logging;
	SQL> archive log list;
	Database log mode              Archive Mode
	Automatic archival             Enabled
	Archive destination            /backup/archivelog
	Oldest online log sequence     67
	Next log sequence to archive   69
	Current log sequence           69

2.2 配置参数文件:

	SQL> ALTER system SET db_unique_name=orcl scope=spfile;
	SQL> ALTER system SET standby_file_management=auto;
	SQL> ALTER system SET archive_lag_target=900;
	SQL> ALTER DATABASE ADD standby logfile GROUP 4 ('/oradata/orcl/sby_redo04.log') SIZE 50m;
	SQL> ALTER DATABASE ADD standby logfile GROUP 5 ('/oradata/orcl/sby_redo05.log') SIZE 50m;
	SQL> ALTER DATABASE ADD standby logfile GROUP 6 ('/oradata/orcl/sby_redo06.log') SIZE 50m;
	SQL> ALTER DATABASE ADD standby logfile GROUP 7 ('/oradata/orcl/sby_redo07.log') SIZE 50m;
	SQL> ALTER system SET log_archive_config='dg_config=(orcl,orclfs,orcldg)';
	SQL> ALTER system SET log_archive_dest_1='location=/backup/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orcl' scope=spfile; 
	SQL> ALTER system SET log_archive_dest_2='service=orclfs lgwr sync affirm max_failure=1 alternate=log_archive_dest_3 valid_for=(online_logfiles,primary_role) db_unique_name=orclfs';
	SQL> ALTER system SET log_archive_dest_3='service=orcldg async noaffirm valid_for=(online_logfiles,primary_role) db_unique_name=orcldg';
	SQL> ALTER system SET log_archive_dest_state_2=enable;
	SQL> ALTER system SET log_archive_dest_state_3=alternate;
	--SQL> alter system set fal_server=orclfs;
	SQL> ALTER system SET fal_client=orclfs;
 
	SQL> shutdown immediate
	SQL> startup
 
	SQL> CREATE pfile FROM spfile;

2.3 主库配置监听

	[oracle@ora12102 ~]$ cd  $ORACLE_HOME
	[oracle@ora12102 db_1]$ cd network/admin/
	[oracle@ora12102 admin]$ vi listener.ora 
	[oracle@ora12102 admin]$ cat listener.ora 
	# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
	# Generated by Oracle configuration tools.
 
	LISTENER =
	  (DESCRIPTION_LIST =
	    (DESCRIPTION =
	      (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
	      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
	    )
	  )

2.4 主库配置tnsname

	[oracle@ora12102 admin]$ cat tnsnames.ora 
	# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
	# Generated by Oracle configuration tools.
 
	LISTENER_TEST =
	  (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
 
 
	TEST =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = test)
	    )
	  )
	orcl =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = orcl)
	    )
	  )
 
 
	orcldg =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102dg)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = orcldg)
	    )
	  )
	 orclfs =
	      (DESCRIPTION =
	        (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102fs)(PORT = 1521))
	        (CONNECT_DATA =
	          (SERVER = DEDICATED)
	          (SERVICE_NAME = orclfs)
	        )
	  )

2.5 备份主库数据文件

	RMAN>  backup full format '/backup/backup_%t_%s_%p' database;
	RMAN>  backup current controlfile for standby format='/backup/dg_cfile.%U'; 
	把备份文件传输到备库端相同的位置下
	SQL> 
	SQL> ALTER DATABASE CREATE FAR SYNC INSTANCE CONTROLFILE AS '/tmp/controlfs01.ctl';
 
	Database altered.
 
	SQL>  create pfile='/tmp/pfile.fs' from spfile;
 
	File created.

2.6 在far sync 建立目录
Far sync

	[root@ora12102fs ~]# mount /oradata/
	[root@ora12102fs ~]# chown -R oracle:oinstall /oradata/
 
	mkdir -p /u01/app/oracle/admin/orclfs/adump
	mkdir -p /oradata/archivelog

2.7 修改fs配置参数
复制密码文件

	[oracle@ora12102 orcl]$ scp /tmp/pfile.fs.ctl ora12102fs:/tmp/           
	oracle@ora12102fs's password: 
	/tmp/pfile.fs.ctl: No such file or directory
	[oracle@ora12102 orcl]$ scp /tmp/pfile.fs ora12102fs:/tmp/    
	oracle@ora12102fs's password: 
	pfile.fs    
 
	*.archive_lag_target=900
	*.audit_file_dest='/u01/app/oracle/admin/orclfs/adump'
	*.audit_trail='db'
	*.compatible='12.1.0.2.0'
	*.control_files='/oradata/orcl/control01.ctl','/oradata/orcl/control02.ctl'
	*.db_block_size=8192
	*.db_cache_size=419430400
	*.db_create_file_dest='/oradata/orcl'
	*.db_domain=''
	*.db_name='orcl'
	*.db_unique_name='ORCLFS'
	*.diagnostic_dest='/u01/app/oracle'
	*.enable_pluggable_database=true
	*.fal_client='ORCLDG'
	*.fal_server='ORCL'
	*.inmemory_size=209715200
	*.log_archive_config='dg_config=(orcl,orclfs,orcldg)'
	*.log_archive_dest_1='location=/oradata/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orclfs'
	*.log_archive_dest_2='service=orcldg async affirm valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=orcldg'
	*.log_archive_dest_state_2='ENABLE'
	*.open_cursors=300
	*.processes=300
	*.remote_login_passwordfile='EXCLUSIVE'
	*.sga_max_size=1073741824
	*.sga_target=1073741824
	*.shared_pool_size=209715200
	*.standby_file_management='AUTO'
	*.undo_tablespace='UNDOTBS1'

2.8 修改fs监听

[oracle@ora12102fs ~]$ cat /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora   
	# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
	# Generated by Oracle configuration tools.
 
	LISTENER =
	  (DESCRIPTION_LIST =
	    (DESCRIPTION =
	      (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102fs)(PORT = 1521))
	      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
	    )
	  )
 
	SID_LIST_LISTENER =
	    (SID_LIST =
	      (SID_DESC =
	        (GLOBAL_DBNAME = orclfs) 
	        (ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
	        (SID_NAME = orcl) 
	      )
	)

2.9 fs 配置 tnsname

	[oracle@ora12102 admin]$ cat tnsnames.ora 
	# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
	# Generated by Oracle configuration tools.
 
	LISTENER_TEST =
	  (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
 
 
	TEST =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = test)
	    )
	  )
	orcl =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = orcl)
	    )
	  )
 
 
	orcldg =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102dg)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = orcldg)
	    )
	  )
	 orclfs =
	      (DESCRIPTION =
	        (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102fs)(PORT = 1521))
	        (CONNECT_DATA =
	          (SERVER = DEDICATED)
	          (SERVICE_NAME = orclfs)
	        )
	  )

2.10 在phyical standby database 备份端建立目录

Dataguard

	mkdir -p /u01/app/oracle/admin/orcl
	mkdir -p /u01/app/oracle/admin/orcldg/adump
	mkdir -p /oradata/archivelog
	mkdir /oradata/orcl
	#pdb directory
	mkdir -p /oradata/orcl/pdbseed/
	mkdir -p /oradata/orcl/travel/

2.11 修改dg配置参数
复制密码文件

	[oracle@ora12102 orcl]$ scp /tmp/pfile.fs.ctl ora12102fs:/tmp/           
	oracle@ora12102fs's password: 
	/tmp/pfile.fs.ctl: No such file or directory
	[oracle@ora12102 orcl]$ scp /tmp/pfile.fs ora12102fs:/tmp/    
	oracle@ora12102fs's password: 
	pfile.fs    
	*.archive_lag_target=900
	*.audit_file_dest='/u01/app/oracle/admin/orcldg/adump'
	*.audit_trail='db'
	*.compatible='12.1.0.2.0'
	*.control_files='/oradata/orcl/control01.ctl','/oradata/orcl/control02.ctl'#Restore Controlfile
	*.db_block_size=8192
	*.db_cache_size=419430400
	*.db_create_file_dest='/oradata/orcl'
	*.db_domain=''
	*.db_file_name_convert='/orcl/','/orcl/'
	*.db_name='orcl'
	*.db_unique_name='orcldg'
	*.diagnostic_dest='/u01/app/oracle'
	*.dispatchers='(PROTOCOL=TCP) (SERVICE=orcldgXDB)'
	*.enable_pluggable_database=true
	*.fal_client=''
	*.fal_server='ORCLFS'
	*.inmemory_size=209715200
	*.log_archive_config='dg_config=(orcl,orclfs,orcldg)'
	*.log_archive_dest_1='location=/oradata/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orcldg'
	*.log_archive_dest_2='service=orcl LGWR SYNC affirm valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=orcl'
	*.log_archive_dest_state_2='enable'
	*.log_file_name_convert='/orcl/','/orcl/'
	*.open_cursors=300
	*.processes=300
	*.remote_login_passwordfile='EXCLUSIVE'
	*.sga_max_size=1073741824
	*.sga_target=1073741824
	*.shared_pool_size=209715200
	*.standby_file_management='AUTO'
	*.undo_tablespace='UNDOTBS1'

2.12 修改dg监听

	[oracle@ora12102fs ~]$ cat /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora   
	# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
	# Generated by Oracle configuration tools.
 
	LISTENER =
	  (DESCRIPTION_LIST =
	    (DESCRIPTION =
	      (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102dg)(PORT = 1521))
	      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
	    )
	  )
 
	SID_LIST_LISTENER =
	    (SID_LIST =
	      (SID_DESC =
	        (GLOBAL_DBNAME = orcldg) 
	        (ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
	        (SID_NAME = orcl) 
	      )
	)

2.13 配置dg tnsname

	 cat tnsnames.ora 
	# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
	# Generated by Oracle configuration tools.
 
	LISTENER_TEST =
	  (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
 
 
	TEST =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = test)
	    )
	  )
	orcl =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = orcl)
	    )
	  )
 
 
	orcldg =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102dg)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = orcldg)
	    )
	  )
 
	orclfs =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12102fs)(PORT = 1521))
	    (CONNECT_DATA =
	      (SERVER = DEDICATED)
	      (SERVICE_NAME = orclfs)
	    )
	  )

2.14 验证网络监听

三、切换日志
orcl

		primary_orcl >ALTER system switch logfile;
 
		System altered.
 
		Sun May 10 15:46:26 2015
		LGWR: Standby redo logfile selected TO archive thread 1 SEQUENCE 94
		LGWR: Standby redo logfile selected FOR thread 1 SEQUENCE 94 FOR destination LOG_ARCHIVE_DEST_2
		Sun May 10 15:46:27 2015
		Thread 1 advanced TO log SEQUENCE 94 (LGWR switch)
		  CURRENT log# 1 seq# 94 mem# 0: /oradata/orcl/redo01.log
		Sun May 10 15:46:27 2015
		Archived Log entry 70 added FOR thread 1 SEQUENCE 93 ID 0x53634e8b dest 1:

orclfs

		ARC3: Standby redo logfile selected FOR thread 1 SEQUENCE 93 FOR destination LOG_ARCHIVE_DEST_2
		RFS[3]: Selected log 5 FOR thread 1 SEQUENCE 94 dbid 1399018635 branch 871237903
		Sun May 10 15:46:26 2015
		Archived Log entry 14 added FOR thread 1 SEQUENCE 93 ID 0x53634e8b dest 1:
		Sun May 10 15:46:43 2015
		FAL[server]: Can't identify FAL client, null string supplied

orcldg

		Sun May 10 15:46:27 2015
		Archived Log entry 19 added FOR thread 1 SEQUENCE 93 ID 0x53634e8b dest 1:
		Sun May 10 15:46:27 2015
		Media Recovery Log /oradata/archivelog/1_93_871237903.dbf
		Media Recovery Waiting FOR thread 1 SEQUENCE 94
		primary_orcl >SELECT * FROM V$DATAGUARD_CONFIG;
 
		DB_UNIQUE_NAME                 PARENT_DBUN                    DEST_ROLE         CURRENT_SCN     CON_ID
		------------------------------ ------------------------------ ----------------- ----------- ----------
		ORCL                           NONE                           PRIMARY DATABASE      2728193          0
		orclfs                         ORCL                           FAR SYNC INSTANCE     2727385          0
		orcldg                         orclfs                         PHYSICAL STANDBY      2727385          0

real-time

	15:58:58 primary_orcl >CREATE TABLE dg_fs2 AS SELECT * FROM dba_objects;
 
	TABLE created.
 
	15:59:14 primary_orcl >
 
	15:59:20 orcl_dg > DESC dg_fs2
	          Name                            NULL?    TYPE
	           ------------------------------- -------- ----------------------------
	    1      OWNER                                    VARCHAR2(128)
	    2      OBJECT_NAME                              VARCHAR2(128)
	    3      SUBOBJECT_NAME                           VARCHAR2(128)
	    4      OBJECT_ID                                NUMBER
	    5      DATA_OBJECT_ID                           NUMBER
	    6      OBJECT_TYPE                              VARCHAR2(23)
	    7      CREATED                                  DATE
	    8      LAST_DDL_TIME                            DATE
	    9      TIMESTAMP                                VARCHAR2(19)
	   10      STATUS                                   VARCHAR2(7)
	   11      TEMPORARY                                VARCHAR2(1)
	   12      GENERATED                                VARCHAR2(1)
	   13      SECONDARY                                VARCHAR2(1)
	   14      NAMESPACE                                NUMBER
	   15      EDITION_NAME                             VARCHAR2(128)
	   16      SHARING                                  VARCHAR2(13)
	   17      EDITIONABLE                              VARCHAR2(1)
	   18      ORACLE_MAINTAINED                        VARCHAR2(1)

15:59:22 orcl_dg >

7.3.1 Configuring a Terminal Destination
Perform the following steps to configure a terminal destination:

1. Select a physical standby database to configure as a cascading standby database.

2. On the cascading standby database, configure the FAL_SERVER database initialization parameter with the Oracle Net alias of the primary database or of a standby database that receives redo directly from the primary database.

3. On the cascading standby database, configure a LOG_ARCHIVE_DEST_n database initialization parameter for one or more terminal destinations. Configure the SERVICE attribute of this destination with the Oracle Net alias of the terminal destination, and the VALID attribute to be valid for archival of the standby redo log while in the standby role.
If you specify ASYNC transport mode on destinations 1 through 10, then redo is shipped in real-time. If you do not specify a transport mode or you specify SYNC on destinations 1 through 10, then redo is shipped in non-real-time. Destinations 11 through 31 operate only in ASYNC (real-time) transport mode.

4. At the terminal destination, configure the FAL_SERVER database initialization parameter with the Oracle Net alias of the cascading standby database or of another standby database that is directly connected to the primary database. Although it is also possible to specify the primary database, this would defeat the purpose of cascading, which is to reduce the redo transport overhead on the primary database.

5. Example 7-1 shows some of the database initialization parameters used by the members of an Oracle Data Guard configuration that includes a primary database named boston that sends redo to a local physical standby database named boston2, which then cascades primary database redo to a remote physical standby database named denver.
Note that a LOG_ARCHIVE_DEST_n database initialization parameter could also be configured on database boston that is valid for standby redo log archival to database denver when database boston is in the standby role. This would allow redo cascading to database denver to continue if a switchover is performed between database boston and database boston2.

此条目发表在 未分类 分类目录。将固定链接加入收藏夹。

评论功能已关闭。