11g Physical Standby配置
Database | DB_UNIQUE_NAME | Oracle Net Service Name |
---|---|---|
Primary | PROD | PROD |
Physical standby | PRODDG | PRODDG |
alter database force logging;
archive log list;
alter database create standby controlfile as '/dsg/oracle11/back/prordg.ctl';
create pfile from spfile;
cp $ORACLE_HOME/dbs/initPROD.ora $ORACLE_HOME/dbs/initPRODDG.ora
3).修改后主库pfile中内容如下:
*.db_domain=''
*.db_name='PROD'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PRODXDB)'
*.open_cursors=
*.pga_aggregate_target=
*.processes=
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=
*.undo_tablespace='UNDOTBS1' #################################################################
#Parameters for Primary Database.
#################################################################
*.DB_NAME='PROD'
*.DB_UNIQUE_NAME=PROD
*.LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(PROD,PRODDG)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/dsg/oracle11/PROD/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PROD'
*.LOG_ARCHIVE_DEST_2='SERVICE=PRODDG LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PRODDG'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE #################################################################
#Parameters which using for switch over from Primary to Standby.
#################################################################
*.FAL_SERVER=PRODDG
*.FAL_CLIENT=PROD
*.DB_FILE_NAME_CONVERT='/dsg/oracle11/PRODDG','/dsg/oracle11/PROD'
*.LOG_FILE_NAME_CONVERT='/dsg/oracle11/PRODDG','/dsg/oracle11/PROD'
*.STANDBY_FILE_MANAGEMENT=AUTO
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile; File created.
cat listener.ora LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.70)(PORT=))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))) SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=db11)
(SERVICE_NAME = DB11)
(SID_NAME=db111)
(ORACLE_HOME=/u01/app/oracle/product/11.2.)
(PRESPAWN_MAX=)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=)(TIMEOUT=))
)
)
(SID_DESC=
(GLOBAL_DBNAME=PROD)
(SERVICE_NAME = PROD)
(SID_NAME=PROD)
(ORACLE_HOME=/u01/app/oracle/product/11.2.)
(PRESPAWN_MAX=)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=)(TIMEOUT=))
)
)
(SID_DESC=
(GLOBAL_DBNAME=PRODDG)
(SERVICE_NAME = PRODDG)
(SID_NAME=PRODDG)
(ORACLE_HOME=/u01/app/oracle/product/11.2.)
(PRESPAWN_MAX=)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=)(TIMEOUT=))
)
)
) cd $ORACLE_HOME/network/admin PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
)
) PRODDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PRODDG)
)
) EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
) PROD@dbrac1 /u01/app/oracle/product/11.2./network/admin$ tnsping prod TNS Ping Utility for Linux: Version 11.2.0.1. - Production on -APR- :: Copyright (c) , , Oracle. All rights reserved. Used parameter files:
/u01/app/oracle/product/11.2./network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = )) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD)))
OK ( msec)
PROD@dbrac1 /u01/app/oracle/product/11.2./network/admin$ tnsping proddg TNS Ping Utility for Linux: Version 11.2.0.1. - Production on -APR- :: Copyright (c) , , Oracle. All rights reserved. Used parameter files:
/u01/app/oracle/product/11.2./network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = )) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PRODDG)))
OK ( msec)
cd $ORACLE_HOME/dbs
orapwd file=orapwPRODDG force=y password=oracle entries=
cd $ORACLE_HOME/dbs
cp orapwPROD orapwPROD
cd $ORACLE_BASE/admin
mkdir -p PRODDG/adump
mkdir -p PRODDG/dpdump
mkdir /dsg/oracle11/PRODDG
cp /dsg/oracle11/back/prordg.ctl /dsg/oracle11/PRODDG/
cp prordg.ctl control01.ctl
cp control01.ctl control02.ctl
cat initPRODDG.ora
PRODDG.__db_cache_size=
PRODDG.__java_pool_size=
PRODDG.__large_pool_size=
PRODDG.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
PRODDG.__pga_aggregate_target=
PRODDG.__sga_target=
PRODDG.__shared_io_pool_size=
PRODDG.__shared_pool_size=
PRODDG.__streams_pool_size=
*.audit_file_dest='/u01/app/oracle/admin/PRODDG/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/dsg/oracle11/PRODDG/control01.ctl','/dsg/oracle11/PRODDG/control02.ctl'
*.db_block_size=
*.db_domain=''
*.db_name='PROD' ##注意和主库的一致
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PRODDGXDB)'
*.open_cursors=
*.pga_aggregate_target=
*.processes=
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=
*.undo_tablespace='UNDOTBS1' #################################################################
#Parameters for Standby Database.
#################################################################
*.DB_UNIQUE_NAME=PRODDG
*.LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(PROD,PRODDG)'
*.DB_FILE_NAME_CONVERT='/dsg/oracle11/PROD','/dsg/oracle11/PRODDG'
*.LOG_FILE_NAME_CONVERT='/dsg/oracle11/PROD','/dsg/oracle11/PRODDG'
*.FAL_SERVER=PROD
*.FAL_CLIENT=PRODDG
*.STANDBY_FILE_MANAGEMENT=AUTO #################################################################
#Parameters which using for switch over from Standby to Primary.
#################################################################
*.LOG_ARCHIVE_DEST_1='LOCATION=/dsg/oracle11/PRODDG/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PRODDG'
*.LOG_ARCHIVE_DEST_2='SERVICE=PROD LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PROD'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
PROD@dbrac1 /home/oracle$ export ORACLE_SID=PRODDG
PRODDG@dbrac1 /home/oracle$ sql SQL*Plus: Release 11.2.0.1. Production on Thu Apr :: Copyright (c) , , Oracle. All rights reserved. Connected to an idle instance. SQL> create spfile from pfile; File created.
SQL> startup mount
ORACLE instance started. Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
Database mounted.
alter database recover managed standby database disconnect from session;
SQL> set line
SQL> select instance_name,host_name,version,status from v$instance; INSTANCE_NAME HOST_NAME VERSION STATUS
---------------- ---------------------------------------------------------------- ----------------- ------------
PROD dbrac1 11.2.0.1. OPEN SQL> alter system switch logfile; System altered. SQL> select max(sequence#) from v$archived_log; MAX(SEQUENCE#)
--------------
SQL> select max(sequence#) from v$archived_log; MAX(SEQUENCE#)
-------------- ,取消日志应用 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> create user hxy identified by hxy; User created. SQL> grant dba to hxy; Grant succeeded. SQL> conn hxy/hxy
Connected.
SQL> create table t as select * from dba_users; Table created. SQL> alter system switch logfile; System altered. SQL> select max(sequence#) from v$archived_log; MAX(SEQUENCE#)
--------------
SQL> select max(sequence#) from v$archived_log; MAX(SEQUENCE#)
-------------- SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; Database altered. SQL> alter database open read only; Database altered. SQL> conn hxy/hxy
Connected. SQL> select * from tab; TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
T TABLE SQL> select count(*) from t; COUNT(*)
----------
SQL> conn / as sysdba
Connected.
SQL> select switchover_status from v$database; SWITCHOVER_STATUS
--------------------
TO STANDBY SQL> alter database commit to switchover to physical standby with session shutdown; Database altered. SQL> shutdown immediate
ORA-: database not mounted ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started. Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
SQL> alter database mount standby database; Database altered. SQL> select database_role from v$database; DATABASE_ROLE
----------------
PHYSICAL STANDBY SQL> alter database recover managed standby database disconnect from session parallel ; Database altered.
SQL> select switchover_status from v$database; SWITCHOVER_STATUS
--------------------
TO PRIMARY SQL> alter database commit to switchover to primary with session shutdown ; Database altered. SQL> shutdown immediate
ORA-: database not open Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started. Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
Database mounted.
Database opened. SQL> select database_role from v$database; DATABASE_ROLE
----------------
PRIMARY
SQL> select switchover_status from v$database; SWITCHOVER_STATUS
--------------------
NOT ALLOWED
SQL> select database_role from v$database; DATABASE_ROLE
----------------
PRIMARY SQL> select switchover_status from v$database; SWITCHOVER_STATUS
--------------------
TO STANDBY SQL> alter database commit to switchover to physical standby with session shutdown; Database altered. SQL> shutdown immediate
ORA-: database not mounted ORACLE instance shut down. SQL> startup nomount
ORACLE instance started. Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
SQL> alter database mount standby database; Database altered. SQL> select database_role from v$database; DATABASE_ROLE
----------------
PHYSICAL STANDBY SQL> alter database recover managed standby database disconnect from session parallel ; Database altered. SQL> select switchover_status from v$database; SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE --备库没有切换
SQL> select database_role from v$database; DATABASE_ROLE
----------------
PHYSICAL STANDBY SQL> select switchover_status from v$database; SWITCHOVER_STATUS
--------------------
TO PRIMARY ---此时的状态变为TO PRIMARY SQL> alter database commit to switchover to primary with session shutdown ; Database altered. SQL> shutdown immediate
ORA-: database not open Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started. Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
Database mounted.
Database opened.
SQL> select database_role from v$database; DATABASE_ROLE
----------------
PRIMARY
SQL> select switchover_status from v$database; SWITCHOVER_STATUS
--------------------
NOT ALLOWED
Thu Apr ::
Starting background process SMCO
Thu Apr ::
SMCO started with pid=, OS id=
Thu Apr ::
Thread cannot allocate new log, sequence
Private strand flush not complete
Current log# seq# mem# : /dsg/oracle11/PROD/redo02.log
Thu Apr ::
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Thread advanced to log sequence (LGWR switch)
Current log# seq# mem# : /dsg/oracle11/PROD/redo03.log
Thu Apr ::
Archived Log entry added for thread sequence ID 0xef8b15b dest :
Thu Apr ::
Starting background process SMCO
Thu Apr ::
SMCO started with pid=, OS id=
Thu Apr ::
Thread cannot allocate new log, sequence
Private strand flush not complete
Current log# seq# mem# : /dsg/oracle11/PROD/redo02.log
Thu Apr ::
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Thread advanced to log sequence (LGWR switch)
Current log# seq# mem# : /dsg/oracle11/PROD/redo03.log
Thu Apr ::
Archived Log entry added for thread sequence ID 0xef8b15b dest :
orapwd file=orapwPRODDG force=y password=oracle entries=
orapwd file=orapwPROD force=y password=oracle entries=
11g Physical Standby配置的更多相关文章
- oracle 11g physical standby switchover
简介 SWITCHOVERS主要是在计划停机维护时用来降低DOWNTIME,如硬件维护.操作系统升级或是数据库rolling upgrade, 也可用来进行特殊情况下的数据库迁移. SWITCHOVE ...
- Creating a Physical Standby Database 11g
1.Environment Item Primary database standby database Platform Redhat 5.4 Redhat 5.4 Hostname gc1 gc2 ...
- 11G、12C Data Guard Physical Standby Switchover转换参考手册
Switchover转换 Step 1: switchover 切换先前检查 (1)确保主备两端log_archive_config和db_unique_name参数都已经正确设置. 需要注意的是 ...
- Oracle RAC 11g DG Broker配置和测试
Oracle RAC 11g DG Broker配置和测试 之前在<RHEL6.4 + Oracle 11g DG测试环境快速搭建参考>已经简单说过. 本篇在实验环境中实际配置 环境: R ...
- Data Guard Physical Standby - RAC Primary to RAC Standby 使用第二个网络 (Doc ID 1349977.1)
Data Guard Physical Standby - RAC Primary to RAC Standby using a second network (Doc ID 1349977.1) A ...
- 11.2 Data Guard Physical Standby Switchover Best Practices using SQL*Plus (Doc ID 1304939.1)
11.2 Data Guard Physical Standby Switchover Best Practices using SQL*Plus (Doc ID 1304939.1) APPLIES ...
- ORACLE 11gR2 DG(Physical Standby)日常维护01
环境:RHEL 6.4 + Oracle 11.2.0.4 一.主备手工切换 1.1 主库,切换成备库并启动到mount 1.2 备库,切换成主库并启动到open 1.3 新的备库启动日志应用 二.重 ...
- ORACLE 11gR2 DG(Physical Standby)日常维护02
环境:RHEL 6.5 + Oracle 11.2.0.4 三.监控DG的状态 3.1监控DG备库的状态 3.2监控主库传输日志链路的状态 四.备库切换为snapshot standby 4.1备库切 ...
- 【原】Configuring Oracle Data Guard In Physical Standby Database
作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...
随机推荐
- 29 GroupSock(NetAddressList)——live555源码阅读(四)网络
29 GroupSock(NetAddressList)——live555源码阅读(四)网络 29 GroupSock(NetAddressList)——live555源码阅读(四)网络 简介 Net ...
- 给dos命令“.bat”文件换图标
最近客户有个需求:给企业建立一个FTP服务器,并且给不同的部门分配不同的目录和管理权限. 这个好实现!直接安装serv-u,进行一番设置,搞定! 不过客户嫌登陆FTP操作麻烦,输入ip,输入账号什么的 ...
- COGS 2416.[HZOI 2016]公路修建 & COGS 2419.[HZOI 2016]公路修建2 题解
大意: [HZOI 2016]公路修建 给定一个有n个点和m-1组边的无向连通图,其中每组边都包含一条一级边和一条二级边(连接的顶点相同),同一组边中的一级边权值一定大于等于二级边,另外给出一个数k( ...
- 交叉编译alsa声卡驱动
變異成靜態 ./configure --target=arm-linux --enable-shared=no --enable-static=yes 編譯成動態 ./configure --targ ...
- Junit 测试 Spring
在测试类上加上@RunWith,和@ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration ...
- ganglia及ganglia-api相关介绍
1, ganglia的安装: http://blog.topspeedsnail.com/archives/3049 2, ganglia-api项目地址 https://github.com/gua ...
- SQL 大数据查询如何进行优化?
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而 ...
- Ebase Xi The world's best RAD platform.
Ebase Xi : http://www.ebasetech.com/ The world's best RAD platform. Xi combines browser and mobile a ...
- jsp调用java方法 function taglib
1.新建tld文件: my-functions.tld: <?xml version="1.0" encoding="UTF-8"?> <ta ...
- 多线程BackroundWorker 使用
参考文章:http://www.cnblogs.com/inforasc/archive/2009/10/12/1582110.html using System; using System.Coll ...