Tuesday, 15 August 2017

Configure Oracle 11gR2 Data Guard Physical Standby

Synopsis

In this exercise we will configure Oracle Data Guard for Oracle 11gR2 database. We have two virtual machines configured where we have built Linux machines and installed Oracle 11gR2 database. Please refer below mentioned link to build Linux virtual machine and install Oracle 11gR2 database software
  • Primary Database
    • hostname : prim.localdomain
    • db_name : PRODPRIM
    • db_unique : PRODPRIM
  • Standby Database
    • hostname : stby.localdomain
    • db_name : PRODPRIM
    • db_unique : PRODSTBY

Configuration on the Primary Database :-

Step 1 :- Enable archivelog mode

SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP MOUNT
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2

Step 2 :- Enable force logging

SQL> ALTER DATABASE FORCE LOGGING;

Database altered.

Step 3 :- Set database parameters to configure the data guard

Here are the list of parameters to be set to configure the dataguard
  • db_unique_name
  • log_archive_config  
  • log_archive_dest_2  
  • remote_login_passwordfile
  • fal_server
  • fal_client
  • standby_file_management
SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(PRODPRIM,PRODSTBY)';

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=PRODSTBY NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PRODSTBY';

System altered.

SQL> alter system set log_archive_dest_state_2=enable;

System altered.

SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;

System altered.

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;

System altered.

SQL> alter system set fal_server=PRODSTBY;

System altered.

SQL> alter system set fal_client='PRODPRIM';

System altered.

SQL> alter system set standby_file_management=auto;

System altered.

Step 4 :- Create and start the Listener

We need to create and start the listener on both primary and standby servers 

Step 5 :- Add tnsnames for services of primary and standby database

This step has to be performed on both primary and standby database servers. You can update the tnsnames.ora file to add service or service can be added using netca utility. Go to $ORACLE_HOME/network/admin/tnsnames.ora add the below mentioned line to the file
In case you want to add service using netca utility refer this link 

PRODPRIM =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = prim.localdomain)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PRODPRIM)
    )
  )

PRODSTBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = stby.localdomain)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PRODSTBY)
    )
  )

Step 6 :- Check the services if its been configured properly using tnsping on both the servers

[oracle@prim dbhome_1]$ tnsping PRODPRIM

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 15-AUG-2017 14:17:41

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = prim.localdomain)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = PRODPRIM)))
OK (0 msec)

[oracle@prim dbhome_1]$ tnsping PRODSTBY

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 15-AUG-2017 14:18:51

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = stby.localdomain)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = PRODSTBY)))
OK (20 msec)

Step 7 :- Backup primary database using RMAN utility

[oracle@prim dbhome_1]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Aug 15 14:20:28 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PRODPRIM (DBID=881986728)

RMAN> backup database plus archivelog;

Step 8 :- Create standby control file 

SQL> alter database create standby controlfile as '/u01/app/oracle/oradata/PRODPRIM/stbycontrol1.ctl';

Database altered.

Step 9 :- Create pfile of primary database

SQL> create pfile from spfile;

File created.

Step 10 :- Update the newly created pfile with below mentioned changes

  • log_archive_dest_2 = 'SERVICE=PRODPRIM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PRODPRIM'
  • fal_client = PRODSTBY
  • fal_server = PRODPRIM
  • db_unique_name = PRODSTBY

Step 11 :- Copy newly created pfile, standby controlfile, password file and RMAN backup pieces to standby database server

[oracle@prim dbs]$ scp initPRODPRIM.ora oracle@stby.localdomain:/u01/app/oracle/product/11.2.0/dbhome_1/dbs
The authenticity of host 'stby.localdomain (192.168.10.2)' can't be established.
RSA key fingerprint is a3:a6:ed:66:82:ad:bf:9b:6b:a7:59:4d:27:f6:f0:a0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'stby.localdomain,192.168.10.2' (RSA) to the list of known hosts.
oracle@stby.localdomain's password:
initPRODSTBY.ora                                                                                                                                                   100% 1286     1.3KB/s   00:00
--------------------------------------------------------------------
[oracle@prim PRODPRIM]$ scp stbycontrol1.ctl oracle@STBY.localdomain:/u01/app/oracle/oradata/PRODSTBY/control01.ctl
oracle@stby.localdomain's password:
stbycontrol1.ctl                                                                                                                                                   100% 9520KB   9.3MB/s   00:00
--------------------------------------------------------------------
 [oracle@prim PRODPRIM]$ scp stbycontrol1.ctl oracle@STBY.localdomain:/u01/app/oracle/flash_recovery_area/PRODSTBY/control02.ctl
oracle@stby.localdomain's password:
stbycontrol1.ctl                                                                                                                                                   100% 9520KB   9.3MB/s   00:00
--------------------------------------------------------------------
[oracle@prim dbs]$ scp orapwPRODPRIM oracle@stby.localdomain:/u01/app/oracle/product/11.2.0/dbhome_1/dbs
oracle@stby.localdomain's password:
orapwPRODPRIM                                                                                                                                                      100% 1536     1.5KB/s   00:00
--------------------------------------------------------------------
[oracle@prim 2017_08_15]$ scp * oracle@stby.localdomain:/u01/app/oracle/flash_recovery_area/PRODSTBY/backup
oracle@stby.localdomain's password:
o1_mf_annnn_TAG20170815T142041_ds5fh218_.bkp                                                                                                                       100%   29MB  29.4MB/s   00:00
o1_mf_annnn_TAG20170815T142204_ds5fknfn_.bkp                                                                                                                       100%   23KB  22.5KB/s   00:00
o1_mf_ncsnf_TAG20170815T142045_ds5fklmm_.bkp                                                                                                                       100% 9600KB   9.4MB/s   00:00
o1_mf_nnndf_TAG20170815T142045_ds5fh5fc_.bkp                                                                                                                       100%  921MB  31.8MB/s   00:29

Configuration on the Standby Database :-

Step 1 :- Set the environment variables and start the database in mount state

$export ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
$export ORACLE_SID = PRODPRIM
$export PATH = $ORACLE_SID/bin:$PATH
Create the necessary directories before starting the database
$mkdir -p /u01/app/oracle/admin/PRODSTBY/adump

SQL> startup mount
ORACLE instance started.

Total System Global Area  839282688 bytes
Fixed Size                  2217992 bytes
Variable Size             494929912 bytes
Database Buffers          339738624 bytes
Redo Buffers                2396160 bytes
Database mounted.

SQL> create spfile from pfile;

File created.

Step 2 :- Restore and recover the database using RMAN

[oracle@stby dbs]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Aug 15 14:54:22 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PRODPRIM (DBID=881986728, not open)

RMAN> list backup of database summary;

using target database control file instead of recovery catalog

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
2       B  F  A DISK        15-AUG-17       1       1       NO         TAG20170815T142045

RMAN> restore database;

......

Finished restore at 15-AUG-17

RMAN> recover database;

Starting recover at 15-AUG-17
using channel ORA_DISK_1

starting media recovery
......
unable to find archived log
archived log thread=1 sequence=7
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/15/2017 14:56:46
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 7 and starting SCN of 980859

Here in this step recovery will fail, it would expect for a archivelog file, this can be ignored

Step 3 :- Add standby redolog file on primary database (one additional redolog group to be created)

SQL> ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby1.log') size 51M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby2.log') size 51M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby3.log') size 51M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby4.log') size 51M;

Database altered.

Step 4 :- Add standby redolog file on standby database (one additional redolog group to be created)

SQL> ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby1.log') size 51M;

Database altered.

SQL>  ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby2.log') size 51M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby3.log') size 51M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE('/u01/app/oracle/oradata/PRODPRIM/stndby4.log') size 51M;

Database altered.

Step 5 :- Start apply process on standby database

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE nodelay DISCONNECT FROM SESSION;

Database altered.

If you want to cancel the apply process use below mentioned command
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

After successful execution of apply process we have completed configuration of physical standby database

Step 6 :- Verify if dataguard is working fine

Switch logs multiple times on primary database using below mentioned command
SQL> alter system switch logfile;

System altered.

Compare the archivelog sequence in primary and standby database 
Primary Database
SQL> select max(sequence#) from v$archived_log;
Standby Database
SQL> select max(sequence#) from v$archived_log;

You can also verify the database role on both primary and standby database
SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
PRODPRIM  READ WRITE           PRIMARY

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
PRODPRIM  MOUNTED              PHYSICAL STANDBY

Monday, 14 August 2017

OGG-00664 OCI Error beginning session (status = 1034-ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory).

Problem Statement

ERROR   OGG-00664  OCI Error beginning session (status = 1034-ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory).

ERROR   OGG-01668  PROCESS ABENDING.

Problem Detail Report

GGSCI (stby.localdomain as ggowner@GGTGT) 6> view report GGREPL01

***********************************************************************
                 Oracle GoldenGate Delivery for Oracle
    Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
   Linux, x64, 64bit (optimized), Oracle 11g on Dec 12 2015 01:27:04

Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.


                    Starting at 2017-08-14 02:27:21
***********************************************************************

Operating System Version:
Linux
Version #1 SMP Sat Jun 23 02:39:07 EDT 2012, Release 2.6.39-200.24.1.el6uek.x86_64
Node: stby.localdomain
Machine: x86_64
                         soft limit   hard limit
Address Space Size   :    unlimited    unlimited
Heap Size            :    unlimited    unlimited
File Size            :    unlimited    unlimited
CPU Time             :    unlimited    unlimited

Process id: 9311

Description:

2017-08-14 02:27:21  WARNING OGG-02904  Replication of PARTIAL XML containing NCHAR/NVARCHAR/NCLOB data may cause divergence.

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************

2017-08-14 02:27:21  INFO    OGG-03059  Operating system character set identified as US-ASCII.

2017-08-14 02:27:21  INFO    OGG-02695  ANSI SQL parameter syntax is used for parameter parsing.
REPLICAT GGREPL01
USERID ggowner, PASSWORD ***

Source Context :
  SourceModule            : [ggdb.ora.sess]
  SourceID                : [/scratch/aime/adestore/views/aime_adc4150408/oggcore/OpenSys/src/gglib/ggdbora/ocisess.c]
  SourceFunction          : [oci_try]
  SourceLine              : [871]
  ThreadBacktrace         : [18] elements
                          : [/u01/app/oracle/product/11.2.0/goldengate/libgglog.so(CMessageContext::AddThreadContext()+0x1b)
[0x7fc03d57df1b]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/libgglog.so(CMessageFactory::CreateMessage(CSourceCont
ext*, unsigned int, ...)+0x134) [0x7fc03d5780a4]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/libgglog.so(_MSG_ERR_ORACLE_OCI_ERROR_WITH_DESC(CSourc
eContext*, int, char const*, char const*, CMessageFactory::MessageDisposition)+0x41) [0x7fc03d563007]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(OCISESS_context_def::oci_try(int, char const*
, ...)+0x47e) [0x7290de]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(OCISESS_context_def::logon(ggs::gglib::ggapp:
:CLoginName const&, ggs::gglib::ggapp::CDBObjName<(DBObjType)12> const&, ggs::gglib::ggunicode::UString const&, int, bool, in
t)+0x732) [0x726602]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(ggs::gglib::ggdbora::OraConnUtil::initConnect
ionLogon(ggs::gglib::ggdbapi::DBAuthParams const&)+0x1c8) [0x753958]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(ggs::gglib::ggdbora::OraConnUtil::openDataSou
rce(ggs::gglib::ggdbapi::DBAuthParams const&)+0x28) [0x753d08]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(ggs::gglib::ggdbora::OraRepConnUtil::openData
Source(ggs::gglib::ggdbapi::DBAuthParams const&)+0x9) [0x755309]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat() [0x6f2732]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(odbc_param(char*, char*)+0x263) [0x6f2a73]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(get_infile_params(time_elt_def*, time_elt_def
*, char**, ggs::gglib::ggdatasource::DataSourceParams&, ggs::Heartbeat::MapGeneratorParams&)+0x1870) [0x5a7fc0]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat() [0x621150]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(ggs::gglib::MultiThreading::MainThread::ExecM
ain()+0x60) [0x6d9d50]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(ggs::gglib::MultiThreading::Thread::RunThread
(ggs::gglib::MultiThreading::Thread::ThreadArgs*)+0x14d) [0x6dacdd]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(ggs::gglib::MultiThreading::MainThread::Run(i
nt, char**)+0xb1) [0x6dadc1]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat(main+0x3b) [0x624a6b]]
                          : [/lib64/libc.so.6(__libc_start_main+0xfd) [0x3aeea1ecdd]]
                          : [/u01/app/oracle/product/11.2.0/goldengate/replicat() [0x55b0a9]]

2017-08-14 02:27:21  ERROR   OGG-00664  OCI Error beginning session (status = 1034-ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory).

2017-08-14 02:27:21  ERROR   OGG-01668  PROCESS ABENDING.

Solution :

This issue occurs were more than once oracle instances are running on to the database
Solution 1:- Provide the tnsname of instance which you want to connect
USERID ggowner@GGTGT, PASSWORD ggowner

Solution2:- Add setevn parameters to set Oracle SID and Oracle Home
SETENV (ORACLE_SID=GGTGT)
SETENV (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REPLICAT GGREPL01
USERID ggowner@GGTGT, PASSWORD ggowner
DISCARDFILE /u01/app/oracle/product/11.2.0/goldengate/dirrpt/ggext01.dsc
ASSUMETARGETDEFS
MAP GGOWNER.EMPLOYEE, TARGET GGOWNER.EMPLOYEE;

REPLICAT GGREPL01
SETENV (ORACLE_SID=GGTGT)
SETENV (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home)
USERID ggowner, PASSWORD ggowner
DISCARDFILE /u01/app/oracle/product/11.2.0/goldengate/dirrpt/ggext01.dsc
ASSUMETARGETDEFS
MAP GGOWNER.EMPLOYEE, TARGET GGOWNER.EMPLOYEE;

Install and Configure GoldenGate

Synopsis

Article illustrates step by step procedure to install and configure GoldenGate. We have classified the activity in four different sections
  1. Installation of Oracle GoldenGate Software on Linux
  2. Prepare and Configure the Oracle Database for GoldenGate
  3. Add and Configure Extract on Source
  4. Add and Configure Replicat on Target
  5. Testing for GoldenGate Replication 

Installation of GoldenGate Software (Perform on both source and target servers)

Step 1:- Unzip the GoldenGate software and runinstaller from Linux prompt. To install GoldenGate for Oracle 11g database, select the 11g option and Click Next


Setp 2:- Specify GoldenGate software location where GoldenGate has to be installed, Check start Manager, Provide Oracle Database Home location and Manager port. Then Click Next


Step 3:- Verify installation details and Click on the Install


Installation progresses, keep monitoring until installation completes


Step 4:- Click Finish. Now GoldenGate software has been successfully installed


Step 5:- Go to the location where GoldenGate has been installed and go to GGSCI prompt. Run command create subdirs from GGSCI prompt

$./ggsci
GGSCI (prim.localdomain) 1> create subdirs

Creating subdirectories under current directory /u01/app/oracle/product/11.2.0/goldengate

Parameter files                /u01/app/oracle/product/11.2.0/goldengate/dirprm: already exists
Report files                   /u01/app/oracle/product/11.2.0/goldengate/dirrpt: already exists
Checkpoint files               /u01/app/oracle/product/11.2.0/goldengate/dirchk: already exists
Process status files           /u01/app/oracle/product/11.2.0/goldengate/dirpcs: already exists
SQL script files               /u01/app/oracle/product/11.2.0/goldengate/dirsql: already exists
Database definitions files     /u01/app/oracle/product/11.2.0/goldengate/dirdef: already exists
Extract data files             /u01/app/oracle/product/11.2.0/goldengate/dirdat: already exists
Temporary files                /u01/app/oracle/product/11.2.0/goldengate/dirtmp: already exists
Credential store files         /u01/app/oracle/product/11.2.0/goldengate/dircrd: already exists
Masterkey wallet files         /u01/app/oracle/product/11.2.0/goldengate/dirwlt: already exists
Dump files                     /u01/app/oracle/product/11.2.0/goldengate/dirdmp: already exists

Prepare and Configure the Oracle Database for GoldenGate

Step 1:- Create tablespace for storing the GoldenGate data

SQL> create tablespace GGDATA datafile '/u01/app/oracle/oradata/GGTGT/GGDATA01.dbf' size 500m autoextend on maxsize 5g;

Tablespace created.

Step 2:- Create user, this user will be GoldenGate owner schema and make GGDATA tablespace as default for this user

SQL> create user GGOWNER identified by ggowner default tablespace GGDATA account unlock;

User created.

Step 3:- To make things simple, we are granting DBA role to GoldenGate owner user

SQL> grant dba to ggowner;

Grant succeeded.

Step 4:- To configure GoldenGate, turn off the recycle bin and restart the database. Bring it to mount state

SQL> alter system set recyclebin=off scope=spfile;

System altered.

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  839282688 bytes
Fixed Size    2217992 bytes
Variable Size  499124216 bytes
Database Buffers  335544320 bytes
Redo Buffers    2396160 bytes
Database mounted.

Step 5:- Enable archivelog mode as its mandatory requirement to configure GoldenGate

SQL> alter database archivelog;

Database altered.

Step 6:- Enable supplemental Logging and open the database 

SQL> alter database add supplemental log data;

Database altered.

SQL> alter database open;

Database altered.

Step 7:- Run maker setup.sql scripts from GoldenGate software directory and provide GoldeGate owner schema

SQL> @marker_setup.sql

Marker setup script

You will be prompted for the name of a schema for the Oracle GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter Oracle GoldenGate schema name:GGOWNER

Marker setup table script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GGOWNER

MARKER TABLE
-------------------------------
OK

MARKER SEQUENCE
-------------------------------
OK

Script complete.

Step 8:- Run DDL setup script from GoldenGate home and provide GoldenGate owner schema

SQL> @ddl_setup.sql

Oracle GoldenGate DDL Replication setup script

Verifying that current user has privileges to install DDL Replication...

You will be prompted for the name of a schema for the Oracle GoldenGate database objects.
NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For Oracle 11g and later, it can be enabled.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter Oracle GoldenGate schema name:GGOWNER

Working, please wait ...
Spooling to file ddl_setup_spool.txt

Checking for sessions that are holding locks on Oracle Golden Gate metadata tables ...

Check complete.

Using GGOWNER as a Oracle GoldenGate schema name.

Working, please wait ...

DDL replication setup script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GGOWNER

CLEAR_TRACE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

CREATE_TRACE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

TRACE_PUT_LINE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

INITIAL_SETUP STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

DDLVERSIONSPECIFIC PACKAGE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

DDLREPLICATION PACKAGE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

DDLREPLICATION PACKAGE BODY STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

DDL IGNORE TABLE
-----------------------------------
OK

DDL IGNORE LOG TABLE
-----------------------------------
OK

DDLAUX PACKAGE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

DDLAUX PACKAGE BODY STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

SYS.DDLCTXINFO PACKAGE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

SYS.DDLCTXINFO PACKAGE BODY STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

DDL HISTORY TABLE
-----------------------------------
OK

DDL HISTORY TABLE(1)
-----------------------------------
OK

DDL DUMP TABLES
-----------------------------------
OK

DDL DUMP COLUMNS
-----------------------------------
OK

DDL DUMP LOG GROUPS
-----------------------------------
OK

DDL DUMP PARTITIONS
-----------------------------------
OK

DDL DUMP PRIMARY KEYS
-----------------------------------
OK

DDL SEQUENCE
-----------------------------------
OK

GGS_TEMP_COLS
-----------------------------------
OK

GGS_TEMP_UK
-----------------------------------
OK

DDL TRIGGER CODE STATUS:

Line/pos   Error
---------- -----------------------------------------------------------------
No errors  No errors

DDL TRIGGER INSTALL STATUS
-----------------------------------
OK

DDL TRIGGER RUNNING STATUS
-----------------------------------
ENABLED

STAYMETADATA IN TRIGGER
-----------------------------------
OFF

DDL TRIGGER SQL TRACING
-----------------------------------
0

DDL TRIGGER TRACE LEVEL
-----------------------------------
NONE

LOCATION OF DDL TRACE FILE
------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/ggdb01/GGDB01/trace/ggs_ddl_trace.log

Analyzing installation status...


VERSION OF DDL REPLICATION
------------------------------------------------------------------------------------------------------------------------
OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401

STATUS OF DDL REPLICATION
------------------------------------------------------------------------------------------------------------------------
SUCCESSFUL installation of DDL Replication software components

Script complete.

Step 9:- Perform Role Setup from GoldenGate home, using script role_setup.sql and provide GoldenGate owner name

SQL> @role_setup.sql

GGS Role setup script

This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql script to change the gg_role parameter to the preferred name. (Do not run the script.)

You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter GoldenGate schema name:GGOWNER
Wrote file role_setup_set.txt

PL/SQL procedure successfully completed.

Role setup script complete

Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:

GRANT GGS_GGSUSER_ROLE TO <loggedUser>

where <loggedUser> is the user assigned to the GoldenGate processes.

SQL> grant GGS_GGSUSER_ROLE to GGOWNER;

Grant succeeded.

Add and Configure Extract Process on Source

Step 1:- Add the extract, trail files will be written to local

GGSCI (prim.localdomain) 1> add extract GGEXT01, tranlog begin now
EXTRACT added.

GGSCI (prim.localdomain) 2>add exttrail /u01/app/oracle/product/11.2.0/goldengate/dirdat/lt, extract GGEXT01
EXTTRAIL added.

Step 2:- Add extract parameter file and start the extract process

GGSCI (prim.localdomain) 3> edit params GGEXT01

EXTRACT GGEXT01
USERID GGOWNER, PASSWORD ggowner
DISCARDFILE /u01/app/oracle/product/11.2.0/goldengate/dirrpt/ggext01.dsc
EXTTRAIL /u01/app/oracle/product/11.2.0/goldengate/dirdat/lt
TABLE GGOWNER.EMPLOYEE;

GSCI (prim.localdomain) 4> start extract GGEXT01

Sending START request to MANAGER ...
EXTRACT GGEXT01 starting

GGSCI (prim.localdomain) 5> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                        
EXTRACT     RUNNING     GGEXT01     00:00:00      00:00:00  

Step 3:- Add Pump process

GGSCI (prim.localdomain) 6> add extract GGPUMP01, exttrailsource /u01/app/oracle/product/11.2.0/goldengate/dirdat/lt
EXTRACT added.


GGSCI (prim.localdomain) 7> add rmttrail /u01/app/oracle/product/11.2.0/goldengate/dirdat/rt, extract GGPUMP01
RMTTRAIL added.

Step 4:- Edit pump parameter file and start the pump process

GGSCI (prim.localdomain) 8> edit params GGPUMP01

EXTRACT GGPUMP01
PASSTHRU
RMTHOST 192.168.10.2, MGRPORT 7809
RMTTRAIL /u01/app/oracle/product/11.2.0/goldengate/dirdat/rt
TABLE GGOWNER.*;

GGSCI (prim.localdomain) 9> start extract GGPUMP01

Sending START request to MANAGER ...
EXTRACT GGPUMP01 starting

GGSCI (prim.localdomain) 10> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                        
EXTRACT     RUNNING     GGEXT01     00:00:00      00:00:01  
EXTRACT     RUNNING     GGPUMP01    00:00:00      00:00:02

Add and Configure Replicat on Target

Step 1:- Login to the database from GGSCI prompt and add checkpoint table

GGSCI (stby.localdomain) 1> dblogin userid ggowner, password ggowner
Successfully logged into database.

GGSCI (stby.localdomain as ggowner@GGTGT) 2> add checkpointtable ggowner.checkpoint

Successfully created checkpoint table ggowner.checkpoint.

Step 2:- Add replicat process

GGSCI (stby.localdomain) 3> add replicat GGREPL01, EXTTRAIL /u01/app/oracle/product/11.2.0/goldengate/dirdat/rt, checkpointtable ggowner.checkpoint
REPLICAT added.

Step 3:- Update the replicat parameter file 

GGSCI (stby.localdomain) 4> edit params GGREPL01

REPLICAT GGREP01
ASSUMETARGETDEFS
USERID ggowner, PASSWORD ggowner
DISCARDFILE /u01/app/oracle/product/11.2.0/goldengate/dirrpt/ggrepl01.dsc,append,MEGABYTES 500
MAP GGOWNER.EMPLOYEE, TARGET GGOWNER.EMPLOYEE;

Step 4:- Start replicat process and verify 

GGSCI (stby.localdomain) 5> start replicat GGREPL01

Sending START request to MANAGER ...
REPLICAT GGREPL01 starting

GGSCI (stby.localdomain) 6> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                        
REPLICAT    RUNNING     GGREPL01    00:00:00      00:00:01  

Add database service using netca - tnsnames.ora

In this article we will see how to add database service using netca utility
Set environment variables like ORACLE_HOME and invoke netca utility from Linux prompt
$netca

Step 1:- Select Local Net Service Name Configuration option and Click Next


Step 2:- Select Add option and Click Next


Step 3:- Provide the service name and click next


Step 4:- Select the network protocol and Click Next


Step 5:- Provide the Hostname and Port number, then Click on Next


Step 6:- This is optional, if you want to test the connection click on Yes, here we want to make sure connection is working fine to connect to database


Step 7:- Wizard will confirm if the connection to database using new tns name is working fine. Now Click Next


Step 8:- Network Service name will be populated by default, Click Next


Step 9:- By default No option is selected, in case you want to configure another listener, select yes an repeat the steps from Step 1 to Step 8


Step 10:- Click on Next


Step 11:- Click on Finish