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

oracle dataguard 安裝配置

編輯:Oracle數據庫基礎

今天安裝小布老師的視頻和參看Oracle 10g 聯機文檔把dataguard 配置起來了。(花了一天的時間)
下面是步驟,供初學者參考。
(高級內容及詳細原理有待進一步研究)
############################
station 1(primary database)
#############################
IPADDR:192.168.1.4
ORACLE_HOME=/u01/Oracle/product/10.2.0/db_1
Oracle_SID=primary
db_unique_name=primary############################
station 2(standby database)
###########################
IPADDR:192.168.1.8
ORACLE_HOME=/u01/Oracle/product/10.2.0/db1
db_unique_name=standby
[主庫部分]
#主庫安裝instance(archive log mode),備庫只安裝軟件
#SQL>ALTER DATABASE FORCE LOGGING;
#創建密碼文件,如果有就不用創建了
[ORACLE]#orpwd file=orapw$ORACLE_SID passWord=Oracle entrIEs=5#添加主庫STANDBY LOGFILE 文件
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u01/oradata/primary/redo041.log') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/u01/oradata/primary/redo051.log') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/u01/oradata/primary/redo061.log') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/u01/oradata/primary/redo071.log') SIZE 50M;#主庫生成pfile
SQL>create pfile from spfile;#主庫修改pfile文件
log_archive_dest_1='LOCATION=/u01/archive'
log_archive_dest_state_1=enable
log_archive_dest_2='SERVICE=standby'
log_archive_dest_state_2=enable
log_archive_start=true
fal_server=standby
fal_clIEnt=primary
db_unique_name=primarySQL>create spfile from pfile;#主庫中創建備庫control file
SQL>shutdown immediate
SQL>startup mount;
SQL>alter database create standby controlfile as
    '/u01/oradata/primary/standby.ctl'
SQL>alter database open;
SQL>shutdown immediate#copy 主庫的數據到備庫中
1.oradata/*(data file,control file, redo file)
scp -r /u01/oradata 192.168.1.8:/u01/oradata2.admin/*(bdump,cdump,adump)
scp -r /u01/admin 192.168.1.8:/u013.dbs/*(listener.ora initprimary.ora)
#備庫中刪除主庫拷貝過來的控制文件
#將之前生成的standby.ctl 復制成三份控制文件保存[備庫部分]
#修改備庫的pfile文件
log_archive_dest_1='LOCATION=/u01/archive'
log_archive_dest_state_1=enable
log_archive_dest_2='SERVICE=primary'
log_archive_dest_state_2=enable
log_archive_start=true
#此處的fal_server,fal_clIEnt的值是tnsnames.ora文件裡面的值
fal_server=primary
fal_clIEnt=standby
db_unique_name=standby#另外創建備庫logfile 組
#創建備庫的logfile 組是根據主庫中logfile group的數量決定的。
#(maximum number of logfiles for each thread + 1) * maximum number of threadsALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u01/oradata/primary/redo041.log') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/u01/oradata/primary/redo051.log') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/u01/oradata/primary/redo061.log') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/u01/oradata/primary/redo071.log') SIZE 50M;
測試
#啟動主庫
#啟動備庫listenerSQL>create spfile from pfile;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>select name,database_role from v$database;
NAME      DATABASE_ROLE
--------- ----------------
PRIMARY   PHYSICAL STANDBYSQL>alter database recover managed standby database disconnect from session;SQL>select sequence#,first_time,next_time from v$archived_log order by sequence#;SQL>select sequence#,applIEd from v$archived_log order by sequence#;
################
primary database
listener.ora
#################
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/Oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = primary)
      (ORACLE_HOME = /u01/Oracle/product/10.2.0/db_1)
      (SERVICE_NAME = primary)
    )
  )LISTENER01 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )
LISTENER02 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )
################
primary database
tnsnames.ora
#################
PRIMARY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.4)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = primary)
    )
  )STANDBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.8)(PORT = 1521))
    )
   (CONNECT_DATA =
      (SERVICE_NAME = primary)
   )
)EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )#######################
standby database
listener.ora
#######################
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/Oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = primary)
      (ORACLE_HOME = /u01/Oracle/product/10.2.0/db_1)
      (SERVICE_NAME = primary)
    )
  )LISTENER01 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )
LISTENER02 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )################
primary database
tnsnames.ora
#################PRIMARY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.4)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = primary)
    )
  )STANDBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.4)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = primary)
    )
  )EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

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