在Oracle 12C上实施ACFS replication

环境: qc550705 & qc550707, AIX6.1+12c RAC

Primary FS: qc550705:/acfs3

Standby FS: qc550707:/acfsstd1

实施前提:primary FS的可用空间必须等于其已使用空间

以下是实施Replication的步骤:

1、 建立replication admin(一个节点上操作)

grid@qc550705:/home/grid>sqlplus "/as sysasm"

 

SQL*Plus: Release 12.1.0.1.0 Production on Fri Feb 14 16:24:33 2014

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options

 

SQL> CREATE USER acfsrep1 IDENTIFIED BY "773946";

 

User created.

 

SQL> GRANT sysasm,sysdba TO acfsrep1;

 

Grant succeeded.。

 

2、 建立standby FS

--Add ACFS volume

SQL> select a.group_number,b.name,a.name,value from v$asm_attribute a,v$asm_diskgroup b where lower(a.name) like '%compatible%' and b.group_number=a.group_number;

 

GROUP_NUMBER NAME                                    NAME                                    VALUE

------------ ---------------------------------------- ---------------------------------------- ------------------------------

          1 ACFSDG                                  compatible.asm                          12.1.0.0.0

          1 ACFSDG                                  compatible.rdbms                        12.1.0.0.0

          1 ACFSDG                                  compatible.advm                          12.1.0.0.0

          2 SYSDG                                    compatible.asm                          12.1.0.0.0

          2 SYSDG                                    compatible.rdbms                        10.1.0.0.0

 

SQL> alter diskgroup acfsdg add volume acfsvol_std1 size 16G unprotected stripe_columns 1;

 

Diskgroup altered.

 

SQL> quit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options

grid@qc550707:/home/grid>ls -l /dev/asm/acfsvol*

brw-rw-r--    1 root    asmadmin    50,24577 Jan 29 13:46 /dev/asm/acfsvol1-48

brw-rw-r--    1 root    asmadmin    50,24578 Jan 29 12:31 /dev/asm/acfsvol3-48

brw-rw-r--    1 root    asmadmin    50,24579 Feb 14 16:32 /dev/asm/acfsvol_std1-48

grid@qc550707:/home/grid>mkfs -V acfs -s 16G /dev/asm/acfsvol_std1-48

mkfs: version                  = 12.1.0.1.0

mkfs: on-disk version          = 39.0

mkfs: volume                    = /dev/asm/acfsvol_std1-48

mkfs: volume size              = 17179869184

mkfs: Format complete.

 

--Mount /acfsstd1

root@qc550707:/>srvctl add filesystem -device /dev/asm/acfsvol_std1-48 -path /acfsstd1 -node qc550707

root@qc550707:/>srvctl start filesystem -device /dev/asm/acfsvol_std1-48 -node qc550707

 

root@qc550707:/>crsctl status res ora.acfsdg.acfsvol_std1.acfs -t

--------------------------------------------------------------------------------

Name          Target  State        Server                  State details

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.acfsdg.acfsvol_std1.acfs

      1        ONLINE  ONLINE      qc550707                mounted on /acfsstd1

                                                            ,STABLE

--------------------------------------------------------------------------------

 

3、 为ASM instances增加ACFS replication专用的Service(两节点都要执行) 

--add service name for +ASM1

grid@qc550705:/home/grid>sqlplus "/as sysasm"

 

SQL*Plus: Release 12.1.0.1.0 Production on Fri Feb 14 16:36:29 2014

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options

 

SQL> alter system set service_names='+ASM1,primary_acfsrep' sid='+ASM1';

 

System altered.

 

SQL> show parameter service_name

 

NAME                                TYPE        VALUE

------------------------------------ ----------- ------------------------------

service_names                        string      +ASM1,primary_acfsrep

 

--add service name for +ASM1 & +ASM2

grid@qc550707:/home/grid>sqlplus '/as sysasm'

 

SQL*Plus: Release 12.1.0.1.0 Production on Fri Feb 14 16:37:06 2014

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options

 

SQL> alter system set service_names='+ASM2,standby_acfsrep' sid='+ASM2';

 

System altered.

 

SQL> show parameter service_name

 

NAME                                TYPE        VALUE

------------------------------------ ----------- ------------------------------

service_names                        string      +ASM2,standby_acfsrep

 

4、 在Primary 和 Standby节点tnsnames.ora文件中增加指向ASM instance的连接串

--add standby FS net service name to tnsnames.ora in Primary node qc550705

standby_acfsrep=(DESCRIPTION=

  (ADDRESS=(PROTOCOL=tcp)(HOST=qc550707)(PORT=1521))

  (CONNECT_DATA=(SERVICE_NAME=standby_acfsrep))) 

 

--add Primary FS net service name to tnsnames.ora in standby node qc550707

primary_acfsrep=(DESCRIPTION=

  (ADDRESS=(PROTOCOL=tcp)(HOST=qc550705)(PORT=1521))

  (CONNECT_DATA=(SERVICE_NAME=primary_acfsrep)))

 

--Test connection to standby ASM instance using sqlplus on primary node

sqlplus acfsrep1/773946@standby_acfsrep as sysasm

 

--Test connection to primary ASM instance using sqlplus on standby node

sqlplus acfsrep1/773946@primary_acfsrep as sysasm

 

5、 在Standby node和Primary node上发起replication initialize

--initialize standby FS

root@qc550707:/>acfsutil repl init standby -p acfsrep1/773946@primary_acfsrep -c standby_acfsrep /acfsstd1

Registering with user specified service name-standby_acfsrep

 

--观察standby node上的复制已经启动

root@qc550707:/>acfsutil repl info -c -v /acfsstd1

Site:                                Standby

Standby status:                      Initializing

    Initializing directories

Background Resources:                4 of 4 Online

Standby mount point:                /acfsstd1

Standby Oracle Net service name:    standby_acfsrep

Primary mount point:

Primary Oracle Net service name:    primary_acfsrep

Primary Oracle Net alias:            repladm/****@primary_acfsrep

Replicated tags:

Log compression:                    Off

Debug log level:                    2

 

--紧接着在Primary node上发起ACFS replication的操作

/sbin/acfsutil repl init primary -s acfsrep1/773946@standby_acfsrep -m /acfsstd1 -c primary_acfsrep /acfs3

root@qc550705:/>/sbin/acfsutil repl init primary -s acfsrep1/773946@standby_acfsrep -m /acfsstd1 -c primary_acfsrep /acfs3

validating the remote connection

remote connection has been established

Registering with user specified service name-primary_acfsrep

The standby replication site is initialized. ACFS replication will begin.

 

6、 验证replication是否已经完成

--Primary node

root@qc550705:/acfs3/.ACFS/repl/logs>acfsutil repl info -c -v /acfs3

Site:                                Primary

Lag Time:                            00:00:00

Primary status:                      Online

Background Resources:                3 of 3 Online

Primary mount point:                /acfs3

Primary Oracle Net service name:    primary_acfsrep

Standby mount point:                /acfsstd1

Standby Oracle Net service name:    standby_acfsrep

Standby Oracle Net alias:            acfsrep1/****@standby_acfsrep

Replicated tags:

Log compression:                    Off

Debug log level:                    2

 

--Standby node

root@qc550707:/>acfsutil repl info -c -v /acfsstd1

Site:                                Standby

Standby status:                      Online

Last sync time with primary:        Tue Mar 25 11:46:09 2014

Background Resources:                4 of 4 Online

Standby mount point:                /acfsstd1

Standby Oracle Net service name:    standby_acfsrep

Primary mount point:                /acfs3

Primary Oracle Net service name:    primary_acfsrep

Primary Oracle Net alias:            acfsrep1/****@primary_acfsrep

Replicated tags:

Log compression:                    Off

Debug log level:                    2

实施过程中的注意事项:

(1)    在standby node上发起initial replication操作后要紧接着在primary node上发起initial replication操作,否则standby node上的FS会一直处于initializing状态,且日志里还有有如下显示,the truck config information是由primary node生成的:

transportstdbyacfsvol_std1-48.log:2014-03-25 10:40:35.433: [transprt][/acfsstd1]Waiting for truck config info...sleeping

(2)    Primary FS中必须要有一半的空余空间用于存放Primary log,位置在/acfs3/.ACFS/repl目录下,一旦Primary FS的可用空间少于2G,复制就会停止,在/oracle/app/grid/product/12.1.0/grid_1/log/qc550705/acfs/replication/monitorprimacfsvol3-48.log 日志里会有如下报错:[ monitor][/acfs3]usrmCheckFreeSpace: primary replication file system has 2GB or less space available per active node.  Automatically terminating replication. Flags: 0xE3

相关推荐