注:对于db_unique_name,我这里开始规划的主备库分别是pcssd和mynas。
pcssd:说明这个库在我的PC机上的SSD存储上。
mynas:说明这个库在我的NAS存储上。
最后,由于考虑到生产环境一般要求对主库环境影响最小,所以主库的db_unique_name最终选择不更改,还是保留jyzhao。
此外,这里LOG_ARCHIVE_DEST_2使用的是归档进程传输,后续可以根据需要改成LGWR传输,这样主备库的延迟可以更低。
修改参数值:
--alter system set db_unique_name='jyzhao' scope=spfile; alter system set log_archive_config= 'DG_CONFIG=(jyzhao,mynas)'; alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=jyzhao'; alter system set log_archive_dest_2='SERVICE=mynas ARCH VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=mynas'; alter system set log_archive_dest_state_1=enable; alter system set log_archive_dest_state_2=enable; alter system set FAL_SERVER='mynas'; alter system set db_file_name_convert='+data/mynas','+data1/jyzhao' scope=spfile; alter system set log_file_name_convert='+data/mynas','+data1/jyzhao','+fra/mynas','+fra1/jyzhao' scope=spfile; alter system set standby_file_management=AUTO;3.4 创建SRLs
确认当前v$log信息:
创建存放SRL的目录并添加SRLs:
ASMCMD> mkdir +fra1/jyzhao/STANDBYLOG --alter system set standby_file_management=manual scope=both sid='*'; alter database add standby logfile thread 1 group 11 '+fra1/jyzhao/standbylog/standby_group_11.log' size 52428800; alter database add standby logfile thread 1 group 12 '+fra1/jyzhao/standbylog/standby_group_12.log' size 52428800; alter database add standby logfile thread 1 group 13 '+fra1/jyzhao/standbylog/standby_group_13.log' size 52428800; alter database add standby logfile thread 2 group 21 '+fra1/jyzhao/standbylog/standby_group_21.log' size 52428800; alter database add standby logfile thread 2 group 22 '+fra1/jyzhao/standbylog/standby_group_22.log' size 52428800; alter database add standby logfile thread 2 group 23 '+fra1/jyzhao/standbylog/standby_group_23.log' size 52428800; --alter system set standby_file_management=auto scope=both sid='*';添加完SRLs之后,可以查询到:
SYS@jyzhao1 >select * from v$standby_log; GROUP# DBID THREAD# SEQUENCE# BYTES BLOCKSIZE USED ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME LAST_CHANGE# LAST_TIME ---------- ---------------------------------------- ---------- ---------- ---------- ---------- ---------- --- ---------- ------------- ------------ ------------ ------------ ------------ ------------ 11 UNASSIGNED 1 0 52428800 512 0 YES UNASSIGNED 12 UNASSIGNED 1 0 52428800 512 0 YES UNASSIGNED 13 UNASSIGNED 1 0 52428800 512 0 YES UNASSIGNED 21 UNASSIGNED 2 0 52428800 512 0 YES UNASSIGNED 22 UNASSIGNED 2 0 52428800 512 0 YES UNASSIGNED 23 UNASSIGNED 2 0 52428800 512 0 YES UNASSIGNED 6 rows selected.