集群服务器基本信息(RAC)
集群RAC是已经搭建好了,现在是需要在RAC中添加一台standby备库
服务器版本信息(以12crac1实例为例子)
- [oracle@12crac1 admin]$ lsb_release -a
- LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
- Distributor ID: OracleServer
- Description: Oracle Linux Server release 6.6
- Release: 6.6
- Codename: n/a
集群服务器IP配置新信息
hostname | IP | instance_name | db_name | service_name |
12crac1.emoney.cn | 192.168.8.230 | em12c1 | em12c | em12c |
12crac2.emoney.cn | 192.168.8.231 | em12c2 | em12c | em12c |
12crac3.emoney.cn | 192.168.8.195 | em12c3 | em12c | em12c |
12crac4.emoney.cn | 192.168.8.196 | em12c4 | em12c | em12c |
数据库版本基本信息
- SQL> select * from v$version;
-
- BANNER CON_ID
- -------------------------------------------------------------------------------- ----------
- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0
- PL/SQL Release 12.1.0.2.0 - Production 0
- CORE 12.1.0.2.0 Production 0
- TNS for Linux: Version 12.1.0.2.0 - Production 0
- NLSRTL Version 12.1.0.2.0 - Production 0
数据库的字符集
- SQL> select userenv('language') from dual;
-
- USERENV('LANGUAGE')
- ----------------------------------------------------
- AMERICAN_AMERICA.ZHS16GBK
Standby服务器的配置信息
这里我之前已经在standby上安装好了数据库软件,没有安装数据库
Standby服务器的版本信息
- [root@localhost oracle]# lsb_release -a
- LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
- Distributor ID: OracleServer
- Description: Oracle Linux Server release 6.6
- Release: 6.6
- Codename: n/a
Standby服务器的IP配置信息
hostname | IP | instance_name | db_name | service_name |
12cdg.emoney.cn | 192.168.8.232 | em12cdg | em12c | em12c |
Standby的数据库版本和primary一致
文件hosts的调整(主备)
[oracle@12crac1 dbs]$ more /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# For Public
192.168.8.230 12crac1.emoney.cn 12crac1
192.168.8.231 12crac2.emoney.cn 12crac2
192.168.8.195 12crac3.emoney.cn 12crac3
192.168.8.196 12crac4.emoney.cn 12crac4
# For VIP
192.168.8.234 12crac1-vip.emoney.cn 12crac1-vip
192.168.8.235 12crac2-vip.emoney.cn 12crac2-vip
192.168.8.197 12crac3-vip.emoney.cn 12crac3-vip
192.168.8.198 12crac4-vip.emoney.cn 12crac4-vip
# For Private IP
10.10.10.10 12crac1-priv.emoney.cn 12crac1-priv
10.10.10.11 12crac2-priv.emoney.cn 12crac2-priv
10.10.10.12 12crac3-priv.emoney.cn 12crac3-priv
10.10.10.13 12crac4-priv.emoney.cn 12crac4-priv
# For SCAN IP
# 192.168.8.238 scan.emoney.cn
# 192.168.8.239 scan.emoney.cn
# 192.168.8.240 scan.emoney.cn
# For DNS Server
192.168.3.1 ym.emoney.cn ym
#DataGurad standby
192.168.3.232 12cdg.emoney.cn 12cdg
将primary数据库中RAC的四个节点内容调整和上面一直,standby的hosts文件也要与上面的一致
ORACLE用户的环境变量(主备)
- [oracle@12crac1 app]$ more ~/.bash_profile
- # .bash_profile
-
- # Get the aliases and functions
- if [ -f ~/.bashrc ]; then
- . ~/.bashrc
- fi
-
- # User specific environment and startup programs
-
- PATH=$PATH:$HOME/bin
-
- export PATH
- export TMP=/tmp
- export TMPDIR=$TMP
- export ORACLE_HOSTNAME=12crac1.emoney.cn
- export ORACLE_UNQNAME=em12c1
- export ORACLE_BASE=/u01/app/oracle
- export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
- export ORACLE_SID=em12c1
- export PATH=/usr/sbin:$PATH
- export PATH=$ORACLE_HOME/bin:$PATH
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
- export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
-
- alias sqlplus="rlwrap sqlplus"
- alias rman="rlwrap rman"
确保primary 和 standby(stamdby库将em12c1替换成em12cdg) 数据库环境变量调整如上,除红色部分不一致以外,其他的部分要一致
tnsname.ora文件调整(主备)
- EM12CDG =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.232)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = EM12CDG)
- )
- )
-
- EM12C =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = scan.emoney.cn)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = em12c)
- (failover_mode =
- (type = select)
- (method = basic)
- )
- )
- )
需注意的是,scan.emoney.cn 是DNS上对RAC做的域名,所以只需要连接改域名,即可无缝连接到RAC上。
将RAC的四个节点和备库节点的tnsnames.ora与上面调整成一致,也可以用netmgr命令添加
监听文件listener.ora(Standby)
- SID_LIST_LISTENER =
- (SID_LIST =
- (SID_DESC =
- (GLOBAL_DBNAME = em12cdg)
- (ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
- (SID_NAME = em12cdg)
- )
- )
-
- LISTENER =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.232)(PORT = 1521))
- )
-
- ADR_BASE_LISTENER = /u01/app/oracle
- ADR_BASE_LISTENER = /u01/app/oracle
也可以通过netmgr调整,注意SID_LIST_LISTENER要配置,表示要监听的那个实例
参数文件file的调整
Primary
- [oracle@12crac1 dbs]$ sqlplus / as sysdba
-
- SQL*Plus: Release 12.1.0.2.0 Production on Wed Mar 18 22:55:21 2015
-
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
-
-
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
- Advanced Analytics and Real Application Testing options
-
- SQL> create pfile from spfile;
-
- File created.
- 编辑刚刚创建的 pfile 文件
点击(此处)折叠或打开
-
[oracle@12crac1 dbs]$ vi /u01/app/oracle/product/12.1.0/db_1/dbs/initem12c1.ora
em12c2.__data_transfer_cache_size=0
em12c3.__data_transfer_cache_size=0
em12c4.__data_transfer_cache_size=0
em12c1.__data_transfer_cache_size=0
em12c4.__db_cache_size=1644167168
em12c2.__db_cache_size=1627389952
em12c3.__db_cache_size=1644167168
em12c1.__db_cache_size=1610612736
em12c2.__java_pool_size=33554432
em12c3.__java_pool_size=33554432
em12c4.__java_pool_size=33554432
em12c1.__java_pool_size=33554432
em12c2.__large_pool_size=83886080
em12c3.__large_pool_size=83886080
em12c4.__large_pool_size=83886080
em12c1.__large_pool_size=83886080
em12c1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
em12c2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
em12c3.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
em12c4.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
em12c2.__pga_aggregate_target=822083584
em12c3.__pga_aggregate_target=822083584
em12c4.__pga_aggregate_target=822083584
em12c1.__pga_aggregate_target=822083584
em12c2.__sga_target=2432696320
em12c3.__sga_target=2432696320
em12c4.__sga_target=2432696320
em12c1.__sga_target=2432696320
em12c1.__shared_io_pool_size=117440512
em12c2.__shared_io_pool_size=117440512
em12c4.__shared_io_pool_size=117440512
em12c3.__shared_io_pool_size=117440512
em12c4.__shared_pool_size=536870912
em12c3.__shared_pool_size=536870912
em12c2.__shared_pool_size=553648128
em12c1.__shared_pool_size=570425344
em12c2.__streams_pool_size=0
em12c3.__streams_pool_size=0
em12c4.__streams_pool_size=0
em12c1.__streams_pool_size=0
*.aq_tm_processes=0
*.audit_file_dest='/u01/app/oracle/admin/em12c/adump'
*.audit_trail='db'
*.cluster_database=TRUE
*.compatible='12.1.0.2.0'
*.control_files='+RACDATA/EM12C/CONTROLFILE/current.265.867196427','+RACFRA/EM12C/CONTROLFILE/current.256.867196429'
*.db_block_size=8192
*.db_create_file_dest='+RACDATA'
*.db_domain=''
*.db_file_name_convert='/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/DATAFILE',
'/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE',
'/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE',
'/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/TEMPFILE',
'/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE',
'/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/TEMPFILE'
*.db_name='em12c'
*.DB_UNIQUE_NAME='EM12C'
*.db_recovery_file_dest='+RACFRA'
*.db_recovery_file_dest_size=10737418240
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=em12cXDB)'
*.enable_pluggable_database=TRUE
*.fal_server='EM12CDG'
em12c1.instance_number=1
em12c2.instance_number=2
em12c3.instance_number=3
em12c4.instance_number=4
*.job_queue_processes=0
*.log_archive_config='dg_config=(EM12C,EM12CDG)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=EM12C'
*.log_archive_dest_2='SERVICE=EM12CDG LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=EM12CDG'
*.LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
*.log_file_name_convert='/u01/app/oracle/oradata/em12cdg','+RACFRA/EM12C/ONLINELOG',
'/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/ONLINELOG'
*.open_cursors=300
*.pga_aggregate_target=770m
*.processes=300
*.remote_login_passwordfile='exclusive'
*.sga_target=2310m
*.standby_file_management='auto'
*.temp_undo_enabled=TRUE
em12c2.thread=2
em12c1.thread=1
em12c3.thread=3
em12c4.thread=4
em12c1.undo_tablespace='UNDOTBS1'
em12c2.undo_tablespace='UNDOTBS2'
em12c3.undo_tablespace='UNDOTBS3'
em12c4.undo_tablespace='UNDOTBS4'
参数说明
db_file_name_convert:
db_file_name_convert:将源过来的数据文件进行目录转换,v$datafile和v$tempfile查询,有多少个不同的目录就要转换多少次
- SQL> select name from v$datafile order by name desc ;
-
- NAME
- --------------------------------------------------------------------------------
- +RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/system.275.867196451
- +RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/sysaux.258.867196451
- +RACDATA/EM12C/DATAFILE/users.274.867196375
- +RACDATA/EM12C/DATAFILE/undotbs4.280.868789597
- +RACDATA/EM12C/DATAFILE/undotbs3.277.868703631
- +RACDATA/EM12C/DATAFILE/undotbs2.272.867196853
- +RACDATA/EM12C/DATAFILE/undotbs1.266.867196377
- +RACDATA/EM12C/DATAFILE/t_rman.dbf
- +RACDATA/EM12C/DATAFILE/system.257.867196321
- +RACDATA/EM12C/DATAFILE/sysaux.271.867196275
- +RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE/users.260.867197175
- +RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE/system.263.867197137
- +RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE/sysaux.262.867197137
-
- SQL> select name from v$tempfile;
-
- NAME
- --------------------------------------------------------------------------------
- +RACDATA/EM12C/TEMPFILE/temp.259.867196445
- +RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/pdbseed_temp012014-12-2
- 4_11-54-51-pm.dbf
-
- +RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/TEMPFILE/temp.261.867197155
所以就得出了参数db_file_name_convert的转换数据
log_file_name_convert:
log_file_name_convert:将源过来的联机日志文件进行转换,v$logfile查询
- SQL> select member from v$logfile order by member;
-
- MEMBER
- --------------------------------------------------------------------------------
- +RACDATA/EM12C/ONLINELOG/group_1.270.867196431
- +RACDATA/EM12C/ONLINELOG/group_2.269.867196433
- +RACDATA/EM12C/ONLINELOG/group_3.268.867196949
- +RACDATA/EM12C/ONLINELOG/group_4.267.867196951
- +RACDATA/EM12C/ONLINELOG/group_5.279.868703645
- +RACDATA/EM12C/ONLINELOG/group_6.278.868703643
- +RACDATA/EM12C/ONLINELOG/group_7.281.868789609
- +RACDATA/EM12C/ONLINELOG/group_8.282.868789611
- +RACFRA/EM12C/ONLINELOG/group_1.260.867196433
- +RACFRA/EM12C/ONLINELOG/group_2.259.867196435
- +RACFRA/EM12C/ONLINELOG/group_3.258.867196951
- +RACFRA/EM12C/ONLINELOG/group_4.257.867196953
- +RACFRA/EM12C/ONLINELOG/group_5.394.868703647
- +RACFRA/EM12C/ONLINELOG/group_6.399.868703645
- +RACFRA/EM12C/ONLINELOG/group_7.390.868789609
- +RACFRA/EM12C/ONLINELOG/group_8.386.868789611
得出log_file_name_convert只需配两个目录转换即可(+RACDATA/EM12C/ONLINELOG和+RACFRA/EM12C/ONLINELOG)
FAL_SERVER:
这个参数指定当日志传输出现问题时,备库到哪里去找缺少的归档日志。它用在备库接收的到的重做日志间有缺口的时候。这种情况会发生在日志传输出现中断时,比如你需要对备库进行维护操作,在备库维护期间,没有日志传输过来,这时缺口就出现了。设置了这个参数,备库就会主动去寻找那些缺少的日志,并要求主库进行传输。
你是主库,就填写:
fal_server=从库
从库上就反过来:
fal_server=主库
注意:FAL_CLIENT在11g中已经废弃,虽然可以配置但是已经不起作用了。
sql>alter system set FAL_SERVER='orcldg';
TEMP_UNDO_ENABLED:
12c的临时UNDO是专门为临时表准备的。首先了解一下临时表:一种为了保存临时数据而被大量使用的特殊表,在临时表上的DML比普通表快,而得到这个好处的主要原因是在修改临时表的数据时基本不会因此直接产生redo,但是,临时表上发生的事务的UNDO数据对应的redo会照常产生,进而写入redo日志。 当然认为这种redo没有必要存在的人不在少数,如此即能进一步加快临时表上的DML执行速度。Oracle 12c接受了这个建议,可以使临时表的UNDO的redo不再产生(听起来有点像绕口令)。刚刚提到临时表的修改不会直接产生redo,即便是有也是UNDO的redo。那么到底在技术上如何避免UNDO的redo产生呢?很讨巧,Oracle12c可以让临时表的UNDO生成在临时表空间中,由于使用了临时数据块,所以和其他临时数据一样,临时表的UNDO就没有对应的redo了!这种新的模式称为临时UNDO。
整理一下临时UNDO的益处:
降低对UNDO表空间的占用。
进一步减少redo的产生,提高DML的速度。
最后是一个笔者个人非常喜欢的功能:在Active Data Guard配置中的Standby 数据库上终于可以直接在临时表上执行DML了,这个特点对用于报表的ADG来说意义重大!
那么如何在12c数据库上启用这个功能呢?
首先请确认COMPATIBLE初始化参数设置为不小于12.1.0.0.0。
然后:
ALTER SYSTEM SET TEMP_UNDO_ENABLED = TRUE; --系统范围
ALTER SESSION SET TEMP_UNDO_ENABLED = TRUE; --会话范围
Standby
点击(此处)折叠或打开
-
em12cdg.__data_transfer_cache_size=0
em12cdg.__db_cache_size=1811939328
em12cdg.__java_pool_size=33554432
em12cdg.__large_pool_size=83886080
em12cdg.__oracle_base='/u01/app/oracle'
em12cdg.__pga_aggregate_target=822083584
em12cdg.__sga_target=2432696320
em12cdg.__shared_io_pool_size=0
em12cdg.__shared_pool_size=486539264
em12cdg.__streams_pool_size=0
*.compatible='12.1.0.2.0'
*.control_files='/u01/app/oracle/oradata/em12cdg/control01.ctl','/u01/app/oracle/flash_recovery_area/control02.ctl'#Restore Controlfile
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata/em12cdg/'
*.db_domain=''
*.db_file_name_convert='+RACDATA/EM12C/DATAFILE','/u01/app/oracle/oradata/em12cdg',
'+RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE','/u01/app/oracle/oradata/em12cdg',
'+RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE','/u01/app/oracle/oradata/em12cdg',
'+RACDATA/EM12C/TEMPFILE','/u01/app/oracle/oradata/em12cdg',
'+RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE','/u01/app/oracle/oradata/em12cdg',
'+RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/TEMPFILE','/u01/app/oracle/oradata/em12cdg'
*.db_name='em12c'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=10737418240
*.db_unique_name='EM12CDG'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=em12cXDB)'
*.enable_pluggable_database=TRUE
*.fal_server='EM12C'
em12cdg.instance_number=1
*.job_queue_processes=0
*.log_archive_config='dg_config=(EM12C,EM12CDG)'
*.log_archive_dest_1='LOCATION=/u01/app/oracle/flash_recovery_area VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=EM12CDG'
*.log_archive_dest_2='service=EM12C VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=EM12C'
*.log_file_name_convert='+RACFRA/EM12C/ONLINELOG','/u01/app/oracle/oradata/em12cdg','+RACDATA/EM12C/ONLINELOG','/u01/app/oracle/oradata/em12cdg'
*.open_cursors=300
*.pga_aggregate_target=770m
*.processes=300
*.remote_login_passwordfile='exclusive'
*.sga_target=2310m
*.standby_file_management='auto'
*.temp_undo_enabled=TRUE
*.undo_tablespace='undotbs1'
注意,此时的db_file_name_convert 和log_file_name_convert是跟primary配置的参数对应关心是相反的
Primary相关的操作
将主库开启归档
- SQL> archive log list;
- Database log mode Archive Mode
- Automatic archival Enabled
- Archive destination USE_DB_RECOVERY_FILE_DEST
- Oldest online log sequence 1264
- Next log sequence to archive 1265
- Current log sequence 1265
由于我之前是已经开起了,如果没有开启,需要先开启
主库强日志模式
查询是否已经开启强日志模式
- SQL> select name, force_logging from v$database;
-
- NAME FORCE_LOGGING
- --------- ---------------------------------------
- EM12C YES
如果没有开启,执行下面的语句
SQL>ALTER DATABASE FORCE LOGGING;
在默认情况下数据库操作会记录redo log,但在一些特定的情况下可以使用nologging来不生成redo信息:
(1)表的批量INSERT(通过/*+APPEND */提示使用“直接路径插入“。或采用SQL*Loader直接路径加载)。表数据不生成redo,但是所有索引修改会生成redo(尽管表不生成日志,但这个表上的索引却会生成redo!)。
(2)LOB操作(对大对象的更新不必生成日志)。
(3)通过CREATE TABLE AS SELECT创建表
(4)各种ALTER TABLE操作,如MOVE和SPLIT
(5)在一些表迁移和表空间迁移中,可以使用alter table a nologging;或者alter tablespace snk nologging;在操作完成后再修改回logging状态。
如果你使用nologging导入大批量数据,以后对这些数据的修改会在redo或者archive log中,但是基准的数据是没有的,所以一旦介质损坏是无法完全恢复的,必须在使用nologging完成切换回logging后,做一次全备或者0级备份。
创建密码文件并拷贝到备库
由于密码文件在ASM上面,用pwcopy命令拷贝密码文件(由于之前用方框中的方法,导致一直报下面的错误,查看了oracle官方文档http://docs.oracle.com/database/121/OSTMG/asm_util002.htm#OSTMG95354)
[grid@12crac1 ~]$ asmcmd
-- 查看密码文件的位置
ASMCMD> pwget --dbuniquename em12c
+RACDATA/EM12C/PASSWORD/pwdem12c.256.867196239
-- 将密码文件从ASM中复制处理啊
ASMCMD> pwcopy --dbuniquename em12c +RACDATA/EM12C/PASSWORD/pwdem12c.256.867196239 /tmp/orapwem12cdg
copying +RACDATA/EM12C/PASSWORD/pwdem12c.256.867196239 -> /tmp/orapwem12cdg
ASMCMD-9456: password file should be located on an ASM disk group
-- 重新复制拷贝出来的密码文件
[oracle@12crac1 tmp]$ scp orapwem12cdg oracle@192.168.8.232:$ORACLE_HOME/dbs/
oracle@192.168.8.232's password:
orapwem12cdg 100% 7680 7.5KB/s 00:00
错误:
|
创建控制文件并拷贝到备库
- [oracle@12crac1 oracle]$ sqlplus / as sysdba
-
- SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 19 10:38:06 2015
-
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
-
-
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
- Advanced Analytics and Real Application Testing options
-
- SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/u01/exp/control01.ctl';
-
- Database altered.
下面是控制文件的复制,将刚才创的控制文件复制到指定目录,指定目录为 standby 参数文件指定参数 :
control_files='/u01/app/oracle/oradata/em12cdg/control01.ctl','/u01/app/oracle/flash_recovery_area/control02.ctl'
[oracle@12crac1 exp]$ scp control01.ctl oracle@192.168.8.232:/u01/app/oracle/oradata/em12cdg/control01.ctl
oracle@192.168.8.232's password:
control01.ctl 100% 19MB 18.7MB/s 00:00
[oracle@12crac1 exp]$ scp control01.ctl oracle@192.168.8.232:/u01/app/oracle/flash_recovery_area/control02.ctl
oracle@192.168.8.232's password:
control01.ctl 100% 19MB 18.7MB/s 00:00
主库创建standby log files
从库使用standby log files来保存从主库接收到的重做日志。
既然主要是从库在使用,那为什么需要在主库上也建立standby log files? 原因主要由两个:一是主库可能转换为备库,而备库是需要有standby log files的;二是如果主库建立了standby log files那备库会自动建立。
这里主库创建了备库日志文件后,由于是在备份之前创建的,所以备库就不用创建了,在rman使用 duplicate恢复备库的时候,备库会自动创建
建立standby如要注意以下几点:
1. standby log files的大小和redo log files一样。
查询redo log files文件大小(默认50M,3个):
SQL> select group#, thread#,bytes/1024/1024 from v$log;
GROUP# THREAD# BYTES/1024/1024
---------- ---------- ---------------
1 1 50
2 1 50
3 2 50
4 2 50
5 3 50
6 3 50
7 4 50
8 4 50
2. 一般而言, standby redo 日志文件组数要比 primary 数据库的 online redo 日志文件组数至少多一个。 推荐 standby redo 日志组数量基于 primary 数据库的线程数(这里的线程数可以理解为 rac 结构中的 rac节点数)。
3. 有一个推荐的公式可以做参考:(每线程的日志组数+1)*最大线程数。
我这里每个线程的日志组数为2,有4个线程,所以创建12个standby logfile:
创建语句如下:
- Alter database add standby logfile thread 1 group 9 (\'+RACDATA/EM12C/ONLINELOG/redo_st_09.log\') size 50m;
- Alter database add standby logfile thread 1 group 10 (\'+RACDATA/EM12C/ONLINELOG/redo_st_10.log\') size 50m;
- Alter database add standby logfile thread 1 group 11 (\'+RACDATA/EM12C/ONLINELOG/redo_st_11.log\') size 50m;
- Alter database add standby logfile thread 2 group 12 (\'+RACDATA/EM12C/ONLINELOG/redo_st_12.log\') size 50m;
- Alter database add standby logfile thread 2 group 13 (\'+RACDATA/EM12C/ONLINELOG/redo_st_13.log\') size 50m;
- Alter database add standby logfile thread 2 group 14 (\'+RACDATA/EM12C/ONLINELOG/redo_st_14.log\') size 50m;
- Alter database add standby logfile thread 3 group 15 (\'+RACDATA/EM12C/ONLINELOG/redo_st_15.log\') size 50m;
- Alter database add standby logfile thread 3 group 16 (\'+RACDATA/EM12C/ONLINELOG/redo_st_16.log\') size 50m;
- Alter database add standby logfile thread 3 group 17 (\'+RACDATA/EM12C/ONLINELOG/redo_st_17.log\') size 50m;
- Alter database add standby logfile thread 4 group 18 (\'+RACDATA/EM12C/ONLINELOG/redo_st_18.log\') size 50m;
- Alter database add standby logfile thread 4 group 19 (\'+RACDATA/EM12C/ONLINELOG/redo_st_19.log\') size 50m;
- Alter database add standby logfile thread 4 group 20 (\'+RACDATA/EM12C/ONLINELOG/redo_st_20.log\') size 50m;
主库全备数据库
用RMAN对主库进行全被,包括归档日志
- [oracle@12crac1 exp]$ rman target /
-
- RUN {
- allocate channel c1 type disk;
- allocate channel c2 type disk;
- sql 'alter system archive log current';
- backup current controlfile for standby format='/u01/app/exp/control_%U';
- BACKUP AS COMPRESSED BACKUPSET FORMAT '/u01/app/exp/em12c_%U_%T' skip inaccessible filesperset 5 DATABASE ;
- sql 'alter system archive log current';
- BACKUP AS COMPRESSED BACKUPSET FORMAT '/u01/app/exp/arch_%U_%T' skip inaccessible filesperset 5 ARCHIVELOG ALL DELETE INPUT;
- release channel c2;
- release channel c1;
- }
将主库备份文件到备库
存放在备库的目录要与主库库备份的目录一致:/u01/app/exp/
[oracle@12crac1 exp]$ scp * oracle@192.168.8.232:/u01/app/exp
Standby相关操作
启动备库监听
- [oracle@12cdg exp]$ lsnrctl start
-
- LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 19-MAR-2015 12:55:30
-
- Copyright (c) 1991, 2014, Oracle. All rights reserved.
-
- Starting /u01/app/oracle/product/12.1.0/db_1/bin/tnslsnr: please wait...
-
- TNSLSNR for Linux: Version 12.1.0.2.0 - Production
- System parameter file is /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
- Log messages written to /u01/app/oracle/diag/tnslsnr/12cdg/listener/alert/log.xml
- Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.8.232)(PORT=1521)))
-
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.8.232)(PORT=1521)))
- STATUS of the LISTENER
- ------------------------
- Alias LISTENER
- Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
- Start Date 19-MAR-2015 12:55:30
- Uptime 0 days 0 hr. 0 min. 0 sec
- Trace Level off
- Security ON: Local OS Authentication
- SNMP OFF
- Listener Parameter File /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
- Listener Log File /u01/app/oracle/diag/tnslsnr/12cdg/listener/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.8.232)(PORT=1521)))
- Services Summary...
- Service \
启动备库
Standby通过修改的参数文件启动到nomount状态
- [oracle@12cdg dbs]$ sqlplus / as sysdba
-
- SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 19 13:03:04 2015
-
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
-
- Connected to an idle instance.
-
- -- 创建spfile
- SQL> create spfile from pfile='?/dbs/initem12cdg.ora';
-
- File created.
-
- --将数据库启动到nomount状态
- SQL> startup nomount
- ORACLE instance started.
-
- Total System Global Area 2432696320 bytes
- Fixed Size 3713720 bytes
- Variable Size 721421640 bytes
- Database Buffers 1694498816 bytes
- Redo Buffers 13062144 bytes
注意,启动时,先用sqlplus连接一下,测试下配置是否正确,都能够连接上去,说明配置没有问题,同时也要测试一下主库
- [oracle@12cdg dbs]$ sqlplus sys/oracle@em12cdg as sysdba
-
- SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 19 12:59:34 2015
-
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
-
- Connected to an idle instance.
-
- [oracle@12cdg dbs]$ sqlplus sys/oracle@em12c as sysdba
-
- SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 19 13:00:12 2015
-
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
-
-
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
- Advanced Analytics and Real Application Testing options
Primary上用auxiliary恢复备库
- [oracle@12crac1 exp]$ rman target sys/oracle@em12c auxiliary sys/oracle@em12cdg
-
- Recovery Manager: Release 12.1.0.2.0 - Production on Thu Mar 19 13:17:27 2015
-
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
-
- connected to target database: EM12C (DBID=1898027596)
- connected to auxiliary database: EM12C (not mounted)
-
- RMAN> duplicate target database for standby;
注意,此可能会出现“问题三”中的错误,具体解决放大参见问题三
查看standby库已经处于mount状态了
重启主库
用grid用户停掉主库的数据库
[grid@12crac1 ~]$ srvctl stop database -db em12c
用pfile创建spfile
[oracle@12crac1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 19 14:06:57 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
用grid用户启动数据
[grid@12crac1 ~]$ srvctl start database -db em12c
重启数据库
关闭数据库(只包含实例关闭)
关闭primary数据库
[grid@12crac1 ~]$ srvctl stop database -db em12c
关闭standby数据库
Shutdown immediate;
启动数据库
启动standby数据库
SQL>Startup nomount;
SQL>alter database mount standby database
--初始化日志应用服务
SQL>alter database recover managed standby database disconnect from session;
--停止日志应用
SQL> recover managed standby database cancel;
-- 将备库打开为只读状态
SQL> alter database open read only;
--启动实时应用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
启动primary实例
[grid@12crac1 ~]$ srvctl start database -db em12c
备用服务器的管理模式与只读模式
启动到管理模式
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect from session;
启动到只读方式
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;
启动 redo 应用
初始化应用日志
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
注意
alter database recover managed standby database(启动前台会话,当前回话一直卡像卡住了一样,即使没有日志应用)
alter database recover managed standby database disconnect from session(启动后台会话,也就是说会话可以继续干别的事情);
启动实时应用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
这个命令指示备库开始使用备用日志文件进行恢复。它也告诉备库命令完成后回到命令行界面
停止日志应用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
此时只是暂停 redo 应用,并不是停止 Standby 数据库,standby 仍会保持接收只不过不会再应用,接收到的归档,直到你再次启动 redo 应用为止
相关管理视图
查询主库和备库是否有差异,如果有差异,看主备库的 fal_server 参数是否配置
select * from v$archive_gap;
问题一
[oracle@12crac1 exp]$ rman target / auxiliary sys/oracle@EM12CDG
Recovery Manager: Release 12.1.0.2.0 - Production on Thu Mar 12 02:55:31 2015
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: EM12C (DBID=1898027596)
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-12154: TNS:could not resolve the connect identifier specified
解决,不要在网上贴代码,还是老老实实用netmgr配置,
-- 网上找的代码,
EM12CDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.8.232 )(PORT = 1521)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = em12c)
)
-- 重新用netmgr跑出的代码
EM12CDG =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.232)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = EM12CDG)
)
问题二
将备库用之前拷贝过来的参数文件,启动到nomount
[oracle@12cdg dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 12 09:56:08 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount pfile=?/dbs/tmppfile.ora
ORA-32006: STANDBY_ARCHIVE_DEST initialization parameter has been deprecated
ORACLE instance started.
Total System Global Area 2432696320 bytes
Fixed Size 3713720 bytes
Variable Size 721421640 bytes
Database Buffers 1694498816 bytes
Redo Buffers 13062144 bytes
[oracle@12cdg admin]$ sqlplus sys/oracle@em12cdg as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 12 09:53:52 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
Descriptor
解决
Tnsnames.ora 中
EM12CDG =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.232)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = EM12CDG)
)
)
中的 SERVICE_NAME 与 show parameter service_names显示的要配置一致,之前由于按照rac中配置的em12c,所以一直报这个错误
问题三:duplicate target database for standby
RMAN> duplicate target database for standby;
Starting Duplicate Db at 12-MAR-15
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=122 device type=DISK
contents of Memory Script:
{
restore clone standby controlfile;
}
executing Memory Script
Starting restore at 12-MAR-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117511.347.874117513
channel ORA_AUX_DISK_1: ORA-19870: error while restoring backup piece +RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117511.347.874117513
ORA-19505: failed to identify file "+RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117511.347.874117513"
ORA-17503: ksfdopn:2 Failed to open file +RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117511.347.874117513
ORA-15001: diskgroup "RACFRA" does not exist or is not mounted
ORA-29701: unable to connect to Cluster Synchronization Servic
failover to previous backup
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117491.332.874117493
channel ORA_AUX_DISK_1: ORA-19870: error while restoring backup piece +RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117491.332.874117493
ORA-19505: failed to identify file "+RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117491.332.874117493"
ORA-17503: ksfdopn:2 Failed to open file +RACFRA/EM12C/AUTOBACKUP/2015_03_12/s_874117491.332.874117493
ORA-15001: diskgroup "RACFRA" does not exist or is not mounted
ORA-29701: unable to connect to Cluster Synchronization Servic
failover to previous backup
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/exp/control_12q1jtln_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/exp/control_12q1jtln_1_1 tag=TAG20150312T021311
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/em12c/control01.ctl
output file name=/u01/app/oracle/oradata/em12c/control02.ctl
Finished restore at 12-MAR-15
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/12/2015 11:03:26
RMAN-05501: aborting duplication of target database
RMAN-05001: auxiliary file name +RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE/users.260.867197175 conflicts with a file used by the target database
RMAN-05001: auxiliary file name +RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE/sysaux.262.867197137 conflicts with a file used by the target database
RMAN-05001: auxiliary file name +RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE/system.263.867197137 conflicts with a file used by the target database
RMAN-05001: auxiliary file name +RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/sysaux.258.867196451 conflicts with a file used by the target database
RMAN-05001: auxiliary file name +RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/system.275.867196451 conflicts with a file used by the target database
解决:
http://blog.itpub.net/22664653/viewspace-705687/
RMAN> duplicate target database for standby nofilenamecheck;
Starting Duplicate Db at 12-MAR-15
using channel ORA_AUX_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/12/2015 11:18:03
RMAN-05501: aborting duplication of target database
RMAN-05500: the auxiliary database must be not mounted when issuing a DUPLICATE command
--此备库已启动为mount状态了,需要将备库关闭,重新启动为nomount状态
问题四 备库添加日志
SQL> Alter database add standby logfile thread 1 group 9 ('/u01/app/oracle/oradata/em12c/redo_st_09.log') size 50m;
Alter database add standby logfile thread 1 group 9 ('/u01/app/oracle/oradata/em12c/redo_st_09.log') size 50m
*
ERROR at line 1:
ORA-01156: recovery or flashback in progress may need access to files
解决:
SQL> alter database recover managed standby database cancel;
Database altered.
http://blog.csdn.net/tianlesoftware/article/details/6232292
问题五:备库启动时报的错
SQL> startup nomount;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
即提示有些废弃的参数在参数文件中配置了,查看alter日志文件,找到删掉即可
Total System Global Area 2432696320 bytes
Fixed Size 3713720 bytes
Variable Size 721421640 bytes
Database Buffers 1694498816 bytes
Redo Buffers 13062144 bytes
解决: 查看 tail -1000 alert_em12c.log
System name: Linux
Node name: 12cdg.emoney.cn
Release: 3.8.13-44.1.1.el6uek.x86_64
Version: #2 SMP Wed Sep 10 06:10:25 PDT 2014
Machine: x86_64
Using parameter settings in server-side spfile /u01/app/oracle/product/12.1.0/db_1/dbs/spfileem12c.ora
System parameters with non-default values:
processes = 300
sga_target = 2320M
control_files = "/u01/app/oracle/oradata/em12c/control01.ctl"
control_files = "/u01/app/oracle/oradata/em12c/control02.ctl"
db_file_name_convert = "+RACDATA/EM12C/DATAFILE"
db_file_name_convert = "/u01/app/oracle/oradata/em12c"
db_file_name_convert = "+RACDATA/EM12C/TEMPFILE"
db_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACDATA/EM12C/DATAFILE"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/DATAFILE"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACDATA/EM12C/TEMPFILE"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACDATA/EM12C/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACDATA/EM12C/0AF976422E023D47E053E608A8C07E2B/TEMPFILE"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACFRA/EM12C/ONLINELOG"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
log_file_name_convert = "+RACDATA/EM12C/ONLINELOG"
log_file_name_convert = "/u01/app/oracle/oradata/em12c"
db_block_size = 8192
compatible = "12.1.0.2.0"
log_archive_dest_1 = "LOCATION=/u01/app/exp"
log_archive_dest_2 = "service=EM12C VALID_FOR=(ALL_LOGFILES,ALL_ROLES) db_unique_name=EM12C"
log_archive_dest_state_2 = "ENABLE"
standby_archive_dest = "/u01/app/exp"
fal_server = "EM12C"
log_archive_config = "dg_config=(EM12C,EM12CDG)"
cluster_database = FALSE
db_recovery_file_dest_size= 10G
standby_file_management = "auto"
undo_management = "AUTO"
undo_tablespace = "UNDOTBS1"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=em12cXDB)"
job_queue_processes = 0
audit_trail = "DB"
db_name = "em12c"
db_unique_name = "EM12CDG"
open_cursors = 300
pga_aggregate_target = 770M
diagnostic_dest = "/u01/app/oracle"
enable_pluggable_database= TRUE
Deprecated system parameters with specified values:
standby_archive_dest
End of deprecated system parameter listing
NOTE: remote asm mode is local (mode 0x1; from cluster type)
在之前的参数文件中去掉参数 standby_archive_dest ,
SQL> create spfile from pfile='/u01/app/exp/tmppfile.ora';
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 2432696320 bytes
Fixed Size 3713720 bytes
Variable Size 721421640 bytes
Database Buffers 1694498816 bytes
Redo Buffers 13062144 bytes
问题 6 ERROR ORA-16009: invalid redo transport destination
Dataguard 搭建好了,主库的日志也可以传到备库了,就是在备库中没有应用
查看主库(primary)
SQL>show parameter log_archive_dest;
…………
log_archive_dest_2 string
SERVICE=EM12CDG LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=EM12CDG
…………
查看备库(standby)
SQL>show parameter log_archive_dest;
…………
log_archive_dest_2 string SQL>show parameter log_archive_dest;
…………
log_archive_dest_2 string
ervice=EM12C VALID_FOR=(ALL_L
OGFILES,ALL_ROLES) db_unique_n
ame=EM12C
…………
在备库上执行下面语句
SQL>alter system set log_archive_dest_2='service=EM12C VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=EM12C';
SQL>show parameter log_archive_dest;
显示正常了
http://www.verydemo.com/demo_c161_i115735.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30150152/viewspace-1471387/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30150152/viewspace-1471387/