A simple method for creating Oracle Database 11g dataguard

Source: Internet
Author: User
The Oracle Database 11g has enhanced the DataGuard function in many aspects, so it is difficult to describe it in detail. Therefore, here I will introduce some feature enhancements that I am most interested in. Backup

Oracle Database 11g has enhanced the Data Guard function in many aspects, which is difficult to describe in detail. Therefore, here I will introduce some feature enhancements that I am most interested in. Backup

Learn how Active Data Guard performs real-time queries, applies archived logs, converts physical backup databases to Snapshot Backup databases, and provides a series of improvement measures for the infrastructure, this makes your investment in the backup environment worthwhile.

Download Oracle Database 11 GB

Oracle Database 11g has enhanced the Data Guard function in many aspects, which is difficult to describe in detail. Therefore, here I will introduce some feature enhancements that I am most interested in.

Creating backup databases is simpler
First, we start from creating a physical standby database. In the Oracle Database 11 GB, the creation of the physical standby database has become extremely simple, and an RMAN command can complete the entire process. In the past, you may need to use the Grid Control wizard interface to complete Data Guard settings between two computers. At the time of writing this article, the Oracle Enterprise Manager Grid Control 11g has not yet been released, and the Database Control does not have the Data Guard wizard. However, whether or not you have used SQL commands, setting Data Guard in Oracle Database 11g is very easy. The process is so simple that I will introduce all the steps here.

Assume that your primary database is named prolin11 and runs on the prolin1 server. You want to set up a backup database on the prolin2 server. The name of the backup database instance should be pro11sb. Follow these steps:

On prolin1, create a spfile first (if you do not have one ).
SQL> create spfile from pfile;
This step is not absolutely necessary, but it can simplify this process. After creating the database, restart the prolin11 database to use spfile.

Although there is no need to create backup redo logs, this is a good practice. Backup redo logs can reflect changes in the primary database in almost real time in the standby database. This concept is called real-time applications (RTA ). Therefore, we will create a backup redo log in the primary database (note that the backup redo log is created in the primary database. RMAN will create them in the standby database ):
SQL> alter database add standby redo logfile group 4
2> ('+ DG1/sby_redo01.rdo') size 50 M;
SQL> alter database add standby redo logfile group 5
2> ('+ DG1/sby_redo02.rdo') size 50 M;
SQL> alter database add standby redo logfile group 6
2> ('+ DG1/sby_redo03.rdo') size 50 M;
SQL> alter database add standby redo logfile group 7
2> ('+ DG1/sby_redo04.rdo') size 50 M;
This will create four standby redo log groups.

Create a pro11sb entry in the listener. ora file on the prolin2 Server:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = pro11sb)
(ORACLE_HOME =/opt/oracle/product/11g/db1)
(SID_NAME = pro11sb)
)
)

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = prolin2) (PORT = 1521 ))
)
Reload the listener to make it take effect.
On prolin1, create a pro11sb database entry in the tnsnames. ora file under $ ORACLE_HOME/network/admin:
PRO11SB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = prolin2) (PORT = 1521 ))
)
(CONNECT_DATA =
(SID = pro11sb)
)
)
In the Oracle Home/dbs directory on prolin2, create an initodba11sb. ora file containing only one row:
Db_name = prolin11
This will be used as the backup instance's initialization file, and other parameters will be automatically filled with the RMAN command described later.

On prolin2, enter the directory $ ORACLE_BASE/admin. Create the pro11sb directory and create the adump directory in the pro11sb directory to save the audit files of the backup instance.

On prolin1, under the $ ORACLE_HOME/dbs directory, you will find the password file of the instance, usually named orapworadba11. If the file does not exist (unlikely), create one. Copy the file to $ ORACLE_HOME/dbs in prolin2. Copy it to the new file orapwodba11sb. This ensures that the master database's sysdba connection password can also be applied to the slave database.

On prolin2, start the instance pro11sb in NOMOUNT state.
$ Sqlplus/as sysdba
SQL> startup nomount
This will start the instance but will not mount anything.

After completing the preparation, call a powerful RMAN script to create a backup database. Start RMAN on prolin1 and run the following script. You will find it easier to save it to a file and then run the script from the RMAN prompt.
Connect target sys/oracle123 @ prolin11
Connect auxiliary sys/oracle123 @ pro11sb

Run {
Allocate channel c1 type disk;
Allocate auxiliary channel s1 type disk;

Duplicate target database
For standby
From active database
Dorecover
Spfile
Parameter_value_convert 'prolin11', 'pro11sb'
Set db_unique_name = 'pro11sb'
Set db_file_name_convert = '/prolin11/', '/pro11sb /'
Set log_file_name_convert = '/prolin11/', '/pro11sb /'
Set control_files = '/oradata/pro11sb/control01.ctl'
Set fal_client = 'pro11sb'
Set fal_server = 'lin11'
Set standby_file_management = 'auto'
Set log_archive_config = 'dg _ config = (prolin11, pro11sb )'
Set log_archive_dest_2 = 'service = prolin11 lgwr async valid_for = (ONLINE_LOGFILES, PRIMARY_ROLE) db_unique_name = pro11sb'
Set log_archive_dest_state_2 = 'enable'
Set log_archive_format = 'pro11sb _ % t _ % s _ % r. arc'
;
SQL channel c1 "alter system archive log current ";
SQL channel s1 "alter database recover managed standby database using current logfile disconnect ";
}
This script will create a backup database, place relevant parameters in the spfile of the backup instance, create a diagnostic target for the backup database, and then restart the backup database. To help you understand the specific mechanism of this operation, you can view the output of the RMAN command here.

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.