dataguard集群搭建

dataguard集群搭建

1. 创建虚拟机

创建一台虚拟机配置如下:

系统Red Hat Enterprise 6(64位)、16vCPU、8G内存、两块VM Network类型网卡、三块硬盘分别为250G、100G、50G(备注磁盘置备选择“Thin Provision”)、udev配置asm盘(vm虚拟机需配置参数:disk.enableUUID=true)、配置启动从网络启动。

2. 准备相关配置文件

2.1登录192.161.14.180机器,拷贝相关文件。

在/var/www/html/目录下创建test(备注文件可以自己取)文件

从/var/www/mt/* 目录下拷贝所有的*.properties、*.rsp、*.sh、*.cfg文件到/var/www/html/test文件下,并改相关文件名。

改完格式如下:

cfgrsp.properties  db_test_sdb.rsp    grid_test_sdb.rsp  test_pdb.sh   test_sdb.sh

db_test_pdb.rsp    grid_test_pdb.rsp  test_pdb.cfg       test_sdb.cfg

2.2修改配置文件test_sdb.cfg

2.2.1修改iso文件url。

url --url=”http://172.16.219.180/OL6.6/dvd” ---如果搭建的是192.161.14.0网段改为” http://192.161.14.180/OL6.6/dvd

 

2.2.2配置网络以及hostname

network --device=bond0 --noipv6 --bootproto=static --bondslaves=eth0,eth1 --bondopts=mode=active-backup,primary=eth0,miimon=80,updelay=60000 --ip=172.16.219.102 --netmask=255.255.255.0  --gateway=172.16.219.254 --onboot=yes --hostname test_sdb

---红色部分是需要根据实际情况修改

         2.2.3磁盘分区

#part /boot/efi --fstype=efi --grow --maxsize=200 --size=50 --ondisk=sda –asprimary(使用UEFI格式启动,根据情况调整,我们选择Legacy模式,注销这行)

part /boot --fstype ext4 --size=500 --ondisk=sda  --asprimary (/boot设置为500M)

part pv.0 --size=1 --grow --ondisk=sda

volgroup vg00 --pesize=32768 pv.0

logvol / --fstype ext4 --name=root --vgname=vg00  --size=51200(根目录设置为50G)

logvol /u01 --fstype=ext4 --name=var --vgname=vg00 --size=153600 –grow(/u01设置为150G余下的都给/u01)

logvol swap --fstype swap --name=swap --vgname=vg00 --size=8192(备注,设置为跟本机物理内存一般大小8G)

注意:我在创建虚拟机的时候第一个盘给了250G是用来做系统的,这里注意配置,以免硬盘空间不足。

         2.2.4host文件设置

#pxe

172.16.219.180   pxe-server(备注:如果是14网段设置为192.161.14.180)

 

#172.16.219.102 mt_dg

172.16.219.121 test_pdb(备注:配置设置的ip和hostname名称)

172.16.219.121 test_sdb(备注:配置设置的ip和hostname名称)

 

         2.2.5更改配置脚本路径名称

#获取自动安装脚本---start

wget -q -O /opt/test_sdb.sh http://pxe-server/test/test_sdb.sh

chmod +x /opt/test_sdb.sh

touch /test_sdb.log

echo '@reboot root /opt/test_sdb.sh  > /test_sdb.log' >> /etc/crontab

(修改红色部分内容)

2.3修改脚本文件test_sdb.sh

         2.3.1修改GI软件的文件路径及其名称。

         su - grid -c 'wget -q  -O /home/grid/grid.rsp http://pxe-server/test/grid_test_sdb.rsp'

su - grid -c '/u01/grid/runInstaller -silent -ignoreSysPrereqs -ignorePrereq -showProgress -responseFile "/home/grid/grid.rsp"

         su - grid -c 'wget -q  -O /u01/app/11.2.0/grid/cfgtoollogs/cfgrsp.properties http://pxe-server/test/cfgrsp.properties(备注:红色部分是要修改的)

         2.3.2修改diskgoup分区

CREATE DISKGROUP DATA EXTERNAL REDUNDANCY

   DISK '/dev/asm-diskb' SIZE 100G

   ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='1M';

CREATE DISKGROUP FRA EXTERNAL REDUNDANCY

   DISK '/dev/asm-diskc'  SIZE   50G

   ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='1M';

(备注:设置大小分别为第二块盘、第三块盘的大小)

         2.3.3修改DB软件的文件路径及其名称

su - oracle -c 'wget -q  -O /home/oracle/db.rsp http://pxe-server/test/db_test_sdb.rsp'

su - oracle -c '/u01/database/runInstaller -silent -ignoreSysPrereqs -ignorePrereq -showProgress -printdiskusage -printmemory -printtime -responseFile "/home/oracle/db.rsp"

(备注:红色部分是要修改的)

         2.3.4修改监控环境安装脚本

ALTER SYSTEM SET remote_listener='test_sdb:1521';(备注:红色部分要修改)

         2.3.5修改脚本名称

sed -i '/@reboot root \/opt\/test_sdb.sh  > \/test_sdb.log/d' /etc/crontab

(备注:红色部分要修改)

2.4修改grid_test_sdb.rsp文件

         2.4.1修改ORACLE_HOMENAME

ORACLE_HOMENAME=test_sdb(备注:红色部分要修改)

2.5修改db_test_sdb.rsp文件

         2.5.1修改ORACLE_HOMENAME

ORACLE_HOMENAME=test_sdb(备注:红色部分要修改)

(备注:如果是双节点,按上面操作)

3. dhcp以及菜单的配置

3.1选择配置dhcpd.conf文件

根据所选网段不同,可以选择拷贝dhcpd.conf.219、dhcpd.conf.14文件覆盖dhcpd.conf文件根据需要修改配置文件dhcpd.conf中的获取ip网段、并重启dhcpd服务。

dhcpd.conf配置文件如下:

#

# DHCP Server Configuration file.

#   see /usr/share/doc/dhcp*/dhcpd.conf.sample

#   see 'man 5 dhcpd.conf'

#

Allow booting;

Allow bootp;

authoritative;

 

default-lease-time 600;

max-lease-time 7200;

ddns-update-style none;

option space PXE;

option PXE.mtftp-ip    code 1 = ip-address;

option PXE.mtftp-cport code 2 = unsigned integer 16;

option PXE.mtftp-sport code 3 = unsigned integer 16;

option PXE.mtftp-tmout code 4 = unsigned integer 8;

option PXE.mtftp-delay code 5 = unsigned integer 8;

option arch code 93 = unsigned integer 16;

option broadcast-address 255.255.255.255;

subnet 172.16.219.0 netmask 255.255.255.0 {

  option routers               172.16.219.1;

  option subnet-mask  255.255.255.0;

  always-broadcast on;

  range dynamic-bootp 172.16.219.200 172.16.219.253;

  class "pxeclients" {

     match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";

     next-server  172.16.219.180;

    if option arch = 00:02 {

       filename "ia64/elilo.efi";

    } else if option arch = 00:06 {

       filename "X86PC/bootia32.efi";

    } else if option arch = 00:07 {

       filename "UEFI/BOOTX64.efi";

    } else {

       filename "Legacy/pxelinux.0";

    }

  }

}

(备注:红色部分可以根据需要自行修改)

         3.2增加启动菜单

根据BIOS启动模式不同可以选择Legacy、UEFI两种模式

Legacy:/var/lib/tftpboot/Legacy/pxelinux.cfg/default配置文件如下:

timeout 100

prompt 0

default menu.c32

ONTIMEOUT local

#CONSOLE 0

#SERIAL 0 9600

 

menu title ==== Linux PXE Boot Menu ====

label 0

  menu label ^ 0) Just Wait .....

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://192.161.14.180/xxxxxxxxxx.cfg ksdevice=eth0

label 1

  menu label ^ 1) rac1-Server

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://192.161.14.180/ol6.5x64-rac1-ks.cfg ksdevice=eth0

label 2

  menu label ^ 2) rac2-Server

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://192.161.14.180/ol6.5x64-rac2-ks.cfg ksdevice=eth0

label 3

  menu label ^ 3) rac1-san-Server

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://192.161.14.180/ol6.5x64-rac1-san-ks.cfg ksdevice=eth0

label 4

  menu label ^ 4) rac2-san-Server

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://192.161.14.180/ol6.5x64-rac2-san-ks.cfg ksdevice=eth0

label 5

  menu label ^ 5) rhel5.11x64-standalone

  kernel OL5/vmlinuz

  append initrd=OL5/initrd.img ks=http://172.16.219.180/ol5x64-standalone-ks.cfg ksdevice=eth0

label 6

  menu label ^ 6) ol6.5x64-dg1

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/219/ol6.5x64-standalone-dg1-ks.cfg ksdevice=eth0

label 7

  menu label ^ 7) ol6.5x64-dg2

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/219/ol6.5x64-standalone-dg2-ks.cfg ksdevice=eth0

label 8

  menu label ^ 8) ol6.5x64-dg3

kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/219/ol6.5x64-standalone-dg3-ks.cfg ksdevice=eth0

label 9

  menu label ^ 9) ol6.5x64-rman1

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/219/ol6.5x64-standalone-rman1-ks.cfg ksdevice=eth

0

 

label 10

  menu label ^ 10) ol6.5x64-warehouse

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/219/ol6.5x64-standalone-warehouse-ks.cfg ksdevice

=eth0

label 11

  menu label ^ 11) performancetest

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/219/ol6.5x64-standalone-pt-ks.cfg ksdevice=eth0

 

label 12

  menu label ^ 12) mt_pdb

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/mt/mt_pdb.cfg ksdevice=eth0

 

label 13

  menu label ^ 13) mt_sdb

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/mt/mt_sdb.cfg ksdevice=eth0

 

label 14

  menu label ^ 14) test_pdb

  kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/test/test_pdb.cfg ksdevice=eth0

 

label 15

  menu label ^ 15) test_sdb

kernel OL6/vmlinuz

  append initrd=OL6/initrd.img ks=http://172.16.219.180/test/test_sdb.cfg ksdevice=eth0

 

(备注:根据格式,设置好名称以及路径)

UEFI: /var/lib/tftpboot/UEFI/efidefault配置文件如下:

efault=0

timeout=10

splashimage=(nd)/splash.xpm.gz

 

title Just Wait .....

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/xxxxxxxxxxx.cfg ksdevice=eth0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - Standalone(219-rman1)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/ol6.5x64-standalone-rman1-ks.cfg ksdevice=eth

0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - Standalone(219-rman2)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/ol6.5x64-standalone-rman2-ks.cfg ksdevice=eth

0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - Standalone(219-rman3)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/ol6.5x64-standalone-rman3-ks.cfg ksdevice=eth

0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - Standalone(219-dg1)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/ol6.5x64-standalone-dg1-ks.cfg ksdevice=eth0

ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - Standalone(219-dg2)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/ol6.5x64-standalone-dg2-ks.cfg ksdevice=eth0

ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - Standalone(219-warehouse)

root (nd)

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - for RAC Node1(219)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/ol6x64-rac1-ks.cfg ksdevice=eth0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - for RAC Node2(219)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://172.16.219.180/219/ol6x64-rac2-ks.cfg ksdevice=eth0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

 

title Install Oracle Linux 6.5 x86_64 use Kickstart - Standalone(192.161.14.132)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://192.161.14.180/14/ol6.5x64-standalone-sumapay_test1-ks.cfg ksdev

ice=eth0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install  Standalone(192.161.14.133)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://192.161.14.180/14/ol6.5x64-standalone-sumapay_test2-ks.cfg ksdev

ice=eth0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install Oracle Linux 6.6 x86_64 use Kickstart - Standalone(192.161.14.149)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://192.161.14.180/14/ol6.5x64-standalone-sumapay_baobiao-ks.cfg ksd

evice=eth0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

 

title Install  warehouse(192.161.14.172)

root (nd)

kernel (nd)/images/OL6/vmlinuz ks=http://192.161.14.180/14/ol6.5x64-standalone-sumapay_warehouse-ks.cfg k

sdevice=eth0 ip=dhcp

initrd (nd)/images/OL6/initrd.img

(备注:根据格式,设置好名称以及路径)

重启xinetd服务 service xinetd restart

4. 主从库的操作

4.1主、从库操作配置listener.ora、tnsnames.ora配置如下:

主:vi /u01/app/11.2.0/grid/network/admin/listener.ora

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)

      (PROGRAM = extproc)

     )

    (SID_DESC =

      (GLOBAL_DBNAME = sumapay)

      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)

      (SID_NAME = sumapay)

    )

  )

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = test_pdb)(PORT = 1521))

    )

  )

 

ADR_BASE_LISTENER = /u01/app/grid

 

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent

从:vi /u01/app/11.2.0/grid/network/admin/listener.ora

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)

      (PROGRAM = extproc)

     )

    (SID_DESC =

      (GLOBAL_DBNAME = sumapay)

      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)

      (SID_NAME = sumapay)

    )

  )

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = test_sdb)(PORT = 1521))

    )

  )

 

ADR_BASE_LISTENER = /u01/app/grid

 

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent

主、从:vi /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

test_pdb =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = test_pdb)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = sumapay)

    )

  )

 

test_sdb =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = test_sdb)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = sumapay)

    )

  )

         4.2重启主从库的监听服务

 su – grid

lsnrctl restart

tnsing test_pdb

tnsting test_sdb

测试两台机器是否连通正常。(备注:注意/etc/hosts文件)

         4.3拷贝密码文件、以及相关脚本文件

         将主库的密码文件/u01/app/oracle/product/11.2.0/db_1/dbs/orapwsumapay拷贝覆盖从库的文件并注意文件权限。重置从库中的/u01/app/oracle/product/11.2.0/db_1/dbs/initsumapay.ora 文件。

echo  '*.db_name=sumapay'  > /u01/app/oracle/product/11.2.0/db_1/dbs/initsumapay.ora

         在主、从库创建/home/oracle/dg_manage文件,并上传相关脚本文件。并赋予执行权限。

check_dg_status.sh  prim2stan.sh  stan2prim_force.sh  stan2prim.sh  startMRP.sh

         4.4主从进行相关设置,并设置主库为归档模式。

                   sqlplus / as sysdba<<EOF

select file_name from dba_data_files;

select name from v\$tempfile;

CREATE TABLESPACE ts_tvpay

DATAFILE '+DATA' SIZE

2048M REUSE AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M,

'+DATA' SIZE 2048M REUSE

AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M,

'+DATA' SIZE 2048M REUSE

AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M,

'+DATA' SIZE 2048M REUSE

AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M,

'+DATA' SIZE 2048M REUSE

AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M,

'+DATA' SIZE 2048M REUSE

AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M,

'+DATA' SIZE 2048M REUSE

AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M,

'+DATA' SIZE 2048M REUSE

AUTOEXTEND

ON NEXT 50M MAXSIZE 10240M

EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

CREATE TEMPORARY TABLESPACE ts_tvpay_temp

TEMPFILE '+DATA' SIZE 1024M AUTOEXTEND ON

NEXT 32M MAXSIZE 8192M,

'+DATA' SIZE 1024M AUTOEXTEND ON 

NEXT 32M MAXSIZE 8192M,

'+DATA' SIZE 1024M AUTOEXTEND ON 

NEXT 32M MAXSIZE 8192M,

'+DATA' SIZE 1024M AUTOEXTEND ON 

NEXT 32M MAXSIZE 8192M

EXTENT MANAGEMENT LOCAL;

select file_name from dba_data_files;

select name from v\$tempfile;

CREATE USER tvpay2 IDENTIFIED BY tvpay

DEFAULT TABLESPACE ts_tvpay

TEMPORARY TABLESPACE ts_tvpay_temp;

GRANT CONNECT,RESOURCE TO tvpay2;

quit;

EOF

sqlplus  / as sysdba  << EOF

 alter system set db_unique_name=test_pdb scope=spfile;

EOF

sqlplus  / as sysdba  << EOF

 alter system set log_archive_config='DG_CONFIG=(test_pdb,test_sdb)' scope=spfile;

EOF

sqlplus  / as sysdba  << EOF

alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST  valid_for=(all_logfiles,all_roles) db_unique_name=test_pdb'  scope=spfile;

alter system set log_archive_dest_2='SERVICE=test_sdb optional lgwr async noaffirm net_timeout=30 valid_for=(online_logfiles,primary_role) db_unique_name=test_sdb'  scope=spfile;

EOF

sqlplus  / as sysdba  << EOF

alter system set db_file_name_convert='+DATA/test_sdb/datafile','+DATA/test_pdb/datafile','+DATA/{test_sdb/tempfile','+DATA/test_pdb/tempfile'  scope=both;

EOF

sqlplus  / as sysdba  << EOF

ALTER SYSTEM set log_file_name_convert='+DATA/test_sdb/onlinelog','+DATA/test_pdb/onlinelog','+FRA/test_sdb/onlinelog','+FRA/test_pdb/onlinelog' sope=both;

EOF

sqlplus  / as sysdba  << EOF

alter system set FAL_SERVER=test_sdb   scope=spfile;

EOF

sqlplus  / as sysdba  << EOF

alter system set FAL_CLIENT=test_pdb  scope=spfile;

EOF

sqlplus  / as sysdba  << EOF

 alter system set standby_file_management=AUTO  scope=spfile;

EOF

sqlplus  / as sysdba  << EOF

ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;

EOF

shutdown immediate;

                   设置主库为归档模式

startup mount

alter database archivelog;

alter database open;

alter system switch logfile; --切换log日志

4.5主从交互操作

从:sqlplus  / as sysdba  << EOF

startup nomount force pfile=/u01/app/oracle/product/11.2.0/db_1/dbs/initsumapay.ora

EOF

主:rman target /

RMAN>connect auxiliary sys/password@test_sdb

RMAN> run{

  duplicate target database for standby nofilenamecheck dorecover from active database

  spfile

set cluster_database='false'

    set db_unique_name='test_sdb'

    set log_archive_max_processes='30'

    set fal_client='test_pdb'

set fal_server='test_sdb'

    set standby_file_management='AUTO'

    set log_archive_config='DG_CONFIG=(test_pdb,test_sdb)'

    set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=test_sdb'

    set log_archive_dest_2='service=test_pdb optional lgwr async noaffirm valid_for=(online_logfiles,primary_role) db_unique_name=test_pdb'

set db_file_name_convert='+DATA/test_pdb/datafile','+DATA/test_sdb/datafile','+DATA/test_pdb/tempfile','+DATA/test_sdb/tempfile'

    set log_file_name_convert='+DATA/test_pdb/onlinelog','+DATA/test_sdb/onlinelog','+FRA/test_pdb/onlinelog','+FRA/test_sdb/onlinelog'

set remote_listener='test_sdb:1521';

}

在从库中查看执行结果:

tail -f /u01/app/oracle/diag/rdbms/mt_pdb/sumapay/trace/alert_sumapay.log

在从库中执行同步脚本startMRP.sh

同步完成后,在主库中切换一下日志,查看当前正在使用的日志,然后看从库的日志是否切换过来。如下所示:

操作前:

主:

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     12

Next log sequence to archive   14

Current log sequence           14

从:

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     12

Next log sequence to archive   0

Current log sequence           14

操作后:

主:

SQL> alter system switch logfile;

 

System altered.

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     13

Next log sequence to archive   15

Current log sequence           15

SQL>

从:

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     13

Next log sequence to archive   0

Current log sequence           15

SQL>

同步一致

posted @ 2016-09-12 20:29  FlyBack  阅读(413)  评论(0编辑  收藏  举报