This document is only the process of deploying Dataguard, does not involve the interpretation and description of concepts, there is no dataguard theory of introduction, in this regard, please check the official Oracle documentation.
Operating system: RedHat 4.2
[ORACLE@DG1 ~]$ Uname-a
Linux dg1 2.6.9-22.el #1 Mon Sep 18:20:28 EDT i686 i686 i386
Oracle Software: Oracle 10g release 10.2.0.1.0
Host information:
Machine Name: DG1 IP Address: 192.168.1.90
Standby information:
Machine Name: DG2 IP Address: 192.168.1.91
The following actions, [ROOT@DG1 ~] #表示主机root用户登录 [ORACLE@DG1 ~]$ represent host Oracle user logon
[ROOT@DG2 ~] #表示备机root用户登录 [Oracle@dg2 ~]$ represents a standby Oracle user login
Operating Prerequisites: On the host DG1, the database software and Oracle database (DB01) has been installed and created, on the standby dg2, only the installation of Oracle software, no database, the physical database through the Rman command to create, the main library has been archived open.
The first step: Host database Settings force logging, only perform actions on the main library
[Oracle@dg1 oracle]$ Sqlplus/as SYSDBA
Sql*plus:release 10.2.0.1.0-production on Wed Apr 27 19:49:13 2011
Copyright (c) 1982, +, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-production
With the partitioning, OLAP and Data Mining options
Sql>
sql> ALTER DATABASE force logging;
Step Two: Configure the network environment of the main and standby machines
Configure the client connection by modifying the main and standby machine Tnsnames.ora files, configuring server-side monitoring by modifying the Listener.ora file of the primary and standby machines, and adding static registration to the file
The file location is under/u01/app/oracle/product/10.2.0/network/admin.
The following is only the example of the host DG1 file, the host IP Listener.ora in the standby file should be changed to 192.168.1.91
Turn off listening, edit the contents of the Listener.ora file, do not need to do the listening operation in the standby, the repository itself is not listening
Lsnrctl> stop
Connecting to (description= address= (protocol=tcp) (host=192.168.1.90) (port=1521))
The command completed successfully
# Listener.ora Network Configuration File:/u01/app/oracle/product/10.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.
Sid_list_listener =
(Sid_list =
(Sid_desc =
(Global_dbname = db01)
(Oracle_home =/u01/app/oracle/product/10.2.0)
(Sid_name = db01)
)
)
LISTENER =
(DESCRIPTION =
(address = (PROTOCOL = TCP) (HOST = 192.168.1.90) (PORT = 1521))
)
Start listening,lsnrctl> start
Tnsnames.ora File Contents
# Tnsnames.ora Network Configuration File:/u01/app/oracle/product/10.2.0/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DB01 =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 192.168.1.90) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = db01)
)
)
PRIMARY =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 192.168.1.90) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = db01)
)
)
STANDBY =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 192.168.1.91) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = db01)
)
)
Step three: Use the Oracle user to create the password file in the standby $oracle_home/dbs directory, which is the same as the password of the host SYS user, in this case Oracle
[Oracle@dg2 Oracle] $orapwd file=orapwdb01 password=oracle entries=5
Step Fourth: Use an Oracle user to create a directory structure for standby db on the standby
[Root@dg2 ~]# Su-oracle
[Oracle@dg2 ~]$ pwd
/home/oracle
[Oracle@dg2 ~]$ mkdir Backup
[Oracle@dg2 ~]$ Cd/u01/app/oracle
[Oracle@dg2 oracle]$ pwd
/u01/app/oracle
[Oracle@dg2 oracle]$ mkdir-p Admin/db01/adump
[Oracle@dg2 oracle]$ mkdir-p Admin/db01/bdump
[Oracle@dg2 oracle]$ mkdir-p Admin/db01/cdump
[Oracle@dg2 oracle]$ mkdir-p Admin/db01/ddump
[Oracle@dg2 oracle]$ mkdir-p Admin/db01/udump
[Oracle@dg2 oracle]$ mkdir Flash_recovery_area
[Oracle@dg2 oracle]$ mkdir archdest
[Oracle@dg2 oracle]$ mkdir-p ORADATA/DB01
Step Fifth: Modify the main standby parameter file, add and edit the parameters required by the Dataguard DB environment, this step can also be implemented by the ALTER SYSTEM command, following only the host DG1 example,
If the database is open, execute the following command
Sql> create Pfile from SPFile;
File created.
Close Database
sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Sql> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-production
With the partitioning, OLAP and Data Mining options
To the DBS directory, find Initdb01.ora use VI Editor to add and modify related parameters, save exit. The specific editing process is omitted.
[ORACLE@DG1 ~]$ CD $ORACLE _home/dbs
[ORACLE@DG1 dbs]$ Ls-l
Total 6960
-RW-RW----1 Oracle oinstall 1544 16:16 Hc_db01.dat
-rw-r--r--1 Oracle Oinstall 1421 Feb 17:34
-RW-R-----1 Oracle Oinstall 12920 May 3 2001 Initdw.ora
-RW-R-----1 Oracle Oinstall 8385 SEP 1998 Init.ora
-RW-RW----1 Oracle oinstall 16:17 lkDB01