配置11Gr2 physical dataguard,11203 RAC 到single instance
11G DATA Guard在新特性physical standby可以在apply log时,open read only,并且可以real-time apply,这样standby db 也就告别了用户老觉的机器闲置,
丢掉了在发生故障时才见其价值的歧视。
standby db在高可用中不但可以用来做灾备,还可以平时用来测试、做报表统计,及logical standby的Rolling upgrade
下面配置一种DATA Guard,primary db是3nodes 11203 RAC,physical standby是11203 的single instance,Primary db有用到ASM存储文件,
Single instance只用local filesystem
primary database server:
[grid@test183 ~]$ olsnodes
test183
test184
test185
[oracle@test183 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 14 00:25:06 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> connect /as sysDBA
Connected.
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 3
cluster_interconnects string
SQL> select group#,thread#,sequence#,bytes,blocksize,members from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS
---------- ---------- ---------- ---------- ---------- ----------
1 1 107 52428800 512 2
2 1 108 52428800 512 2
3 2 59 52428800 512 2
4 2 60 52428800 512 2
5 3 73 52428800 512 2
6 3 74 52428800 512 2
sys@RAC>select member,group# from v$logfile order by 2;
MEMBER GROUP#
------------------------------------------------------------ ----------
+FLRV/rac/onlinelog/group_1.260.790169423 1
+DBDG/rac/onlinelog/group_1.262.790169417 1
+FLRV/rac/onlinelog/group_2.259.790169425 2
+DBDG/rac/onlinelog/group_2.261.790169423 2
+DBDG/rac/onlinelog/group_3.258.790169683 3
+FLRV/rac/onlinelog/group_3.258.790169685 3
+DBDG/rac/onlinelog/group_4.257.790169685 4
+FLRV/rac/onlinelog/group_4.257.790169689 4
8 rows selected.
SQL> l
1* select name from v$datafile
SQL> /
NAME
------------------------------------------------------------------------------------------------------------------------
+DATA/orcc/datafile/system.256.835435369
+DATA/orcc/datafile/sysaux.257.835435373
+DATA/orcc/datafile/undotbs1.258.835435373
+DATA/orcc/datafile/users.259.835435373
+DATA/orcc/datafile/example.264.835435689
+DATA/orcc/datafile/undotbs2.265.835436097
+DATA/orcc/datafile/undotbs3.269.835520945
7 rows selected.
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string +DATA1/stbydb, +DATA/orcc
db_name string orcc
db_unique_name string orcc
global_names boolean FALSE
instance_name string orcc1
lock_name_space string
log_file_name_convert string +ARCH1/stbydb, +ARCH/orcc, +DATA1/stbydb, +DATA/orcc
processor_group_name string
service_names string orcc
NOTE:
每个THREAD 两组日志,每组日志两个成员分别在+DBDG,+FLRV
standby database server:
SQL> select * from v$version where rownum=1;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
cluster_interconnects string
NOTE:
Standby db版本与primary db相同,但是一个单实例
确保实例使用spfile启动,
####在primary db为了直观增加一个service name,不是必须的,修改service_names 参数,默认是db_unique_name + [.db_domain],这是一个动态参数不需要重启实例,
可以通过,未执行
system set也可以通过srvctl add service增加,pmon process会自动注册到listener上。
sys@RAC>show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string rac.anbob.com
sys@RAC>alter system set service_names='rac.anbob.com','prmrdb';
sys@RAC>show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string rac.anbob.com, prmrdb
下面正式开始DATA GUARD配置
1.physical standby安装oracle software . 另外创建db所需要的目录机构如adump,oradata,这里我们用OMF结构也就是ORACLE管理方式
[oracle@test188 ~]$ export ORACLE_SID=stdby
[oracle@test188 ~]$ echo $ORACLE_SID
stdby
[oracle@test188 ~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@test188 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@test188 ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/{a,dp}dump
[oracle@test188 ~]$ mkdir -p $ORACLE_BASE/fast_recovery_area/$ORACLE_SID/onlinelog
[oracle@test188 ~]$ mkdir -p $ORACLE_BASE/oradata/$ORACLE_SID/datafile
[oracle@test188 ~]$ mkdir -p $ORACLE_BASE/oradata/$ORACLE_SID/tempfile
[oracle@test188 ~]$ mkdir -p $ORACLE_BASE/oradata/$ORACLE_SID/controlfile
[oracle@test188 ~]$ mkdir -p $ORACLE_BASE/oradata/$ORACLE_SID/onlinelog
2. 在standby db配置tnsnames.ora记录,这里我用的是SCAN 地址,也就是可以连接任何节点
ORCC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan-dgh)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcc)
)
)
3. 增加一个静态监听,在 physical standby db
[grid@test188 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = stbydb)
(ORACLE_HOME = /u01/app/11.2.0/grid)
(SID_NAME = stbydb)
)
(SID_DESC =
(GLOBAL_DBNAME = stdby)
(ORACLE_HOME = /u01/app/11.2.0/grid)
(SID_NAME = stdby)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test188)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/grid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
lnsrctl reload
[grid@test188 admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-DEC-2015 01:24:11
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test188)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 14-DEC-2015 00:57:39
Uptime 0 days 0 hr. 26 min. 37 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/test188/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test188)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "stbydb" has 2 instance(s).
Instance "stbydb", status UNKNOWN, has 1 handler(s) for this service...
Instance "stbydb", status READY, has 2 handler(s) for this service...
Service "stdby" has 1 instance(s).
Instance "stdby", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
4. 在RAC的每个节点增加TNSNAMES.ORA记录,在primary db
[oracle@test183 admin]$ vi tnsnames.ora
[oracle@test183 admin]$ cat tnsnames.ora
# tnsnames.ora.test183 Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora.test183
# Generated by Oracle configuration tools.
ORCC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan-dgh)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcc)
)
)
STBYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test188)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stbydb)
)
)
stdbytns =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test188)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stdby)
)
)
[oracle@test183 admin]$ scp tnsnames.ora test184:`pwd`
tnsnames.ora 100% 667 0.7KB/s 00:00
[oracle@test183 admin]$ scp tnsnames.ora test185:`pwd`
tnsnames.ora 100% 667 0.7KB/s 00:00
5. 启动force logging 在 primary DB
sys@RAC>select force_logging from v$database;
FOR
---
NO
sys@RAC>alter database force logging;
sys@RAC>select force_logging from v$database;
FOR
---
YES
6,对于网络认证我这里没有用SSL,而是PASSWORD文件,复制password文件从primary db到standby host's ORACLE_HOME/dbs,并重命名为standby instance
[oracle@test188 ~]$ export ORACLE_SID=stdby
[oracle@test188 ~]$ cd $ORACLE_HOME/dbs
[oracle@test188 dbs]$ ls -ltr
total 44
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r----- 1 oracle oinstall 4608 Oct 8 11:10 initorcc.ora.bak
-rw-rw---- 1 oracle oinstall 1544 Oct 8 11:21 hc_orcc.dat
-rw-r----- 1 oracle oinstall 24 Oct 8 11:24 lkORCC
-rw-rw---- 1 oracle oinstall 1544 Dec 11 09:12 hc_stbydb.dat
-rw-r--r-- 1 oracle oinstall 1515 Dec 11 09:53 initstbydb.ora
-rw-r----- 1 oracle asmadmin 24 Dec 11 10:33 lkSTBYDB
-rw-r----- 1 oracle oinstall 2048 Dec 11 10:57 orapwstbydb
-rw-r----- 1 oracle asmadmin 4608 Dec 14 01:06 spfilestbydb.ora
[oracle@test188 dbs]$ cp orapwstbydb orapwstdby
7.修改 data guard 参数 to primary. 包括DG配置和 redo传输参数如SYNC,ASYNC, AFFIRM, NOAFFIRM, archive log , datafile/logfile 文件名转换
SQL> show parameter log_archive_config
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_config string dg_config=(orcc,stbydb)
SQL> alter system set log_archive_config='dg_config=(rac,stbydb,stdby)' scope=both ;
System altered.
SQL> show parameter log_archive_config
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_config string dg_config=(rac,stbydb,stdby)
tip:
DG_CONFIG list that includes the DB_UNIQUE_NAME of the primary database and each standby database
sys@RAC>alter system set log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=rac' scope=both;
System altered.
sys@RAC>alter system set log_archive_dest_4='service=STDBYTNS LGWR ASYNC NOAFFIRM max_failure=10 max_connections=5 reopen=180 valid_for=(online_logfiles,primary_role) db_unique_name=stdby' scope=both;
System altered.
sys@RAC>alter system set log_archive_dest_state_1='enable' scope=both;
sys@RAC>alter system set log_archive_dest_state_4='enable' scope=both;
SQL> show parameter fal_server
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
fal_server string stbydb
SQL> alter system set fal_server='STDBYTNS,STBYDB' scope=both;
System altered.
SQL> SHOW PARAMETER FAL_SERVER
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
fal_server string STDBYTNS,STBYDB
sys@RAC>alter system set log_archive_max_processes=10 scope=both;
SQL> show parameter db_file_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string +DATA1/stbydb, +DATA/orcc
SQL> show parameter log_file_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_file_name_convert string +ARCH1/stbydb, +ARCH/orcc, +DATA1/stbydb, +DATA/orcc
alter system set db_file_name_convert='+DATA1/stbydb','+DATA/orcc','/u01/app/oracle/oradata/stdby/','+DATA/orcc' scope=spfile;
alter system set log_file_name_convert='/u01/app/oracle/fast_recovery_area/stdby','+ARCH/orcc','/u01/app/oracle/fast_recovery_area/stdby','+DATA/orcc','+ARCH1/stbydb','+ARCH/orcc','+DATA1/stbydb','+DATA/orcc' scope=spfile;
sys@RAC>alter system set standby_file_management='AUTO' scope=both;
8,启用primary库rac 到archivelog mode
[oracle@znode1 oracle]$ srvctl stop database -d rac
[oracle@znode1 oracle]$ srvctl start database -d rac -o mount
idle>archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 72
Current log sequence 73
idle>alter database archivelog;
Database altered.
idle>archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 72
Next log sequence to archive 73
Current log sequence 73
9,在standby database 创建初始化参数,只写db_name
[oracle@dbserver1 dbs]$ vi initstdby.ora
*.db_name='stdby'
10,standby database 启动到nomount状态
[oracle@dbserver1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Aug 8 17:59:06 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
idle>startup nomount
ORACLE instance started.
Total System Global Area 167395328 bytes
Fixed Size 1343640 bytes
Variable Size 113250152 bytes
Database Buffers 50331648 bytes
Redo Buffers 2469888 bytes
idle>
11,用11g的新特性rman active duplicate 还原主库到备库,在primary host
[oracle@znode1 oracle]$ rman target / auxiliary sys/oracle@stdbytns
rman>
duplicate target database for standby from active database
spfile
set db_unique_name='stdby'
set db_file_name_convert='+DATA/orcc','/u01/app/oracle/oradata/stdby','+DATA/orcc/tempfile','/u01/app/oracle/oradata/stdby'
set log_file_name_convert='+ARCH/orcc','/u01/app/oracle/fast_recovery_area/stdby','+DATA/orcc','/u01/app/oracle/oradata/stdby'
set control_files='/u01/app/oracle/oradata/stdby/controlfile/control01.ctl'
set log_archive_max_processes='5'
set LOG_ARCHIVE_FORMAT='log%t_%s_%r.arc'
set REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
set fal_server='orcc'
SET cluster_database='false'
set db_create_file_dest = '/u01/app/oracle/oradata/stdby'
set db_recovery_file_dest = '/u01/app/oracle/fast_recovery_area'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(orcc,stbydb,stdby)'
set log_archive_dest_2='service=PRIMARYTNS LGWR ASYNC NOAFFIRM max_failure=10 max_connections=5 reopen=180 valid_for=(online_logfiles,primary_role) db_unique_name=orcc'
set log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=stdby'
set audit_file_dest = '/u01/app/oracle/admin/stdby/adump'
set diagnostic_dest= '/u01/app/oracle'
reset REMOTE_LISTENER
reset local_listener;
TIP:
保证以下参数指定目录在备库存在audit_file_dest,control_files,如果没有audit_file_dest目录,备库会启动后无法登录遇ORA-09925 错误,解决方法是如下
[root@dbserver1 ~]# ps -ef|grep ora_|grep -v grep|awk '{print $2}'|xargs kill -9
[oracle@dbserver1 dbs]$ rm -rf /dev/shm/ora_stdby*
如果上面失败第二次duplicate会遇RMAN-05537,解决方法是shutdown abort standby db,rm spfile,startup nomount with pfile,re-run rman dumplicate on primary db
12,修改standby database spfile 记录,把primary instance记录删除,重建Standby spfile
sys@RAC>create pfile from spfile;
File created.
[oracle@dbserver1 dbs]$ vi initstdby.ora
[oracle@test188 dbs]$ cat initstdby.ora
*.db_cache_size=369098752
*.java_pool_size=16777216
*.java_pool_size=16777216
stdby.__large_pool_size=16777216
stdby.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
stdby.__pga_aggregate_target=503316480
stdby.__sga_target=754974720
stdby.__shared_io_pool_size=0
stdby.__shared_pool_size=201326592
stdby.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/stdby/adump'
*.audit_trail='db'
*.cluster_database=FALSE
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/stdby/controlfile/control01.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata/stdby'
*.db_domain=''
*.db_file_name_convert='+DATA/orcc','/u01/app/oracle/oradata/stdby','+DATA/orcc/tempfile','/u01/app/oracle/oradata/stdby'
*.db_name='orcc'
*.db_recovery_file_dest_size=4558159872
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_unique_name='stdby'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orccXDB)'
orcc1.fal_client='orcc1'
orcc2.fal_client='orcc2'
orcc3.fal_client='orcc3'
*.fal_server='orcc'
orcc1.instance_number=1
orcc2.instance_number=2
orcc3.instance_number=3
*.log_archive_config='dg_config=(orcc,stbydb,stdby)'
*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=stdby'
*.log_archive_dest_2='service=PRIMARYTNS LGWR ASYNC NOAFFIRM max_failure=10 max_connections=5 reopen=180 valid_for=(online_logfiles,primary_role) db_unique_name=orcc'
*.log_archive_dest_3='LOCATION=+DATA/orcc/STANDBYLOG VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=orcc'
*.log_archive_dest_4='service=STDBYTNS LGWR ASYNC NOAFFIRM max_failure=10 max_connections=5 reopen=180 valid_for=(online_logfiles,primary_role) db_unique_name=stdby'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_dest_state_3='enable'
*.log_archive_dest_state_4='enable'
*.log_archive_format='log%t_%s_%r.arc'
*.log_archive_max_processes=5
*.log_archive_min_succeed_dest=2
*.log_file_name_convert='+ARCH/orcc','/u01/app/oracle/fast_recovery_area/stdby','+DATA/orcc','/u01/app/oracle/oradata/stdby'
*.memory_target=1244659712
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sec_case_sensitive_logon=FALSE
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
note:
删除rac1和rac2开头的实例参数,可以按需要修改要修改的参数,因为从primary db传过来两个undo TBS(每个实例一个),需在standby db指定undo表空间*.undo_tablespace='UNDOTBS1',重建spfile
SQL> connect /as sysdba
Connected.
SQL> create spfile from pfile;
create spfile from pfile
*
ERROR at line 1:
ORA-32002: cannot create SPFILE already being used by the instance
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile;
File created.
sql>startup force
13,在standby db增加standby 日志 做real-time apply,standby log 每个thread 日志组比online log 组数多一个,standby日志大小与online redo相同
primary db:
sys@RAC>select group#,thread#,bytes,members from v$log;
GROUP# THREAD# BYTES MEMBERS
---------- ---------- ---------- ----------
1 1 52428800 2
2 1 52428800 2
3 2 52428800 2
4 2 52428800 2
standby db:
alter database add standby logfile size 52428800;
增加6组(number of group per thread +1)* number of thread
14,修改standby database 到archive log mode
15,Starting Redo Apply on the physical standby database
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
USING CURRENT LOGFILE 表示接受到redo log立及应用,启用real-time apply
DISCONNECT 表示后台进程应用
有时因为primary db log_archive_dest_2 值 service=STDBYTNS LGWR ASYNC NOAFFIRM,不能保证适时传输时,需要alter system archive log current
或alter system switch logfile切日志查看
同步数据是否成功,当然也可以改log_archive_dest_2 的值。
验证日志传输与应用
SELECT RESETLOGS_ID,THREAD#,SEQUENCE#,STATUS,ARCHIVED FROM V$ARCHIVED_LOG
sys@RAC>SELECT RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS WHERE DEST_ID=2;
RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY
SQL>SELECT MESSAGE FROM V$DATAGUARD_STATUS;
...
LNS: Beginning to archive log 1 thread 1 sequence 117
ARCH: Completed archiving thread 1 sequence 116 (6010717-6011086)
LNS: Completed archiving log 1 thread 1 sequence 117
ARCH: Beginning to archive thread 1 sequence 117 (6011086-6011618)
LNS: Standby redo logfile selected for thread 1 sequence 118 for destination LOG_ARCHIVE_DEST_2
LNS: Beginning to archive log 2 thread 1 sequence 118
ARCH: Completed archiving thread 1 sequence 117 (6011086-6011618)
sys@RAC>SELECT name, value, datum_time, time_computed FROM V$DATAGUARD_STATS;
NAME VALUE DATUM_TIME TIME_COMPUTED
-------------------------------- ------------------------------ ------------------------------ ------------------------------
transport lag +00 00:00:00 08/13/2012 16:09:02 08/13/2012 16:09:03
apply lag +00 00:00:00 08/13/2012 16:09:02 08/13/2012 16:09:03
apply finish time +00 00:00:00.000 08/13/2012 16:09:03
estimated startup time 20 08/13/2012 16:09:03
The apply lag metric is computed using data that is periodically received from the primary database.
The DATUM_TIME column contains a timestamp of when this data was last
received by the standby database. The TIME_COMPUTED column contains a timestamp taken when the apply lag metric was calculated
sql>SELECT * FROM V$STANDBY_EVENT_HISTOGRAM WHERE NAME = 'apply lag'
sys@RAC>SELECT * FROM V$STANDBY_EVENT_HISTOGRAM WHERE NAME = 'apply lag';
NAME TIME UNIT COUNT LAST_TIME_UPDATED
--------------- ---------- ---------------- ---------- --------------------
apply lag 0 seconds 2402 08/13/2012 16:12:45
apply lag 1 seconds 43 08/13/2012 16:12:40
apply lag 2 seconds 13 08/13/2012 16:02:40
apply lag 3 seconds 13 08/13/2012 16:01:08
apply lag 4 seconds 4 08/13/2012 13:16:47
...
当然可以建一张表来测试同步了,在两个节点上的事务也都可以同步到standby实例上
Stopping Redo Apply
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
问题1:
复制过程中出现
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-00344: unable to re-create online log '/u01/app/oracle/oradata/stdby/onlinelog/group_14.279.898378057'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1
RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-00344: unable to re-create online log '/u01/app/oracle/oradata/stdby/onlinelog/group_15.280.898378071'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1
解决
su - oracle
mkdir -p /u01/app/oracle/oradata/stdby/onlinelog/
问题2:
[oracle@test183 ~]$ rman target / auxiliary sys/oracle@stdbytns
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 14 07:37:36 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCC (DBID=904043557)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-01031: insufficient privileges
[oracle@test183 ~]$ rman target / auxiliary sys/oracle@stdbytns
解决:
由于备库环境中还存在基于ASM 的物理备库,s
关闭ASM物理备库的监听
su - grid
lsnrctl stop
启动基于文件系统的数据库的$ORACLE_HOME/network/admin/listener.ora的监听,注意也要配置静态监听或借助于
netmgr配置
su - oracle
lsnrctl start |
|