模拟生产搭建Standby RAC实验环境(11.2.0.4 DG)(7)

实际看同步延迟:

SQL> select * from v$dataguard_stats; NAME VALUE UNIT TIME_COMPUTED DATUM_TIME -------------------------------- ---------------------------------------------------------------- ------------------------------ ------------------------------ ------------------------------ transport lag +00 00:04:36 day(2) to second(0) interval 08/10/2017 09:26:06 08/10/2017 09:25:50 apply lag +00 00:05:34 day(2) to second(0) interval 08/10/2017 09:26:06 08/10/2017 09:25:50 apply finish time +00 00:00:05.432 day(2) to second(3) interval 08/10/2017 09:26:06 estimated startup time 26 second 08/10/2017 09:26:06

因为我们使用的是归档进程传输,所以会有一组在线日志的延迟,如果我们想在保证不影响主库业务的同时,尽可能更实时的去同步传输,那我们就需要使用LGWR传输,只需要去掉ARCH的关键字即可:

--之前的设置 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_2='SERVICE=mynas VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=mynas';

实际上默认的就是使用LGWR去ASYNC传输,一般这样延迟会很小,大部分状态下都可以接近实时同步。关于这两种方式的差异可以参考《ARCH和LGWR进程同步DG日志的区别》。

7.添加资源

最后我们需要把Standby RAC的数据库和实例都添加到OCR中,使他们能够方便被CRS所管理:

--oracle user: srvctl add database -d mynas -n jyzhao -o /opt/app/oracle/product/11.2.0/dbhome_1 -c RAC -p +data/mynas/parameterfile/spfileMYNAS.ora -r physical_standby -a DATA,FRA srvctl add instance -d mynas -i jyzhao1 -n jystdrac1 srvctl add instance -d mynas -i jyzhao2 -n jystdrac2 srvctl start database -d mynas

参数比较多,可以参考帮助说明:

[grid@jystdrac1 ~]$ srvctl add database -h Adds a database configuration to the Oracle Clusterware. Usage: srvctl add database -d <db_unique_name> -o <oracle_home> [-c {RACONENODE | RAC | SINGLE} [-e <server_list>] [-i <inst_name>] [-w <timeout>]] [-m <domain_name>] [-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-n <db_name>] [-y {AUTOMATIC | MANUAL | NORESTART}] [-g "<serverpool_list>"] [-x <node_name>] [-a "<diskgroup_list>"] [-j "<acfs_path_list>"] -d <db_unique_name> Unique name for the database -o <oracle_home> ORACLE_HOME path -c <type> Type of database: RAC One Node, RAC, or Single Instance -e <server_list> Candidate server list for RAC One Node database -i <inst_name> Instance name prefix for administrator-managed RAC One Node database (default first 12 characters of <db_unique_name>) -w <timeout> Online relocation timeout in minutes -x <node_name> Node name. -x option is specified for single-instance databases -m <domain> Domain for database. Must be set if database has DB_DOMAIN set. -p <spfile> Server parameter file path -r <role> Role of the database (primary, physical_standby, logical_standby, snapshot_standby) -s <start_options> Startup options for the database. Examples of startup options are OPEN, MOUNT, or 'READ ONLY'. -t <stop_options> Stop options for the database. Examples of shutdown options are NORMAL, TRANSACTIONAL, IMMEDIATE, or ABORT. -n <db_name> Database name (DB_NAME), if different from the unique name given by the -d option -y <dbpolicy> Management policy for the database (AUTOMATIC, MANUAL, or NORESTART) -g "<serverpool_list>" Comma separated list of database server pool names -a "<diskgroup_list>" Comma separated list of disk groups -j "<acfs_path_list>" Comma separated list of ACFS paths where database's dependency will be set -h Print usage

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/41b909d7fe2e6d6da5927df0d4318bef.html