Step By Step Configure DataGuard (10g) Physical Standby Database On Linux X86_64(1/2待續...)
一. 環境描述
主節點Primary db server:
hostname: primarydb
ip: 168.0.3.92
sid: gridctl
備節點Standby db server:
hostname:standbydb
ip: 168.0.3.93
sid: gridctl
Two nodes:
#more /etc/hosts
168.10.13.192 primarydb
168.10.13.193 standbydb
ORACLE_HOME:/oracle/product/10.2.0/db_1
Archivelog_dest:/oradata/archivelog/primary_arc
/oradata/archivelog/standby_arc
datafile directory: /oradata/gridctl/
[@more@]二. 建立物理備用資料庫(Create Physical Standby Database)
- 編輯主節點資料庫環境
1.1 設定主節點歸檔日誌目錄,standby歸檔日誌目錄
#su - oracle
$cd /oradata/archivelog
$mkdir primary_arc standby_arc
$sqlplus / as sysdba
SQL>alter system set log_archive_dest_1='LOCATION=/oradata/archivelog/primary_arc' scope=both;
SQL>alter system set standby_archive_dest='/oradata/archivelog/standby_arc' scope=both;
1.2 如果主庫不是歸檔模式,需要將主庫修改為歸檔模式
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oradata/archivelog/primary_arc
Oldest online log sequence 204
Current log sequence 206
SQL> shutdown immediate;
Database closed.
Database dismounted.
SQL> startup mount;
ORACLE instance started.
。。。。。。
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL>!
[oracle@primarydb primary_arc]$ pwd
/oradata/archivelog/primary_arc
[oracle@primarydb primary_arc]$ ls -lt
total 376
-rw-r----- 1 oracle oinstall 379904 Sep 2 17:26 1_207_724504451.dbf
$exit
1.3 設定主節點為force logging 模式
SQL>alter database force logging;
Database altered.
- 主節點上,生成備用庫所需的檔案(資料檔案,控制檔案,PFILE)
2.1 查詢主節點資料檔案
SQL> select name from v$datafile;
/oradata/gridctl/system01.dbf
/oradata/gridctl/undotbs01.dbf
/oradata/gridctl/sysaux01.dbf
/oradata/gridctl/users01.dbf
/oradata/gridctl/mgmt.dbf
/oradata/gridctl/mgmt_ecm_depot1.dbf
SQL> select name from v$tempfile;
/oradata/gridctl/temp01.dbf
SQL> select member from v$logfile;
/oradata/gridctl/redo01.log
/oradata/gridctl/redo02.log
/oradata/gridctl/redo03.log
SQL> select name from v$controlfile;
/oradata/gridctl/ora_control1.dbf
/oradata/gridctl/ora_control2.dbf
/oradata/gridctl/ora_control3.dbf
SQL> !
[oracle@primarydb ~]$ cd /oradata/gridctl
[oracle@primarydb gridctl]$ ls -lt
total 2696988
-rw-r----- 1 oracle oinstall 104858112 Sep 3 09:28 redo02.log
-rw-r----- 1 oracle oinstall 6832128 Sep 3 09:28 ora_control1.dbf
-rw-r----- 1 oracle oinstall 6832128 Sep 3 09:28 ora_control2.dbf
-rw-r----- 1 oracle oinstall 6832128 Sep 3 09:28 ora_control3.dbf
-rw-r----- 1 oracle oinstall 822091776 Sep 3 09:28 system01.dbf
-rw-r----- 1 oracle oinstall 484450304 Sep 3 09:28 undotbs01.dbf
-rw-r----- 1 oracle oinstall 398467072 Sep 3 09:28 mgmt.dbf
-rw-r----- 1 oracle oinstall 340795392 Sep 3 09:26 sysaux01.dbf
-rw-r----- 1 oracle oinstall 104865792 Sep 3 09:21 mgmt_ecm_depot1.dbf
-rw-r----- 1 oracle oinstall 268443648 Sep 3 07:02 users01.dbf
-rw-r----- 1 oracle oinstall 104858112 Sep 3 06:57 redo01.log
-rw-r----- 1 oracle oinstall 209723392 Sep 3 05:05 temp01.dbf
-rw-r----- 1 oracle oinstall 104858112 Sep 2 17:26 redo03.log
2.2 將主節點資料檔案打包
SQL>shutdown immediate;
Database closed.
Database dismounted.
SQL>exit
[oracle@primarydb ~]$cd /oradata
[oracle@primarydb ~]$tar -cvf oradata_gridctl.tar gridctl
2.3 在主節點上建立備用庫控制檔案
SQL> startup
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2089472 bytes
Variable Size 578817536 bytes
Database Buffers 490733568 bytes
Redo Buffers 2101248 bytes
Database mounted.
Database opened.
SQL> alter database create standby controlfile as '/oradata/stdcontrol.ctl';
Database altered.
2.4 在主節點上建立pfile,並做相應的修改
SQL>create pfile='/oradata/initgridctl.ora' from spfile;
SQL>exit
[oracle@primarydb ~]cd /oradata
[oracle@primarydb oradata]$ more initgridctl.ora
。。。。。。
*.control_files='/oradata/gridctl/stdcontrol.ctl'
*.log_archive_dest_1='LOCATION=/oradata/archivelog/primary_arc'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.standby_archive_dest='/oradata/archivelog/standby_arc'
*.fal_server='PRIMARY'
*.fal_client='STANDBY'
*.standby_file_management='AUTO'
。。。。。。
本節主要是在主節點上生成三個檔案,分別為:
/oradata/oradata_gridctl.tar
/oradata/stdcontrol.ctl
/oradata/initgridctl.ora
- 透過ftp方式將主節點的三個檔案複製到備用庫,並分別解壓或者複製到合適的位置
透過ftp,將主節點/oradata/oradata_gridctl.tar;/oradata/stdcontrol.ctl兩個檔案以bin方式ftp到備庫,將主節點/oradata/initgridctl.ora以asc方式ftp到備庫.
備節點:
[oracle@standbydb oradata]$ ls -lt
-rw-r--r-- 1 oracle oinstall 1285 Sep 3 17:15 initgridctl.ora
-rw-r--r-- 1 oracle oinstall 6832128 Sep 3 17:15 stdcontrol.ctl
-rw-r--r-- 1 oracle oinstall 2963916800 Sep 3 17:14 oradata_gridctl.tar
drwxr-xr-x 2 oracle dba 4096 Sep 3 17:12 archivelog
drwxr-xr-x 2 oracle dba 16384 Aug 12 2009 lost+found
[oracle@standbydb oradata]$ tar -xvf oradata_gridctl.tar
gridctl/
gridctl/ora_control1.dbf
gridctl/ora_control2.dbf
gridctl/ora_control3.dbf
gridctl/redo01.log
gridctl/redo02.log
gridctl/redo03.log
gridctl/system01.dbf
gridctl/undotbs01.dbf
gridctl/sysaux01.dbf
gridctl/temp01.dbf
gridctl/users01.dbf
gridctl/mgmt.dbf
gridctl/mgmt_ecm_depot1.dbf
[oracle@standbydb oradata]$ mv stdcontrol.ctl ./gridctl
[oracle@standbydb oradata]$ cd gridctl
[oracle@standbydb gridctl]$ ls -lt
-rw-r--r-- 1 oracle oinstall 6832128 Sep 3 17:15 stdcontrol.ctl
-rw-r----- 1 oracle oinstall 6832128 Sep 3 09:35 ora_control1.dbf
-rw-r----- 1 oracle oinstall 6832128 Sep 3 09:35 ora_control2.dbf
-rw-r----- 1 oracle oinstall 6832128 Sep 3 09:35 ora_control3.dbf
-rw-r----- 1 oracle oinstall 398467072 Sep 3 09:35 mgmt.dbf
-rw-r----- 1 oracle oinstall 104865792 Sep 3 09:35 mgmt_ecm_depot1.dbf
-rw-r----- 1 oracle oinstall 104858112 Sep 3 09:35 redo02.log
-rw-r----- 1 oracle oinstall 340795392 Sep 3 09:35 sysaux01.dbf
-rw-r----- 1 oracle oinstall 822091776 Sep 3 09:35 system01.dbf
-rw-r----- 1 oracle oinstall 484450304 Sep 3 09:35 undotbs01.dbf
-rw-r----- 1 oracle oinstall 268443648 Sep 3 09:35 users01.dbf
-rw-r----- 1 oracle oinstall 104858112 Sep 3 06:57 redo01.log
-rw-r----- 1 oracle oinstall 209723392 Sep 3 05:05 temp01.dbf
-rw-r----- 1 oracle oinstall 104858112 Sep 2 17:26 redo03.log
- 備機上建立一些必須的目錄,目錄的結構與主節點相同
4.1 建立歸檔日誌的相關目錄
[oracle@standbydb dbs]$ cd /oradata/archivelog
[oracle@standbydb archivelog]$ ls
[oracle@standbydb archivelog]$ mkdir primary_arc standby_arc
[oracle@standbydb archivelog]$ ls -lt
total 8
drwxr-xr-x 2 oracle oinstall 4096 Sep 3 17:26 primary_arc
drwxr-xr-x 2 oracle oinstall 4096 Sep 3 17:26 standby_arc
4.2 建立dump相關目錄
[oracle@standbydb oracle]$ cd /oracle
[oracle@standbydb oracle]$ ls
OracleHomes oraInventory product
[oracle@standbydb oracle]$ mkdir admin
[oracle@standbydb oracle]$ cd admin
[oracle@standbydb admin]$ mkdir gridctl
[oracle@standbydb admin]$ cd gridctl
[oracle@standbydb gridctl]$ pwd
/oracle/admin/gridctl
[oracle@standbydb gridctl]$ mkdir adump bdump cdump udump
[oracle@standbydb gridctl]$ ls -lt
total 20
drwxr-xr-x 2 oracle oinstall 4096 Sep 3 17:27 adump
drwxr-xr-x 2 oracle oinstall 4096 Sep 3 17:27 bdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 3 17:27 cdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 3 17:27 udump
- 配置主節點的監聽器LISTENER.ORA和TNSNAMES.ORA 檔案
[oracle@primarydb /]$ cd $ORACLE_HOME/network/admin
[oracle@primarydb admin]$ more listener.ora
。。。。。。
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = gridctl)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(SID_NAME = gridctl)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primarydb)(PORT = 1521))
)
配置完主節點監聽器listener.ora檔案後,啟動主節點監聽器
[oracle@primarydb admin]$ lsnrctl
LSNRCTL> start
Starting /oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=primarydb)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 03-SEP-2010 17:48:33
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/product/10.2.0/db_1/network/log/listener.log
Service "gridctl" has 1 instance(s).
Instance "gridctl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@primarydb admin]$ more tnsnames.ora
。。。。。。
PRIMARY=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primarydb )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = gridctl)
)
)
STANDBY=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standbydb )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = gridctl)
)
)
- 配置備庫監聽器及tnsnames.ora檔案
[oracle@standbydb ]$cd $ORACLE_HOME/network/admin
[oracle@standbydb admin]$ more listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = gridctl)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(SID_NAME = gridctl)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standbydb)(PORT = 1521))
)
配置完備庫監聽器listener.ora檔案後,啟動備庫監聽器
[oracle@standbydb admin]$ lsnrctl
LSNRCTL> start
。。。。。。
Starting /oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=standbydb)(PORT=1521)))
Service "gridctl" has 1 instance(s).
。。。。。。
[oracle@standbydb admin]$ more tnsnames.ora
PRIMARY=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primarydb )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = gridctl)
)
)
STANDBY=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standbydb )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = gridctl)
)
)
- 在主備節點上分別用tnsping測試網路連通性
7.1 主節點測試網路連通性
[oracle@primarydb admin]$ tnsping primary
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = primarydb)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = gridctl)))
OK (0 msec)
[oracle@primarydb admin]$ tnsping standby
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = standbydb)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = gridctl)))
OK (10 msec)
主節點連線primary,standby都是通的。
7.2 備節點測試網路連通性
[oracle@standbydb admin]$ tnsping primary
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = primarydb)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = gridctl)))
OK (0 msec)
[oracle@standbydb admin]$ tnsping standby
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = standbydb)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = gridctl)))
OK (10 msec)
備節點連線primary,standby都是通的。
7.3 在主、備機上檢查$ORACLE_HOME/dbs/orapw
[oracle@standbydb]$cd $ORACLE_HOME/dbs
[oracle@standbydb]$orapwd file=$ORACLE_HOME/dbs/orapwgridctl2 password=password entries=5
- 在備庫節點,建立spfile,並啟動備資料庫到standby role狀態
[oracle@standbydb ~]$ sqlplus / as sysdba
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2089472 bytes
Variable Size 578817536 bytes
Database Buffers 490733568 bytes
Redo Buffers 2101248 bytes
SQL> alter database mount standby database;
Database altered.
SQL> alter database recover managed standby database disconnect from session;
Database altered.
- 在主節點上設定歸檔路徑,切換幾次日誌
[oracle@primarydb admin]$ sqlplus / as sysdba
SQL> alter system set log_archive_dest_2='service=standby mandatory reopen=60' scope=both;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
在備節點上觀察日誌:
[oracle@standbydb bdump]$ tail -f alert_gridctl.log
-- Connected User is Valid
RFS[2]: Assigned to RFS process 20551
RFS[2]: Identified database type as 'physical standby'
RFS[2]: Archived Log: '/oradata/archivelog/standby_arc/1_209_724504451.dbf'
Fri Sep 3 18:31:19 2010
RFS[1]: Archived Log: '/oradata/archivelog/standby_arc/1_210_724504451.dbf'
Fri Sep 3 18:31:22 2010
Media Recovery Log /oradata/archivelog/standby_arc/1_209_724504451.dbf
Media Recovery Log /oradata/archivelog/standby_arc/1_210_724504451.dbf
Media Recovery Waiting for thread 1 sequence 211
Fri Sep 3 18:32:06 2010
RFS[2]: Archived Log: '/oradata/archivelog/standby_arc/1_211_724504451.dbf'
Fri Sep 3 18:32:06 2010
Media Recovery Log /oradata/archivelog/standby_arc/1_211_724504451.dbf
Media Recovery Waiting for thread 1 sequence 212
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/32980/viewspace-1037818/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Step By Step Configure DataGuard (10g) Physical Standby Database On Linux X86_64(2/2)DatabaseLinux
- Step By Step Install Oracle GC 10.2.0.5 on Redhat Linux 5.5 x86_64 (1/2待續...)OracleGCRedhatLinux
- Step By Step Guide To Create Physical Standby Database Using RMAN [ID 469493.1]GUIIDEDatabase
- oracle Physical Standby failover stepOracleAI
- Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE WithoutGUIIDEDatabase
- Step By Step Install Oracle GC 10.2.0.5 on Redhat Linux 5.5 x86_64 (2/2)OracleGCRedhatLinux
- Step-By-Step Guide To Create Physical Standby On Normal File System For ASM Primary using RMANGUIIDEORMASM
- Oracle 11gR2 Active DataGuard配置Step By Step(一)Oracle
- Oracle 11gR2 Active DataGuard配置Step By Step(二)Oracle
- Oracle 11gR2 Active DataGuard配置Step By Step(三)Oracle
- Step By Step Guide On Creating Physical Standby Using RMAN Duplicate In ASM Filesystem For ASM PrimaGUIIDEASM
- ORACLE10g DataGuard 配置Physical Standby DatabaseOracleDatabase
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(1)LinuxOracle 10g
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(2)LinuxOracle 10g
- oracle 10g physical standby database creationOracle 10gDatabase
- DataGuard:Physical Standby Switchover
- Oracle 10g R2建立ASM例項Step By Step(一)Oracle 10gASM
- Oracle 10g R2建立ASM例項Step By Step(四)Oracle 10gASM
- Step by Step Guide on How to Create Logical Standby [ID 738643.1]GUIIDE
- 使用RMAN備份集搭建Oracle Dataguard Step by Step(一)Oracle
- 使用RMAN備份集搭建Oracle Dataguard Step by Step(二)Oracle
- 配置 Oracle 10g RAC primary + RAC physical standby dataguardOracle 10g
- Step By Step of Configuring Oracle 11gR2 (11.2.0.1) RAC to RAC DataguardOracle
- DataGuard:Physical Standby FailoverAI
- Learn C++ step by step(2) (轉)C++
- Linux Software RAID step by stepLinuxAI
- 安裝linux(step by step)(轉)Linux
- step by step install oracle 10g rac asm on windowsOracle 10gASMWindows
- Git Step by Step (7):Git遠端倉庫(續)Git
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- Step by step install grid control agent on linux 5.3 x86_64遠端安裝Linux
- Recover physical standby database after loss of archive log(2)DatabaseHive
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(10)LinuxOracle 10g
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(9)LinuxOracle 10g
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(8)LinuxOracle 10g
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(7)LinuxOracle 10g
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(6)LinuxOracle 10g
- 單機Linux平臺Oracle 10g DataGuard Physical Standby 搭建例項(5)LinuxOracle 10g