配置远程归档
与本地归档一样,远程归档也是配置在dmarch.ini文件中,远程归档相关的主要几个配置项包括:
1. ARCH_TYPE设置为REMOTE,表示是远程归档
2. ARCH_DEST设置为远程数据库实例名,表示REDO日志发送到这个节点
3. ARCH_INCOMING_PATH设置为本地存储路径,用于保存ARCH_DEST实例发送的REDO日志
一般建议DMRAC集群中的节点,在配置本地归档之外,再交叉配置集群中所有其他节点的远程归档。查询V$DM_ARCH_INI、V$ARCH_STATUS等动态视图可以获取归档配置以及归档状态等相关信息。下面以两节点DMRAC集群为例,说明如何配置远程归档,RAC0和RAC1是DMRAC集群中的两个实例,交叉进行REMOTE归档配置:
1)修改数据库为MOUNT状态。
rac0实例:
SQL> alter database mount;
executed successfully
used time: 00:00:01.852. Execute id is 0.
rac1实例:
SQL> alter database mount;
executed successfully
used time: 00:00:01.853. Execute id is 0.
2)配置本地归档。
rac0实例:
SQL> alter database add archivelog 'dest=/dm7/data/rac0_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 3.459(ms). Execute id is 0.
rac1实例:
SQL> alter database add archivelog 'dest=/dm7/data/rac1_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 3.000(ms). Execute id is 0.
3)配置远程归档。
rac0实例:
SQL> alter database add archivelog 'dest=RAC1,type=remote,file_size=256,space_limit=0,incoming_path=/dm7/data/rac1_arch';
executed successfully
used time: 2.836(ms). Execute id is 0.
rac1实例:
SQL> alter database add archivelog 'dest=RAC0,type=remote,file_size=256,space_limit=0,incoming_path=/dm7/data/rac0_arch';
executed successfully
used time: 2.865(ms). Execute id is 0.
4)开启归档模式。
rac0实例:
SQL> alter database archivelog;
executed successfully
used time: 11.553(ms). Execute id is 0.
rac1实例:
SQL> alter database archivelog;
executed successfully
used time: 10.644(ms). Execute id is 0.
5)修改数据库为OPEN状态。
rac0实例:
SQL> alter database open;
executed successfully
used time: 00:00:01.362. Execute id is 0.
rac1实例:
SQL> alter database open;
executed successfully
used time: 00:00:02.341. Execute id is 0.
6)查看归档配置文件dmarch.ini
rac0实例:
[dmdba@dmrac1 rac0_config]$ pwd
/dm7/data/rac0_config
[dmdba@dmrac1 rac0_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments
ARCH_WAIT_APPLY = 1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm7/data/rac0_arch
ARCH_FILE_SIZE = 256
ARCH_SPACE_LIMIT = 0
[ARCH_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC1
ARCH_INCOMING_PATH = /dm7/data/rac1_arch
ARCH_FILE_SIZE = 256
ARCH_SPACE_LIMIT = 0
rac1实例:
[dmdba@dmrac2 rac1_config]$ pwd
/dm7/data/rac1_config
[dmdba@dmrac2 rac1_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments
ARCH_WAIT_APPLY = 1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm7/data/rac1_arch
ARCH_FILE_SIZE = 256
ARCH_SPACE_LIMIT = 0
[ARCH_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC0
ARCH_INCOMING_PATH = /dm7/data/rac0_arch
ARCH_FILE_SIZE = 256
ARCH_SPACE_LIMIT = 0
7)检查ARCH_INI参数是否为1
rac0实例:
SQL> select * from v$dm_ini where para_name='ARCH_INI';
LINEID PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1 ARCH_INI 1 0 1 N 1 1 dmarch.ini SYS
used time: 10.267(ms). Execute id is 9.
rac1实例:
SQL> select * from v$dm_ini where para_name='ARCH_INI';
LINEID PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1 ARCH_INI 1 0 1 N 1 1 dmarch.ini SYS
used time: 30.225(ms). Execute id is 19.
8)检查是否生成了归档日志文件(在打开数据库时就会生成)
本地归档日志文件
rac0实例:
[dmdba@dmrac1 rac0_arch]$ pwd
/dm7/data/rac0_arch
[dmdba@dmrac1 rac0_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCHIVE_LOCAL1_20200528202150715_0.log
rac1实例:
[dmdba@dmrac2 rac1_arch]$ pwd
/dm7/data/rac1_arch
[dmdba@dmrac2 rac1_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCHIVE_LOCAL1_20200528202151877_1.log
远程归档日志文件
rac0实例:
[dmdba@dmrac1 rac1_arch]$ pwd
/dm7/data/rac1_arch
[dmdba@dmrac1 rac1_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCH_REMOTE1_20200528202146001_1.log
rac1实例:
[dmdba@dmrac2 rac0_arch]$ pwd
/dm7/data/rac0_arch
[dmdba@dmrac2 rac0_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCH_REMOTE1_20200528202156601_0.log