Configure the Dataguard test for Oracle11g and create the physical standby database (PhysicalStandbyDatabase)

Source: Internet
Author: User
Both master and slave databases are of the same Linux system version, and the database version is Oracle11gR2 master database: 10.1.1.1 slave Database: 10.2.2.21. confirm that the master and slave database system is: [root @

Both master and slave databases are of the same Linux system version, and the database version is Oracle11gR2 master database: 10.1.1.1 slave Database: 10.2.2.21. confirm that the master and slave database system is: [root @

Both the master and slave databases are of the same Linux system version, and the database version is Oracle11gR2.
Master Database: 10.1.1.1 slave Database: 10.2.2.2
1. Confirm the Master/Slave Database System
System:
[Root @ LINUXIDC1 ~] # Uname-
Linux LINUXIDC1 2.6.18-194. el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

Slave database:
[Root @ LINUXIDC2 ~] # Uname-
Linux LINUXIDC2 2.6.18-194. el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

2. Set in the master database:
SQL> ALTER DATABASE FORCE LOGGING;
View the following parameters:
For example, SQL> show parameter LOG_ARCHIVE_DEST_1
Master Database
DB_NAME = bhoms
DB_UNIQUE_NAME = bhoms01 (if it is a spfile file, alter system set db_unique_name = 'bhoms01 'scope = spfile; after modifying the parameters, You can restart the database)
LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (bhoms01, bhoms02) '(alter system set log_archive_config = 'dg _ config = (bhoms01, bhoms02 )';)
LOG_ARCHIVE_DEST_1 = 'location =/u01/app/oracle/flash_recovery_area/BHOMS/archivelog valid_for = (all_logfiles, all_roles) db_unique_name = bhoms01'
(Alter system set log_archive_dest_1 = 'location =/u01/app/oracle/flash_recovery_area/BHOMS/archivelog valid_for = (all_logfiles, all_roles) db_unique_name = bhoms01 ';)
LOG_ARCHIVE_DEST_2 = 'service = bhoms02 async valid_for = (online_logfiles, primary_role) db_unique_name = bhoms02'
(Alter system set log_archive_dest_2 = 'service = bhoms02 async valid_for = (online_logfiles, primary_role) db_unique_name = bhoms02 ';)
LOG_ARCHIVE_DEST_STATE_1 = ENABLE (alter system set LOG_ARCHIVE_DEST_STATE_1 = ENABLE ;)
LOG_ARCHIVE_DEST_STATE_2 = ENABLE (alter system set LOG_ARCHIVE_DEST_STATE_2 = ENABLE ;)
FAL_SERVER = bhoms02 (alter system set fal_server = bhoms02 ;)
FAL_CLIENT = bhoms01 (alter system set fal_client = bhoms01 ;)
DB_FILE_NAME_CONVERT = 'bhoms02 ', 'bhoms01' (alter system set DB_FILE_NAME_CONVERT = 'bhoms02 ', 'bhoms01' scope = spfile ;)
LOG_FILE_NAME_CONVERT = '/u01/app/oracle/oradata/bhoms/', '/u01/app/oracle/oradata/bhoms ', '/u01/app/oracle/flash_recovery_area/BHOMS02/onlinelog', '/u01/app/oracle/flash_recovery_area/BHOMS01/onlinelog'
(Alter system set log_file_name_convert = '/u01/app/oracle/oradata/bhoms/', '/u01/app/oracle/oradata/bhoms ', '/u01/app/oracle/flash_recovery_area/BHOMS02/onlinelog', '/u01/app/oracle/flash_recovery_area/BHOMS01/onlinelog' scope = spfile ;)
STANDBY_FILE_MANAGEMENT = AUTO (alter system set STANDBY_FILE_MANAGEMENT = AUTO ;)

Close the database:
SQL> shutdown immediate;

Start:
SQL> startup

View:
SQL> select * from v $ dataguard_config;

DB_UNIQUE_NAME
------------------------------
Bhoms01
Bhoms02

3. Back up data in the master database
[Oraoms @ LINUXIDC1 ~] $ Rman target/
RMAN> backup database;

Upload the backup data file ftp to the backup database/home/oraoms/backup.
Ftp 10.2.2.2
Enter user and password
Cd/home/oraoms/backup
Bin
Put file name
Bye

Create a control file for the slave database on the master database
SQL> alter database create standby controlfile as '/home/oraoms/bhoms02.ctl ';

Database altered.
Create the pfile file required for backup on the master database
SQL> create pfile = '/home/oraoms/initbhoms. ora' from spfile;

File created.

Upload the above control file, pfile file, and password file to the slave database.
(The password file is located at $ ORACLE_HOME/dbs/orapwbhoms)

4. File authorization on the slave Database
[Oraoms @ LINUXIDC2 backup] $ pwd
/Home/oraoms/backup
[Oraoms @ LINUXIDC2 backup] $ chmod 777 *

5. The database named bhoms has been installed on the false device library.
Close the database and back up data files to other directories.
SQL> shutdown immediate

Configure the slave database tnsnames. ora ($ ORACLE_HOME/network/admin/tnsnames. ora)
Bhoms01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.1.1.1) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bhoms01)
)
)

Bhoms02 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.2.2.2) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bhoms02)
)
)

Test:
[Oraoms @ LINUXIDC2 admin] $ tnsping bhoms01
[Oraoms @ LINUXIDC2 admin] $ tnsping bhoms02

Configure tnsnames. ora ($ ORACLE_HOME/network/admin/tnsnames. ora) of the master database)
Bhoms01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.1.1.1) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bhoms01)
)
)

Bhoms02 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.2.2.2) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bhoms02)
)
)
Test:
[Oraoms @ LINUXIDC1 admin] $ tnsping bhoms01
[Oraoms @ LINUXIDC1 admin] $ tnsping bhoms02

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.