Steps to create Oracle DG physical standby

Source: Internet
Author: User
Tags backup

First, create a backup

A physical standby database is equivalent to a mirrored copy of a primary database at a point in time, so you must have at least one full backup of the primary database before you create the physical standby database.

Oracle recommends using Rman to create a backup set, but if the database is not large, I personally prefer to create a backup set in a user-managed way.

There are three ways to create a backup:

1. RMAN Backup and Recovery--no shutdown database required

Backup:

$ Rman Target/

rman> backup full format ' D:/full_%d_%t_%s.bak ' database include the current controlfile for standby;

Rman> SQL ' alter system archive log current ';

Rman> Backup archivelog all format= ' D:/arch_%d_%t_%s.bak ';

Transfer:

After backup, copy the backup files to the same directory on the standby, emphasizing: the same directory, the Rman recovery in standby can be

Recovery:

$rman targetsys/admin@primaryauxiliary/

Rman> duplicate target database for standby dorecover Nofilenamecheck;

2. User management-No need to shutdown database

Creating a hot backup in user management is a backup table space that can be divided into three steps:

1). Specifies that the tablespace enters the backup state through the ALTER tablespace BEGIN backup command token.

2). Data files that lock tablespaces are replicated through operating system commands.

3). Specifies a tablespace end backup by using the ALTER tablespace ending backup command token.

For example, to back up the users table space:

Sql> Select Tablespace_name, file_name from Dba_data_files;

Tablespace_name file_name

------------------------------ -------------------------------------------------

Users/u01/app/oracle/oradata/orcl/users01.dbf

Sysaux/u01/app/oracle/oradata/orcl/sysaux01.dbf

Undotbs1/u01/app/oracle/oradata/orcl/undotbs01.dbf

System/u01/app/oracle/oradata/orcl/system01.dbf

sql> ALTER tablespace USERS BEGIN BACKUP;

Tablespace altered.

Sql>!cp/u01/app/oracle/oradata/orcl/users01.dbf/u01/users01.dbf

sql> ALTER tablespace USERS end BACKUP;

Tablespace altered.

3. Direct copy file--shutdown

When the instance is closed, copy the data file to the standby.

Ii. creating standby Database control files

Execute the following statement on the primary library to create a control file for the standby database:

sql> ALTER DATABASE CREATE STANDBY controlfile as '/u01/backup/control01.ctl ';

Note: Control files usually require multiple copies, you can either manually copy the above files, or create a few more with the command. Note that if you choose to perform multiple copies of the above command multiple times, be sure to ensure that the database is mount when you perform the creation, otherwise the SCN of several control files may not match, causing the standby database to boot to the Mount state normally.

In addition, after creating the control file to the standby database creation time, to ensure that the primary database no longer have structural changes (such as increased table space, etc.), or primary and standby synchronization problems.

Data Guard is also based on the control file to determine which is standby

Iii. Configure initialization parameter files for the standby database

You can follow these steps:

(1) Create the Pfile client initialization parameter file.

Because the SPFile server-side initialization parameter file is in binary format and cannot be edited directly, it is recommended that the Pfile be created first through SPFile, as follows:

Sql> CREATE PFILE from SPFILE;

(2) Modify the parameters in the initialization parameter file.

Note the configuration of the initialization parameters for primary and standby different roles.

Note that the paths in each initialization parameter are kept accurate and valid.

Iv. copy files to the standby server

Copying files to a standby server consists of three main parts: a backed-up data file, a standby database control file created, and a modified initialization parameter file.

V. Configuring the STANDBY Database

If you are in a Windows environment, you also need to create a new oracleservice.

Oradim.exe-new-sid Orcl-startmode m

Oradim.exe-edit-sid Orcl-startmode A

Create a key file, and be careful to keep the password consistent with the primary database.

Configure the listener and start.

Modify the Tnsnames.ora of the server on which the primary database resides and the server on which the standby database resides, and add the corresponding net Service Name separately.

Creates a server-side initialization file.

Six, start the physical standby database redo Application

Once you have finished configuring the standby database, you can start the standby database. Physical standby can be opened in read write mode in very few cases, and in some cases can be opened in read Only mode, but in most cases it should be initiated to the Mount State.

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.