ITPub博客

首页 > Linux操作系统 > Linux操作系统 > dg standby lgwr

dg standby lgwr

原创 Linux操作系统 作者:carlos。zh 时间:2011-06-03 11:07:17 0 删除 编辑


主庫一直在線:

主庫:
 alter database force logging;
 ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(dt2as,dt2asdg)';
 alter system set log_archive_dest_1='LOCATION=/data/dt2as/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dt2as';
 alter system set  log_archive_dest_2='SERVICE=dt2asdg LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dt2asdg';
 ALTER SYSTEM SET FAL_CLIENT = dt2as sid='dt2as';
 ALTER SYSTEM SET FAL_SERVER = dt2asdg;

DG的pile可以用主庫的pfile然後再進行相應的修改;
 *.db_unique_name='dt2asdg'
 *.fal_client='dt2asdg'
 *.fal_server='dt2as'
 *.log_archive_config='DG_CONFIG=(dt2as,dt2asdg)'
 *.log_archive_dest_1='LOCATION=/data/dt2as1/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES)  DB_UNIQUE_NAME=dt2asdg'
 *.log_archive_dest_2='SERVICE=dt2as LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)  DB_UNIQUE_NAME=dt2as'

主庫做一次全庫備份:
 $mkdir /data/rman_backup
 $chmod 770 /data/rman_backup
 $rman target /
 Rman> backup database format='/data/rman_backup/%U_%s.bak';
 Rman> sql"alter system archive log current";
 Rman>backup filesperset 10 archivelog all format='/data/backup/%U_%s.bak';(當刪除了以前的歸檔,該動作可能報錯,所以執行 crosscheck archivelog all;
                     crosscheck backupset;)
 備份完主庫及當后,再生成備庫的controlfile
 alter database create standby controlfile as '/data/rman_backup/dgcon.ctl'

配置網絡連接
 主庫 tnsname.ora
 # tnsnames.ora Network Configuration File: /u01/product/oracle/network/admin/tnsnames.ora
 # Generated by Oracle configuration tools.

 DT2AS =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.98.204)(PORT = 1526))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = dt2as)
     )
   )

 LISTENER_DT2AS =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.98.204)(PORT = 1526))

 dt2asdg =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.98.205)(PORT = 1526))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = dt2asdg)
     )
   )
 備庫的listener.ora
 # listener.ora Network Configuration File: /u01/product/oracle/network/admin/listener.ora
 # Generated by Oracle configuration tools.

 LISTENER =
   (DESCRIPTION_LIST =
     (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.98.205)(PORT = 1526))
     )
   )

 ADR_BASE_LISTENER = /u01/product
 備庫的tnsnames.ora

 DT2AS =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.98.204)(PORT = 1526))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = dt2as)
     )
   )
 
 dt2asdg =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.98.205)(PORT = 1526))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = dt2asdg)
     )
   )
 LISTENER_DT2AS =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.98.205)(PORT = 1526))
不管是10g還是11g的---》開啟備庫的時候,都要做以下工作
 備庫  11g
 lsnrctl start
 mkdir /u01/product/flash_recovery_area
 mkdir /u01/product/admin
 mkdir /u01/product/diag
  cd admin
  mkdir dt2as
  mkdir {adump,dpdump,pfile}
  cd diag           service dbname
  mkdir /diag/rdbms     ---->最後自動生成/diag/rdbms/dt2asdg/dt2as/
 mkdir /data/dt2as/arch
 cp /data/rman_backup/dgcon.ctl /data/dt2as/control01.ctl /data/dt2as/control02.ctl .....
 sqlplus / as sysdba
 startup nomount pfile='/u01/product/oracle/dbs/initdt2as.ora'
 alter database mount standby database;
              節點一
 SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 111 ('/data/dt2as/dgredo111a.log','/data/dt2as/dgredo111b.log') SIZE 50M;
 SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 112 ('/data/dt2as/dgredo112a.log','/data/dt2as/dgredo112b.log') SIZE 50M;
 SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 113 ('/data/dt2as/dgredo113a.log','/data/dt2as/dgredo113b.log') SIZE 50M;
 SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 114 ('/data/dt2as/dgredo114a.log','/data/dt2as/dgredo114b.log') SIZE 50M;
 SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 115 ('/data/dt2as/dgredo115a.log','/data/dt2as/dgredo115b.log') SIZE 50M;
 SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 116 ('/data/dt2as/dgredo116a.log','/data/dt2as/dgredo116b.log') SIZE 50M;
 $rman target /
 Rman> restore database;
 Rman> restore archivelog all;
 $ sqlplus / as sysdba
 SQL > atler database recover managed standby database disconnect from session;
 SQL > alter database recover managed standby database cancel;
為了備庫以後切換能夠正常工作 需要增加tempfile
 alter database tempfile '/data/dt2as/temp01.dbf' offline;
 alter database tempfile '/data/dt2as/temp02.dbf' drop;
 alter tablespace temp add tempfile '/data/dt2as/temp01.dbf' size 2000m reuse;
 alter tablespace temp add tempfile '/data/dt2as/temp01.dbf' size 2000m reuse;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25072296/viewspace-697047/,如需转载,请注明出处,否则将追究法律责任。

上一篇: dg
下一篇: exp/expdp
请登录后发表评论 登录
全部评论

注册时间:2010-12-12

  • 博文量
    21
  • 访问量
    24587