Creating a Physical Standby Database

Stella981
• 阅读 499

Creating a Physical Standby Database

Purpose

This tutorial shows you how to create a physical standby database. The steps described configure the standby database for maximum performance mode, which is the default data protection mode. This tutorial shows you how to:

  • Use the new DUPLICATE FROM ACTIVE DATABASE RMAN command
  • Enable Maximum Performance standby mode
  • Verify that data is getting to the Physical standby
  • Examine views to monitor Primary and Physical Standby Databases using SQL*Plus

NOTE: This OBE represents a Data Guard configuration where orcl is the primary database and orclsby1 is the physical standby database SID. For simplicity, in this OBE, both the primary and standby databases are running on a single server.

Time to Complete

Approximately 1 hour

Topics

This tutorial covers the following topics:

Creating a Physical Standby Database

Overview

Creating a Physical Standby Database

Prerequisites

Creating a Physical Standby Database

Preparing the Primary Database for Standby Database Creation

Creating a Physical Standby Database

Creating the Physical Standby Database

Creating a Physical Standby Database

Verify that the Physical Standby Database is Performing Correctly

Creating a Physical Standby Database

Summary

Viewing Screenshots

Creating a Physical Standby Database Place the cursor over this icon to load and view all the screenshots for this tutorial. ** (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)**

Note: Alternatively, you can place the cursor over an individual icon in the following steps to load and view only the screenshot associated with that step. You can hide an individual screenshot by clicking it.

Overview

Oracle Database 11_g_ RMAN introduces the FROM ACTIVE DATABASE capability to the DUPLICATE FOR STANDBY command. This alleviates the previous need for interim storage on both the Primary and Standby systems, and the limitation of single stream network traffic.

Now when taking the backup of the Primary database you can simultaneously create and restore the standby database over the network in parallel streams. Apart from some simple Oracle Net setup, and creating a couple of directories and an interim password file, the whole standby creation can be done in one RMAN script.

RMAN will automatically copy the server parameter file to the standby host, start the auxiliary instance with the server parameter file, restore a backup control file, and copy all necessary database files and archived redo logs over the network to the standby host.

Prerequisites

Before you perform this tutorial, you should:

1.

Perform an Oracle Database 11g installation (software and db installed) for a single server environment OR Oracle Database 11g installation (software and db installed) on 1 server and Oracle Database 11g software only on 2nd server for a dual server environment.

2.

Download and unzip the physstby.zip file into your working directory (i.e.wkdir)

Back to Topic List

Preparing the Primary Database for Standby Database Creation

In this practice, you verify that the primary database is configured correctly to support a physical standby database.

You only need to perform these preparatory tasks once. After you complete these steps, the database is prepared to serve as the primary database for one or more standby databases. You should perform the following steps:

1.

Determine if FORCE LOGGING is enabled. If it is not enabled, enable FORCE LOGGING mode. This statement may take some time to complete, because it waits for all unlogged direct write I/O to finish. You use the following commands:

Select FORCE_LOGGING from V$DATABASE;

ALTER DATABASE FORCE LOGGING;

Creating a Physical Standby Database

2.

Configure redo transport authentication.

Data Guard uses Oracle Net sessions to transport redo data and control messages between the members of a Data Guard configuration. These redo transport sessions are authenticated using either the Secure Sockets Layer (SSL) protocol or a remote login password file.

In this OBE, we will be using a remote login password file which will be created in a subsequent step.

3.

Configure the primary database to receive redo data, by adding the standby logfiles to the primary. You can use the cr_sby_redologs.sql script, after validating the directory paths reflect your environment.

It is highly recommended that you have one more standby redo log group than you have online redo log groups as the primary database. The files must be the same size or larger than the primary database’s online redo logs.

SQL> alter database add standby logfile 2 '/u01/app/oracle/oradata/orcl/srl01.log' size 52428800 3 /

Database altered.

SQL> alter database add standby logfile 2 '/u01/app/oracle/oradata/orcl/srl02.log' size 52428800 3 /

Database altered.

SQL> alter database add standby logfile 2 '/u01/app/oracle/oradata/orcl/srl03.log' size 52428800 3 /

Database altered.

SQL> alter database add standby logfile 2 '/u01/app/oracle/oradata/orcl/srl04.log' size 52428800 3 /

Database altered.

4.

Set primary database initialization parameters

On the primary database, you define initialization parameters that control redo transport services while the database is in the primary role. You use SQL commands similar to the following to verify these settings:

Creating a Physical Standby Database

Ensure the following parameters are set to reflect the Data Guard configuration.

DB_NAME

Specifies the database name. Must be orcl.

DB_UNIQUE_NAME

Specify a unique name for each database. Does not change even if DG roles change. Must be orcl.

CONTROL_FILES

Specifies the local path name for the control files on the primary database.

LOG_ARCHIVE_CONFIG

Uses the DG_CONFIG attribute to list the DB_UNIQUE_NAME of the primary and standby databases.

LOG_ARCHIVE_DEST_1

Defaults to archive destination for the local archived redo log files.

LOG_ARCHIVE_DEST_2

Valid only for the primary role, this destination transmits redo data to the remote physical standby destination orclsby1.

REMOTE_LOGIN_PASSWORDFILE

Must be EXCLUSIVE or SHARED if a remote login password file is used (default = EXCLUSIVE)

LOG_ARCHIVE_DEST_STATE_n

Must be ENABLE (default)

Use the following commands to set the LOG_ARCHIVE_CONFIG and LOG_ARCHIVE_DEST_2 indicating the primary and standby databases.

Creating a Physical Standby Database

5.

Issue the following statements to determine your database's archival state, and then put the primary database in ARCHIVELOG mode to enable automatic archiving.

Creating a Physical Standby Database

Back to Topic List

Creating the Physical Standby Database

In this practice, you configure the network environment and create a physical standby database.

NOTE: In this OBE, you configure the network for a single server environment. If you are configuring an environment on two different servers, you would need to configure Net Manager on both servers accordingly.

A

Using Oracle Net Manager to Create an Oracle Net service name for your physical standby database.

B.

Using Oracle Net Manager to Configure an entry for your standby database in the listener.ora file.

C.

Creating the standby database over the network

Back to Topic List

A. Use Oracle Net Manager to create an Oracle Net service name for your physical standby database.

1.

Launch Net Manager.

netmgr

2.

Expand Local. Select Service Naming and click the green plus sign

Creating a Physical Standby Database

3.

Enter your (i.e. orclsby1) in the Net Service Name field and click Next

Creating a Physical Standby Database

4.

Select TCP/IP (Internet Protocol) and click Next

Creating a Physical Standby Database

5.

Enter your fully qualified (i.e. edtdr9p1.us.oracle.com) and click Next.

Creating a Physical Standby Database

6.

Enter your (i.e. orclsby1.us.oracle.com) in the Service Name field and click Next

Creating a Physical Standby Database

7.

Click Finish.

8.

Click File -> Save Network Configuration to save the information to the tnsnames.ora file.

Back to Topic

B. Use Oracle Net Manager to configure an entry for your standby database in the listener.ora file.

1.

Expand Listeners

2.

Select LISTENER.

3.

Select Database Services in the drop-down list.

Creating a Physical Standby Database

4.

Click Add Database.

5.

Enter your (i.e. orclsby1.us.oracle.com) in the Global Database Name field. Enter your <oracle_home> and your (i.e. orclsby1) in the SID field.

Creating a Physical Standby Database

6.

Select File -> Save Network Configuration.

7.

Select File -> Exit.

Back to Topic

C. Creating the standby database over the network

1.

Reload the listener.

Creating a Physical Standby Database

2.

Navigate to ORACLE_HOME/dbs folder to perform this steps.

Copy the remote login password file (orapworcl) from the primary database system to the standby database system, renaming it to orapworclsby1.

The password file must be re-copied each time the SYSDBA or SYSOPER privilege is granted or revoked and whenever the login password of a user with these privileges is changed. You may need FTP, or some other remote file transfer mechanism, if you are using differenet servers.

NOTE: This step is required if you are using Oracle Database 11_g_ encryption, or OS authentication for administrative users.

Creating a Physical Standby Database

3.

In the ORACLE_HOME/dbs folder, for the standby system, create an initialization parameter file named initorclsby1.ora containing a single parameter: DB_NAME= (i.e. orclsby1)

Creating a Physical Standby Database

4.

For the standby system, change to the /u01/app/oracle/admin directory. Create your (i.e. orclsby1) directory. Change to your (i.e. orclsby1) directory and create the adump directory.

Creating a Physical Standby Database

5.

For the standby system, create your (i.e. orclsby1) directory in $ORACLE_BASE/oradata for the data files.

NOTE: Depending on how you installed Oracle Database 11_g_, you may need to also add the following directory paths: $ORACLE_BASE/flash_recovery_area and $ORACLE_BASE/oradata

Creating a Physical Standby Database

6.

On the standby system, set the ORACLE_SID environment variable to your (i.e. orclsby1) and start the instance in NOMOUNT mode with the text initialization parameter file.

Creating a Physical Standby Database

7.

On the primary system, ensure the ORACLE_SID environment variable is set to your primary DB (i.e. orcl).

Creating a Physical Standby Database

8.

On the primary system, invoke RMAN and connect as SYSDBA to the target database. Connect to the auxiliary database.

Creating a Physical Standby Database

9.

Execute the cr_phys_sby1.txt script from RMAN on the primary system. When this script finishes you will have a new standby database that was created over the network without any interim storage.

Creating a Physical Standby Database

Creating a Physical Standby Database

Creating a Physical Standby Database

Creating a Physical Standby Database

Creating a Physical Standby Database

Creating a Physical Standby Database

10.

Perform a log switch on the primary database and redo will start being sent to the standby.

Creating a Physical Standby Database

11.

On the standby system, ensure the ORACLE_SID environment variable is set to your (i.e. orclsby1) and start the MRP process.

Creating a Physical Standby Database

Back to Topic

Verify that the Physical Standby Database is Performing Correctly

Once you create the physical standby database and set up redo transport services, you may want to verify database modifications are being successfully transmitted from the primary database to the standby database. To see that redo data is being received on the standby database, you should first identify the existing archived redo log files on the standby database, force a log switch and archive a few online redo log files on the primary database, and then check the standby database again. The following steps show how to perform these tasks.

1.

On the standby database, identify the existing archived redo log files by querying the V$ARCHIVED_LOG view.

You can use the query_archived_log.sql file.

Creating a Physical Standby Database

2.

On the primary database, issue the ALTER SYSTEM SWITCH LOGFILE statement to force a log switch and archive the current online redo log file group.

Creating a Physical Standby Database

3.

On the standby database, re-query the V$ARCHIVED_LOG view to verify the redo data was received and archived on the standby database:

Creating a Physical Standby Database

4.

On the standby database, query the V$ARCHIVED_LOG view to verify the archived redo log files were actually applied. Please requery until you see a YES in the APPLIED column.

At the completion of this step, the physical standby database is running and provides the maximum performance level of data protection.

Creating a Physical Standby Database

Summary

In this tutorial, you learned how to:

Creating a Physical Standby Database

Prepare the Primary Database for Standby Database Creation

Creating a Physical Standby Database

Create the Physical Standby Database over the network

Creating a Physical Standby Database

Verify that the Physical Standby Database is Performing Correctly

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Wesley13 Wesley13
2年前
java将前端的json数组字符串转换为列表
记录下在前端通过ajax提交了一个json数组的字符串,在后端如何转换为列表。前端数据转化与请求varcontracts{id:'1',name:'yanggb合同1'},{id:'2',name:'yanggb合同2'},{id:'3',name:'yang
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
待兔 待兔
2个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Stella981 Stella981
2年前
Android So动态加载 优雅实现与原理分析
背景:漫品Android客户端集成适配转换功能(基于目标识别(So库35M)和人脸识别库(5M)),导致apk体积50M左右,为优化客户端体验,决定实现So文件动态加载.!(https://oscimg.oschina.net/oscnet/00d1ff90e4b34869664fef59e3ec3fdd20b.png)点击上方“蓝字”关注我
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
7个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这