Friday, 24 February 2017

Oracle Golden Gate GGSCI command


GGSCI commands executed at the ggsci line utility, are used to setup, manage, monitor and troubleshoot the different components of the Goldengate Replication configuration. You are able to look at the current status, lag, database versions, previous commands run, add/delete processes, etc.

Some of the more interesting Goldengate commands are below.

GGSCICommand -> history
view sourceprint?

GGSCI (proddb01) 44> history

GGSCI Command History

   35: info PMP02 detail
   36: info all
   37: info PMP02 detail
   38: info all
   39: info all
   40: history
   41: view report EXT02
   42: history
   43: view report EXT02 detail
   44: history


GGSCI (proddb01) 45> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                          
EXTRACT     RUNNING     PMP02       00:00:00      00:00:01   
EXTRACT     RUNNING     EXT02       00:00:00      00:00:01   
REPLICAT    RUNNING     RHA02       00:00:00      00:00:03
GGSCICommand -> !

To rerun the previous command use “!”

GGSCI (proddb01) 46> !
info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                          
EXTRACT     RUNNING     PMP02       00:00:00      00:00:06   
EXTRACT     RUNNING     EXT02       00:00:00      00:00:06   
REPLICAT    RUNNING     RHA02       00:00:00      00:00:08
To run a specific command from the history use “!” with the command line number.
GGSCI (proddb01) 47> !42
history

GGSCI Command History

   38: info all
   39: info all
   40: history
   41: view report EXT02
   42: history
   43: view report EXT02 detail
   44: history
   45: info all
   46: info all
   47: history


VERSION: You can view this to view the version of the OS, host info and the database version.

GGSCI (proddb02) 3> versions
Operating System:
SunOS
Version Generic_147440-01, Release 5.10
Node: proddb02
Machine: sun4u

Database:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Solaris: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

GGSCICommand -> view report 
REPORTS: View the reports for specific processes.
GGSCI (proddb01) 49> view report EXT02

Opened new report file at 2013-03-12 00:01:00.

***********************************************************************
**                     Run Time Messages                             **
***********************************************************************

2013-03-12 02:43:12  INFO    OGG-01738  BOUNDED RECOVERY: CHECKPOINT: for object pool 1: p21775_extr: start=SeqNo: 17632, RBA: 21008, SCN: 0.1148
5118 (11485118), Timestamp: 2013-03-12 02:41:35.000000, Thread: 1, end=SeqNo: 17632, RBA: 21504, SCN: 0.11485118 (11485118), Timestamp: 2013-03-1
2 02:41:35.000000, Thread: 1.

2013-03-12 06:43:20  INFO    OGG-01738  BOUNDED RECOVERY: CHECKPOINT: for object pool 1: p21775_extr: start=SeqNo: 17646, RBA: 18448, SCN: 0.1149
0824 (11490824), Timestamp: 2013-03-12 06:42:08.000000, Thread: 1, end=SeqNo: 17646, RBA: 18944, SCN: 0.11490824 (11490824), Timestamp: 2013-03-1
2 06:42:08.000000, Thread: 1.
GGSCICommand -> show all
Use the “show” command to look at the configuration info on the different processes.
GGSCI (proddb01) 50> show

Parameter settings:

SET SUBDIRS    ON
SET DEBUG      OFF

Current directory: /u01/app/ha/ggs

Using subdirectories for all process files

Editor:  vi

Reports (.rpt)                 /u01/app/db01/ggs/dirrpt
Parameters (.prm)              /u01/app/db01/ggs/dirprm
Stdout (.out)                  /u01/app/db01/ggs/dirout
Replicat Checkpoints (.cpr)    /u01/app/db01/ggs/dirchk
Extract Checkpoints (.cpe)     /u01/app/db01/ggs/dirchk
Process Status (.pcs)          /u01/app/db01/ggs/dirpcs
SQL Scripts (.sql)             /u01/app/db01/ggs/dirsql
Database Definitions (.def)    /u01/app/db01/ggs/dirdef

GGSCI (proddb01) 52> show all

Parameter settings:

SET SUBDIRS    ON
SET DEBUG      OFF

Current directory: /u01/app/ha/ggs

Using subdirectories for all process files

Editor:  vi

Reports (.rpt)                 /u01/app/db01/ggs/dirrpt
Parameters (.prm)              /u01/app/db01/ggs/dirprm
Stdout (.out)                  /u01/app/db01/ggs/dirout
Replicat Checkpoints (.cpr)    /u01/app/db01/ggs/dirchk
Extract Checkpoints (.cpe)     /u01/app/db01/ggs/dirchk
Process Status (.pcs)          /u01/app/db01/ggs/dirpcs
SQL Scripts (.sql)             /u01/app/db01/ggs/dirsql
Database Definitions (.def)    /u01/app/db01/ggs/dirdef

Wednesday, 22 February 2017

script to kill the session in Oracle RAC

select 'alter system kill session '''||sid||','||serial#||',@'||inst_id||''';' from gv$session  where USERNAME='XXXX';

How to take the Backup of a package in Oracle

set heading off
set echo off
set flush off
set pagesize 50000
set linesize 32767
set long 99999999
spool packege_body.pks
select dbms_metadata.get_ddl('PACKAGE_BODY','ERCOT_REPORT_COLLECT_PKG','SCHEMA NAME') from dual ;
spool off;

Add Data file

 ************************************************** Database status Tablespace Usage ASM Disk Group Usage(RAC) Backup Filesystem Usage Alert...