Brief description of Oracle physical standby database configuration and manageme

http://lancexu1212.spaces.live.com/

Brief description of Oracle physical standby database configuration and management

Configuration of Oracle physical standby database is quite simple,brief steps are as follows:

1.Install Oracle database software and create a database as primary database

2.Enable primary database to forced logging
SQL>alter database force logging;

3.Create standby redo logs,the number of standby redo logs follows the equation below:
(Maximum number of logfiles for each thread + 1) * maximum number of threads
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb1/stdby_redo01.log' size 50m;
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb1/stdby_redo02.log' size 50m;
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb1/stdby_redo03.log' size 50m;
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb1/stdby_redo04.log' size 50m;

4.Modify initialization parameters for the primary database:
SQL>alter system set db_name=mydb1;
SQL>alter system set db_unique_name=mydb1;
SQL>alter system set log_archive_config='DG_CONFIG=(mydb1,mydb2)';
SQL>alter system set log_archive_dest_1='LOCATION=/opt/oracle/arch1/mydb1/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=mydb1';
SQL>alter system set log_archive_dest_2='SERVICE=mydb2 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=mydb2';
SQL>alter system set log_archive_dest_state_1=enable;
SQL>alter system set log_archive_dest_state_2=enable;
SQL>alter system set fal_server=mydb2;
SQL>alter system set fal_client=mydb1;
SQL>alter system set db_file_name_convert='/opt/oracle/oradata/mydb1','/opt/oracle/oradata/mydb2' scope=spfile;
SQL>alter system set log_file_name_convert='/opt/oracle/oradata/mydb1','/opt/oracle/oradata/mydb2' scope=spfile;
SQL>alter system set standby_file_management=auto;

5.Put the primary database in archivelog mode:
SQL>shutdown immediate;
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;

6.Backup the primary database using rman:
RMAN>backup database;

7.Create standby controlfile and parameter file:
SQL>alter database create standby controlfile as '/opt/oracle/oradata/mydb2/control01.ctl';
SQL>create pfile='/opt/oracle/dbs/initmydb2.ora' from spfile;

8.Multiplex the controlfiles for standby database and modify the parameter file for standby database:
bash-3.00$cp /opt/oracle/oradata/mydb2/control01.ctl /opt/oracle/oradata/mydb2/control02.ctl
bash-3.00$cp /opt/oracle/oradata/mydb2/control01.ctl /opt/oracle/oradata/mydb2/control03.ctl

bash-3.00$vi /opt/oracle/dbs/initmydb2.ora

db_name=mydb1
db_unique_name=mydb2
control_files='/opt/oracle/oradata/mydb2/control01.ctl','/opt/oracle/oradata/mydb2/control02.ctl','/opt/oracle/oradata/mydb2/control03.ctl'
log_archive_config='DG_CONFIG=(mydb1,mydb2)'
log_archive_dest_1='LOCATION=/opt/oracle/arch/mydb2 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=mydb2'
log_archive_dest_2='SERVICE=mydb1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=mydb1'
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable
fal_server=mydb1
fal_client=mydb2
db_file_convert='/opt/oracle/oradata/mydb1','/opt/oracle/oradata/mydb2'
log_file_convert='/opt/oracle/oradata/mydb1','/opt/oracle/oradata/mydb2'
standby_file_management=auto

9.Create a password file for the standby database,make sure the password is identical to the password of primary database:
bash-3.00$orapwd file=/opt/oracle/dbs/orapwmydb2 password=db2pwd

10.Create listeners for primary and standby database,create Oracle Net service names for both primary and standby database on both primary and standby database,they will be used by redo transport services:

11.Start the standby database instance and mount:
SQL>startup nomount;
SQL>create spfile from pfile;
SQL>alter database mount standby database;

12.Restore standby database:
bash-3.00$rman target /

RMAN>restore database;

13.Create standby redo log files and put standby database into managed realtime redo apply recovery mode:
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb2/stdby_redo01.log' size 50m;
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb2/stdby_redo02.log' size 50m;
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb2/stdby_redo03.log' size 50m;
SQL>alter database add standby logfile '/opt/oracle/oradata/mydb2/stdby_redo04.log' size 50m;
SQL>alter database recover managed standby database using current logfile disconnect from session;

Several administrative SQL commands for physical standby database:

1.put physical standby database into managed realtime redo log apply recovery mode:
SQL>alter database recover managed standby database using current logfile disconnect from session;

2.put physical standby database into managed archived redo log apply recovery mode:
SQL>alter database recover managed standby database disconnect from session;

3.stop applying redo log:
SQL>alter database recover managed standby database cancel;

4.switchover roles:
SQL>alter database commit to switchover to physical standby with session shutdown;
SQL>alter database commit to switchover to primary with session shutdown;

5.monitor recovery progress:
SQL>select sequence#,name,applied from v$archived_log;

时间: 2024-10-23 19:57:20

Brief description of Oracle physical standby database configuration and manageme的相关文章

Brief description of Oracle physical standby database configuration and management

http://lancexu1212.spaces.live.com/ Brief description of Oracle physical standby database configuration and management Configuration of Oracle physical standby database is quite simple,brief steps are as follows: 1.Install Oracle database software an

Oracle10G Physical Standby Database笔记

oracle|笔记 试验环境primary server:  windows2000 server + oracle 10.0.1.0.2  ORACLE_SID:dgtest  ORACLE_HOME: D:\oracle\product\10.1.0\db_1standby server: windows XP pro + oracle 10.0.1.0.2ORACLE_SID:dgtestORACLE_HOME: D:\oracle\product\10.1.0\db_1   配置步骤首先

【DataGuarad】ORA-1153 trying to turn on Flashback for Physical Standby Database 2011-10-

当试图开启备库的flashback功能时报如下错误: SQL> alter database flashback on; alter database flashback on * ERROR at line 1: ORA-01153: an incompatible media recovery is active 原因:备库还在应用日志 ORA-1153, 00000, "an incompatible media recovery is active" // *Cause:

【DataGuarad】ORA-1153 trying to turn on Flashback for Physical Standby Database

当试图开启备库的flashback功能时报如下错误: SQL> alter database flashback on; alter database flashback on * ERROR at line 1: ORA-01153: an incompatible media recovery is active 原因:备库还在应用日志 ORA-1153, 00000, "an incompatible media recovery is active" // *Cause:

oracle中flashback standby database解决办法

Flashback之后的standby database如何打开,操作如下: SQL> flashback database to restore point myrs1;   Flashback complete.   SQL> shutdown immediate ORA-01109: database not open     Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE inst

Data Guard - Snapshot Standby Database配置

概述 一般情况下,物理standby数据库处于mount状态接收和应用主库的REDO日志,物理standby数据库不能对外提供访问.如果需要只读访问,那么可以临时以read-only的方式open物理备库,或者配置ACTIVE DATA GUARD,那么物理standby数据库可以进行只读(read-only)访问(比如报表业务查询),但是物理standby数据库不能进行读写操作(read-write). 有些情况下,为了实现系统的压力测试或者Real Application Testing(R

[20170302]关于activate standby database

[20170302]关于alter database activate standby database.txt --//这是很久以前但是关于alter database activate standby database的讨论: --//链接: http://www.itpub.net/thread-2062967-1-1.html --//ORACLE 11204 --//哪个视图体现了此 ACTIVATE STANDBY DATABASE 和 普通的 DATABASE 区别? --//我自

信息: Oracle Database Configuration Assistant 失败

安装异常: 信息: Oracle Database Configuration Assistant 失败 log:C:\Program Files\Oracle\Inventory\logs\installActions2014-10-24_10-56-40PM.log 本人的解决: 跳过此步按照,可以先不管的,安装完其他步骤后,安装其他完成后. 在程序中,运行"Database Configuration Assistant ",再次安装,就可成功.   网友意见: 1.cmd下输入

9i下创建standby database 步骤

创建 最近,对oracle 9i下的data guard进行了测试,发现9i作standby时更方便了先整理出来,如下: 操作环境:Windows 2000 Professional + Serveice pack 4数据库:Oracle 9201主库SID:pormals从库SID:pormalsoracle安装采用OMF结构 1.主从两机的操作系统和相同pack 2.在主从库上建立数据库,选择只安装Software 3.在主库上,通过dbca建立数据库,除了字符集选择 zhs16gbk外,全