Lo que vamos a hacer aqui es configurar 2 instancias de Far Sync (farsync y farsync2), una que pertenezca a la Principal (orcl) y otra que pertenezca a la Standby (orclstby).
Primero en la BD orcl, vamos a crear el controlfile y el password file para la instancia Far Sync
SQL> alter database create far sync instance controlfile as '/u01/app/oracle/oradata/farsync/control01.ctl' Database altered. SQL> !cp /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapworcl /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwfarsync
Ahora vamos a crear los Standby Redo Logs para la instancia Far Sync
SQL> alter database add standby logfile '/u01/app/oracle/oradata/farsync/farsync01.log' size 50M; Database altered. SQL> alter database add standby logfile '/u01/app/oracle/oradata/farsync/farsync02.log' size 50M; Database altered. SQL> alter database add standby logfile '/u01/app/oracle/oradata/farsync/farsync03.log' size 50M; Database altered. SQL> alter database add standby logfile '/u01/app/oracle/oradata/farsync/farsync04.log' size 50M; Database altered.
Vamos ahora a crear un archivo de parámetros (pfile) para la instancia Far Sync, y la vamos a subir
[oracle@adg12c ~]$ export ORACLE_SID=farsync [oracle@adg12c ~]$ cat /u01/pfile.ora *.archive_lag_target=0 *.audit_file_dest='/u01/app/oracle/admin/orcl/adump' *.audit_trail='db' *.compatible='12.1.0.0.0' *.control_files='/u01/app/oracle/oradata/farsync/control01.ctl' *.db_block_size=8192 *.db_domain='oracle.com' *.db_name='orcl' *.db_recovery_file_dest='/u01/app/oracle/recovery_area' *.db_recovery_file_dest_size=5368709120 *.dg_broker_start=TRUE *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)' *.enable_pluggable_database=true *.log_archive_config='dg_config=(orcl,farsync,orclstby)' *.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(all_logfiles,all_roles) db_unique_name=farsync' *.log_archive_dest_2='SERVICE=orclstby ASYNC VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=orclstby' *.log_archive_dest_state_2='ENABLE' *.log_archive_dest_state_3='ENABLE' farsync.log_archive_format='%t_%s_%r.dbf' *.log_archive_max_processes=4 *.log_archive_min_succeed_dest=1 farsync.log_archive_trace=0 *.open_cursors=300 *.processes=300 *.remote_login_passwordfile='EXCLUSIVE' *.standby_file_management='MANUAL' *.undo_tablespace='UNDOTBS1' LOG_FILE_NAME_CONVERT='orcl',farsync' DB_UNIQUE_NAME=farsync FAL_SERVER=orcl [oracle@adg12c ~]$ sqlplus Enter user-name: /as sysdba Connected to an idle instance. SQL> startup nomount pfile=/u01/pfile.ora SQL> ORACLE instance started. Total System Global Area 246386688 bytes Fixed Size 2286992 bytes Variable Size 188746352 bytes Database Buffers 50331648 bytes Redo Buffers 5021696 bytes SQL> alter database mount Database altered.
A continuación lo que vamos a hacer es agregar la configuración de la instancia Far Sync , al DG broker
[oracle@adg12c ~] export ORACLE_SID=orcl [oracle@adg12c ~] sqlplus "/ as sysdba" SQL> alter system set log_archive_dest_2=''; System altered. SQL> exit [oracle@adg12c ~] export ORACLE_SID=farsync [oracle@adg12c ~] sqlplus "/ as sysdba" SQL> alter system set log_archive_dest_2=''; System altered. SQL> exit [oracle@adg12c ~] export ORACLE_SID=orcl [oracle@adg12c ~] dgmgrl DGMGRL> connect sys/oracle Connected as SYSDG. DGMGRL> add far_sync farsync as connect identifier is farsync; far sync instance "farsync" added DGMGRL> enable far_sync farsync; Enabled. DGMGRL> exit [oracle@adg12c ~] export ORACLE_SID=orcl [oracle@adg12c ~] sqlplus "/ as sysdba" SQL> alter system set log_archive_dest_2='service="orclstby"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="orclstby" net_timeout=30','valid_for=(online_logfile,all_roles)'; System altered. SQL> exit [oracle@adg12c ~] export ORACLE_SID=farsync [oracle@adg12c ~] sqlplus "/ as sysdba" SQL> alter system set log_archive_dest_2='SERVICE=orclstby ASYNC VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=orclstby'; System altered. SQL> create spfile from pfile='/u01/pfile.ora'; File created. SQL> shutdown immediate; ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 246386688 bytes Fixed Size 2286992 bytes Variable Size 188746352 bytes Database Buffers 50331648 bytes Redo Buffers 5021696 bytes Database mounted. SQL> exit
Una vez que completamos estos pasos, vamos a hacer los mismos , reemplazando la instancia farsync (ORACLE_SID=farsync) , por farsync2 (ORACLE_SID=farsync2) , y así tenemos nuestras dos instancias Far Sync.
Lo que sigue es que tenemos que configurar las rutas con la propiedad de RedoRoutes conectandonos a la BD orcl.
[oracle@adg12c ~]$ . oraenv ORACLE_SID = [orcl] ? orcl The Oracle base remains unchanged with value /u01/app/oracle [oracle@adg12c ~]$ dgmgrl DGMGRL> connect sys/oracle Connected as SYSDG. DGMGRL> EDIT DATABASE orcl SET PROPERTY 'RedoRoutes' = '( LOCAL : farsync SYNC)'; Property "RedoRoutes" updated DGMGRL> EDIT FAR_SYNC farsync SET PROPERTY 'RedoRoutes' = '(orcl : orclstby ASYNC)'; Property "RedoRoutes" updated DGMGRL> EDIT FAR_SYNC farsync2 SET PROPERTY 'RedoRoutes' = '(orclstby : orcl ASYNC)'; Property "RedoRoutes" updated DGMGRL> EDIT DATABASE orclstby SET PROPERTY 'RedoRoutes' = '(LOCAL : farsync2 FASTSYNC)'; Property "RedoRoutes" updated
Ahora vamos a configurar los umbrales de aplicación y transporte en el retraso y de desconexión
DGMGRL> edit database orclstby set property TransportDisconnectedThreshold=0; Property "transportdisconnectedthreshold" updated DGMGRL> edit database orclstby set property transportlagthreshold=0; Property "transportlagthreshold" updated DGMGRL> edit database orcl set property TransportDisconnectedThreshold=0; Property "transportdisconnectedthreshold" updated DGMGRL> edit database orcl set property transportlagthreshold=0; Property "transportlagthreshold" updated DGMGRL> edit far_sync farsync set property TransportDisconnectedThreshold=0; Property "transportdisconnectedthreshold" updated DGMGRL> edit far_sync farsync set property transportlagthreshold=0; Property "transportlagthreshold" updated DGMGRL> edit far_sync farsync2 set property TransportDisconnectedThreshold=0; Property "transportdisconnectedthreshold" updated DGMGRL> edit far_sync farsync2 set property transportlagthreshold=0; Property "transportlagthreshold" updated DGMGRL> edit database orcl set property ApplyLagThreshold=0; Property "applylagthreshold" updated DGMGRL> edit database orclstby set property ApplyLagThreshold=0; Property "applylagthreshold" updated DGMGRL> edit database orclstby set property logxptmode=sync; Property "logxptmode" updated
Vamos a ver como quedo nuestra configuración de nuestras instancias de Far Sync
DGMGRL> show configuration; Configuration - DGCONFIG Protection Mode: MaxPerformance Databases: orcl - Primary database farsync - Far Sync orclstby - Physical standby database farsync2 - Far Sync (inactive) Fast-Start Failover: DISABLED Configuration Status: SUCCESS
Si te fijas, la instancia farsync2 esta inactiva, ya que esta le pertenece a la BD standby (orclstby),de igual manera ahora verificamos que la BD orcl este lista para un switchover
DGMGRL> validate database orcl; Database Role: Primary database Ready for Switchover: Yes
Ya que verificamos que si esta lista para el switchover, vamos a proceder a hacerlo hacia orclstby
DGMGRL> switchover to orclstby; Performing switchover NOW, please wait... Operation requires a connection to instance "orclstby" on database "orclstby" Connecting to instance "orclstby"... Connected as SYSDBA. New primary database "orclstby" is opening... Operation requires startup of instance "orcl" on database "orcl" Starting instance "orcl"... ORACLE instance started. Database mounted. Database opened. Switchover succeeded, new primary is "orclstby"
Ahora que la BD orclstby es la primaria, y orcl es la BD es la standby , vamos a checar la configuración de nuevo, y veras que la instancia farsync2 es la instancia Far Sync activa, y la instancia farsync2 va a estar inactiva
DGMGRL> show configuration; Configuration - DGCONFIG Protection Mode: MaxPerformance Databases: orclstby - Primary database farsync2 - Far Sync orcl - Physical standby database farsync - Far Sync (inactive) Fast-Start Failover: DISABLED Configuration Status: SUCCESS
Conclusión
Este tipo de configuración te va a permitir tener "casi cero" perdida de datos, sin perjudicar tu BD primaria por los estados latentes de tu red. Así como tener la misma configuración cuando hagas un switchover de tus BDs.
No hay comentarios.:
Publicar un comentario