auto start Goldengate on ubuntu 10.04 lucid

4 Sep

0. ubuntu release
root@pmr02:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.04 LTS
Release:        10.04
Codename:       lucid

root@pmr02:~# sudo su – oracle
oracle@pmr02:~$ cd /u01/app/oracle/product/gg/

1. create parameter startGoldenGate
oracle@pmr02:/u01/app/oracle/product/gg$ vi /u01/app/oracle/product/gg/startGoldenGate
start manager

start extract *
start replicat *

exit

2. test parameter startGoldenGate
oracle@pmr02:/u01/app/oracle/product/gg$ ./ggsci  PARAMFILE /u01/app/oracle/product/gg/startGoldenGate

Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 11 on Jul 28 2010 13:22:25
Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
GGSCI (pmr02) 1> start manager
Manager started.
GGSCI (pmr02) 2>
GGSCI (pmr02) 2> start extract *
Sending START request to MANAGER …
EXTRACT EXTFD01 starting
Sending START request to MANAGER …
EXTRACT PUMPFD01 starting
GGSCI (pmr02) 3> start replicat *
Sending START request to MANAGER …
REPLICAT REPFD02 starting
GGSCI (pmr02) 4>
GGSCI (pmr02) 4> exit

3. create script linux untuk startup goldengate
oracle@pmr02:/u01/app/oracle/product/gg$ vi /u01/app/oracle/product/gg/startgoldengate
#!/bin/sh
# Start the oracle listener
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=pmr02
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export GGATE=/u01/app/oracle/product/gg
export PATH=$ORACLE_HOME/bin:$PATH:$GGATE
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/u01/app/oracle/product/gg
$GGATE/ggsci PARAMFILE startGoldenGate

oracle@pmr02:/u01/app/oracle/product/gg$ chmod a+x /u01/app/oracle/product/gg/startgoldengate

4. create parameter stopGoldenGate
oracle@pmr02:/u01/app/oracle/product/gg$ vi /u01/app/oracle/product/gg/stopGoldenGate
stop extract *
stop replicat *

STOP MANAGER !
exit

5. test parameter stopGoldenGate
oracle@pmr02:/u01/app/oracle/product/gg$ ./ggsci  PARAMFILE /u01/app/oracle/product/gg/stopGoldenGate
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 11 on Jul 28 2010 13:22:25
Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
GGSCI (pmr02) 1> stop extract *
Sending STOP request to EXTRACT EXTFD01 …
Request processed.
Sending STOP request to EXTRACT PUMPFD01 …
Request processed.
GGSCI (pmr02) 2> stop replicat *
Sending STOP request to REPLICAT REPFD02 …
Request processed.
GGSCI (pmr02) 3>
GGSCI (pmr02) 3> STOP MANAGER !
Sending STOP request to MANAGER …
Request processed.
Manager stopped.
GGSCI (pmr02) 4> exit

6. create script linux untuk shutdown goldengate
oracle@pmr02:/u01/app/oracle/product/gg$ vi /u01/app/oracle/product/gg/stopgoldengate
#!/bin/sh
# Start the oracle listener
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=pmr02
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export GGATE=/u01/app/oracle/product/gg
export PATH=$ORACLE_HOME/bin:$PATH:$GGATE
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/u01/app/oracle/product/gg

$GGATE/ggsci PARAMFILE stopGoldenGate
exit 0

oracle@pmr02:/u01/app/oracle/product/gg$ chmod a+x /u01/app/oracle/product/gg/stopgoldengate

7. create service script linux untuk automatic startup & shutdown goldengate
oracle@pmr02:/u01/app/oracle/product/gg$ vi /u01/app/oracle/product/gg/xgoldengate
#!/bin/sh
#
# chkconfig: 345 51 49
# description: startup and shutdown the Oracle 11g goldengate
#
echo “Goldengate start/stop”
ORA_OWNER=oracle
GG_HOME=/u01/app/oracle/product/gg

case “$1” in
‘start’)
# Start the goldengate
echo -n “Starting the goldengate : ”
su – $ORA_OWNER -c $GG_HOME/startgoldengate
echo
;;

‘stop’)
# Stop the goldengate
echo -n “Shutting down goldengate : ”
su – $ORA_OWNER -c $GG_HOME/stopgoldengate
echo
;;

‘restart’)
# Restart the Oracle databases:
echo -n “Restarting goldengate : ”
$0 stop
$0 start
echo
;;

*)
echo “Usage: xgoldengate [ start | stop | restart }”
exit 1

esac
exit 0

oracle@pmr02:/u01/app/oracle/product/gg$ chmod a+x /u01/app/oracle/product/gg/xgoldengate

8. test script automatic startup & shutdown goldengate
oracle@pmr02:/u01/app/oracle/product/gg$ exit
logout
root@pmr02:~#

root@pmr02:~# cp /u01/app/oracle/product/gg/xgoldengate /etc/init.d/
root@pmr02:~# cd /etc/init.d/
root@pmr02:/etc/init.d# chmod 700 xgoldengate

root@pmr02:/etc/init.d# ./xgoldengate
Goldengate start/stop
Usage: xgoldengate [ start | stop | restart }

root@pmr02:/etc/init.d# ./xgoldengate stop

Goldengate start/stop
Shutting down goldengate :
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 11 on Jul 28 2010 13:22:25
Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
GGSCI (pmr02) 1> stop extract *
Sending STOP request to EXTRACT EXTFD01 …
Request processed.
Sending STOP request to EXTRACT PUMPFD01 …
Request processed.
GGSCI (pmr02) 2> stop replicat *
Sending STOP request to REPLICAT REPFD02 …
Request processed.
GGSCI (pmr02) 3>
GGSCI (pmr02) 3> STOP MANAGER !
Sending STOP request to MANAGER …
Request processed.
Manager stopped.
GGSCI (pmr02) 4> exit

root@pmr02:/etc/init.d# ./xgoldengate start

Goldengate start/stop
Starting the goldengate :
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 11 on Jul 28 2010 13:22:25
Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
GGSCI (pmr02) 1> start manager
Manager started.
GGSCI (pmr02) 2>
GGSCI (pmr02) 2> start extract *
Sending START request to MANAGER …
EXTRACT EXTFD01 starting
Sending START request to MANAGER …
EXTRACT PUMPFD01 starting
GGSCI (pmr02) 3> start replicat *
Sending START request to MANAGER …
REPLICAT REPFD02 starting
GGSCI (pmr02) 4>
GGSCI (pmr02) 4> exit

9. script goldengate, run automatic boot
root@pmr02:/etc/init.d# update-rc.d xgoldengate defaults
update-rc.d: warning: /etc/init.d/xgoldengate missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts&gt;
Adding system startup for /etc/init.d/xgoldengate …
/etc/rc0.d/K20xgoldengate -> ../init.d/xgoldengate
/etc/rc1.d/K20xgoldengate -> ../init.d/xgoldengate
/etc/rc6.d/K20xgoldengate -> ../init.d/xgoldengate
/etc/rc2.d/S20xgoldengate -> ../init.d/xgoldengate
/etc/rc3.d/S20xgoldengate -> ../init.d/xgoldengate
/etc/rc4.d/S20xgoldengate -> ../init.d/xgoldengate
/etc/rc5.d/S20xgoldengate -> ../init.d/xgoldengate

2 Responses to “auto start Goldengate on ubuntu 10.04 lucid”

  1. karis September 28, 2010 at 3:13 am #

    pertamax tp g ditanggalnya…:))
    terima kasih banyak pak… sangat membant saya…
    seandainya ada juga buat mac…
    :))
    bantu saya coba bereksperiment buat mac…:))

  2. setijoagus September 28, 2010 at 4:20 am #

    thx, jika membantu
    bantu saya untuk “kirim mac” supaya bisa bereksperiment 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: