在Oracle 12c上實施ACFS replication

dbhelper發表於2015-01-23

在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 nodePrimary 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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1411702/,如需轉載,請註明出處,否則將追究法律責任。

相關文章