资源描述
大并发高可用负载均衡系统(实施部署方案)目录一、 方案说明2二、 系统架构描述21、 系统整体结构图22、 WEB端高可用负载均衡32.1 Nginx负载均衡简介32.2 高可用方案简介43、 数据库高可用方案介绍5三、 WEB端负载均衡及高可用系统部署53.1 前端调度服务器Nginx部署53.1.1 安装说明53.1.2 Nginx安装53.1.3 启动配置63.1.4 测试、维护73.2 高可用keepalive部署7四、 数据高可用方案部署7五、 运行维护事项8上海俊泽-2015一、 方案说明 为满足公司业务平台的发展需要,应对业务平台的多用户大并发量的访问请求,需要一套高效可靠的系统部署方案。 目前各业务平台存在的问题有,业务系统(web数据库)单机运行,单台应用服务器提供的访问能力有限,存在单点故障,虽然现在能做到故障急时报警,但出现故障后恢复时间较见;另外业务数据存在安全隐患,数据定时备份,数据库或数据库服务器故障后存在数据留失风险,仅故障恢复时间较常等。 本套部署方案旨在加固业务系统的可靠性、可扩展性,提高业务系统的并发访问,提高业务数据安全性。二、 系统架构描述1、 系统整体结构图2、 WEB端高可用负载均衡2.1 Nginx负载均衡简介 nginx是一款高性能的HTTP和反向代理服务器软件,截止到2014年底,Nginx仅次于apache成为第二大web服务器软件,而在全球最忙碌top10000网站中使用比例更是高达42.7%。其发展速度和流行程度已经远远超过其它同类软件,成为大型网站和高并发网站的首选。Nginx的优势l 轻量级 安装文件小 运行时CPU内存使用率低l 性能强,支持多核心,处理静态文件效率高,内核采用 的poll模型最大可以支持50K并发连接l 支持热部署,同时启动速度快,可以不间断服务的情况下对软件和配置进行升级l 支持负载均衡,支持容错和健康检查l 代理功能强大,支持无缓存的反向代理。主流的负载均衡方案优缺点参考:2.2 高可用方案简介 单台调度服务器如果出现故障就会造成业务不可访问,在关键的业务环境里通常都会提供一台备用调度服务器,用来降低单点故障给业务系统带来的风险。这里推荐使用开源软件Keepalive来提供nginx调度服务器的高可用,当主nginx宕机后,keepalive会将调度业务切换至备用调度主机,继续提供用户访问。 Keepalived的作用是检测web服务器的状态,如果有一台web服务器死机,或工作出现故障,Keepalived将检测到,并将有故障的web服务器从系统中剔除,当web服务器工作正常后Keepalived自动将web服务器加入到服务器群中,这些工作全部自动完成,不需要人工干涉,需要人工做的只是修复故障的web服务器。官方网址:3、 数据库高可用方案介绍三、 WEB端负载均衡及高可用系统部署3.1 前端调度服务器Nginx部署3.1.1 安装说明nginx安装有源码安装和系统匹配的安装包安装,这里为了方便采用redhat下的RPM包安装。3.1.2 Nginx安装1) nginx下载地址http:/nginx.org/en/linux_packages.html2) 下载相关的安装包wget 3)安装nginx官方提供的yum源,用yum安装rpm -ivh yum install nginx4) 查看安装文件/etc/logrotate.d/nginx/etc/nginx/etc/nginx/conf.d/etc/nginx/conf.d/default.conf/etc/nginx/conf.d/example_ssl.conf/etc/nginx/fastcgi_params/etc/nginx/koi-utf/etc/nginx/koi-win/etc/nginx/mime.types/etc/nginx/nginx.conf/etc/nginx/scgi_params/etc/nginx/uwsgi_params/etc/nginx/win-utf/etc/rc.d/init.d/nginx/etc/sysconfig/nginx/usr/sbin/nginx/usr/share/nginx/usr/share/nginx/html/usr/share/nginx/html/50x.html/usr/share/nginx/html/index.html/var/cache/nginx/var/log/nginx3.1.3 启动配置1) 启动服务# service nginx start 2) 查看进程rootRH01 # ps -ef|grep nginx root 30622 1 0 10:56 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.confnginx 30623 30622 0 10:56 ? 00:00:00 nginx: worker process 以上信息显示一个主进程和一个工作进程rootRH01 # lsof -i:80COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEnginx 30622 root 6u IPv4 70955 0t0 TCP *:http (LISTEN)nginx 30623 nginx 6u IPv4 70955 0t0 TCP *:http (LISTEN)3) 删除或重命名默认配置文件4) 修改配置文件rootRH01 # vim /etc/nginx/nginx.conf default_type application/octet-stream; log_format main $remote_addr - $remote_user $time_local $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf;upstream tomcat ip_hash; server 192.168.18.6:80 weight=10; server 192.168.18.7:8080 weight=10; server listen 80; server_name locahost;location / proxy_pass http:/tomcat; 3.1.4 测试、维护3.2 高可用keepalive部署3.2.1 keepalive安装1) 安装前请配置yum源2) yum install -y keepalived 3) 查看安装文件路径# rpm -ql keepalived/etc/keepalived/etc/keepalived/keepalived.conf/etc/rc.d/init.d/keepalived/etc/sysconfig/keepalived/usr/bin/genhash/usr/libexec/keepalived/usr/sbin/keepalived/usr/share/snmp/mibs/KEEPALIVED-MIB.txt4) 修改配置文件主调度主机配置文件rootRH01 # cat /etc/keepalived/keepalived.conf! Configuration File for keepalivedglobal_defs notification_email smtp_connect_timeout 30 router_id 192.168.18.8 #对端主机IPvrrp_instance VI_1 state MASTER #主调度服务器 interface eth0 virtual_router_id 51 priority 100 # 主调度服务器使用高优先级 advert_int 1 authentication auth_type PASS auth_pass 1111 #交互密码 virtual_ipaddress 192.168.18.9 # 虚拟IP地址 备机配置文件:rootRH04 # cat /etc/keepalived/keepalived.conf ! Configuration File for keepalivedglobal_defs notification_email smtp_connect_timeout 30 vrrp_instance VI_1 state BACKUP interface eth0 virtual_router_id 51 priority 90 advert_int 1 authentication auth_type PASS auth_pass 1111 virtual_ipaddress 5) 启动服务# /etc/init.d/keepalived start 在主备机同时启动服务,查看主机是否挂载浮动IP6) 测试查看主机是否挂载浮动IP,停止主机keepalivd进程,查看备机是否挂载浮动IP,再恢复主机进程,查看浮动IP是否又回到主机。3.2.2 配置监控nginx进程1) 经过前面的配置,如果主服务器的keepalived停止服务,备服务器会自动接管VIP对外服务;一旦主服务器的keepalived恢复,会重新接管VIP。 但如果nginx服务故障,备用调度服务器将无法发觉,所以我们要做到当主服务器故障或nginx进程停止,备机能全权接管提供对处服务。2)使用nmap检查nginx端口来判断nginx的状态,记得要首先安装nmap,#yum install nmap -y 3)加入监控脚本如下:rootRH01 # vim /etc/keepalived/nginx_chk.sh#!/bin/sh#check nginx server status#NGINX=/usr/sbin/nginx#如果发现nginx不正常,先重启进程,等3秒再检查,仍然失败不再尝试!PORT=80nmap localhost -p $PORT |grep $PORT/tcp openif $? -ne 0 ;then /etc/init.d/nginx restart sleep 3 nmap localhost -p $PORT |grep $PORT/tcp open $? -ne 0 & /etc/init.d/keepalived stopfi*主备机都要添加4) 为脚本添加执行权限chmod +x /etc/keepalived/nginx_chk.sh 5) 在keepalive中加入脚本配置vim /etc/keepalived/keepalived.confvrrp_script chk_http_port script /etc/keepalived/nginx_chk.sh #监控脚本 interval 2 #时间 weight 2track_script chk_http_port全部配置文件如:global_defs notification_email smtp_connect_timeout 30vrrp_script chk_http_port script /etc/keepalived/nginx_chk.sh interval 2 weight 2vrrp_instance VI_1 state MASTER interface eth0 virtual_router_id 51 priority 100 advert_int 1 authentication auth_type PASS auth_pass 1111 virtual_ipaddress track_script chk_http_port 6)更进一步,为了避免启动keepalived之前没有启动nginx , 可以在/etc/init.d/keepalived的start中首先启动nginx:start() /etc/init.d/nginx start sleep 3 -x $exec | exit 5 -e $config | exit 6 echo -n $Starting $prog: daemon $exec $KEEPALIVED_OPTIONS retval=$? echo $retval -eq 0 & touch $lockfile return $retval6) 测试维护查看检测日志:# tail -f /var/log/messages四、 数据高可用方案部署1、主库准备工作Host IP DB_NAME DB_UNIQUE_NAME Net Service Name(网络服务名)主库192.168.137.128 ORCLDB WENDING db_wending备库192.168.137.129 ORCLDB PHYSTDBY db_phystdby保护模式:默认最大性能模式注意DataGuard启动顺序:启动顺序: 先standby ,后primary;关闭顺序: 先primary ,后standby;1.1、检查数据库是否支持Data Guard(企业版才支持),是否归档模式,Enable force logging$ sqlplus /as sysdbaSQL select * from v$option where parameter = Managed Standby; 确认主库处于归档模式 SQL archive log list (先检查是否归档模式,不是则修改) startup mount alter database archivelog; alter database open; 将primary数据库置为FORCE LOGGING模式 SQL alter database force logging; (强制产生日志)1.2、如果主库没有密码文件则建立密码文件,从而可以OS验证的方式登陆$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=iamwangnc entries=51.3、配置standby redolog(最佳性能模式可以忽略,如果将来变成备库且要转为其它两种模式则要建立)SQL alter database add standby logfile group 4 (/orahome/oradata/WENDING/stdby_redo04.log) size 50m, group 5 (/orahome/oradata/WENDING/stdby_redo05.log) size 50m, group 6 (/orahome/oradata/WENDING/stdby_redo06.log) size 50m, group 7 (/orahome/oradata/WENDING/stdby_redo07.log) size 50m;standby redolog的组数参考公式:(online redolog组数 + 1) * 数据库线程数;单机线程数为1,RAC一般为2。standby redolog的组成员数和大小也尽量和online redolog一样。1.4、设置主库初始化参数$ sqlplus /as sysdbaSQL create pfile=/home/oracle/pfile.ora from spfile; (备份参数文件)SQL alter system set LOG_ARCHIVE_CONFIG=DG_CONFIG=(WENDING,PHYSTDBY) scope=spfile; (启动db接受或发送redo data,包括所有库的db_unique_name)SQL alter system set LOG_ARCHIVE_DEST_1=LOCATION=/orahome/arch1/WENDING VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=WENDING scope=spfile; (主库归档目的地)SQL alter system set LOG_ARCHIVE_DEST_2=SERVICE=db_phystdby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSTDBY scope=spfile; (当该库充当主库角色时,设置物理备库redo data的传输目的地)SQL alter system set LOG_ARCHIVE_MAX_PROCESSES=5 scope=spfile; (最大ARCn进程数)SQL alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=spfile; (允许redo传输服务传输数据到目的地,默认是enable)SQL alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=spfile; (同上)SQL alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile; (exclusive or shared,所有库sys密码要一致,默认是exclusive)-以下是主库切换为备库,充当备库角色时的一些参数设置,如果不打算做数据库切换就不用设置了SQL alter system set FAL_SERVER=db_phystdby scope=spfile; (配置网络服务名,假如转换为备库角色时,从这里获取丢失的归档文件)SQL alter system set FAL_CLIENT=db_wending scope=spfile; (配置网络服务名,fal_server拷贝丢失的归档文件到这里)SQL alter system set DB_FILE_NAME_CONVERT=PHYSTDBY,WENDING scope=spfile; (前为切换后的主库路径,后为切换后的备库路径,如果主备库目录结构完全一样,则无需设定)SQL alter system set LOG_FILE_NAME_CONVERT=PHYSTDBY,WENDING scope=spfile; (同上,这两个名字转换参数是主备库的路径映射关系,可能会是路径全名,看情况而定)SQL alter system set STANDBY_FILE_MANAGEMENT=auto scope=spfile; (auto后当主库的datafiles增删时备库也同样自动操作,且会把日志传送到备库standby_archive_dest参数指定的目录下,确保该目录存在,如果你的存储采用文件系统没有问题,但是如果采用了裸设备,你就必须将该参数设置为manual)SQL alter system set STANDBY_ARCHIVE_DEST=LOCATION=/orahome/arch1/WENDING scope=spfile; (一般和LOG_ARCHIVE_DEST_1的位置一样,如果备库采用ARCH传输方式,那么主库会把归档日志传到该目录下)有了以上参数设置,则无论该库充当主库角色还是备库角色都无需再修改了。然后重启数据库:SQL shutdown immediateSQL startup;1.5、备份主库数据文件关闭应用服务器,停止监听,开始rman备份:$ lsnrctl stop$ rman target /RMAN backup full database format /backup/backup_%T_%s_%p.bak;#RMAN sql alter system archive log current;#RMAN backup archive log all format=/backup/arch_%T_%s_%p.bak;1.6、在主库上建立备库控制文件(控制文件通常需要有多份,手工将文件复制几份)$ sqlplus /as sysdbaSQL alter database create standby controlfile as /backup/stdby_control01.ctl;$ cd /backup/$ cp sdtby_control01.ctl stdby_control02.ctl$ cp sdtby_control01.ctl stdby_control03.ctl1.7、为备库准备init参数$ sqlplus /as sysdbaSQL create pfile = /backup/initPHYSTDBY.ora from spfile;$ cd /backup/$ vi initPHYSTDBY.ora 注意主备库不同角色的属性配置,注意文件路径等,注意db_name要和主库一致,主要是以下参数:audit_file_dest=/u01/app/oracle/admin/PHYSTDBY/adumpbackground_dump_dest=/u01/app/oracle/admin/PHYSTDBY/bdumpcore_dump_dest=/u01/app/oracle/admin/PHYSTDBY/bdumpuser_dump_dest=/u01/app/oracle/admin/PHYSTDBY/udump-control_files=/orahome/oradata/stdby_control01.ctl,/orahome/oradata/stdby_control02.ctl,/orahome/oradata/stdby_control03.ctldb_unique_name=PHYSTDBYlog_archive_config=DG_CONFIG=(PHYSTDBY,WENDING)log_archive_dest_1=LOCATION=/orahome/arch1/PHYSTDBY VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PHYSTDBYlog_archive_dest_2=SERVICE=db_wending LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=WENDING-fal_client=DB_PHYSTDBYfal_server=DB_WENDINGdb_file_name_convert=WENDING,PHYSTDBYlog_file_name_convert=WENDING,PHYSTDBYstandby_archive_dest=LOCATION=/orahome/arch1/PHYSTDBY另外,如果备库将来要打开成只读模式,需要确认audit_trail参数不是含db,应该设成os或none。1.8、拷贝上面生成的文件backup_%T.bak、stdby_control01/02/03.ctl、initPHYSTDBY.ora到备库所在主机注意rman备份的文件在主备库主机上目录要一致。$ scp backup*.bak 192.168.137.129:/backup/$ scp initPHYSTDBY.ora 192.168.137.129:$ORACLE_HOME/dbs/$ scp stdby_control*.ctl 192.168.137.129:/orahome/oradata/1.9、建立主库监听和主备库的网络服务名(必须是dedicated的),并启动监听$ netca (是图形界面,或者手工从别的库把listener.ora和tnsnames.ora拷过来修改也行)$ lsnrctl start$ tnsping db_wending$ tnsping db_phystdby (此时tnsping还不通物理备库)tnsping对方的时候,有可能linux防火墙限制了,会提示TNS-12560: TNS: 协议适配器错误。临时禁用防火墙方法:# service iptables stop永久禁用防火墙方法:# chkconfig -list iptables# chkconfig -level 345 iptables off2、建立备库2.1、设置环境变量并建立备库一些必需目录$ export ORACLE_BASE=/u01/app/oracle$ export ORACLE_SID=PHYSTDBY$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump-以下目录要看哪些地方可能会存放数据库文件,注意不能少建$ mkdir -p /orahome/oradata/$ORACLE_SID$ mkdir -p /u01/app/oracle/oradata/$ORACLE_SID$ mkdir -p /orahome/arch1/$ORACLE_SID2.2、在备库主机上生成密码文件,且sys密码和主库得一致$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=iamwangnc entries=52.3、在备库上建立监听,和主备库网络服务名(必须是dedicated的),并启动监听$ netca (是图形界面,或者手工从别的库把listener.ora和tnsnames.ora拷过来修改也行)$ lsnrctl start$ tnsping db_wending$ tnsping db_phystdby2.4、在备库上建立spfile$ sqlplus /as sysdbaSQL create spfile from pfile;如果pfile没有放到$ORACLE_HOME/dbs/下,而是放在别的位置:SQL create spfile from pfile=/backup/initPHYSTDBY.ora;2.5、启动物理备库SQL startup nomountSQL alter database mount standby database;2.6、备库做rman恢复$ rman target / (要求主备库rman备份文件的存放路径和文件名一致)RMAN restore database;#RMAN restore archivelog all;介质恢复后,rman 自动将standby 数据库打开到mount 状态。2.7、配置standby redolog(最佳性能模式可以忽略,如果要转为其它两种模式则要建立)SQL alter database add standby logfile group 4 (/orahome/oradata/PHYSTDBY/stdby_redo04.log) size 50m, group 5 (/orahome/oradata/PHYSTDBY/stdby_redo05.log) size 50m, group 6 (/orahome/oradata/PHYSTDBY/stdby_redo06.log) size 50m, group 7 (/orahome/oradata/PHYSTDBY/stdby_redo07.log) size 50m;standby redolog的组数参考公式:(online redolog组数 + 1) * 数据库线程数;单机线程数为1,RAC一般为2。standby redolog的组成员数和大小也尽量和online redolog一样。2.8、在备库上,启动redo applySQL alter database recover managed standby database disconnect from session;到此物理备库创建完毕!3、主备库各参数文件内容3.1、主备库listener.ora一样,如果有不一样也是host不一样-SID_LIST_LISTENER =(SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (PROGRAM = extproc) )LISTENER =(DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0) )-3.2、主备库tnsnames.ora一样,如果有不一样也是host和port不一样-DB_WENDING =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.128)(PORT = 1521) ) (CONNECT_DATA = (SERVICE_NAME = wending.lk) )DB_PHYSTDBY =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.129)(PORT = 1521) ) (CONNECT_DATA = (SERVICE_NAME = phystdby.lk) )EXTPROC_CONNECTION_DATA =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) )-3.3、init$ORACLE_SID.ora主库initWENDING.ora:-WENDING._db_cache_size=226492416WENDING._java_pool_size=4194304WENDING._large_pool_size=4194304WENDING._shared_pool_size=96468992WENDING._streams_pool_size=0*.audit_file_dest=/u01/app/oracle/admin/WENDING/adump*.audit_sys_operations=TRUE*.audit_trail=db,extended*.background_dump_dest=/u01/app/oracle/admin/WENDING/bdump*.control_files=/orahome/oradata/control1.ctl,/orahome/oradata/control2.ctl,/orahome/oradata/control3.ctl*.core_dump_dest=/u01/app/oracle/admin/WENDING/cdump*.db_block_size=8192*.db_domain=LK*.db_file_name_convert=PHYSTDBY,WENDING*.db_name=ORCLDB*.db_unique_name=WENDING*.fal_client=DB_WENDING*.fal_server=DB_PHYSTDBY*.job_queue_processes=10*.log_archive_config=DG_CONFIG=(WENDING,PHYSTDBY)*.log_archive_dest_1=LOCATION=/orahome/arch1/WENDING VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=WENDING*.log_archive_dest_2=SERVICE=db_phystdby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSTDBY*.log_archive_max_processes=5*.log_file_name_convert=PHYSTDBY,WENDING*.open_cursors=1500*.processes=500*.sga_max_size=320M*.sga_target=320M*.standby_archive_dest=LOCATION=/orahome/arch1/WENDING*.standby_file_management=AUTO*.undo_management=AUTO*.undo_retention=10800*.undo_tablespace=UNDOTBS1*.user_dump_dest=/u01/app/oracle/admin/WENDING/udump-备库initPHYSTDBY.ora:-PHYSTDBY._db_cache_size=226492416PHYSTDBY._java_pool_size=4194304PHYSTDBY._large_pool_size=4194304PHYSTDBY._shared_pool_size=96468992PHYSTDBY._streams_pool_size=0*.audit_file_dest=/u01/app/oracle/admin/PHYSTDBY/adump*.audit_sys_operations=TRUE*.audit_trail=os*.background_dump_dest=/u01/app/oracle/admin/PHYSTDBY/bdump*.control_files=/orahome/oradata/stdby_control01.ctl,/orahome/oradata/stdby_control02.ctl,/orahome/oradata/stdby_control03.ctl*.core_dump_dest=/u01/app/oracle/admin/PHYSTDBY/cdump*.db_block_size=8192*.db_domain=LK*.db_file_name_convert=WENDING,PHYSTDBY*.db_name=ORCLDB*.db_unique_name=PHYSTDBY*.fal_client=DB_PHYSTDBY*.fal_server=DB_WENDING*.job_queue_processes=10*.log_archive_config=DG_CONFIG=(PHYSTDBY,WENDING)*.log_archive_dest_1=LOCATION=/orahome/arch1/PHYSTDBY VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PHYSTDBY*.log_archive_dest_2=SERVICE=db_wending LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=WENDING*.log_archive_max_processes=5*.log_file_name_convert=WENDING,PHYSTDBY*.open_cursors=1500*.processes=500*.sga_max_size=320M*.sga_target=320M*.standby_archive_dest=LOCATION=/orahome/arch1/PHYSTDBY*.standby_file_management=AUTO*.undo_management=AUTO*.undo_retention=10800*.undo_tablespace=UNDOTBS1*.user_dump_dest=/u01/app/oracle/admin/PHYSTDBY/udump-4、主库归档测试主库归档前:SQL archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination /orahome/arch1/WENDINGOldest online log sequence 6Next log sequence to archive 8Current log sequence 8此时备库:SQL archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination /orahome/arch1/PHYSTDBYOldest online log sequence 0Next log sequence to archive 0Current log sequence 8主库归档后:SQL ALTER SYSTEM SWITCH LOGFILE; -对单实例数据库或RAC中的当前实例执行日志切换SQL ALTER SYSTEM ARCHIVE LOG CURRENT; -对数据库中的所有实例执行日志切换SQL archive log list; Database log mode Archive ModeAutomatic archival EnabledArchive destination /orahome/arch1/WENDINGOldest online log sequence 7Next log sequence to archive 9Current log sequence 9此时备库:SQL archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination /orahome/arch1/PHYSTDBYOldest online log sequence 0Next log sequence to archive 0Current log sequence 95、修改主库DataGuard保护模式.、LGWR传送日志的配置方法:为了便于大家更好的理解,我们先画一个表,表中描述了不同保护模式下LOG_ARCHIVE_DEST_n参数应该设置的属性:.、修改主库DataGuard保护模式SQL select name,db_unique_name,protection_mode from v$database;查看当前保护模式.、主库修改初始化参数 (主库db_wending操作)SQL alter system set log_archive_dest_2=SERVICE=
展开阅读全文