DATA_GUARD_WTORRE

Page 1

No banco primary: SQL> alter system set standby_file_management='AUTO'; System altered. SQL> sho parameter standby_file_management NAME TYPE VALUE ------------------------------------ ----------- ------------standby_file_management string AUTO rman target / catalog rmanebs/rman@rman RMAN> run 2> { 3> allocate channel t1 type 'sbt_tape' 4> parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'; 5> backup current controlfile for standby; 6> } allocated channel: t1 channel t1: sid=1574 devtype=SBT_TAPE channel t1: Data Protection for Oracle: version 5.5.1.0 Starting backup at 15-JAN-10 channel t1: starting full datafile backupset channel t1: specifying datafile(s) in backupset including standby control file in backupset channel t1: starting piece 1 at 15-JAN-10 channel t1: finished piece 1 at 15-JAN-10 piece handle=4ul3hdku_1_1 tag=TAG20100115T143718 comment=API Version 2.0,MMS Version 5.5.1.0 channel t1: backup set complete, elapsed time: 00:01:05 Finished backup at 15-JAN-10 Starting Control File and SPFILE Autobackup at 15-JAN-10 piece handle=c-1821636664-20100115-10 comment=API Version 2.0,MMS Version 5.5.1.0 Finished Control File and SPFILE Autobackup at 15-JAN-10 released channel: t1 RMAN> hodb004wtr[/u01/ibmdba/backup/config] sqlplus SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jan 15 14:45:13 2010 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Enter user-name: / as sysdba Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> alter system switch logfile; System altered. OBS.: Não precisei fazer backup do banco, pois usei o backup feito pela rotina diária, e também não foi alterado mais nenhum parâmetro de inicialização do banco primary (além do standby_file_management) porque a entrega de archives será via tdp e não via service do oracle, para não impactar no tráfego de rede, nem em disponbilidade/performance do servidor de produção. No banco standby (hodb003wtr): 1. Foi clonado o binário do banco de produção, gerado tar e copiado para o novo servidor. 2. /u04/oracle/EBSDG/db/tech_st/10.2.0/appsutil/clone/bin/adcfgclone.pl dbTechStac k -> a instância informada aqui foi EBSDG, apenas para diferenciar da produção, mas o nome do DB continua efetivamente EBS. 3. Ajustados os parâmetros de inicialização (initEBSDG.ora):


standby_file_management=AUTO log_archive_dest_1='location=/u05/oracle/EBSDG/db/apps_st/data/archive' standby_archive_dest =/u05/oracle/EBSDG/db/apps_st/data/archive log_archive_format='EBSDG_%t_%s_%r.arc' db_file_name_convert=('/u01/oracle/EBS/db/apps_st/data/','/u05/oracle/EBSDG/db/apps_st/data/', '/u02/oracle/EBS/db/apps_st/data/','/u05/oracle/EBSDG/db/apps_st/data/', '/u03/oracle/EBS/db/data/','/u05/oracle/EBSDG/db/apps_st/data/', '/u01/oracle/EBS/db/tech_st/10.2.0/dbs/monitora','/u05/oracle/EBSDG/db/apps_st/data/monitora.dbf') log_file_name_convert=('/u01/oracle/EBS/db/apps_st/data/','/u05/oracle/EBSDG/db/apps_st/data/') REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE db_name = EBS instance_name = EBSDG lock_name_space = EBSDG service_names = EBSDG 4. Criado password file com a mesma senha de produção no diretório $ORACLE_HOME/dbs: orapwd file=/u04/oracle/EBSDG/db/tech_st/10.2.0/dbs/orapwEBSDG password=senha entries=10 5. Startup nomount da instância standby. 6. Executado duplicate: hodb003wtr[/u04/oracle/EBSDG/db/tech_st/10.2.0/dbs] more duplicate_ebsdg.txt connect target sys/f9v3h1@EBS connect catalog rmanebs/rman@rman connect auxiliary / run { allocate auxiliary channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/ bin64/tdpo_004.opt)'; set newname for tempfile 1 to '/u05/oracle/EBSDG/db/apps_st/data/temp01.dbf'; set newname for tempfile 2 to '/u05/oracle/EBSDG/db/apps_st/data/temp02.dbf'; set newname for tempfile 3 to '/u05/oracle/EBSDG/db/apps_st/data/temp03.dbf'; duplicate target database for standby dorecover; } Os scripts estão no /home/oracledg: hodb003wtr[/home/oracledg] ls -l duplicate* -rwx------ 1 oracledg dba 123 Jan 15 15:11 duplicate_ebsdg.sh -rw------- 1 oracledg dba 504 Jan 15 15:10 duplicate_ebsdg.txt 7. Para sincronizar os archives e abrir o banco em modo de leitura: hodb003wtr[/home/oracledg] crontab -l ################################################################### # Executa shutdown do banco, e restaura os archives ################################################################### 00 01,13 * * * /home/oracledg/scripts/aplica_archive.sh > /home/oracledg/scripts/ aplica_archive.out ################################################################### # Verifica se os archives foram aplicados, e abre o banco em modo de leitura ################################################################### 35 01,13 * * * /home/oracledg/scripts/open_read_dg.sh > /home/oracledg/scripts/ open_read_dg.out ********************************************************************************** Conteúdo dos scripts: hodb003wtr[/home/oracledg] more /home/oracledg/scripts/aplica_archive.sh . /home/oracledg/.profile


# Verifica ultimo archive aplicado sqlplus -s " / as sysdba" <<EOF set head off set feed off spool /home/oracledg/scripts/ultimo_log.log select max (sequence#) from v\$archived_log; spool off exit EOF ULTIMOLOG=`tail -1 /home/oracledg/scripts/ultimo_log.log` echo $ULTIMOLOG sqlplus " / as sysdba" <<EOF spool /home/oracledg/scripts/shutdown_startup.log shutdown immediate; startup mount; spool off exit EOF rman <<EOF connect target / connect catalog rmanebs/rman@rman run { allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/ oracle/bin64/tdpo_004.opt)'; restore archivelog from logseq $ULTIMOLOG; } exit EOF sqlplus " / as sysdba" <<EOF spool /home/oracledg/scripts/recovery_managed.log ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; spool off exit EOF ******************************************************************************* hodb003wtr[/home/oracledg] more /home/oracledg/scripts/open_read_dg.sh . /home/oracledg/.profile sqlplus " / as sysdba" <<EOF spool /home/oracledg/scripts/logs_pendentes_aplicar.log select thread#,sequence#,to_char(completion_time,'dd-mm-yyyy hh24:mi:ss'),archived,applied from v\$ARCHIVED_LOG where archived <> applied order by 2; spool off exit EOF PEND=`tail -3 /home/oracledg/scripts/logs_pendentes_aplicar.log|grep "no rows selected"|wc -l` echo $PEND if [ $PEND -eq '1' ]; then echo "E possivel abri standby para leitura" sqlplus " / as sysdba" <<EOF


spool /home/oracledg/scripts/open_dg_read.log ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; ALTER DATABASE OPEN; spool off exit EOF rm /u05/oracle/EBSDG/db/apps_st/data/archive/EBSDG*.arc else echo "Nao e possivel abrir standby para leitura, existe logs pendentes para aplicar" fi


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.