Pages

Friday, November 27, 2015

sql command files to disable and enable all constraints

Here sql command files to disable and enable all constraints: 

Disable: 

set feedback off 
set verify off 
set echo off 
prompt Finding constraints to disable... 
set termout off 
set pages 80 
set heading off 
set linesize 120 
spool tmp_disable.sql 
select 'spool igen_disable.log;' from dual; 
select 'ALTER TABLE '||substr(c.table_name,1,35)|| 
' DISABLE CONSTRAINT '||constraint_name||' ;' 
from user_constraints c, user_tables u 
where c.table_name = u.table_name; 
select 'exit;' from dual; 
set termout on 
prompt Disabling constraints now... 
set termout off 
@tmp_disable.sql; 
exit 
/ 


Enable: 

set feedback off 
set verify off 
set wrap off 
set echo off 
prompt Finding constraints to enable... 
set termout off 
set lines 120 
set heading off 
spool tmp_enable.sql 
select 'spool igen_enable.log;' from dual; 
select 'ALTER TABLE '||substr(c.table_name,1,35)|| 
' ENABLE CONSTRAINT '||constraint_name||' ;' 
from user_constraints c, user_tables u 
where c.table_name = u.table_name; 
/ 
select 'exit;' from dual; 
set termout on 
prompt Enabling constraints now... 
set termout off 
@tmp_enable; 
!rm -i tmp_enable.sql; 
exit 
/

Thursday, November 19, 2015

GoldenGate Autostart and autorestart defualts

There are three arguments you can define with AUTORESTART

RETRIES
<max retries>
The maximum number of times that Manager should try to restart a
process before aborting retry efforts. The default number of tries is 2.

WAITMINUTES
<wait minutes>
The amount of time, in minutes, to pause between discovering that a
process has terminated abnormally and restarting the process. Use this
option to delay restarting until a necessary resource becomes available or
some other event occurs. The default delay is 2 minutes.

RESETMINUTES
<reset minutes>
The window of time, in minutes, during which retries are counted. The
default is 120 minutes (2 hours). After the time expires, the number of
retries reverts to zero.

In your case you have just defined WAITMINUTES as 1. SO RETRIES is 2 and RESETMINUTES is 120.
So by the time you disabled the trigger your extract had already exhausted its 2 tries within first 2 minutes and was waiting for 120 minutes to try again.

You can check with something like the below and see

AUTORESTART REPLICAT *, RETRIES 3, WAITMINUTES 5, RESETMINUTES 20

Monday, November 16, 2015

GoldenGate ETROLLOVER

                                                                             EXTRACT              DATAPUMP       REPLICATE


When Issue ETROLLOVER on EXTRACT       write n->n+1   read from n+1, write to n   no change
..................................................DATAPUMP                                     write to n+1

Sunday, November 15, 2015

Velocity Template Format Date and Decimals

#set ( $String = "formatter" )
$String.format("%5.2f", $val)
--Turn 123.41234 into 123.41 the same as decimal (5, 2) in T-SQL


$String.format("%.10s", $date)
--Turn datetime into 2015-01-01





For GG using velocity:
#set ( $String = "formatter" )
#set ( $Double = 1.0 )

$String.format("%15.2f", $Double.parseDouble($col.AfterValue))
date:                   $col.AfterValue.substring(0,10)
time:                   $col.AfterValue.substring(11,23)