一:实验环境介绍

虚拟机系统:    RHEL Linux 6.4(64位)

数据库版本:    Oracle 11gR2 11.2.0.4 (64位)

IP地址规划:

主数据库

10.54.22.105 

SID:pri

db_name:pri

db_unique_name:pri

备份数据库

10.54.22.106 

SID:std

db_name:pri

db_unique_name:std

基础要求:(1)安装两台虚拟机分别作为主库和备库,硬盘大小随意。但要保证

根分区有20G,别给太小了就行。物理内存1G,SWAP 2G

关于Active database duplication方式:(必看)

在Oracle 10g下,我们可以使用RMAN duplicate 命令创建一个具有不同DBID 的复制库。 到了Oracle 11gR2, RMAN 的duplicate 有2种方法实现:

1. Active database duplication    (本文所使用的方式,适用于11gR2之后的版本)

2. Backup-based duplication        (传统方式,10g,11g通用)

 

Active database duplication 通过网络,直接copy target 库到auxiliary 库,然后创建复制库。这种方法就不需要先用RMAN 备份数据库,然后将备份文件发送到auxiliary端。

这个功能的作用是非常大的。 尤其是对T级别的库。 因为对这样的库进行备份,然后将备份集发送到备库,在进行duplicate 的代价是非常大的。 一备份要占用时间,二要占用备份空间,三在网络传送的时候,还需要占用带宽和时间。所以Active database duplicate 很好的解决了以上的问题。 它对大库的迁移非常有用。

如果是从RAC duplicate 到单实例,操作是一样的。 如果是从单实例duplicate 到RAC。 那么先duplicate 到 单实例。 然后将单实例转换成RAC。

二:安装数据库软件前的系统配置        (主库和备库端都要做下列操作)

1.基本配置:

一定要用新装的系统(这里以红帽企业版6.4为例),系统要求最低配置1G内存,2Gswap分区,根分区20G以上,装好系统后先配置好yum,IP地址,/etc/sysconfig/network文件中的主机名,以及/etc/hosts文件中的IP地址和主机名的对应关系。

主库IP:10.54.22.105   

主库主机名:ora11g

备库IP:10.54.22.106

备库主机名:ora11g-dg

2.修改/etc/hosts添加主机信息

#vi /etc/hosts

**********************

10.54.22.105   ora11g

10.54.22.106   ora11g-dg

3.关闭防火墙

#chkconfig iptables off

#service iptables stop

4.关闭SELINUX

sed -i '/SELINUX=enforcing/SELINUX=disabled/'  /etc/selinux/config

setenforce=0

5.修改/etc/sysctl.conf,加入以下内容:

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4294967295

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

结束后,执行

 /sbin/sysctl  -p

6.修改/etc/security/limits.conf,加入内容

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  1024

oracle              hard    nofile  65536

oracle              soft    stack   10240 

7.创建相关的组与用户:

/usr/sbin/groupadd oinstall

/usr/sbin/groupadd -g 502 dba

/usr/sbin/groupadd -g 503 oper

/usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle

# passwd oracle

8.创建所需的目录并赋予特定的属主和属组

mkdir -p /u01/app/oracle

chown -R oracle:oinstall /u01/app

chmod -R 775 /u01/app

9.检查组件包的安装:

yum install -y binutils  compat-libstdc++  elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

rpm  -ivh pdksh-5.2.14-21.x86_64.rpm --nodeps --force

也可在后面静默安装检查先决条件时再根据提示安装

10.编辑vim /home/oracle/.bash_profile文件,配置相关环境变量

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_SID=pri (备库端设置为std)

export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export PATH=$ORACLE_HOME/bin:$PATH

三:开始安装oracle11g数据库软件        (主库和备库端都要做下列操作)

1.挂载oracle11g的镜像到/mnt/cdrom 目录下,并把3个包解压到/usr/local/src 目录下

cd /mnt/cdrom/

unzip p13390677_112040_Linux-x86-64_1of7.zip -d /usr/local/src

unzip p13390677_112040_Linux-x86-64_2of7.zip -d /usr/local/src

unzip p13390677_112040_Linux-x86-64_3of7.zip -d /usr/local/src

(只装数据库的话,解压前两个包即可,第三个包是grid)

2. root身份执行xhost +,然后切换到oracle用户进入/usr/local/src/database目录中,执行runInstaller 开始安装 (database是默认解压完的目录名)

# xhost +

# su - oracle

$ ./runInstaller

注意:安装oracle11g要求分辨率最低为1024x768,不然无法完整显示安装过程

 

安装过程:略

注意:主库在安装完软件后需要进行DBCA建库操作,推荐不要启用归档模式,会节省时间,备库端不要建库!可以开启监听程序

四:开始搭建Dataguard

1:将数据库改为强制日志模式            (此步骤只在主库上做)

[oracle@pri ~]$ sqlplus / as sysdba

查看当前是否强制日志模式:

SYS@pri> select name,log_mode,force_logging from v$database;   

NAME LOG_MODE FOR

---------         ------------ ---

PRI         NOARCHIVELOG NO

SYS@pri> alter database force logging;

Database altered.

SYS@pri> select name,log_mode,force_logging from v$database;

NAME LOG_MODE FOR

---------         ------------ ---

PRI         NOARCHIVELOG YES

2:创建密码文件                        (此步骤只在主库上做)

注意:两端分别创建自己的密码文件好像有问题,备库的密码文件需要跟主库一致,否则导致日志传输不到备库,有待验证。我最后是将主库的密码文件直接copy到备库,重命名后使用。

[oracle@pri ~]$ cd $ORACLE_HOME/dbs

[oracle@ora11g dbs]$ ls

hc_pri.dat  init.ora  initpri.ora  lkPRI  orapwpri  snapcf_pri.f  spfilepri.ora 

已经有一个密码文件了

[oracle@pri dbs]$ orapwd file=orapwpri password=oracle force=y

这条命令可以手动生成密码文件,force=y的意思是强制覆盖当前已有的密码文件(如果有可以不建立)

 

将主库的密码文件copy给备库,并重命名

[oracle@pri dbs]$ scp orapwpri 192.168.11.121:$ORACLE_HOME/dbs/orapwstd

 

3:创建standby redolog日志组            (此步骤只在主库上做)

原则:

1:standby redo log的文件大小与primary 数据库online redo log 文件大小相同

2:standby redo log日志文件组的个数依照下面的原则进行计算:

Standby redo log组数公式>=(每个instance日志组个数+1)*instance个数

假如只有一个节点,这个节点有三组redolog,

所以Standby redo log组数>=(3+1)*1 == 4

所以至少需要创建4组Standby redo log

 

查看当前线程与日志组的对应关系及日志组的大小:

SYS@pri> select thread#,group#,bytes/1024/1024 from v$log;   

 

THREAD# GROUP# BYTES/1024/1024

---------------     ------------- ------------------------

1 1 50

1 2 50

1 3 50

如上,我现在的环境有三组redolog,每个日志组的大小都是50M,

所以Standby redo log组数>=(3+1)*1== 4

所以至少需要创建4组Standby redo log,大小均为50M

(thread:线程,只有在多实例数据库才有用的参数,例如RAC环境,单实例不考虑)

 

查看当前有哪些日志组及其成员:

SYS@pri> col member for a50

SYS@pri> select group#,member from v$logfile;

 

GROUP# MEMBER

---------- --------------------------------------------------

3 /u01/app/oracle/oradata/pri/redo03.log

2 /u01/app/oracle/oradata/pri/redo02.log

1 /u01/app/oracle/oradata/pri/redo01.log

 

先手动创建standby log日志组所需的目录:

(创建新目录只是为了便于区分,并非必须)

[oracle@ora11g oradata]$ cd /u01/app/oracle/oradata/

[oracle@ora11g oradata]$ ls

standbylog pri

 

新建4个日志组作为standby redolog日志组,大小与原来的日志组一致:

由于已经存在group1-3,,所以group号只能从4开始

SYS@pri>

alter database add standby logfile group 4 '/u01/app/oracle/oradata/standbylog/std_redo04.log' size 50m;

alter database add standby logfile group 5 '/u01/app/oracle/oradata/standbylog/std_redo05.log' size 50m;

alter database add standby logfile group 6 '/u01/app/oracle/oradata/standbylog/std_redo06.log' size 50m;

alter database add standby logfile group 7 '/u01/app/oracle/oradata/standbylog/std_redo07.log' size 50m; 

查看standby 日志组的信息:

SYS@pri> select group#,sequence#,status, bytes/1024/1024 from v$standby_log;

 

GROUP# SEQUENCE# STATUS BYTES/1024/1024

---------- ------------------ ------------------- ------------------------

4 0 UNASSIGNED 50

5 0 UNASSIGNED 50

6 0 UNASSIGNED 50

7 0 UNASSIGNED 50

 

查看当前有哪些日志组及其成员:

SYS@pri> set pagesize 100

SYS@pri> col member for a60

SYS@pri> select group#,member from v$logfile order by group#;

 

GROUP#     MEMBER

------------    ------------------------------------------------------------

1     /u01/app/oracle/oradata/pri/redo01.log

2     /u01/app/oracle/oradata/pri/redo02.log

3     /u01/app/oracle/oradata/pri/redo03.log

4     /u01/app/oracle/oradata/standbylog/std_redo04.log

5     /u01/app/oracle/oradata/standbylog/std_redo05.log

6     /u01/app/oracle/oradata/standbylog/std_redo06.log

7     /u01/app/oracle/oradata/standbylog/std_redo07.log

 

 

4:修改主库的pfile参数文件        (此步骤只在主库上做)

 

查看spfile的路径:

SYS@pri> show parameter spfile;

 

NAME TYPE VALUE

----------- ----------- -----------------------------------------------------------------

spfile string /u01/app/oracle/product/11.2.0/db_1/dbs/spfilepri.ora

 

用spfile创建一个pfile,用于修改:   

SYS@pri> create pfile from spfile;

 

修改主库的pfile:

/u01/app/oracle/product/11.2.0/db_1/dbs/ initpri.ora

[oracle@pri ~]$ cd $ORACLE_HOME/dbs

pri.__db_cache_size=318767104

pri.__java_pool_size=4194304

pri.__large_pool_size=4194304

pri.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

pri.__pga_aggregate_target=335544320

pri.__sga_target=503316480

pri.__shared_io_pool_size=0

pri.__shared_pool_size=163577856

pri.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/pri/adump'

*.audit_trail='db'

*.compatible=' 11.2.0.4.0 '

*.control_files='/u01/app/oracle/oradata/pri/control01.ctl','/u01/app/oracle/flash_recovery_area/pri/control02.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='pri'

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=4070572032

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=priXDB)'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=836763648

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

以下内容是需要新增加的:

*.db_unique_name='pri' DG主库和备库的db_name必须一致,db_unique_name不一致

*.log_archive_config='dg_config=(pri,std)' pri主数据库SID,std备份数据库SID

*.log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=pri' 主数据库的归档日志路径和SID

*.log_archive_dest_2='service=std valid_for=(online_logfiles,primary_role) db_unique_name=std' 备份数据库的SID

*.log_archive_dest_state_1=enable

*.log_archive_dest_state_2=enable

*.log_archive_max_processes=4

*.fal_server='std' 备份数据库的SID

*.fal_client='pri' 主数据库的SID

*.db_file_name_convert='/u01/app/oracle/oradata/std','/u01/app/oracle/oradata/pri' 第一个目录是备份数据库数据文件路径(备份服务器上有此目录),第二个是主数据库数据文件路径

*.log_file_name_convert='/u01/app/oracle/oradata/std','/u01/app/oracle/oradata/pri' 第一个目录是备份数据库数据文件路径(备份服务器上有此目录),第二个是主数据库数据文件路径

*.standby_file_management='auto'

修改完毕,保存退出

 

手工创建/u01/app/oracle/arch:       

[oracle@pri dbs]$ mkdir –p /u01/app/oracle/arch

 

5:用修改过的pfile重新创建一个spfile,用于重启数据库    (此步骤只在主库上做)

关闭数据库:

SYS@pri> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

 

用修改过的pfile重新创建一个spfile:

SYS@pri> create spfile from pfile;   

 

此时把数据库改为归档模式:        (如果当初建库时选择了启用归档,则此步骤忽略)

由于当前数据库已关闭,首先需要把数据库启动到mount状态

SYS@pri> startup mount;       

ORACLE instance started.

Database mounted.

SYS@pri> alter database archivelog;    启用归档模式

Database altered.

 

SYS@pri> alter database open;        OPEN数据库

Database altered.

 

SYS@pri> archive log list;            查看是否启用归档模式

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u01/app/oracle/arch

Oldest online log sequence 22

Next log sequence to archive 24

Current log sequence 24

如上,归档路径已经改为/u01/app/oracle/arch,证明对pfile的修改已生效

 

查看当前数据库是否使用spfile启动:   

SYS@pri> show parameter spfile;

 

NAME TYPE VALUE

----------- ----------- -----------------------------------------------------------------

spfile string /u01/app/oracle/product/11.2.0/db_1/dbs/spfilepri.ora

 

如上,若能看到spfile的路径,则证明数据库是使用spfile启动的,若没有值,则说明是用pfile启动的。

 

确认数据库已经启用归档模式和强制日志模式:

SYS@pri> select name,log_mode,force_logging from v$database;

 

NAME LOG_MODE FOR

---------     ------------------- -------

PRI ARCHIVELOG YES

 

6:修改监听文件,添加静态监听        (主库、备库都要做)

主库:

[oracle@pri ~]$ cd $ORACLE_HOME/network/admin

[oracle@pri admin]$ vim listener.ora     添加的内容如下红色字体部分:

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

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

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

    )

  )

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = pri)

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

      (SID_NAME = pri)

    )

  )

 

ADR_BASE_LISTENER = /u01/app/oracle

主库修改后最终效果如下图:

 

 

备库:

[oracle@pri ~]$ cd $ORACLE_HOME/network/admin

[oracle@pri admin]$ vim listener.ora     添加的内容如下红色字体部分:

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

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

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

    )

  )

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = std)

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

      (SID_NAME = std)

    )

  )

 

ADR_BASE_LISTENER = /u01/app/oracle

备库修改后最终效果如下图:

 

 

使新增加的监听生效:    (主库和备库端都要做)

[oracle@pri admin]$ lsnrctl stop

[oracle@pri admin]$ lsnrctl start

 

确认新增加的静态监听有效:

主库:

[oracle@pri ~]$ lsnrctl status

..........................................(N行省略)

Services Summary...

Service "pri" has 2 instance(s).

Instance "pri", status UNKNOWN, has 1 handler(s) for this service...

Instance "pri", status READY, has 1 handler(s) for this service...

Service "priXDB" has 1 instance(s).

Instance "pri", status READY, has 1 handler(s) for this service...

The command completed successfully

 

备库:

[oracle@std ~]$ lsnrctl status

..........................................(N行省略)

Services Summary...

Service "std" has 2 instance(s).

Instance "std", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

如上,静态监听添加成功

 

 

7:编辑网络服务名配置文件tnsnames.ora        (主库和备库端都要做)

[oracle@ora11g admin]$ pwd

/u01/app/oracle/product/11.2.0/db_1/network/admin

[oracle@ora11g admin]$ ls

listener.ora samples tnsnames.ora

listener.ora_bak shrept.lst tnsnames.ora_bak

[oracle@ora11g admin]$ more tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

pri =

  (DESCRIPTION =

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

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = pri)

    )

  )

 

std =

  (DESCRIPTION =

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

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = std)

    )

  )  

编辑结果如下图:

 

 

保证主库和备库的tnsnames.ora文件中的内容完全相同,可以把修改后的文件直接传给备库。

[oracle@ora11g admin]$ scp tnsnames.ora 192.168.11.121:$ORACLE_HOME/network/admin

tnsnames.ora 100% 925 0.9KB/s 00:00

 

配置完后,确保在任意一端上都能tnsping通对方:

[oracle@pri admin]$ tnsping std

[oracle@std admin]$ tnsping pri

 

8:在备库端,修改pfile参数文件        (只在备库端做)

首先,在主库端把pfile拷贝给备库端的$ORACLE_HOME/dbs目录下,并重命名:

[oracle@ora11g-dg ~]$ cd $ORACLE_HOME/dbs

[oracle@ora11g-dg dbs]$ ls

hc_std.dat init.ora initstd.ora lkSTD orapwstd spfilestd.ora

[oracle@ora11g dbs]$ scp initpri.ora 192.168.2.253:$ORACLE_HOME/dbs/initstd.ora

initpri.ora 100% 1497 1.5KB/s 00:00

然后在备库端进行修改:

[oracle@ora11g-db ~]$ cd $ORACLE_HOME/dbs

 

[oracle@ora11g-dg dbs]$ more initstd.ora

pri.__db_cache_size=318767104

pri.__java_pool_size=4194304

pri.__large_pool_size=4194304

pri.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

pri.__pga_aggregate_target=335544320

pri.__sga_target=503316480

pri.__shared_io_pool_size=0

pri.__shared_pool_size=163577856

pri.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/std/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/u01/app/oracle/oradata/std/control01.ctl','/u01/app/oracle/oradata/std/control02.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='pri' DG主库和备库的db_name必须一致,db_unique_name不一致

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=4070572032

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=stdXDB)'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=836763648

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

以下需要手工添加

*.db_unique_name='std'

*.log_archive_config='dg_config=(pri,std)'

*.log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_

roles) db_unique_name=std'

*.log_archive_dest_2='service=pri valid_for=(online_logfiles,primary_role) db

_unique_name=pri'

*.log_archive_dest_state_1=enable

*.log_archive_dest_state_2=enable

*.log_archive_max_processes=4

*.fal_server='pri'

*.fal_client='std'

*.db_file_name_convert='/u01/app/oracle/oradata/pri','/u01/app/oracle/oradata

/std'

*.log_file_name_convert='/u01/app/oracle/oradata/pri','/u01/app/oracle/oradat

a/std'

*.standby_file_management='auto'

 

修改完毕,保存退出

 

注意:整个搭建过程最需要留意的就是主库和备库的PFILE配置,建议修改完后仔细对照主备库PFILE的区别

 

9:在备库端手工创建所需的目录    (备库端做,不提前创建的话恢复时会报错!)

mkdir -pv /u01/app/oracle/admin/std/adump

mkdir -pv /u01/app/oracle/diag/rdbms/std/std/trace

mkdir -pv /u01/app/oracle/arch

mkdir -pv /u01/app/oracle/oradata/std

mkdir -pv /u01/app/oracle/oradata/standbylog

mkdir -pv /u01/app/oracle/flash_recovery_area

 

10:用修改后的pfile创建一个spfile,用于启动数据库        (备库端做)

[oracle@std ~]$ sqlplus / as sysdba

Connected to an idle instance.

 

SYS@std> create spfile from pfile;

File created.

做到这一步报错:

show parameter log_archive_dest;
alter system set log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=std';
ho cat /u01/app/oracle/admin/orcl/bdump/alert_orcl.log

 

将数据库启动到nomount状态:

SYS@std> startup nomount;

ORACLE instance started.

 

Total System Global Area 839282688 bytes

Fixed Size 2233000 bytes

Variable Size 482348376 bytes

Database Buffers 352321536 bytes

Redo Buffers 2379776 bytes

SYS@std>

 

11:利用RMAN在备库上恢复主库            (备库端做)

[oracle@std ~]$ rman target sys/oracle@pri auxiliary sys/oracle@std

 

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Apr 15 16:39:28 2014

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

 

connected to target database: PRI (DBID=775616459)

connected to auxiliary database: PRI (not mounted)

 

RMAN> duplicate target database for standby from active database nofilenamecheck;

这条命令可以直接恢复数据文件,standby控制文件,standby日志组,非常霸道

Starting Duplicate Db at 16-MAR-16

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=134 device type=DISK

contents of Memory Script:

{

backup as copy reuse

targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwpri' auxiliary format

'/u01/app/oracle/product/11.2.0/db_1/dbs/orapwstd' ;

}

executing Memory Script

Starting backup at 16-MAR-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=140 device type=DISK

Finished backup at 16-MAR-16

content of Memory Script:

{

backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/std/control01.ctl';

}

executing Memory Script

Starting backup at 16-MAR-16

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

copying standby control file

output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_pri.f tag=TAG20160316T110737 RECID=2 STAMP=906635257

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 16-MAR-16

contents of Memory Script:

{

sql clone 'alter database mount standby database';

}

executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:

{

set newname for tempfile 1 to

"/u01/app/oracle/oradata/std/temp01.dbf";

switch clone tempfile all;

set newname for datafile 1 to

"/u01/app/oracle/oradata/std/system01.dbf";

set newname for datafile 2 to

"/u01/app/oracle/oradata/std/sysaux01.dbf";

set newname for datafile 3 to

"/u01/app/oracle/oradata/std/undotbs01.dbf";

set newname for datafile 4 to

"/u01/app/oracle/oradata/std/users01.dbf";

backup as copy reuse

datafile 1 auxiliary format

"/u01/app/oracle/oradata/std/system01.dbf" datafile

2 auxiliary format

"/u01/app/oracle/oradata/std/sysaux01.dbf" datafile

3 auxiliary format

"/u01/app/oracle/oradata/std/undotbs01.dbf" datafile

4 auxiliary format

"/u01/app/oracle/oradata/std/users01.dbf" ;

sql 'alter system archive log current';

}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/std/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 16-MAR-16

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/u01/app/oracle/oradata/pri/system01.dbf

output file name=/u01/app/oracle/oradata/std/system01.dbf tag=TAG20160316T110744

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:38

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002 name=/u01/app/oracle/oradata/pri/sysaux01.dbf

output file name=/u01/app/oracle/oradata/std/sysaux01.dbf tag=TAG20160316T110744

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:09

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=/u01/app/oracle/oradata/pri/undotbs01.dbf

output file name=/u01/app/oracle/oradata/std/undotbs01.dbf tag=TAG20160316T110744

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=/u01/app/oracle/oradata/pri/users01.dbf

output file name=/u01/app/oracle/oradata/std/users01.dbf tag=TAG20160316T110744

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 16-MAR-16

sql statement: alter system archive log current

contents of Memory Script:

{

switch clone datafile all;

}

executing Memory Script

datafile 1 switched to datafile copy

input datafile copy RECID=2 STAMP=906635463 file name=/u01/app/oracle/oradata/std/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=3 STAMP=906635463 file name=/u01/app/oracle/oradata/std/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=4 STAMP=906635463 file name=/u01/app/oracle/oradata/std/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=5 STAMP=906635463 file name=/u01/app/oracle/oradata/std/users01.dbf

Finished Duplicate Db at 16-MAR-16

 

RMAN>

恢复数据库结束

 

12:尝试开启备库

 

登陆并查看数据库当前状态:

 

[oracle@std ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 14 16:41:50 2014

Copyright (c) 1982, 2010, Oracle. All rights reserved.

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SYS@std> startup

SYS@std> select status from v$instance;

 

STATUS

------------

MOUNTED        (RMAN恢复完直接就是mount状态)

 

13:备库启动日志应用(启用备库前确认归档日志是否都已拷贝)

SYS@std> alter database recover managed standby database disconnect from session;

Database altered.

(停止日志应用的命令是:alter database recover managed standby database cancel;)

 

查看日志应用情况:

SYS@std> set pagesize 100

SYS@std> select sequence#,applied from v$archived_log order by 1;

 

SEQUENCE# APPLIED

---------- ---------

8 YES

9 YES

10 YES

 

如上,如果发现有个NO的,也是正常的,说明该日志在主库上还没有归档,可以在主库上运行alter system switch logfile;命令来进行日志切换,再到备库查看日志应用情况

 

 

14:分别查看主库和备库的归档序列号是否一致:

先在主库手动切换一下日志:

SYS@pri> alter system switch logfile;

 

System altered.

然后查看主库:

SYS@pri> archive log list;

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u01/app/oracle/arch

Oldest online log sequence 22

Next log sequence to archive 24

Current log sequence 24

备库:

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u01/app/oracle/arch

Oldest online log sequence 22

Next log sequence to archive 0

Current log sequence 24

 

结果完全一致,至此,DataGuard的搭建成功!

 

15:检查命令

查看standby启动的DG进程

SQL> select process,client_process,sequence#,status from v$managed_standby; 

 

PROCESS   CLIENT_P  SEQUENCE# STATUS 

--------- -------- ---------- ------------ 

ARCH      ARCH             23 CLOSING 

ARCH      ARCH              0 CONNECTED            //归档进程 

ARCH      ARCH             21 CLOSING 

ARCH      ARCH              0 CONNECTED 

RFS       ARCH              0 IDLE 

RFS       UNKNOWN           0 IDLE 

RFS       LGWR             24 IDLE               //归档传输进程 

RFS       UNKNOWN           0 IDLE 

MRP0      N/A              24 APPLYING_LOG      //日志应用进程 

 

9 rows selected. 

 

查看数据库的保护模式:

SQL> select database_role,protection_mode,protection_level,open_mode from v$database; 

DATABASE_ROLE    PROTECTION_MODE      PROTECTION_LEVEL     OPEN_MODE 

---------------- -------------------- -------------------- -------------------- 

PRIMARY          MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  READ WRITE 

 

#standby 端查看,也是一样的。 

SQL> select database_role,protection_mode,protection_level,open_mode from v$database; 

 

DATABASE_ROLE    PROTECTION_MODE      PROTECTION_LEVEL     OPEN_MODE 

---------------- -------------------- -------------------- -------------------- 

PHYSICAL STANDBY MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  MOUNTED 

查看DG的日志信息

SQL> select * from v$dataguard_status;

 

16:Open Read Only standby数据库并且开启实时日志应用

SQL> shutdown immediate 

ORA-01109: database not open 

Database dismounted. 

ORACLE instance shut down. 

SQL> startup 

ORACLE instance started. 

Total System Global Area 1188511744 bytes 

Fixed Size                  1364228 bytes 

Variable Size             754978556 bytes 

Database Buffers          419430400 bytes 

Redo Buffers               12738560 bytes 

Database mounted. 

Database opened. 

SQL> select database_role,protection_mode,protection_level,open_mode from v$database; 

DATABASE_ROLE    PROTECTION_MODE      PROTECTION_LEVEL     OPEN_MODE 

---------------- -------------------- -------------------- -------------------- 

PHYSICAL STANDBY MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  READ ONLY 

SQL> select process,client_process,sequence#,status from v$managed_standby; 

PROCESS   CLIENT_P  SEQUENCE# STATUS 

--------- -------- ---------- ------------ 

ARCH      ARCH              0 CONNECTED 

ARCH      ARCH              0 CONNECTED 

ARCH      ARCH              0 CONNECTED 

ARCH      ARCH             26 CLOSING 

RFS       ARCH              0 IDLE 

RFS       UNKNOWN           0 IDLE 

RFS       LGWR             27 IDLE 

7 rows selected. 

SQL> recover managed standby database using current logfile disconnect from session; 

Media recovery complete. 

SQL> select process,client_process,sequence#,status from v$managed_standby; 

PROCESS   CLIENT_P  SEQUENCE# STATUS 

--------- -------- ---------- ------------ 

ARCH      ARCH              0 CONNECTED 

ARCH      ARCH              0 CONNECTED 

ARCH      ARCH              0 CONNECTED 

ARCH      ARCH             26 CLOSING 

RFS       ARCH              0 IDLE 

RFS       UNKNOWN           0 IDLE 

RFS       LGWR             27 IDLE 

MRP0      N/A              27 APPLYING_LOG 

8 rows selected. 

SQL> select process,client_process,sequence#,status from v$managed_standby;

PROCESS   CLIENT_P  SEQUENCE# STATUS

--------- -------- ---------- ------------

ARCH   ARCH         19 CLOSING

ARCH   ARCH         20 CLOSING

ARCH   ARCH          0 CONNECTED

ARCH   ARCH         21 CLOSING

MRP0   N/A          22 WAIT_FOR_LOG

RFS   ARCH          0 IDLE

RFS   UNKNOWN       0 IDLE

RFS   UNKNOWN       0 IDLE

RFS   LGWR         22 IDLE

9 rows selected.

五:相关知识补充:

1:DataGuard的三种数据保护模式:

(1)MAXIMIZE PROTECTION(最大保护模式):

最大数据保护与无数据分歧,LGWR将同时传送到备用节点,在主节点事务确认之前,备用节点也必须完全收到日志数据。如果网络不好,引起LGWR不能传送数据,将引起严重的性能问题,导致主节点DOWN机。

(2)MAXIMIZE AVAILABILITY(最大可用模式):

无数据丢失模式,允许数据分歧,允许异步传送。正常情况下运行在最大保护模式,在主节点与备用节点的网络断开或连接不正常时,自动切换到最大性能模式,主节点的操作还是可以继续的。在网络不好的情况下有较大的性能影响。

(3)MAXIMIZE PERFORMANCE(最大性能模式):

这种模式应当可以说是从8i继承过来的备用服务器模式,异步传送,无数据同步检查,可能丢失数据,但是能获得主节点的最大性能。

验证数据同步

  1. 检查两个库的dg功能 
    –通过归档应用日志
  2. 创建、删除表空空间
create tablespace test1 datafile '/home/oracle/ora_dbf/testkts.dbf' size 2m autoextend off;
alter system switch logfile;
  1. 创建,删除用户 

    create user testsp identified by testsp default tablespace test1; 
    alter system switch logfile;

  2. 创建,删除表 
    conn testsp/testsp 
    grant connect,resource,dba,IMP_FULL_DATABASE,EXP_FULL_DATABASE, 
    UNLIMITED TABLESPACE 
    to testsp; 
    create table ggs(a varchar2(20)) ; 
  3. 插入,删除数据 
    insert into innpay.ggs values(‘itpux5’); 
    select * from testsp.ggs; 
    commit; 
    alter system switch logfile;


–事实应用日志 
(备) 
alter database recover managed standby database cancel; 
alter database recover managed standby database using current logfile disconnect ;

  1. 删除数据 
    delete from test1.test1_tab; 
    commit;

  2. 删除表 
    drop table test1.test1_tab;

  3. 删除用户 
    drop user test1 cascade;

  4. 删除表空间 
    drop tablespace test includeing contents and datafile;

adg异常状态调整

switchover_status含义

状态含义
NOT ALLOWED当前的数据库不是带有备用数据库的主数据库
PREPARING DICTIONARY该逻辑备用数据库正在向一个主数据库和其他备用数据库发送它的重做数据,以便为切换做准备
PREPARING SWITCHOVER接受用于切换的重做数据时,逻辑备用配置会使用它
RECOVERY NEEDED备用数据库还没有接收到切换请求
SESSIONS ACTIVE在主数据库中存在活动的SQL会话;在继续执行之前必须断开这些会话
SWITCHOVER PENDING适用于那些已收到主数据库切换请求但是还没有处理该请求的备用数据库
SWITCHOVER LATENT切换没有完成并返回到主数据库
TO LOGICAL STANDBY主数据库已经收到了来自逻辑备用数据库的完整的字典
TO PRIMARY该备用数据库可以转换为主数据库
TO STANDBY该主数据库可以转换为备用数据库

部分异常情况的处理方法

错误:

SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
FAILED DESTINATION
  • 该错误是由于主机arch进程无法连接到备机造成 

在双方机器上分别tnsping两个tnsname,一般来说,应有一方监听没起,启动后连接失败方应会很快会被arch进程检测到,从而连接成功。

数据库主要文件

select status from v$instance; --查看数据库状态 
select member from v$logfile;  --联机重做日志
select name from v$datafile;  --日志文件
select name from v$tempfile; --临时数据文件
show parameter control_files;(select status,name from v$controlfile)--查看控制文件

日志查看

建议在部署过程中一直开着方便随时查看问题
tail -f /home/oracle/app/diag/rdbms/itpuxdb/itpuxdb/trace/alert_itpuxdb.log
tail -f /home/oracle/app/diag/rdbms/stitpux/stitpux/trace/alert_stitpux.log

 

安装过程遇到的问题总结

1.由于std创建库了,在安装过程中。遇到的问题有db_unique_name='pri' 。所以需要修改过来:

SQL> alter system set db_unique_name='std' scope=spfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> 

SQL> startup ;

ORACLE instance started.

Total System Global Area 2.6991E+10 bytes

Fixed Size          2213976 bytesVariable Size        1.9596E+10 bytes

Database Buffers     7247757312 bytes

Redo Buffers          145174528 bytes

Database mounted.

Database opened.

SQL> 

SQL>  show parameter db_unique_name;

 

2.重新安装oracle时,没有orainstRoot.sh文件  
重新安装RAC时,到excute configuration scripts时,只提示运行:/opt/ora10g/product/10.2.0/crs_1/root.sh这个文件,
不提示/opt/ora10g/oraInventory/orainstRoot.sh;这个文件,是为什么?

原因:
没删除/etc/oraInst.loc文件

 

开启实时同步

SQL> alterdatabase open;

 

Database altered.

 

SQL> alter databaserecover managed standby database using current logfile disconnect from session;

 

Database altered.

 

SQL>

3.3.11 开启flashback

上面DataGuard搭建好之后,千万不要忘了把备库的flashback打开,具体如下:

 

SQL> alterdatabase recover managed standby database cancel;  #取消实时同步

 

Database altered.

 

SQL> shutdownimmediate  #关闭数据库

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startupmount   #打开到mount状态

ORA-32004: obsolete or deprecatedparameter(s) specified for RDBMS instance

ORACLE instance started.

 

Total System Global Area  688959488 bytes

Fixed Size          2256432 bytes

Variable Size        566231504 bytes

Database Buffers     117440512 bytes

Redo Buffers           3031040 bytes

Database mounted.

SQL> alterdatabase flashback on;  #开始flashback

 

Database altered.

 

SQL> alterdatabase open;   #open数据库

 

Database altered.

 

SQL> alterdatabase recover managed standby database using current logfile disconnect fromsession;    #开启实时同步

 

Database altered.

3.4验证DG同步

上面已经把DataGurad搭建完,下面介绍如何验证DataGuard是否能实时同步

1.  通过查看archive_log_dest_2列是否有error报错,如果有报错,则需要先根据报错内容解决问题

SQL>col dest_name format a30

SQL>col error format a20

 

SQL>select dest_name,error from v$archive_dest;

 

DEST_NAME             ERROR

--------------------------------------------------

LOG_ARCHIVE_DEST_1

LOG_ARCHIVE_DEST_2

LOG_ARCHIVE_DEST_3

LOG_ARCHIVE_DEST_4

LOG_ARCHIVE_DEST_5

LOG_ARCHIVE_DEST_6

LOG_ARCHIVE_DEST_7

LOG_ARCHIVE_DEST_8

LOG_ARCHIVE_DEST_9

LOG_ARCHIVE_DEST_10

LOG_ARCHIVE_DEST_11

 

DEST_NAME             ERROR

--------------------------------------------------

LOG_ARCHIVE_DEST_12

LOG_ARCHIVE_DEST_13

LOG_ARCHIVE_DEST_14

LOG_ARCHIVE_DEST_15

LOG_ARCHIVE_DEST_16

LOG_ARCHIVE_DEST_17

LOG_ARCHIVE_DEST_18

LOG_ARCHIVE_DEST_19

LOG_ARCHIVE_DEST_20

LOG_ARCHIVE_DEST_21

LOG_ARCHIVE_DEST_22

 

DEST_NAME             ERROR

--------------------------------------------------

LOG_ARCHIVE_DEST_23

LOG_ARCHIVE_DEST_24

LOG_ARCHIVE_DEST_25

LOG_ARCHIVE_DEST_26

LOG_ARCHIVE_DEST_27

LOG_ARCHIVE_DEST_28

LOG_ARCHIVE_DEST_29

LOG_ARCHIVE_DEST_30

LOG_ARCHIVE_DEST_31

 

31rows selected.

 

SQL>

注意:上面显示没有报错

2.  查询主库最大归档序号,一致即归档同步成功。

主库上执行:

SQL>select max(sequence#) from v$archived_log;

 

MAX(SEQUENCE#)

--------------

       132

备库上操作:

SQL>select max(sequence#) from v$archived_log;

 

MAX(SEQUENCE#)

--------------

       132

 

主库上执行日志切换

SQL>alter system archive log current;

 

Systemaltered.

 

SQL>select max(sequence#) from v$archived_log;

 

MAX(SEQUENCE#)

--------------

       133

 

SQL>

备库上再次验证:

SQL>select max(sequence#) from v$archived_log;

 

MAX(SEQUENCE#)

--------------

       133

 

SQL>

 

3.  查看主备库状态

主库上执行:

SQL>select switchover_status,database_role from v$database;

 

SWITCHOVER_STATUS    DATABASE_ROLE

------------------------------------

TOSTANDBY       PRIMARY

 

备库上执行:

SQL>select switchover_status,database_role from v$database;

 

SWITCHOVER_STATUS    DATABASE_ROLE

------------------------------------

NOTALLOWED     PHYSICAL STANDBY

4.  可以创建一个table进行测试

主库上操作:

SQL>create table dg(id number);

 

Tablecreated.

SQL>insert into dg values(1);

 

1row created.

 

SQL>commit;

 

Commitcomplete.

 

SQL>select * from dg;

 

    ID

----------

     1

备库上操作:

SQL>select * from dg;

 

    ID

----------

     1

 

SQL>

上面说明DG是同步的。

3.5DG切换与恢复

我们配置DG的目的就是为了在主库出现故障时,备库能够提供服务,保证业务的正常运行。DG的故障切换分为switchover和failover两种:

3.5.1 switchover

switchover是用户有计划的进行停机切换,能够保证不丢失数据,下面我们来看下switchover是怎样操作的:

主库上操作:

SQL> selectswitchover_status,database_role from v$database; 

SWITCHOVER_STATUS    DATABASE_ROLE

-------------------- ----------------

TO STANDBY      PRIMARY

 

SQL>

注意:上面查询结果为TO STANDBY 或 SESSIONS ACTIVE表明可以进行切换

 

SQL> alter database commit to switchover to physical standby;

 

Databasealtered.

SQL> startupmount

ORACLE instance started.

 

Total System Global Area  688959488 bytes

Fixed Size          2256432 bytes

Variable Size        566231504 bytes

Database Buffers     117440512 bytes

Redo Buffers           3031040 bytes

Database mounted.

SQL> selectdatabase_role from v$database;

 

DATABASE_ROLE

----------------

PHYSICAL STANDBY

 

备库上操作:

SQL> select switchover_status,database_role from v$database;

 

SWITCHOVER_STATUS    DATABASE_ROLE

------------------------------------

TO PRIMARY       PHYSICAL STANDBY

 

SQL>

注意:上面查询结果显示为TO PRIMARY 或 SESSIONS ACTIVE表明可以切换成主库;

现在可以把备库切换成主库:

SQL> alterdatabase commit to switchover to primary with session shutdown;

 

Database altered.

 

SQL> alter database open;

 

Database altered.

 

SQL> selectswitchover_status,database_role,open_mode from v$database;

 

SWITCHOVER_STATUS    DATABASE_ROLE    OPEN_MODE

-------------------- ------------------------------------

SESSIONS ACTIVE      PRIMARY         READ WRITE

 

记住:这时候需要在现在的备库(原先的主库)开启实时同步

 

SQL> alterdatabase open;

 

Database altered.

 

SQL> alterdatabase recover managed standby database using current logfile disconnect fromsession;

 

Database altered.

 

到此DG switover切换完成,验证方法同上。

3.5.2 failover

failover是当主库真正出现严重系统故障,如数据库宕机,软硬件故障导致主库不能支持服务,从而进行的切换动作。

注意:为了能够在failover后能够恢复DG,需要在主库上开启flashback,如果不开启flashback的话,DG就可能需要重新搭建

由于主库已经不可访问,下面所有的操作都在备库完成:

SQL> alterdatabase recover managed standby database cancel;   #停止实时同步

 

Database altered.

 

SQL> alter databaserecover managed standby database finish force;

 

Database altered.

 

SQL> selectdatabase_role from v$database;

 

DATABASE_ROLE

----------------

PHYSICAL STANDBY

 

SQL> alterdatabase commit to switchover to primary;

 

Database altered.

 

SQL> alter database open;

 

Database altered.

 

SQL> selectswitchover_status,database_role,open_mode from v$database;

 

SWITCHOVER_STATUS    DATABASE_ROLE    OPEN_MODE

-------------------- ------------------------------------

RESOLVABLE GAP       PRIMARY         READ WRITE

至此failover操作完成,原来的备库已经切换为主库,可以给业务提供服务了。

3.5.2 failover恢复

上面提到了failover,这种情形是当主库真正出现异常之后,才会执行的操作,那么我们执行过failover 之后,如何在重新构建DG,这里我们利用flashback database来重构,具体方法如下:

在新的主库上执行:

SQL> selectto_char(standby_became_primary_scn) from v$database;

 

TO_CHAR(STANDBY_BECAME_PRIMARY_SCN)

----------------------------------------

977458

 

SQL>

在之前的主库上,也就是现在的备库上执行下面的操作:

SQL> startupmount

ORA-32004: obsolete or deprecatedparameter(s) specified for RDBMS instance

ORACLE instance started.

 

Total System Global Area  688959488 bytes

Fixed Size          2256432 bytes

Variable Size        566231504 bytes

Database Buffers     117440512 bytes

Redo Buffers           3031040 bytes

Database mounted.

SQL> flashbackdatabase to scn 977458; #这个值为在新主库上查询到的SCN值

 

Flashback complete.

 

SQL> alterdatabase convert to physical standby;

 

Database altered.

SQL> shutdownimmediate

ORA-01507: database not mounted

 

 

ORACLE instance shut down.

SQL> startup

ORA-32004: obsolete or deprecatedparameter(s) specified for RDBMS instance

ORACLE instance started.

 

Total System Global Area  688959488 bytes

Fixed Size          2256432 bytes

Variable Size        566231504 bytes

Database Buffers     117440512 bytes

Redo Buffers           3031040 bytes

Database mounted.

Database opened.

SQL> alterdatabase recover managed standby database using current logfile disconnect fromsession;

 

Database altered.

 

SQL>

到此failover 恢复已经完成,关于如何验证DG方法如上,这里不在介绍。

 

http://www.cnblogs.com/pigdragon/p/6432164.html 

https://blog.csdn.net/shiyu1157758655/article/details/72878249

https://wenku.baidu.com/view/10941c70195f312b3069a52a.html   dg管理推荐篇

 

 

 

 

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐