程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> Oracle 11g Linux單機STANDBY配置

Oracle 11g Linux單機STANDBY配置

編輯:Oracle數據庫基礎
 

環境:RHEL 4 U5+Oracle 11.1.0.6

主庫SID:ora11g 備用庫SID:standby

主庫數據文件存放目錄:/home/oracle/opt/oradata/ora11g/

備用庫數據文件存放目錄:/home/oracle/opt/oradata/standby/

 

1、 驗證主庫是否歸檔,如果是未歸檔模式的話必須更改為歸檔模式:

 

Sys@ORA11G> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/opt/oradata/ora11g/archive

Oldest online log sequence 61

Next log sequence to archive 63

Current log sequence 63

 

2、 將主庫置於FORCE LOGGING模式:

 

Sys@ORA11G> alter database force logging;

 

3、 對主庫做一個全庫的RMAN備份,用於STANDBY配置:

 

[oracle@test51 bin]$ ./rman target /

 

Recovery Manager: Release 11.1.0.6.0 - Production on Thu Aug 16 15:51:22 2007

 

Copyright (c) 1982, 2007, Oracle. All rights reserved.

 

connected to target database: ORA11G (DBID=4026454982)

 

RMAN> backup database format \'/home/oracle/liuyun/%U.bak\';

 

Starting backup at 16-AUG-07

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=121 device type=DISK

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00004 name=/home/oracle/opt/oradata/ora11g/users01.dbf

input datafile file number=00002 name=/home/oracle/opt/oradata/ora11g/sysaux01.dbf

input datafile file number=00001 name=/home/oracle/opt/oradata/ora11g/system01.dbf

input datafile file number=00005 name=/home/oracle/opt/oradata/ora11g/example01.dbf

input datafile file number=00003 name=/home/oracle/opt/oradata/ora11g/undotbs01.dbf

channel ORA_DISK_1: starting piece 1 at 16-AUG-07

channel ORA_DISK_1: finished piece 1 at 16-AUG-07

piece handle=/home/oracle/liuyun/03iphp8l_1_1.bak tag=TAG20070816T155148 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 16-AUG-07

channel ORA_DISK_1: finished piece 1 at 16-AUG-07

piece handle=/home/oracle/liuyun/04iphpc9_1_1.bak tag=TAG20070816T155148 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 16-AUG-07

 

4、 准備STANDBY數據文件路徑和其他路徑:

 

[oracle@test51 oradata]$ pwd

/home/oracle/opt/oradata

[oracle@test51 oradata]$ mkdir standby

[oracle@test51 oradata]$ ls

ora11g orcl standby

[oracle@test51 oradata]$ cd $ORACLE_BASE/admin

[oracle@test51 admin]$ mkdir standby

[oracle@test51 admin]$ ls

ora11g orcl standby

[oracle@test51 standby]$mkdir adump

[oracle@test51 standby]$mkdir dpdump

[oracle@test51 standby]$mkdir pfile

[oracle@test51 standby]$ ls

adump dpdump pfile

 

5、更改tnsnames配置,添加主庫和備用庫的連接字:

 

primary =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = test51)(PORT = 1522))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ora11g)

)

)

 

standby =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = test51)(PORT = 1522))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = standby)

)

)

 

6、生成STANDBY控制文件:

 

Sys@ORA11G> alter database create standby controlfile as \'/home/oracle/opt/oradata/standby/control01.ctl\';

 

Database altered.

 

[oracle@test51 standby]$ cp control01.ctl control02.ctl

[oracle@test51 standby]$ cp control01.ctl control03.ctl

[oracle@test51 standby]$ ls

archive control01.ctl control02.ctl control03.ctl

 

6、生成standby 初始化參數文件:

 

Sys@ORA11G> create pfile=\'$ORACLE_BASE/admin/standby/pfile/init.ora\' from spfile;

 

File created.

 

添加以下幾個參數,需要注意的是從11G開始原來備用庫歸檔參數standby_archive_dest這個參數已經廢除了,STANDBY的歸檔路徑改為常規的歸檔路徑log_archive_dest_n。還有原來單機配置STANDBY需要的參數lock_name_space也廢除了:

 

*.log_archive_config=\'DG_CONFIG=(ora11g,standby)\'

*.fal_client=\'standby\'

*.fal_server=\'primary\'

*.db_file_name_convert=\'ora11g\',\'standby\'  

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved