Oracle_rac+asm+dataguard项目实施.pdf

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:35

目 录
1
前言 .................................................................................................................................. 4
2
环境 .................................................................................................................................. 4
3
配置过程 .......................................................................................................................... 5
3.1
修改主库,将主库改为归档模式及 force logging 状态 ........................... 6
3.2
收集所有需要配置文件和备份文件 ............................................................... 7
3.3
在主库和备库上修改 oracle 网络服务 ....................................................... 12
3.4
恢复数据库到 Standby 端,并生成出数据库实例 .................................. 26
3.5
配置主库,并进行日志的传送 ..................................................................... 46
3.6
验证 standby 能否接收日志传输 .................................................................. 48
3.7
创建逻辑 standby ........................................................................................... 50
4
DATA GUARD 的日常维护 ......................................................................................... 57
4.1
开启和关闭顺序 ............................................................................................. 57
4.2
DATA GUARD 启用模式切换(物理 standby) ............................................. 57
4.3
Primary 和 Standby 的角色转换(物理 standby) ................................ 58
4.4
Primary 和 Standby 的角色转换(逻辑 standby) ................................ 61
5
定时自动清理备库归档日志 ......................................................................................... 64
5.1
定时备份归档日志到本地文件系统后删除归档日志 ................................. 64
5.2
定时删除归档日志备份集文件 ..................................................................... 65
6
问题记录 ........................................................................................................................ 65
6.1
逻辑 standby 不自动删除已应用的主库归档日志 ...................................... 65
7
附录 ................................................................................................................................ 67
7.1
主库 pfile 文件 ............................................................................................... 67
7.2
备库 pfile 文件 .............................................................................................. 69
4
XX 项目 DATAGUARD 灾备系统实施
1 前言
这是本人第一次在生产环境中使用 dataguard 技术进行异地容灾实施,此文为
记录实施的整个过程。
2 环境
主库:oracle 10g rac + asm
备库:oracle 10g 单实例 + asm
Primary 数据库为 RAC 环境
操作系统:AIX 5300-11-01-0944
数据库版本:ORACLE 10.2.0.4.0
计算机 RAC 节点一
主机名 cdlcdb01
IP: 10.1.0.1
数据库名:afc
实例名(即 SID):afc1
计算机 RAC 节点二
操作系统:AIX 5300-11-01-0944
数据库版本:ORACLE 10.2.0.4.0
5
主机名:cdlcdb01
IP: 10.1.0.3
数据库名:afc
实例名(即 SID):afc2
Standby 数据库为单机环境
计算机三
主机名:cdlcdbdg
IP 地址:10.1.99.31
数据库名:afc
实例名: standby
注意:这里数据库的名称需要定义和主库的全局数据库名称完全一样,方便
RMAN 的恢复,如果两者不一样,也能够通过“重定向”等方式加以配置,未尝
试过需要进一步研究。这里搭建的环境是双节点 RAC+单节点 Data guard,前提
条件是 RAC 服务器正常运行,Data guard 备用机安装同样版本的操作系统和数
据库,但无需创建数据库实例,监听服务也无需创建。
3 配置过程
该过程主要将修改主库和备库的初始化启动文件等配置信息,通过 RMAN 工
具从主库备份数据库,再通过 RMAN 工具从备库恢复数据,最后等待归档日志的
正常传输,实现数据库的同步。需注意的是 RAC 环境要只要保持一个结点数据打
开,其它结点全关闭。在实施过程中是将节点 10.1.0.3 数据库关闭,所有主库
操作均在 10.1.0.1 上进行的。
6
3.1 修改主库,将主库改为归档模式及 force logging
状态
--如果当前数据库已启用归档模式,则直接修改 force logging 状态,XX 项目
之前已启用归档模式。
--关闭所有节点的实例服务
sqlplus sys/System@afc1 as sysdba
SQL>set sqlprompt primary>
primary>shutdown immediate
--在其中的一个节点(以节点一,实例名 afc1 为例)
primary>sqlplus / as sysdba
primary>startup mount
primary>alter database archivelog;
primary>alter database open;
--将 RAC 数据库改为 force logging
sqlplus sys/System@afc1 as sysdba
primary>alter database force logging;
primary>select inst_id , force_logging from gv$database;
INST_ID FOR
---------- ---
2 YES
1 YES
7
3.2 收集所有需要配置文件和备份文件
在 RAC1 上创建备份目录/u01/orabak,权限为 oracle 所有。
# mkdir /u01
#cd /u01
#mkdir orabak
#chown -R oracle:oinstall /u01
在 Standby 上创建同样的目录/u01/orabak,权限为 oracle 所有。
# mkdir /u01
#cd /u01
#mkdir orabak
#chown -R oracle:oinstall /u01
这里的目录最好需要和 RAC1 上保持一致,以便 RMAN 能够顺利恢复。
在 RAC1 的备份目录/u01/orabak 下面通过 sqlplus 创建 pfile initstandby.ora
primary>CREATE PFILE='/u01/orabak/initstandby.ora' FROM SPFILE;
切换到 RAC1 的/u01/orabak 目录,进行 RMAN 备份,RAC1 oracle 下执行
$rman target /
RMAN> BACKUP DEVICE TYPE DISK FORMAT '/u01/orabak/db_%U' DATABASE PLUS
ARCHIVELOG;
RMAN> BACKUP DEVICE TYPE DISK FORMAT '/u01/orabak/control_%U' CURRENT
CONTROLFILE FOR STANDBY;
8
具体如下
RMAN> BACKUP DEVICE TYPE DISK FORMAT '/u01/orabak/db_%U' DATABASE PLUS
ARCHIVELOG;
Starting backup at 14-SEP-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006
name=+DATA/afc/datafile/afcdata.274.717886887
input datafile fno=00007
name=+DATA/afc/datafile/data_2010_10.266.717886899
input datafile fno=00008
name=+DATA/afc/datafile/data_2010_11.263.717886909
input datafile fno=00009
name=+DATA/afc/datafile/data_2010_12.265.717886921
input datafile fno=00010
name=+DATA/afc/datafile/data_2011_01.267.717886931
input datafile fno=00011
name=+DATA/afc/datafile/data_2011_02.259.717886943
input datafile fno=00012
name=+DATA/afc/datafile/data_2011_03.268.717886953
input datafile fno=00013
name=+DATA/afc/datafile/data_2011_04.295.717886963
input datafile fno=00014
name=+DATA/afc/datafile/data_2011_05.294.717886975
input datafile fno=00015
name=+DATA/afc/datafile/data_2011_06.260.717886985
input datafile fno=00016
name=+DATA/afc/datafile/data_2011_07.262.717886997
9
input datafile fno=00017
name=+DATA/afc/datafile/data_2011_08.280.717887007
input datafile fno=00018
name=+DATA/afc/datafile/data_2011_09.279.717887017
input datafile fno=00019
name=+DATA/afc/datafile/data_2011_10.278.717887029
input datafile fno=00020
name=+DATA/afc/datafile/data_2011_11.277.717887039
input datafile fno=00021
name=+DATA/afc/datafile/data_2011_12.276.717887051
input datafile fno=00022
name=+DATA/afc/datafile/indx_2010_10.273.717887061
input datafile fno=00023
name=+DATA/afc/datafile/indx_2010_11.272.717887067
input datafile fno=00024
name=+DATA/afc/datafile/indx_2010_12.271.717887073
input datafile fno=00025
name=+DATA/afc/datafile/indx_2011_01.270.717887079
input datafile fno=00026
name=+DATA/afc/datafile/indx_2011_02.293.717887085
input datafile fno=00027
name=+DATA/afc/datafile/indx_2011_03.285.717887089
input datafile fno=00028
name=+DATA/afc/datafile/indx_2011_04.282.717887095
input datafile fno=00029
name=+DATA/afc/datafile/indx_2011_05.284.717887101
input datafile fno=00030
name=+DATA/afc/datafile/indx_2011_06.290.717887107
input datafile fno=00031
name=+DATA/afc/datafile/indx_2011_07.286.717887113
10
input datafile fno=00032
name=+DATA/afc/datafile/indx_2011_08.292.717887119
input datafile fno=00033
name=+DATA/afc/datafile/indx_2011_09.289.717887123
input datafile fno=00034
name=+DATA/afc/datafile/indx_2011_10.291.717887129
input datafile fno=00035
name=+DATA/afc/datafile/indx_2011_11.257.717887135
input datafile fno=00036
name=+DATA/afc/datafile/indx_2011_12.258.717887141
input datafile fno=00003
name=+DATA/afc/datafile/sysaux.264.717886285
input datafile fno=00001
name=+DATA/afc/datafile/system.288.717886285
input datafile fno=00002
name=+DATA/afc/datafile/undotbs1.297.717886285
input datafile fno=00005
name=+DATA/afc/datafile/undotbs2.300.717886371
input datafile fno=00004 name=+DATA/afc/datafile/users.296.717886285
channel ORA_DISK_1: starting piece 1 at 14-SEP-10
channel ORA_DISK_1: finished piece 1 at 14-SEP-10
piece handle=/u01/orabak/db_57lnt6j8_1_1 tag=TAG20100914T191550
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:05
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
11
channel ORA_DISK_1: starting piece 1 at 14-SEP-10
channel ORA_DISK_1: finished piece 1 at 14-SEP-10
piece handle=/u01/orabak/db_58lnt6p1_1_1 tag=TAG20100914T191550
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:06
Finished backup at 14-SEP-10
Starting backup at 14-SEP-10
using channel ORA_DISK_1
specification does not match any archive log in the recovery catalog
backup cancelled because all files were skipped
Finished backup at 14-SEP-10
RMAN> BACKUP DEVICE TYPE DISK FORMAT '/u01/orabak/control_%U' CURRENT
CONTROLFILE FOR STANDBY;
Starting backup at 14-SEP-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including standby control file in backupset
channel ORA_DISK_1: starting piece 1 at 14-SEP-10
channel ORA_DISK_1: finished piece 1 at 14-SEP-10
piece handle=/u01/orabak/control_59lnt6up_1_1 tag=TAG20100914T192201
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
12
Finished backup at 14-SEP-10
RMAN> exit
Recovery Manager complete.
将 RAC1 上的/u01/orabak 下的所有文件,包含 RMAN 备份文件,tnsnames.ora,
listener.ora 和 initstandby.ora 拷贝至 Standby 的同样的目录上。
3.3 在主库和备库上修改 oracle 网络服务
修改 RAC1 和 RAC2 的 oracle 的 tnsnames.ora,红色为修改或添加部分。
[cdlcdb01]$ vi tnsnames.ora
"tnsnames.ora" 51 lines, 1194 characters
# tnsnames.ora Network Configuration File:
/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
AFC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
13
(SERVICE_NAME = afc)
)
)
AFC2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afc)
(INSTANCE_NAME = afc2)
)
)
AFC1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afc)
(INSTANCE_NAME = afc1)
)
)
14
STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.99.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)
LISTENERS_AFC =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
15
)
[cdlcdb02]$vi tnsnames.ora
"tnsnames.ora" 51 lines, 1212 characters
# tnsnames.ora.cdlcdb02 Network Configuration File:
/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora.cdlcdb02
# Generated by Oracle configuration tools.
AFC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afc)
)
)
AFC2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
16
(SERVICE_NAME = afc)
(INSTANCE_NAME = afc2)
)
)
AFC1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afc)
(INSTANCE_NAME = afc1)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.99.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)
17
LISTENERS_AFC =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
修改 Standby 的 tnsnames.ora 和 listner.ora 配置
[cdlcdbdg]$ vi tnsnames.ora
"tnsnames.ora" 51 lines, 1212 characters
# tnsnames.ora.cdlcdb02 Network Configuration File:
/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora.cdlcdb02
# Generated by Oracle configuration tools.
18
AFC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afc)
)
)
AFC2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afc)
(INSTANCE_NAME = afc2)
)
)
AFC1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
19
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afc)
(INSTANCE_NAME = afc1)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.99.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)
LISTENERS_AFC =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdb02-vip)(PORT = 1521))
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
20
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
[oracle@standby admin]$vi listener.ora
"listener.ora" 20 lines, 566 characters
# listener.ora.cdlcdb01 Network Configuration File:
/oracle/product/10.2.0/db_1/network/admin/listener.ora.cdlcdbdg
# Generated by Oracle configuration tools.
LISTENER_CDLCDBDG =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cdlcdbdg)(PORT = 1521)(IP
= FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.99.31)(PORT = 1521)(IP
= FIRST))
)
)
21
SID_LIST_LISTENER_CDLCDBDG =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
修改 Standby 的oracle 宿主目录/home/oracle 下. profile 文件,最终修改结果
如下
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1
export ORACLE_SID=afc
export ORACLE_TERM=xterm
export
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib
export PATH=$PATH:$ORACLE_HOME/bin:$CRS_HOME/bin
export
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib/
:$CLASSPATH:$ORACLE_HOME/network/jlib
新建恢复 standby DB 需要使用的目录
22
mkdir –p /u01/oradata
我们将所有的数据文件,归档日志,控制文件,数据库系统文件等都放入该目录,
以便方便管理和接下来的启动参数配置。
mkdir /oracle/admin/standby/adump
mkdir /oracle/admin/standby/bdump
mkdir /oracle/admin/standby/cdump
mkdir /oracle/admin/standby/dpdump
mkdir /oracle/admin/standby/hdump
mkdir /oracle/admin/standby/udump
创建 standby 相应的 trace 目录
mkdir /oracle/admin/standby/pfile
mkdir /oracle/admin/standby/scripts
创建其他目录
chown -R oracle:oinstall /oracle/admin/standby
将 Standby 上/u01/orabak 里从 RAC1 上拷贝过来的文件 initstandby.ora 拷贝
至$ORACLE_HOME/dbs 下。通过指令创建 orapwstandby.ora,该文件包含的是 sys
的用户密码,注意密码一定要保证与主库一致,这里主库数据库密码为 system。
$ cd /oracle/product/10.2.0/db_1/dbs
$ orapwd file=orapwstandby password=system
修改 Standby 上$ORACLE_HOME/dba 下 initstandby.ora 文件,这是重点需要配
置和注意的地方。
修改前 initstandby.ora 文件内容如下
23
[oracle@afc1 bak]$ vi initstandby.ora
afc1.__db_cache_size=436207616
afc2.__db_cache_size=536870912
afc1.__java_pool_size=16777216
afc2.__java_pool_size=16777216
afc1.__large_pool_size=16777216
afc2.__large_pool_size=16777216
afc1.__shared_pool_size=1124073472
afc2.__shared_pool_size=1023410176
afc1.__streams_pool_size=0
afc2.__streams_pool_size=0
*.audit_file_dest='/oracle/admin/afc/adump'
*.background_dump_dest='/oracle/admin/afc/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.3.0'
*.control_files='+DATA/afc/controlfile/current.281.717886343'
*.core_dump_dest='/oracle/admin/afc/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='afc'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=afcXDB)'
24
afc1.instance_number=1
afc2.instance_number=2
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=+DATA/'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=1147142144
*.processes=1500
*.remote_listener='LISTENERS_AFC'
*.remote_login_passwordfile='exclusive'
*.sessions=1655
*.sga_target=1610612736
afc2.thread=2
afc1.thread=1
*.undo_management='AUTO'
afc1.undo_tablespace='UNDOTBS1'
afc2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/oracle/admin/afc/udump'
修改后 initstandby.ora 文件如下
[oracle@standby dbs]$ vi initstandby.ora
*.__db_cache_size=419430400
*.__java_pool_size=16777216
25
*.__large_pool_size=16777216
*.__shared_pool_size=1140850688
*.__streams_pool_size=0
*.audit_file_dest='/oracle/admin/standby/adump'
*.background_dump_dest='/oracle/admin/standby/bdump'
*.compatible='10.2.0.3.0'
*.control_files='+DATA/standby/controlfile/current.524.729903425'
*.core_dump_dest='/oracle/admin/standby/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='afc'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=standbyXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=1147142144
*.processes=1500
*.sessions=1655
*.sga_target=1610612736
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/admin/standby/udump'
#--以下参数为新增参数
26
*.db_unique_name='standby'
*.log_archive_config='dg_config= (afc,standby)'
*.db_file_name_convert='+DATA/afc/datafile','+DATA/standby/datafile',
'+DATA/afc/tempfile','+DATA/standby/tempfile'
*.log_file_name_convert='+DATA/afc/onlinelog','+DATA/standby/onlinelo
g'
*.log_archive_dest_1='LOCATION=+DATA/STANDBY/ARCH
valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.LOG_ARCHIVE_DEST_2='SERVICE=afc LGWR ASYNC
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=afc'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
*.FAL_SERVER='afc'
*.FAL_CLIENT='standby'
*.STANDBY_FILE_MANAGEMENT='AUTO'
Standby 利用 initstandby.ora 创建 spfile,创建的 spfile 默认为
$ORACLE_HOME/dbs/spfilestandby.ora,为二进制文件,无法直接读取内容。
sqlplus / as sysdba
set sqlprompt standby>
standby>create spfile from
pfile='/oracle/product/10.2.0/db_1/dbs/initstandby.ora';
3.4 恢复数据库到 Standby 端,并生成出数据库实例
启动数据库的监听程序
27
$lsnrctl start
将数据库启动到 nomount 状态
$sqlplus / as sysdba
standby>startup nomount
执行 RMAN 恢复,这里 rman 带上了路径。
[oracle@standby bak]$ /oracle/product/10.2.0/db_1/bin/rman target
sys/system@afc auxiliary /
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Jun 2 16:24:24
2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: AFC (DBID=1203082423)
connected to auxiliary database: AFC (not mounted)
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY;
此时开始恢复了,包括控制文件和数据文件。
具体如下
[oracle@standby bak]$ /oracle/product/10.2.0/db_1/bin/rman target
sys/system@afc auxiliary /
$ rman target sys/CCJhaieia_XHY_S1091@afc auxiliary /
28
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Sep 9 18:49:14
2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: AFC (DBID=1276216263)
connected to auxiliary database: AFC (not mounted)
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY;
Starting Duplicate Db at 09-SEP-10
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=1644 devtype=DISK
contents of Memory Script:
{
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting restore at 09-SEP-10
29
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece
/u01/orabak/3ilndoui_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/orabak/3ilndoui_1_1 tag=TAG20100908T225058
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:09
output filename=+DATA/standby/controlfile/current.256.729283775
Finished restore at 09-SEP-10
sql statement: alter database mount standby database
released channel: ORA_AUX_DISK_1
WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names
changed to diskgroup only.
contents of Memory Script:
{
set newname for tempfile 1 to
"+data";
switch clone tempfile all;
set newname for datafile 1 to
"+data";
30
set newname for datafile 2 to
"+data";
set newname for datafile 3 to
"+data";
set newname for datafile 4 to
"+data";
set newname for datafile 5 to
"+data";
set newname for datafile 6 to
"+data";
set newname for datafile 7 to
"+data";
set newname for datafile 8 to
"+data";
set newname for datafile 9 to
"+data";
set newname for datafile 10 to
"+data";
set newname for datafile 11 to
"+data";
set newname for datafile 12 to
"+data";
set newname for datafile 13 to
"+data";
31
set newname for datafile 14 to
"+data";
set newname for datafile 15 to
"+data";
set newname for datafile 16 to
"+data";
set newname for datafile 17 to
"+data";
set newname for datafile 18 to
"+data";
set newname for datafile 19 to
"+data";
set newname for datafile 20 to
"+data";
set newname for datafile 21 to
"+data";
set newname for datafile 22 to
"+data";
set newname for datafile 23 to
"+data";
set newname for datafile 24 to
"+data";
set newname for datafile 25 to
"+data";
32
set newname for datafile 26 to
"+data";
set newname for datafile 27 to
"+data";
set newname for datafile 28 to
"+data";
set newname for datafile 29 to
"+data";
set newname for datafile 30 to
"+data";
set newname for datafile 31 to
"+data";
set newname for datafile 32 to
"+data";
set newname for datafile 33 to
"+data";
set newname for datafile 34 to
"+data";
set newname for datafile 35 to
"+data";
set newname for datafile 36 to
"+data";
restore
check readonly
33
clone database
;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to +data in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
34
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
35
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
36
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 09-SEP-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=1644 devtype=DISK
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DATA
restoring datafile 00002 to +DATA
restoring datafile 00003 to +DATA
restoring datafile 00004 to +DATA
restoring datafile 00005 to +DATA
restoring datafile 00006 to +DATA
restoring datafile 00007 to +DATA
restoring datafile 00008 to +DATA
restoring datafile 00009 to +DATA
37
restoring datafile 00010 to +DATA
restoring datafile 00011 to +DATA
restoring datafile 00012 to +DATA
restoring datafile 00013 to +DATA
restoring datafile 00014 to +DATA
restoring datafile 00015 to +DATA
restoring datafile 00016 to +DATA
restoring datafile 00017 to +DATA
restoring datafile 00018 to +DATA
restoring datafile 00019 to +DATA
restoring datafile 00020 to +DATA
restoring datafile 00021 to +DATA
restoring datafile 00022 to +DATA
restoring datafile 00023 to +DATA
restoring datafile 00024 to +DATA
restoring datafile 00025 to +DATA
restoring datafile 00026 to +DATA
restoring datafile 00027 to +DATA
restoring datafile 00028 to +DATA
restoring datafile 00029 to +DATA
restoring datafile 00030 to +DATA
restoring datafile 00031 to +DATA
restoring datafile 00032 to +DATA
restoring datafile 00033 to +DATA
38
restoring datafile 00034 to +DATA
restoring datafile 00035 to +DATA
restoring datafile 00036 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/orabak/3flndoot_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/orabak/3flndoot_1_1 tag=TAG20100908T224757
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:06:16
Finished restore at 09-SEP-10
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy recid=37 stamp=729284164
filename=+DATA/standby/datafile/system.289.729284107
datafile 2 switched to datafile copy
input datafile copy recid=38 stamp=729284164
filename=+DATA/standby/datafile/undotbs1.291.729284107
datafile 3 switched to datafile copy
input datafile copy recid=39 stamp=729284164
filename=+DATA/standby/datafile/sysaux.288.729284107
39
datafile 4 switched to datafile copy
input datafile copy recid=40 stamp=729284164
filename=+DATA/standby/datafile/users.292.729284123
datafile 5 switched to datafile copy
input datafile copy recid=41 stamp=729284164
filename=+DATA/standby/datafile/undotbs2.290.729284107
datafile 6 switched to datafile copy
input datafile copy recid=42 stamp=729284164
filename=+DATA/standby/datafile/afcdata.257.729283789
datafile 7 switched to datafile copy
input datafile copy recid=43 stamp=729284164
filename=+DATA/standby/datafile/data_2010_10.258.729283789
datafile 8 switched to datafile copy
input datafile copy recid=44 stamp=729284164
filename=+DATA/standby/datafile/data_2010_11.259.729283789
datafile 9 switched to datafile copy
input datafile copy recid=45 stamp=729284164
filename=+DATA/standby/datafile/data_2010_12.260.729283789
datafile 10 switched to datafile copy
input datafile copy recid=46 stamp=729284164
filename=+DATA/standby/datafile/data_2011_01.261.729283791
datafile 11 switched to datafile copy
input datafile copy recid=47 stamp=729284164
filename=+DATA/standby/datafile/data_2011_02.262.729283791
datafile 12 switched to datafile copy
input datafile copy recid=48 stamp=729284164
filename=+DATA/standby/datafile/data_2011_03.263.729283791
datafile 13 switched to datafile copy
40
input datafile copy recid=49 stamp=729284164
filename=+DATA/standby/datafile/data_2011_04.264.729283791
datafile 14 switched to datafile copy
input datafile copy recid=50 stamp=729284164
filename=+DATA/standby/datafile/data_2011_05.265.729283879
datafile 15 switched to datafile copy
input datafile copy recid=51 stamp=729284164
filename=+DATA/standby/datafile/data_2011_06.266.729283879
datafile 16 switched to datafile copy
input datafile copy recid=52 stamp=729284165
filename=+DATA/standby/datafile/data_2011_07.267.729283879
datafile 17 switched to datafile copy
input datafile copy recid=53 stamp=729284165
filename=+DATA/standby/datafile/data_2011_08.268.729283879
datafile 18 switched to datafile copy
input datafile copy recid=54 stamp=729284165
filename=+DATA/standby/datafile/data_2011_09.269.729283879
datafile 19 switched to datafile copy
input datafile copy recid=55 stamp=729284165
filename=+DATA/standby/datafile/data_2011_10.270.729283879
datafile 20 switched to datafile copy
input datafile copy recid=56 stamp=729284165
filename=+DATA/standby/datafile/data_2011_11.271.729283985
datafile 21 switched to datafile copy
input datafile copy recid=57 stamp=729284165
filename=+DATA/standby/datafile/data_2011_12.272.729283985
datafile 22 switched to datafile copy
41
input datafile copy recid=58 stamp=729284165
filename=+DATA/standby/datafile/indx_2010_10.273.729283985
datafile 23 switched to datafile copy
input datafile copy recid=59 stamp=729284165
filename=+DATA/standby/datafile/indx_2010_11.274.729283985
datafile 24 switched to datafile copy
input datafile copy recid=60 stamp=729284165
filename=+DATA/standby/datafile/indx_2010_12.275.729283987
datafile 25 switched to datafile copy
input datafile copy recid=61 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_01.276.729283987
datafile 26 switched to datafile copy
input datafile copy recid=62 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_02.277.729283987
datafile 27 switched to datafile copy
input datafile copy recid=63 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_03.278.729284017
datafile 28 switched to datafile copy
input datafile copy recid=64 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_04.279.729284017
datafile 29 switched to datafile copy
input datafile copy recid=65 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_05.280.729284055
datafile 30 switched to datafile copy
input datafile copy recid=66 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_06.281.729284055
datafile 31 switched to datafile copy
42
input datafile copy recid=67 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_07.282.729284055
datafile 32 switched to datafile copy
input datafile copy recid=68 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_08.283.729284055
datafile 33 switched to datafile copy
input datafile copy recid=69 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_09.284.729284055
datafile 34 switched to datafile copy
input datafile copy recid=70 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_10.285.729284069
datafile 35 switched to datafile copy
input datafile copy recid=71 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_11.286.729284069
datafile 36 switched to datafile copy
input datafile copy recid=72 stamp=729284165
filename=+DATA/standby/datafile/indx_2011_12.287.729284107
Finished Duplicate Db at 09-SEP-10
RMAN>
在使用 ASM 磁盘的时候,一般情况下将数据库恢复过来后参数 control_files
会自动配置为正确的控制文件,但为安全还是需要进 ASM 磁盘里看一下真实的文
件名是否与参数中的配置一样
--查看目前的参数配置
standby> show parameter control_files
NAME TYPE VALUE
43
control_files +DATA/afc/controlfile/current.524.729903425
--查看备库实际控制文件名
$ export ORACLE_SID=+ASM
$ asmcmd -p
ASMCMD [+] > cd data/standby/controlfile
ASMCMD [+data/standby/controlfile] > ls
current.524.729903425
如果不一样,注意在使用 ASM 的情况下,数据库恢复后要将真实的控制文件名称更新到
control_files 参数
alter system set control_files='+DATA/standby/controlfile/current.
524.729903425'
因为 ASM 默认情况下是自动分配分配文件名,所以恢复数据库后如果数据库参数和实际控
制文件不符,则要将该参数修改,然后再重建一次 pfile 文件,否则数据库重启后要报错
ORA-00205: error in identifying control file, check alert log for more info
在 Standby 上创建 standby red log 日志文件(考虑到如果要切换角色的话,将
主库上也创建 standby red log 日志文件)
这步很重要,否则会造成要切换日志的备库时候才同步一次,之前因为日志大小
未设置好,导致备库的数据要一个多小时才同步一次,修改正确后主库和备库基
本达到实时
第 1 步确保主和备数据库上的日志文件尺寸是相同的。
当前备重做日志文件的尺寸必须与当前主数据库联机重做日志文件的尺寸完全符合。
例如,如果主数据库使用两个联机重做日志组,其日志文件是200K,则备重做日志组也应
该是200K 大小的日志文件。
第 2 步确定备重做日志文件组的适当数目。
最少地,配置应该比主数据库上的联机重做日志文件组的数目多一个备重做日志文件
组。然而,推荐的备重做日志文件组数目依赖于主数据库上的线程数。使用下面的等式来

定备重做日志文件组的适当数目。
(每个线程的日志文件的最大数目+1)×线程最大数目
44
使用这个等式减少了主实例的日志写(LGWR)进程因为在备数据库上无法分配备重做
日志文件而被锁住的可能性。例如,如果主数据库每个线程有2 个日志文件,并有2 个线程,
则在备数据库上需要有 6 个备重做日志文件组。
查询主库日志文件大小和线程数
select a.member, b.* from v$logfile a, v$log b where a.group# = b.group#;
可以看到,主库日志文件大小为 256M,线程数为 2,根据公式要增加 6 个日志组
查询备库日志文件大小和线程数
增加主库 standby red log 日志组,以备以后有切换的需要
--增加主库 standby 日志组
sqlplus / as sysdba
primary>alter database add standby logfile thread 1
GROUP 5 SIZE 256M,
GROUP 6 SIZE 256M,
GROUP 7 SIZE 256M;
primary>alter database add standby logfile thread 2
GROUP 8 SIZE 256M,
GROUP 9 SIZE 256M,
GROUP 10 SIZE 256M;
45
现在我们来查查主库的 standby red log 日志组,发现创建成功了
select * from V$STANDBY_LOG;
如果发现日志组大小建的和在线重做日志大小不一样,也可以删除日志组后再重
做,这里顺便将删除方法列上
--删除日志组
sqlplus / as sysdba
alter database drop logfile group 10;
alter database drop logfile group 9;
alter database drop logfile group 8;
alter database drop logfile group 7;
alter database drop logfile group 6;
alter database drop logfile group 5;
以同样的步骤增加备库 standby red log 日志组(详细步骤省略,这里已确定备
库日志也为 256M 一个)
--增加备库 standby 日志组
Sqlplus / as sysdba
standby>alter database add standby logfile thread 1
GROUP 5 ('+data/standby/onlinelog/group_5_standby') SIZE 256M,
GROUP 6 ('+data/standby/onlinelog/group_6_standby') SIZE 256M,
46
GROUP 7 ('+data/standby/onlinelog/group_7_standby') SIZE 256M;
standby>alter database add standby logfile thread 2
GROUP 8 ('+data/standby/onlinelog/group_8_standby') SIZE 256M,
GROUP 9 ('+data/standby/onlinelog/group_9_standby') SIZE 256M,
GROUP 10 ('+data/standby/onlinelog/group_10_standby') SIZE 256M;
至此备库端配置已完成,此时是物理 standby。但由于备库数据库仅为 500G,而
主库为 1T,所以只能使用逻辑 standby,以能支持定期清理数据的业务。
3.5 配置主库,并进行日志的传送
这一阶段的配置只需要在 RAC1 上进行即可。
接下来就是修改主库配置,让主库运用这个配置,向备库传输日志归档
有两种方法都可以实现,只需要
(1)在 RAC1 上通过 SQL 语句直接更新系统参数,考虑到是 RAC 环境,推荐这种方
式比较简单实用
sqlplus / as sysdba
#--带 scope=both 参数使得修改主库参数并立即生效,重启后也生效
primary>alter system set db_unique_name='afc' scope=both;
primary>alter system set log_archive_config='dg_config= (standby,afc)'
scope=both;
primary>alter system set
db_file_name_convert='+DATA/standby/datafile','+DATA/afc/datafile','+
DATA/standby/tempfile','+DATA/afc/tempfile' scope=both;
47
primary>alter system set
log_file_name_convert='+DATA/standby/onlinelog','+DATA/afc/onlinelog'
scope=both;
primary>alter system set log_archive_dest_1='LOCATION=+DATA/AFC/ARCH
valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=afc' scope=both;
#--注意:
#--同步方式只能在 DataGuard 的最大保护(maximum protection)或是最高可用(maximum
availability)的模式下实现,因为最大性能模式(max perfermance)的机制就是异步的。
#--LGWR SYNC 表示同步,LGWR ASYNC 表示异步,我们这里采取的是异步方式,基本也能达到实时
primary>alter system set LOG_ARCHIVE_DEST_2='SERVICE=standby LGWR ASYNC
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
scope=both;
primary>alter system set LOG_ARCHIVE_DEST_STATE_1=enable scope=both;
primary>alter system set LOG_ARCHIVE_DEST_STATE_2=enable scope=both;
primary>alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
scope=both;
primary>alter system set FAL_SERVER='standby' scope=both;
primary>alter system set FAL_CLIENT='afc' scope=both;
primary>alter system set STANDBY_FILE_MANAGEMENT='auto' scope=both;
这样 RAC 会对上述的配置直接生效。
(2)在 RAC1 上,切换到$ORACLE_HOME/dbs 通过 pfile,
$ORACLE_HOME/dbs/initafc1.ora 直接创建 spfile,默认的 spfile 存在于
+DATA/afc,再重启 RAC 的两个节点。
sqlplus / as sysdba
primary>create spfile from pfile='$ORACLE_HOME/dbs/initafc1.ora';
重启数据库,使得上述 spfile 能够生效。
48
至此,主库端的配置结束。
3.6 验证 standby 能否接收日志传输
由于项目使用的是逻辑 standby 方式,所以该步骤可以直接跳过,如果要采用物
理 standby 则进行此步
在 Standby 上启动数据库到恢复管理模式,并开始准备从主库接受归档日志的传
输。
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT
LOGFILE DISCONNECT;
在备库端查看其角色是否已经是 physical standby
sqlplus / as sysdba
standby> select DATABASE_ROLE,open_mode from v$database;
DATABASE_ROLE OPEN_MODE
---------------- ----------
PHYSICAL STANDBY MOUNTED
在主库查看其角色
primary> select DATABASE_ROLE,open_mode from v$database;
DATABASE_ROLE OPEN_MODE
---------------- ----------
PRIMARY READ WRITE
49
在备库查看网络连接
[oracle@standby ~]$ netstat -n|grep 1521
tcp4 0 0 10.1.99.31.1521 10.1.99.31.33026
ESTABLISHED
tcp4 0 0 10.1.99.31.33026 10.1.99.31.1521
ESTABLISHED
tcp4 0 0 10.1.99.31.1521 10.1.99.31.33129
ESTABLISHED
tcp4 0 0 10.1.99.31.33129 10.1.99.31.1521
ESTABLISHED
tcp4 0 0 10.1.99.31.1521 10.1.0.3.45037
ESTABLISHED
tcp4 0 0 10.1.99.31.1521 10.1.0.1.49027
ESTABLISHED
说明备库已经和主库建立了网络连接
在备库查看 data guard 为哪种日志接受方式
standby> select process,client_process,sequence#,status from
v$managed_standby;
PROCESS CLIENT_P SEQUENCE# STATUS
--------- -------- ---------- ------------
ARCH ARCH 0 CONNECTED
ARCH ARCH 0 CONNECTED
RFS UNKNOWN 0 IDLE
RFS UNKNOWN 571 IDLE
50
在备库查看日志的队列情况
standby> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG
ORDER BY SEQUENCE#;
在主库进行强制归档
primary>ALTER SYSTEM ARCHIVE LOG CURRENT;
在备库查看新的归档日志有没有正常传输过来
standby>SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG
ORDER BY SEQUENCE#;
如果已经有新的日志,说明 data guard 已经生效。
3.7 创建逻辑 standby
由于项目使用的是逻辑standby方式,所以进行该步操作,如果要采用逻辑
standby则按2.6进行操作
3.7.1 设置 primary 数据库
由于有前期创建物理standby 时的基础,此处primary 数据库的初始化参数可以
不做修改,最重要的是不要
忘记生成LogMiner 字典信息。
primary> execute dbms_logstdby.build;
PL/SQL 过程已成功完成。
3.7.2 转换物理 standby 为逻辑 standby
执行下列语句,转换物理standby 为逻辑standby:
standby> show parameter db_name;
NAME TYPE VALUE
------------------------------------ -----------
51
------------------------------
db_name string AFC
数据库这时应处于mount状态,不能被打开
standby>alter database recover to logical standby standby;
数据库已更改。
STANDBY>shutdown immediate
ORA-01507: 未装载数据库
ORACLE 例程已经关闭。
standby>startup mount;
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1289484 bytes
Variable Size 79692532 bytes
Database Buffers 79691776 bytes
Redo Buffers 7098368 bytes
数据库装载完毕。
standby>show parameter db_name;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
db_name string STANDBY
--查看备库角色
standby>select database_role from v$database;
DATABASE_ROLE
----------------
LOGICAL STANDBY
3.7.3 重建逻辑 standby 的密码文件
standby>$ cd /oracle/product/10.2.0/db_1/dbs
standby>$ orapwd file=orapwstandby password=system
注意保持sys 密码与primary 数据库一致。
3.7.4 检查主库及备库的参数设置是否正确,如发现不正确则要修
改,正确的主及备库参数如下
primary>
SQL> show parameter db_unique_name;
show parameter log_archive_config;
52
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
db_unique_name string afc
SQL> show parameter db_file_name_convert;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_config string dg_config=
(afc,standby)
SQL> show parameter log_file_name_convert;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
db_file_name_convert string
+DATA/standby/datafile, +DATA/
afc/datafile,
+DATA/standby/te
mpfile,
+DATA/afc/tempfile
SQL> show parameter log_archive_dest_1;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_file_name_convert string
+DATA/standby/onlinelog, +DATA
/afc/onlinelog
SQL> show parameter LOG_ARCHIVE_DEST_2;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_1 string
LOCATION=+DATA/AFC/ARCH valid_
for=(ALL_LOGFILES,ALL_ROLES) D
B_UNIQUE_NAME=afc
log_archive_dest_10 string
SQL> show parameter LOG_ARCHIVE_DEST_STATE_1;
53
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_2 string SERVICE=standby LGWR
ASYNC val
id_for=(ONLINE_LOGFILES,PRIMAR
Y_ROLE)
DB_UNIQUE_NAME=standby
SQL> show parameter LOG_ARCHIVE_DEST_STATE_2;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
SQL> show parameter REMOTE_LOGIN_PASSWORDFILE;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_state_2 string enable
SQL> show parameter FAL_SERVER;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
remote_login_passwordfile string EXCLUSIVE
SQL> show parameter FAL_CLIENT;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
fal_server string STANDBY
SQL> show parameter STANDBY_FILE_MANAGEMENT;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
fal_client string AFC
standby>
standby> show parameter db_unique_name;
54
show parameter log_archive_config;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
db_unique_name string standby
SQL>
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_config string dg_config=
(afc,standby)
SQL> show parameter db_file_name_convert;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
db_file_name_convert string +DATA/afc/datafile,
+DATA/stan
dby/datafile,
+DATA/afc/tempfi
le,
+DATA/standby/tempfile
SQL> show parameter log_file_name_convert;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_file_name_convert string +DATA/afc/onlinelog,
+DATA/sta
ndby/onlinelog
SQL> show parameter log_archive_dest_1;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_1 string
LOCATION=+DATA/STANDBY/ARCH va
lid_for=(ALL_LOGFILES,ALL_ROLE
S)
DB_UNIQUE_NAME=standby
log_archive_dest_10 string
SQL> show parameter LOG_ARCHIVE_DEST_2;
55
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_2 string SERVICE=afc LGWR
ASYNC valid_f
or=(ONLINE_LOGFILES,PRIMARY_RO
LE)
DB_UNIQUE_NAME=afc
SQL> show parameter LOG_ARCHIVE_DEST_STATE_1;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_state_1 string ENABLE
log_archive_dest_state_10 string enable
SQL> show parameter LOG_ARCHIVE_DEST_STATE_2;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
log_archive_dest_state_2 string ENABLE
SQL> show parameter REMOTE_LOGIN_PASSWORDFILE;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
remote_login_passwordfile string EXCLUSIVE
SQL> show parameter FAL_SERVER;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
fal_server string afc
SQL> show parameter FAL_CLIENT;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
fal_client string standby
SQL> show parameter STANDBY_FILE_MANAGEMENT;
NAME TYPE VALUE
56
------------------------------------ -----------
------------------------------
standby_file_management string AUTO
SQL>
3.7.5 打开逻辑 standby
由于逻辑standby 与primary 数据库事务并不一致,因此第一次打开时必须指定
resetlogs 选择,如下:
standby> alter database open resetlogs;
数据库已更改。
然后执行下列sql 命令应用redo 数据:
standby> alter database start logical standby apply immediate;
数据库已更改。
3.7.6 检查一下同步效果
首先在primary 数据库插入删除操作,然后看备库是否同步进行更新,由于我们
AFC系统是通过通信程序传输交易数据,可提前将通信程序停掉,在此要验证同
步效果的时候再打开,在现场的情况发现是基本能实时同步,延时在一分钟以内
下面简单举个例子
primary> select * from jss.b;
ID
----------
1
2
3
已选择3 行。
primary> insert into jss.b values (4);
已创建1 行。
primary>insert into b values (5);
已创建1 行。
primary> insert into b values (6);
已创建1 行。
primary> commit;
提交完成。
primary> alter system switch logfile;(如果备库上未看到刚插入的数据,
可考虑执行该步切换日志文件)
系统已更改。
查询逻辑standby 的同步情况 (此时备库应处于open状态)
57
standby>select * from jss.b;
ID
----------
1
2
3
4
5
6
已选择6 行。
提示:细心观察,发现逻辑standby 有一点很好,从primary 接收到的redo 文
件,应用过之后会自动删除,节省磁盘空间。
Ok,逻辑standby 也创建完成了。
4 DATA GUARD 的日常维护
4.1 开启和关闭顺序
启动的时候,先备库的 listener,再启动备库,再启动主库的 listener,再启动主
库。
关闭的时候,先关闭主库,再关闭备库。
4.2 DATA GUARD 启用模式切换(物理 standby)
物理 Standby 在使用时有两种模式,一是 recover managed 模式,此时会处于日
志接受阶段,但用户无法进行数据库访问;二是只读模式,用可以查看数据,但
日志接收会终止,直到下次模式切换回去。
启动到 recover managed 模式
sqlplus / as sysdba
SQL>shutdown immediate;
58
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect from
session;
启动到 read only 模式
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database open read only;
如果在管理恢复模式下到只读模式
SQL>recover managed standby database cancel;
SQL>alter database open read only;
这个时候,可以给数据库增加临时数据文件(这个在热备份的时候是没有备份过
来的)

alter tablespace temp add tempfile ‘/u01/oradata/temp01.dbf’ size
100M;
从只读方式到管理恢复方式
SQL>recover managed standby database disconnect from session;
4.3 Primary 和 Standby 的角色转换(物理 standby)
注意两点:
(1),当 RAC 变成备库时,只能运行一个数据库实例,另外一个实例必须停止,建
议是开启数据库后 shutdown immediate 其中一个实例;而不推荐只开启一个数
据库节点,容易导致 RAC 出现其中一个节点反复重启,最后 RAC 环境宕掉。
(2)角色切换的顺序:只能是先从 Primary 切到 Standby,再从 Standby 切到
Primary.
59
在主库端
(1)在 RAC1 上检查当前库的角色状态;
sqlplus / as sysdba
SQL>select database_role,switchover_status from v$database;
(2)在 RAC2 上关闭节点的数据库实例 afc1
sqlplus / as sysdba
SQL>shutdown immediate
SQL>exit
(3)在 RAC2 上检查 RAC service 运行状态
[oracle@afc2 ~]$ crs_stat -t
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....c1.inst application ONLINE ONLINE cdlcdb01
ora....c2.inst application ONLINE ONLINE cdlcdb02
ora.afc.db application ONLINE ONLINE cdlcdb02
ora....SM1.asm application ONLINE ONLINE cdlcdb01
ora....01.lsnr application ONLINE ONLINE cdlcdb01
ora....b01.gsd application ONLINE ONLINE cdlcdb01
ora....b01.ons application ONLINE ONLINE cdlcdb01
ora....b01.vip application ONLINE ONLINE cdlcdb01
60
ora....SM2.asm application ONLINE ONLINE cdlcdb02
ora....02.lsnr application ONLINE ONLINE cdlcdb02
ora....b02.gsd application ONLINE ONLINE cdlcdb02
ora....b02.ons application ONLINE ONLINE cdlcdb02
ora....b02.vip application ONLINE ONLINE cdlcdb02
(4)在主库上,确定只有一个数据库实例 afc1 在运行,在 RAC1 上将主库切换成
备库
在 RAC1 上切换到备库
sqlplus / as sysdba
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION
SHUTDOWN;
在 RAC1 上启动到 recover managed 模式
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect from
session;
查看切换后的状态
SQL>select DATABASE_ROLE,open_mode from v$database;
(5)在备库对角色进行切换
sqlplus / as sysdba
SQL>ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
61
SQL>shutdown immediate;
SQL>startup;
检查切换后的结果
SQL>select database_role,switchover_status from v$database;
(6)在新的主库进行日志归档
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
(7)在新的备库查看日志接收情况
SQL>SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY
SEQUENCE#;
3.4 在主备库可以通过以下一些方式查看,进行 trouble-shooting
SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS;
SQL> select distinct thread#,max(sequence#) over(partition by thread#
) a from v$archived_log;
SQL> select process,status,pid,client_process,client_pid from
v$managed_standby;
4.4 Primary 和 Standby 的角色转换(逻辑 standby)
4.4.1 检查 primary 数据库状态
在当前的primary 数据库查询v$database 视图中的switchover_status
列,查看当前primary 数据库状态。
62
primary> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
如果该查询返回TO STANDBY 或SESSIONS ACTIVE 则表示状态正常,可以执
行转换操作,如果否的话,
就需要你先检查一下当前的dataguard 配置,看看是否正确。
4.4.2 准备转换 primary 为逻辑 standby
执行下列语句,将primary 置为准备转换的状态:
primary> alter database prepare to switchover to logical standby;
数据库已更改。
查看一下switchover_status 的状态,哟,果然变成准备ing 啦~~
primary> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
PREPARING SWITCHOVER
4.4.3 准备转换逻辑 standby 为 primary
我们一定要学习oracle 这种逻辑,甭管想做什么,都得先有个准备的过程~
standby> alter database prepare to switchover to primary;
数据库已更改。
standby> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
PREPARING SWITCHOVER
4.4.4 再次检查 primary 数据库状态
primary > select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO LOGICAL STANDBY
63
注意:这步虽然不做什么操作,但检查结果却非常重要,它直接关系到
switchover 转换是否能够成功。逻辑standby 执行完prepare 命令之后,就会
生成相应的LogMiner 字典数据(就像我们前面创建逻辑standby 时,primary 会
生成LogMiner 字典数据一样),只有它正常生成并发送至当前的primary,转换
操作才能够继续下去。不然当前的primary 数据库在转换完之后,可能就失去了
从新的primary 接收redo 数据的能力了。
因此,如果上述查询的返回结果不是:TO LOGICAL STANDBY 的话,你可能
就需要取消此次转换,检查原因,然后再重新操作了。
提示:
取消转换可以通过下列语句:
ALTERDATABASEPREPARETOSWITCHOVERCANCEL;
需要分别在primary 和逻辑standby 执行。
4.4.5 转换 primary 为逻辑 standby
执行下列语句:
primary > alter database commit to switchover to logical standby;
数据库已更改。
该语句需要等待当前primary 所有事务全部结束。同时该语句也会自动拒绝
用户发布的新事务或修改需求。为确保该操作尽可能快的执行,最好自开始切换
操作起就禁止所有用户的操作。该命令执行完之后,这个primary 就已经成为新
的逻辑standby 了。不过在新primary 执行完转换之前,不要关闭当前这个数据
库。
4.4.6 再次检查逻辑 standby 状态
逻辑standby 在接收到前primary 的转换消息,并应用完相关的redo 数据
之后,会自动暂停sql 应用,然后查询switchover_status 的状态,应该为:TO
PRIMARY
standby> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
4.4.7 转换逻辑 standby 为 primary
最后的工作总会在逻辑standby 上操作,通过上列语句,将该逻辑standby
64
转换为新的primary。
standby > alter database commit to switchover to primary;
数据库已更改。
转换完成
4.4.8 启动新逻辑 standby 的 sql 应用
最后启动新逻辑standby 的sql 应用。
primary > alter database start logical standby apply;
数据库已更改。
5 定时自动清理备库归档日志
由于备库未配置磁带库,所以如果不对归档日志进行删除的话很容易造成硬盘空间存储
问题。如果用操作系统命令直接删除归档日志又怕归档日志没应用完,所以写 rman 脚本自
动对归档日志进行清理,用 rman 备份归档日志后再把备份集从操作系统层删除,以此来解
决此问题。
5.1 定时备份归档日志到本地文件系统后删除归档日志
Arch_del.sh 脚本内容
D=$(date +"%Y%m%d_%H%M")
rman target / nocatalog cmdfile=/delarch/arch_del.rcv msglog=/delarch/log/del_arc.$D.log
arch_del.rcv 脚本内容
run {
allocate channel d1 type disk;
crosscheck archivelog all;
delete noprompt expired archivelog all;
sql 'alter system archive log current';
backup format '/archbak/%d_log_%T_%s_%p_%u.arc' archivelog all delete all input;
release channel d1;
}
crontab -e
按 i 之后把下面两行复制进去
0 6 * * * su - oracle -c /delarch/arch_del.sh
0 14 * * * su - oracle -c /delarch/arch_del.sh
65
5.2 定时删除归档日志备份集文件
Del_arch.sh 脚本内容
rm /archbak/*.arc
crontab -e
按 i 之后把下面两行复制进去
0 19 * * * su - oracle -c /delarch/del_archbak.sh
6 问题记录
6.1 逻辑 standby 不自动删除已应用的主库归档日志
博客中有记载,这个问题困扰了我很久,最后原因居然是我把一个默认参数给改了,但我却
没一点印象,没有怀疑到这上来
http://www.aixchina.net/home/space.php?uid=20260&do=blog&id=24797]http://www.aixchina.net/home/space.php?uid=20260&do=blog&id=24797
今天终于解决了一个 dataguard 困扰了我半年的问题,其实算不上解决问题,原因只是
因为我将一个默认参数进行了修改导致,但到底困扰了我这么久,还是记录一下。
这是我的第一个实施的 dataguard 项目,主库环境为 oracle 10g rac +asm,备库是 oracle
asm 单实例,因为备库的容量只有主库的一半大,所以做的是逻辑 standby。数据同步一直
都正常,但一直有个问题没解决,那就是备库归档日志增长过快,导致备库容量紧张,只能
手工去删除归档日志的问题。
生产库备置了磁带库使用了 tsm 进行数据库备份,备份后自动清除归档日志。备库则未
配置磁带库和 tsm 软件,于是我自己写了个脚本定时执行来进行归档日志备份后清除归档日
志,另外再写了个脚本定期清理已备份的归档日志备份集。从 rman 日志中看备份一切正常,
已删除了相应的归档日志文件。但从 asm 磁盘中看仍有大量的归档日志文件未删除,rman
怎么会不清这些归档日志呢?真是百思不得其解,在论坛上求助也无果。
因为这个项目是外省的一个项目,平时我都是通过远程桌面连接过去进行的分析,公司
的网速是挺慢的,每次操作都卡得要死,所以都没有太深入进行检查分析。昨天晚上在外工
作到到 4 点才回家睡觉,于是今天下午决定在家决定联系用户好好对此问题进行详细分析,
希望能彻底解决问题。果然家里 4M 独立带宽很给力,远程过去一点都不卡,这似乎预示着
今天一定能解决问题。
仔细看了一下昨天的 rman 备份日志,然后又用 asmcmd 命令到 asm 磁盘组查看归档日
志文件发现备份日志中记录已删除的归档日志果然在 asm 磁盘中找不到,看来 rman 命令确
实是生效了,删除了相应的归档日志。我注意到已删除的归档日志和未删除的归档日志文件
命名有很大的不一样,难道这些没有删除的归档日志是从主库接收过来的?所以才不能被
66
rman 所删除?带着这个疑问,马上用 asmcmd 访问了主库的 asm 磁盘中的归档日志文件,
果然备库中未删除的归档日志文件就来自于主库。原来之前我不可理解的备库归档日志增长
过快原因就在于此,因为所有的主库归档日志都存在于备库,又没进行过删除,不大才怪。
原因是找到了,那就好好想想该怎么解决吧。
记得看了好几个文档都说逻辑 standby在应用完主库归档日志后会自动把接收过来的归
档日志文件删除掉,而且我后来也实施了好几个 dataguard 灾备项目,结果也证实确实是逻
辑 standby在应用完主库归档日志后会自动把接收过来的归档日志文件删除掉。有一个参数
LOG_AUTO_DELETE 可以使应用完主库归档日志后不删除已应用的归档日志,但这个参数
默认为 true,我也没改过这个参数呀?但结合现在的实际情况来看很像是这个参数被改了。
最初的想法是先把这个参数改为 true 看看是什么效果,看能不能解决问题。于是按着
文档上的执行 EXECUTE DBMS_LOGSTDBY.APPLY_SET('LOG_AUTO_DELETE', TRUE);
居然出错了,大意是说参数个数或类型为匹配之类的,改为
EXECUTE DBMS_LOGSTDBY.APPLY_SET('LOG_AUTO_DELETE', 'TRUE');后执行成功。
立马进行试验
1、在主库强制进行归档,查看归档后的归档日志文件名
2、在备库查看这个归档日志是否被应用,结果是已经被应用了
3、查看备库 asm 磁盘的归档日志文件中是否还存在这个从主库接收过来的归档日志文
件,结果是还存在
经过实验,有一点点小失望,好不容易感觉到希望感觉好像希望又要破灭了,这时突然
想起要来查查 LOG_AUTO_DELETE 参数的值,经过查询终于知道了如何查看
看来参数已经失效了,遗憾的是在改这个参数前忘记了先查看这个参数的值,如果之前是
FALSE,现在是 TRUE 那就好定位了。可不管先前是什么,我现在已经改成了 TRUE,但感
觉也还没效,这又是怎么回事呢?
又是一番网上查询,未找到相关资料,这时无意在备库的 asm 磁盘中查询了一下今天
的归档日志文件,竟然有了意外发现
67
那些从主库接收过来的归档日志几乎全部没有了,难道开始是我太心急?再回到上级目
录,发现除了 2011_03_22 目录外,其它目录居然都不见了,再查看 asm 磁盘空间,居然空
出了大把空间。看来果真是那个参数的问题。
问题是解决了,原因是 LOG_AUTO_DELETE 参数之前被改为了 FALSE,但除了我不
会有人会来进行这个操作才对,看来很有可能是当时为了研究 dataguard 时不小心改了这个
参数而未改回来。不管怎么样,问题解决了总是开心的,马上把结果告诉给用户,用户也是
比较高兴,因为之前都老要他人工去进行删除归档日志文件,据然说过年期间他不放心还跑
到单位去清了一次归档日志,也真是不容易。
7 附录
7.1 主库 pfile 文件
afc2.__db_cache_size=671088640
afc1.__db_cache_size=637534208
afc1.__java_pool_size=16777216
68
afc2.__java_pool_size=16777216
afc1.__large_pool_size=16777216
afc2.__large_pool_size=16777216
afc2.__shared_pool_size=889192448
afc1.__shared_pool_size=922746880
afc1.__streams_pool_size=0
afc2.__streams_pool_size=0
*.audit_file_dest='/oracle/admin/afc/adump'
*.background_dump_dest='/oracle/admin/afc/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.3.0'
*.control_files='+DATA/afc/controlfile/current.281.717886343'
*.core_dump_dest='/oracle/admin/afc/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='+DATA/standby/datafile','+DATA/afc/datafile','+DATA/standby/tempfil
e','+DATA/afc/tempfile'
*.db_name='afc'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=afcXDB)'
*.fal_client='AFC'
*.fal_server='STANDBY'
afc1.instance_number=1
afc2.instance_number=2
*.job_queue_processes=10
*.log_archive_config='dg_config= (afc,standby)'
*.log_archive_dest_1='LOCATION=+DATA/AFC/ARCH
valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=afc'
*.log_archive_dest_2='SERVICE=standby
LGWR
ASYNC
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
*.log_archive_format='%t_%s_%r.dbf'
*.log_file_name_convert='+DATA/standby/onlinelog','+DATA/afc/onlinelog'
*.open_cursors=300
*.pga_aggregate_target=1147142144
*.processes=1500
*.remote_listener='LISTENERS_AFC'
*.remote_login_passwordfile='exclusive'
*.sessions=1655
*.sga_target=1610612736
*.standby_file_management='AUTO'
afc2.thread=2
afc1.thread=1
69
*.undo_management='AUTO'
afc1.undo_tablespace='UNDOTBS1'
afc2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/oracle/admin/afc/udump'
7.2 备库 pfile 文件
*.__db_cache_size=419430400
standby.__db_cache_size=637534208
*.__java_pool_size=16777216
standby.__java_pool_size=16777216
*.__large_pool_size=16777216
standby.__large_pool_size=16777216
*.__shared_pool_size=1140850688
standby.__shared_pool_size=922746880
*.__streams_pool_size=0
standby.__streams_pool_size=0
*.audit_file_dest='/oracle/admin/standby/adump'
*.background_dump_dest='/oracle/admin/standby/bdump'
*.compatible='10.2.0.3.0'
*.control_files='+DATA/standby/controlfile/current.524.729903425'#Restore Controlfile
*.core_dump_dest='/oracle/admin/standby/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='+DATA/afc/datafile','+DATA/standby/datafile','+DATA/afc/tempfile','+
DATA/standby/tempfile'
*.db_name='STANDBY'#db_name
*.db_unique_name='standby'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=standbyXDB)'
*.FAL_CLIENT='standby'
*.FAL_SERVER='afc'
*.job_queue_processes=10
*.log_archive_config='dg_config= (afc,standby)'
*.log_archive_dest_1='LOCATION=+DATA/STANDBY/ARCH
valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.log_archive_dest_2='SERVICE=afc
LGWR
ASYNC
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=afc'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_file_name_convert='+DATA/afc/onlinelog','+DATA/standby/onlinelog'
*.open_cursors=300
*.pga_aggregate_target=1147142144
70
*.processes=1500
*.REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
*.sessions=1655
*.sga_target=1610612736
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/admin/standby/udump'

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】