熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

技術專題總結:standby Database (二)

2013-11-13 22:12:38  來源: Oracle 

  Standby database 的建立
  Oracle Standby Database 的建立過程並不復雜但建立過程的相關設置取決於建立standby database 的目的例如如果建立standby database 是為了 disaster protectionstandby database 就不能建立在與 primary database 相同服務器上面如果是為了 protection against data corruption在standby database 接收到 primary database 送來的 archived log files 時apply 需要晚上一段比如三個小時或是六個小時這樣當 primary database出現錯誤的時候standby database 不會與primary database 同步
  
  在這篇文章裡面我無法面面俱到的分析各種性能僅做一個具體實例分析
  
  我們承諾客戶的條件
  
  x uptime of SIS database
  in case of failure on primary:
   / hour to fail over to standby database
   no more than mins data loss
   hours scheduled downtime to revert back to primary/standby configuration
  
  我們為了完成以上各項必須完成的工作
  
   在remote site 建立 standby database我們有半小時的時間 activing standby database我個人喜歡再做一次 cold backup
   以我們的環境組 log groups每組 個membersonline redo log file size 是 M運行高峰期每分鐘可以多達 個archived files 產生因此非高峰的時候我們用cron job 做強制 log switch
   因為我們的standby database server 不是專用的所以在非高峰期時我們需要重新建立 primary/standby database
  
  在這裡我又要說一些多余的話了DBA 在申請down time 的時候應該給自己預留足夠的時間到底多少合適自己要掌握好(如果留的時間太少老板和客戶可能會認為DBA的工作很容易或不重要如果一旦出了差錯自己的壓力方面也夠大所以一般選擇在用戶可接受的最多的時間我一般要求需要時間的倍)
  
   根據上面的條件我們做的環境設置
  
  () 首先我們必須確認 primary database 處於archived mode:
  
  SQL> archive log list;
  Database log mode Archive Mode
  Automatic archival Enabled
  Archive destination /oradba/sisi/arch
  Oldest online log sequence
  Next log sequence to archive
  Current log sequence
  
  () 我們必須滿足的條件是 high availablity所以我們采用的是雙機
  
  采用雙機形式有很多的好處除了再安裝與primary node 相同的OS系統及oracle 系統外其他各種設置都可以與primary node 完全相同省掉很多修改參數的麻煩之處
  
  () 我們的oracle 版本是EEstandby node 通過net 接收 primary node 的 archived log files我們專門在 standby node 開通了 port 做為 standby database 的listener(Oracle 的缺省是 port )
  
   standby database的建立過程
  
  standby database一般是用primary database的cold backup建立的特殊情況下可以用RMAN或export dmp file來做這裡我們是講的正常情況
  
  () 在 standby node上面建立與primary node上面相同的datafile directory我們用的是/oradba/sisi/
  
  () 修改 primary database的 initialize parameter file: (我們的例子請不要問我為什麼很多是 application要求的不是我制定的)
  
  primary database:
  db_name = sisi
  instance_name = sisi
  service_names = sisi
  control_files = (/oradba/sisi/ctrl/stctlsictl /oradba/sisi/ctrl/stctlsictl)
  db_files =
  compatible =
  rollback_segments = (rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs
   rbs rbs)
  db_file_multiblock_read_count =
  optimizer_mode = rule #application required
  db_block_size =
  db_block_buffers =
  shared_pool_size =
  sort_area_size =
  sort_area_retained_size =
  log_checkpoint_interval =
  sessions =
  transactions =
  transactions_per_rollback_segment =
  processes =
  open_cursors =
  dml_locks =
  log_buffer =
  log_checkpoint_timeout =
  cursor_space_for_time = true
  utl_file_dir=/tmp
  timed_statistics = false # if you want timed statistics
  max_dump_file_size = # limit trace file size to Meg each
  core_dump_dest = /oradba/sisi/cdump
  background_dump_dest= /oradba/sisi/bdump
  user_dump_dest = /oradba/sisi/udump
  remote_login_passwordfile = none
  parallel_max_servers =
  #The following parameters are the HA parameters needed for Standby Database on primary side
  LOG_ARCHIVE_START=TRUE
  LOG_ARCHIVE_FORMAT = sisi%Sarc
  LOG_ARCHIVE_DEST_=LOCATION=/oradba/sisi/arch MANDATORY REOPEN=
  LOG_ARCHIVE_DEST_STATE_=ENABLE
  STANDBY_ARCHIVE_DEST=/oradba/sisi/arch
  LOG_ARCHIVE_DEST_=SERVICE=standby_sisi MANDATORY REOPEN=
  LOG_ARCHIVE_DEST_STATE_=ENABLE
  LOG_ARCHIVE_MIN_SUCCEED_DEST=
  
  復制到Standby database side相對的directory下面
  db_name = sisi
  instance_name = sisi
  service_names = sisi
  control_files = (/oradba/sisi/ctrl/stctlsictl /oradba/sisi/ctrl/stctlsictl)
  db_files =
  compatible =
  rollback_segments = (rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs rbs
   rbs rbs)
  db_file_multiblock_read_count =
  optimizer_mode = rule
  db_block_size =
  db_block_buffers =
  shared_pool_size =
  sort_area_size = #M Change to M after import
  sort_area_retained_size =
  log_checkpoint_interval =
  sessions =
  transactions =
  transactions_per_rollback_segment =
  processes =
  open_cursors =
  dml_locks =
  log_buffer =
  log_checkpoint_timeout =
  cursor_space_for_time = true
  utl_file_dir=/tmp
  timed_statistics = false # if you want timed statistics
  max_dump_file_size = # limit trace file size to Meg each
  core_dump_dest = /oradba/sisi/cdump
  background_dump_dest= /oradba/sisi/bdump
  user_dump_dest = /oradba/sisi/udump
  remote_login_passwordfile = none
  parallel_max_servers =
  #The following parameter are the HA parameters needed for Standby Database on standby side
  LOG_ARCHIVE_START=FALSE
  LOG_ARCHIVE_FORMAT = sisi%Sarc
  LOG_ARCHIVE_DEST_=LOCATION=/oradba/sisi/arch MANDATORY REOPEN=
  LOG_ARCHIVE_DEST_STATE_=ENABLE
  STANDBY_ARCHIVE_DEST=/oradba/sisi/arch
  LOG_ARCHIVE_DEST_=SERVICE=standby_sisi MANDATORY REOPEN=
  LOG_ARCHIVE_DEST_STATE_=ENABLE
  LOG_ARCHIVE_MIN_SUCCEED_DEST=
  
  () shutdown primary database normal/immediate做一個冷備份再次 startup primary database時用 pfile標示到上面改過的 parameter file 用ftp或其他OS工具把冷備份的 data
  files/online redo log files到在standby node已經建好的對應 directory下面
  
  () 建立 standby database control file
  Alter database create standby controlfile as /oradba/sisi/temp/stctlsictl;
  用 rcp或 ftp到standby node對應的directory用 cp command復制另一個
  
  () 在primary side編輯 tnsnamesora文件增加一條(可以用netasst做)
  STANDBY_SISI =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = ))
  )
  (CONNECT_DATA =
  (SID = sisi)
  )
  )
  
  () 在 standby node編輯 listenerora文件增加一條(可以用netasst做)
  
  ST_LISTENER =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = prtltest)(PORT = ))
  )
  
  SID_LIST_ST_LISTENER =
  (SID_LIST =
  (SID_DESC =
  (GLOBAL_DBNAME = sisi)
  (ORACLE_HOME = /oracle/)
  (SID_NAME = sisi)
  )
  )
  
  () start standby li
From:http://tw.wingwit.com/Article/program/Oracle/201311/18478.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.