Simple configuration of Oracle10g mongouard physical standby Database

Source: Internet
Author: User

 

Primary master database

IP: 192.168.50.4/24

Dbname: ora10g

Database Version: 10g R2

Operating system version: rhel6.0 64-bit

Standby physical standby Database

IP: 192.168.50.230/24

Dbname: ora10g

Database Version: 10g R2

Operating system version: rhel5.4 64-bit

I. Configure the Oracle network. Both the master database and the slave database must be configured.

[Oracle @ rhel6 ~] $ Vi/u01/app/oracle/network/admin/tnsnames. ora

PRIMARY =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.50.4) (PORT = 1521 ))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ora10g.766.com)

)

)

 

STANDBY =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.50.230) (PORT = 1521 ))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ora10g.766.com)

)

)

2. Configure the master database, modify the initialization parameters, and generate the control file for the slave database.

SQL> alter database force logging;

Database altered.

 

SQL> select force_logging from v $ database;

 

FORCE_LOG

---------

YES

 

SQL> create pfile = '/home/oracle/initora10g. ora' from spfile;

File created.

 

Add at the end of the file

Log_archive_dest_1 = 'location =/u01/arch /'

Log_archive_dest_state_1 = enable

Log_archive_dest_2 = 'service = standby'

Log_archive_dest_state_2 = enable

Log_archive_format = '% t _ % s _ % r. arc'

Log_archive_max_processes = 2

Fal_server = standby

Fal_client = primary

Db_unique_name = ora10g

 

SQL> alter database create standby controlfile as '/u01/app/oradata/ora10g/standby. ctl ';

Database altered.

Close master database

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

Iii. Slave Database Configuration

[Oracle @ localhost ~] $ Scp-rvp 192.168.50.4:/u01/app/oradata/ora10g/u01/app/oradata

[Oracle @ localhost ~] $ Scp 192.168.50.4:/home/oracle/initora10g. ora/u01/app/oracle/dbs/

 

Modify the parameters as follows:

Log_archive_dest_1 = 'location =/u01/arch /'

Log_archive_dest_state_1 = enable

Log_archive_dest_2 = 'service = primary'

Log_archive_dest_state_2 = enable

Log_archive_format = '% t _ % s _ % r. arc'

Log_archive_max_processes = 2

Fal_server = primary

Fal_client = standby

Db_unique_name = ora10g

 

Create related directories and files

[Oracle @ localhost ~] $ Mkdir/u01/arch/

[Oracle @ localhost ~] $ Mkdir-p/u01/app/admin/ora10g/{adump, bdump, cdump, udump}

[Oracle @ localhost ~] $ Cd/u01/app/oradata/ora10g/

[Oracle @ localhost ora10g] $ mv standby. ctl control01.ctl

[Oracle @ localhost ora10g] $ cp control01.ctl control02.ctl

[Oracle @ localhost ora10g] $ cp control01.ctl control03.ctl

[Oracle @ localhost ~] $ Orapwd file = $ ORACLE_HOME/dbs/orapwora10g password = 123456 entries = 5

Iv. Test

Start the master database:

Connected to an idle instance.

SQL> create spfile from pfile = '/home/oracle/initora10g. ora ';

File created.

 

SQL> startup

SQL> select name, database_role from v $ database;

 

NAME DATABASE_ROLE

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

ORA10G PRIMARY

 

Start slave database:

[Oracle @ localhost ~] $ Sqlplus/nolog

SQL * Plus: Release 10.2.0.1.0-Production on Thu Aug 4 16:49:39 2011

Copyright (c) 1982,200 5, Oracle. All rights reserved.

 

SQL> conn/as sysdba

Connected to an idle instance.

SQL> create spfile from pfile;

File created.

 

SQL> startup nomount;

ORACLE instance started.

Total System Global Area 629145600 bytes

Fixed Size 2022824 bytes

Variable Size 180355672 bytes

Database Buffers 440401920 bytes

Redo Buffers 6365184 bytes

 

 

SQL> select name, database_role from v $ database;

 

NAME DATABASE_ROLE

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

ORA10G PHYSICAL STANDBY

 

SQL> alter database recover managed standby database disconnect from session;

Database altered.

 

 

Create a table on the master database and switch to the online log group for test:

SQL> create table hr. dg01 as select * from dba_source;

Table created.

 

SQL> alter system switch logfile;

System altered.

 

SQL>/

System altered.

 

SQL>/

System altered.

 

 

Slave database:

SQL> select sequence #, first_time, next_time, applied from v $ archived_log;

 

SEQUENCE # FIRST_TIME NEXT_TIME APPLIED

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

91 2011-08-04-14:38:52 2011-08-04-14:41:21 YES

92 2011-08-04-14:41:21 2011-08-04-15:13:44 YES

93 2011-08-04-15:13:44 2011-08-04-15:15:07 YES

94 2011-08-04-15:15:07 2011-08-04-15:42:58 YES

95 2011-08-04-15:42:58 2011-08-04-16:55:53 YES

96 2011-08-04-16:55:53 2011-08-04-16:56:11 YES

97 2011-08-04-16:56:11 2011-08-04-16:56:18 YES

98 2011-08-04-16:56:18 2011-08-04-16:56:33 YES

 

8 rows selected.

 

Set the standby database to read-only to verify the data:

SQL> alter database recover managed standby database cancel;

Database altered.

 

SQL> alter database open read only;

Database altered.

 

SQL> select count (*) from hr. dg01;

 

COUNT (*)

----------

323203

Reset the standby database to the redo log status of the application.

SQL> alter database recover managed standby database disconnect from session;

Database altered.

 

This article is from the "yueda tianchong" blog

Related Article

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.