Using TFA(Trace File Analyzer) Collector (Part 2)

Using TFA(Trace File Analyzer) Collector

TFA(Trace File Analyzer) Collector - 
Tool for Enhanced Diagnostic Gathering (Doc ID 1513912.2)
Note: The installation for TFA is on my previous Post:
Install TFA
Make it Automatic for Star/Stop ...
1.) Collecting Information:

Options:
-all Collect all logs (If no time is given for collection then files for 
the last 4 hours
will be collected) This is the default option.
-oda Collect ODA/OS logs
-odastorage Collect ODA Storage logs and Data
-crs Collect CRS logs
-dbwlm Collect DBWLM logs
-acfs Collect ACFS logs
-asm Collect ASM logs
-database Collect database logs from databases specified
-install Collect Oracle Installation related files
-cfgtools Collect CFGTOOLS logs
-os Collect OS files such as /var/log/messages
-ashhtml Collect Generate ASH HTML Report (requires –database)
-ashtext Collect Generate ASH TEXT Report (requires –database)
-zdlra Collect Zero Data Loss Recovery Appliance specific logs and data.

-- Trim and Zip all files updated in the last 1 hour as well as chmos/osw data
-- from across the cluster and collect at the initiating node

[root@lnx01 ~]# tfactl diagcollect -all -since 1h

Collecting data for all components using above parameters...
Collecting data for all nodes

Collection Id : 20160429075309lnx01

Repository Location in lnx01 : /oracle/tfa/repository

Collection monitor will wait up to 30 seconds for collections to start
2016/04/29 07:53:13 EDT : Collection Name : tfa_Fri_Apr_29_07_53_09_EDT_2016.zip
2016/04/29 07:53:13 EDT : Scanning of files for Collection in progress...
2016/04/29 07:53:13 EDT : Collecting extra files...
2016/04/29 07:53:18 EDT : Getting list of files satisfying time range [04/29/2016 06:53:13 EDT, 04/29/2016 07:53:18 EDT]
2016/04/29 07:53:18 EDT : Starting Thread to identify stored files to collect
2016/04/29 07:53:18 EDT : Getting List of Files to Collect
2016/04/29 07:53:18 EDT : Trimming file : lnx01/tnslsnr/lnx01/listener/trace/listener.log with original file size : 3.4MB
2016/04/29 07:53:18 EDT : Finished Getting List of Files to Collect
2016/04/29 07:53:18 EDT : Collecting ADR incident files...
2016/04/29 07:53:18 EDT : Waiting for collection of extra files
2016/04/29 07:53:18 EDT : Completed collection of extra files...
2016/04/29 07:53:23 EDT : Completed Zipping of all files
2016/04/29 07:53:23 EDT : Cleaning up temporary files
2016/04/29 07:53:23 EDT : Finished Cleaning up temporary files
2016/04/29 07:53:23 EDT : Finalizing the Collection Zip File
2016/04/29 07:53:23 EDT : Finished Finalizing the Collection Zip File
2016/04/29 07:53:23 EDT : Total Number of Files checked : 1072
2016/04/29 07:53:23 EDT : Total Size of all Files Checked : 33MB
2016/04/29 07:53:23 EDT : Number of files containing required range : 27
2016/04/29 07:53:23 EDT : Total Size of Files containing required range : 12MB
2016/04/29 07:53:23 EDT : Number of files trimmed : 1
2016/04/29 07:53:23 EDT : Total Size of data prior to zip : 9.6MB
2016/04/29 07:53:23 EDT : Saved 3.3MB by trimming files
2016/04/29 07:53:23 EDT : Zip file size : 387kB
2016/04/29 07:53:23 EDT : Total time taken : 10s
2016/04/29 07:53:23 EDT : Completed collection of zip files.

Logs are being collected to: /oracle/tfa/repository/collection_Fri_Apr_29_07_53_09_EDT_2016_node_all
/oracle/tfa/repository/collection_Fri_Apr_29_07_53_09_EDT_2016_node_all/lnx01.tfa_Fri_Apr_29_07_53_09_EDT_2016.zip

-- Trim and Zip all files from database CDB in the last 1 hour and
-- collect at the initiating node

[root@lnx01 ~]# ps -ef | grep smon
oracle    1809     1  0 03:44 ?        00:00:00 ora_smon_db11
oracle    1862     1  0 03:44 ?        00:00:00 ora_smon_db12c
oracle    1993     1  0 03:44 ?        00:00:00 asm_smon_+ASM
oracle    2324     1  0 03:46 ?        00:00:00 ora_smon_CDB

[root@lnx01 ~]# tfactl diagcollect -database CDB -since 1h -z foo
Collecting data for all nodes

Collection Id : 20160429075802lnx01

Repository Location in lnx01 : /oracle/tfa/repository

Collection monitor will wait up to 30 seconds for collections to start
2016/04/29 07:58:05 EDT : Collection Name : tfa_foo.zip
2016/04/29 07:58:05 EDT : Scanning of files for Collection in progress...
2016/04/29 07:58:05 EDT : Collecting extra files...
2016/04/29 07:58:10 EDT : Getting list of files satisfying time range [04/29/2016 06:58:05 EDT, 04/29/2016 07:58:10 EDT]
2016/04/29 07:58:10 EDT : Starting Thread to identify stored files to collect
2016/04/29 07:58:10 EDT : Getting List of Files to Collect
2016/04/29 07:58:10 EDT : Finished Getting List of Files to Collect
2016/04/29 07:58:11 EDT : Collecting ADR incident files...
2016/04/29 07:58:11 EDT : Waiting for collection of extra files
2016/04/29 07:58:12 EDT : Completed collection of extra files...
2016/04/29 07:58:16 EDT : Completed Zipping of all files
2016/04/29 07:58:16 EDT : Cleaning up temporary files
2016/04/29 07:58:16 EDT : Finished Cleaning up temporary files
2016/04/29 07:58:16 EDT : Finalizing the Collection Zip File
2016/04/29 07:58:16 EDT : Finished Finalizing the Collection Zip File
2016/04/29 07:58:16 EDT : Total Number of Files checked : 1072
2016/04/29 07:58:16 EDT : Total Size of all Files Checked : 33MB
2016/04/29 07:58:16 EDT : Number of files containing required range : 3
2016/04/29 07:58:16 EDT : Total Size of Files containing required range : 15kB
2016/04/29 07:58:16 EDT : Number of files trimmed : 0
2016/04/29 07:58:16 EDT : Total Size of data prior to zip : 153kB
2016/04/29 07:58:16 EDT : Saved 0kB by trimming files
2016/04/29 07:58:16 EDT : Zip file size : 28kB
2016/04/29 07:58:16 EDT : Total time taken : 11s
2016/04/29 07:58:16 EDT : Completed collection of zip files.

Logs are being collected to: /oracle/tfa/repository/collection_Fri_Apr_29_07_58_02_EDT_2016_node_all
/oracle/tfa/repository/collection_Fri_Apr_29_07_58_02_EDT_2016_node_all/lnx01.tfa_foo.zip

-- Trim and Zip all ASM logs from lnx01 updated between from and to time and
-- collect at the initiating node

[root@lnx01 ~]# hostname
lnx01

tfactl diagcollect -asm -node lnx01 -from Apr/29/2016 -to "Apr/29/2016 08:00:00"
Collecting data for lnx01 node(s)
Scanning files from Apr/29/2016 00:00:00 to Apr/29/2016 08:00:00

Collection Id : 20160429080435lnx01

Repository Location in lnx01 : /oracle/tfa/repository

Collection monitor will wait up to 30 seconds for collections to start
2016/04/29 08:04:37 EDT : Collection Name : tfa_Fri_Apr_29_08_04_35_EDT_2016.zip
2016/04/29 08:04:37 EDT : Scanning of files for Collection in progress...
2016/04/29 08:04:37 EDT : Collecting extra files...
2016/04/29 08:04:41 EDT : Completed collection of extra files...
2016/04/29 08:04:42 EDT : Getting list of files satisfying time range [04/29/2016 00:00:00 EDT, 04/29/2016 08:00:00 EDT]
2016/04/29 08:04:42 EDT : Starting Thread to identify stored files to collect
2016/04/29 08:04:42 EDT : Getting List of Files to Collect
2016/04/29 08:04:42 EDT : Finished Getting List of Files to Collect
2016/04/29 08:04:42 EDT : Collecting ADR incident files...
2016/04/29 08:04:42 EDT : Completed Zipping of all files
2016/04/29 08:04:42 EDT : Cleaning up temporary files
2016/04/29 08:04:42 EDT : Finished Cleaning up temporary files
2016/04/29 08:04:42 EDT : Finalizing the Collection Zip File
2016/04/29 08:04:42 EDT : Finished Finalizing the Collection Zip File
2016/04/29 08:04:42 EDT : Total Number of Files checked : 1072
2016/04/29 08:04:42 EDT : Total Size of all Files Checked : 33MB
2016/04/29 08:04:42 EDT : Number of files containing required range : 1
2016/04/29 08:04:42 EDT : Total Size of Files containing required range : 351kB
2016/04/29 08:04:42 EDT : Number of files trimmed : 0
2016/04/29 08:04:42 EDT : Total Size of data prior to zip : 487kB
2016/04/29 08:04:42 EDT : Saved 0kB by trimming files
2016/04/29 08:04:42 EDT : Zip file size : 52kB
2016/04/29 08:04:42 EDT : Total time taken : 5s
2016/04/29 08:04:42 EDT : Completed collection of zip files.

Logs are being collected to: /oracle/tfa/repository/collection_Fri_Apr_29_08_04_35_EDT_2016_node_lnx01
/oracle/tfa/repository/collection_Fri_Apr_29_08_04_35_EDT_2016_node_lnx01/lnx01.tfa_Fri_Apr_29_08_04_35_EDT_2016.zip

2.) Configure

tfactl set

The set command allows us to adjust the way TFAMain is running. This command makes the
changes that you can see when doing a tfactl print config. By default changes are made locally
so if the change is required on all nodes you must supply the ‘-c’ flag.

[root@lnx01 ~]# tfactl set -h

Usage: /oracle/tfa/bin/tfactl set [
            autodiagcollect=<ON | OFF> | trimfiles=<ON | OFF> |
            tracelevel=<COLLECT|SCAN|INVENTORY|OTHER>:<1|2|3|4> |
            reposizeMB=<n> | repositorydir=<dir> [-force] |
            logsize=<n> [-local] | logcount=<n> [-local] |
            maxcorefilesize=<n> [-local] | maxcorecollectionsize=<n> [-local]
            autopurge=<ON | OFF> | rtscan=<ON|OFF> | minagetopurge=<n>
        ] [-c]

   Turn ON/OFF or Modify various TFA features

  rtscan              allow Alert Log Scanning
  autodiagcollect     allow for automatic diagnostic collection when an event
                      is observed (default ON)
  autopurge           allow automatic purging of collections when less space
                      is observed in repository (default ON)
  minagetopurge       the minimum age of a collection in hours before it is
                      considered for purging
  trimfiles           allow trimming of files during diagcollection (default ON)
  tracelevel          control the trace level of log files in /oracle/tfa/lnx01/tfa_home/log
                      (default 1 for all facilities)
  repositorydir=<dir> set the diagcollection repository to <dir>
  reposizeMB=<n>      set the maximum size of diagcollection repository to <n>MB
  logsize=<n>         set the maximum size of each TFA log to <n>MB (default 50 MB)
  logcount=<n>        set the maximum number of TFA logs to <n> (default 10)
  maxcorefilesize=<n> set the maximum size of Core File to <n>MB (default 20 MB )
  maxcorecollectionsize=<n> set the maximum collection size of Core Files to <n>MB (default 200 MB )

  minSpaceForRTScan=<n>     Minimun space required to run RT Scanning(default 500)
  -force              skip inital checks while changing repository (Not Recommended)
  -c                  set the value on all nodes (Does not apply to repository
                      settings)

Examples:
  /oracle/tfa/bin/tfactl set autodiagcollect=ON
  /oracle/tfa/bin/tfactl set autopurge=ON
  /oracle/tfa/bin/tfactl set minagetopurge=15
  /oracle/tfa/bin/tfactl set tracelevel=INVENTORY:3
  /oracle/tfa/bin/tfactl set reposizeMB=20480
  /oracle/tfa/bin/tfactl set logsize=100
  
 3.) Tool Status
 
 [root@lnx01 ~]# tfactl toolstatus
.------------------------------------.
|       External Support Tools       |
+-------+--------------+-------------+
| Host  | Tool         | Status      |
+-------+--------------+-------------+
| lnx01 | alertsummary | DEPLOYED    |
| lnx01 | exachk       | DEPLOYED    |
| lnx01 | ls           | DEPLOYED    |
| lnx01 | pstack       | DEPLOYED    |
| lnx01 | orachk       | DEPLOYED    |
| lnx01 | sqlt         | DEPLOYED    |
| lnx01 | grep         | DEPLOYED    |
| lnx01 | summary      | DEPLOYED    |
| lnx01 | prw          | NOT RUNNING |
| lnx01 | vi           | DEPLOYED    |
| lnx01 | tail         | DEPLOYED    |
| lnx01 | param        | DEPLOYED    |
| lnx01 | dbglevel     | DEPLOYED    |
| lnx01 | darda        | DEPLOYED    |
| lnx01 | history      | DEPLOYED    |
| lnx01 | oratop       | DEPLOYED    |
| lnx01 | oswbb        | RUNNING     |
| lnx01 | changes      | DEPLOYED    |
| lnx01 | events       | DEPLOYED    |
| lnx01 | ps           | DEPLOYED    |
| lnx01 | srdc         | DEPLOYED    |
'-------+--------------+-------------'

Make it Automatic for Star/Stop ...
Advertisements

Using TFA(Trace File Analyzer) Collector (Part 1)

TFA(Trace File Analyzer) Collector - 
Tool for Enhanced Diagnostic Gathering (Doc ID 1513912.2)

As described on MOS, Trace File Analyzer Collector (TFA) is a diagnostic collection utility to simplify 
diagnostic data collection on Oracle Clusterware/Grid Infrastructure, RAC and Single Instance Database systems.  
TFA is similar to the diagcollection utility packaged with Oracle Clusterware in that it collects and packages 
diagnostic data - however - TFA is MUCH more powerful than diagcollection with its ability to centralize and 
automate the collection of diagnostic information.

Note: The installation for TFA is on my previous Post:
Install TFA

1.) Stop/Start
Note: Remember that all path are on PATH variable, below my .bash_profile for ROOT:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
export JAVA_HOME=/oracle/grid/jdk
export ORACLE_BASE=/oracle
export CRS_HOME=/oracle/grid
export TFA_HOME=/oracle/tfa/lnx01/tfa_home
PATH=$PATH:$CRS_HOME/bin:/oracle/grid/perl/bin:/oracle/tfa/bin
export PATH

-- As Root:

[root@lnx01 ~]# tfactl stop

Stopping TFA from the Command Line
Stopped OSWatcher
TFA is running  - Will wait 5 seconds (up to 3 times)
TFA is running  - Will wait 5 seconds (up to 3 times)
TFA-00002 : Oracle Trace File Analyzer (TFA) is not running
TFA Stopped Successfully
. . .
Successfully stopped TFA..

[root@lnx01 ~]# ps -ef | grep -i tfa
root      7059     1  0 04:51 ?        00:00:00 /bin/sh /etc/init.d/init.tfa run
root      7155     1  1 04:51 ?        00:00:26 /oracle/grid/jdk/jre/bin/java -Xms128m -Xmx512m -classpath /oracle/tfa/lnx01/tfa_home/jlib/RATFA.jar:/oracle/tfa/lnx01/tfa_home/jlib/je-5.0.84.jar:/oracle/tfa/lnx01/tfa_home/jlib/ojdbc5.jar:/oracle/tfa/lnx01/tfa_home/jlib/commons-io-2.1.jar oracle.rat.tfa.TFAMain /oracle/tfa/lnx01/tfa_home

[root@lnx01 ~]# tfactl start

Note: If you face the problem below to start:

TFA-00002 : Oracle Trace File Analyzer (TFA) is not running
TFA Failed to start listening for commands

Check this file (./database/BERKELEY_JE_DB/je.lck) with FUSER,
if you found some PID:

kill -9 <PID>
rm ./database/BERKELEY_JE_DB/je.lck

tfactl start

Note: If you face some problem with PERL:
ln -s /oracle/grid/perl/bin/perl /usr/bin/perl

Logs:
-rw-r--r-- 1 root root   4627 Apr 29 05:29 syserrorout.04.29.2016-04.51.14
-rw-r--r-- 1 root root 207726 Apr 29 05:29 tfa.04.29.2016-04.51.15.log
-rw-r--r-- 1 root root   1069 Apr 29 05:31 syserrorout.04.29.2016-05.31.19
-rw-r--r-- 1 root root   1069 Apr 29 05:31 syserrorout.04.29.2016-05.31.58
-rw-r--r-- 1 root root   1069 Apr 29 05:32 syserrorout.04.29.2016-05.32.36
-rw-r--r-- 1 root root   1069 Apr 29 05:37 syserrorout.04.29.2016-05.37.24
-rw-r--r-- 1 root root   3172 Apr 29 05:50 syserrorout.04.29.2016-05.47.33
-rw-r--r-- 1 root root  14327 Apr 29 05:50 tfa.04.29.2016-05.47.34.log
-rw-r--r-- 1 root root   1069 Apr 29 05:52 syserrorout.04.29.2016-05.52.22
-rw-r--r-- 1 root root   1588 Apr 29 05:55 syserrorout.04.29.2016-05.55.10
-rw-r--r-- 1 root root   1166 Apr 29 05:56 tfa.04.29.2016-05.55.11.log
[root@lnx01 log]# pwd
/oracle/tfa/lnx01/tfa_home/log

2.) TFACTL PRINT options

[root@lnx01 ~]# tfactl print status

.--------------------------------------------------------------------------------------------.
| Host  | Status of TFA | PID  | Port | Version    | Build ID             | Inventory Status |
+-------+---------------+------+------+------------+----------------------+------------------+
| lnx01 | RUNNING       | 5402 | 5000 | 12.1.2.7.0 | 12127020160303214632 | COMPLETE         |
'-------+---------------+------+------+------------+----------------------+------------------'

[root@lnx01 ~]# tfactl print config
.---------------------------------------------------------------.
|                             lnx01                             |
+--------------------------------------------------+------------+
| Configuration Parameter                          | Value      |
+--------------------------------------------------+------------+
| TFA version                                      | 12.1.2.7.0 |
| Automatic diagnostic collection                  | OFF        |
| Alert Log Scan                                   | ON         |
| Trimming of files during diagcollection          | ON         |
| Repository current size (MB)                     | 4          |
| Repository maximum size (MB)                     | 1439       |
| Inventory Trace level                            | 1          |
| Collection Trace level                           | 1          |
| Scan Trace level                                 | 1          |
| Other Trace level                                | 1          |
| Max Size of TFA Log (MB)                         | 50         |
| Max Number of TFA Logs                           | 10         |
| Max Size of Core File (MB)                       | 20         |
| Max Collection Size of Core Files (MB)           | 200        |
| Automatic Purging                                | ON         |
| Minimum Age of Collections to Purge (Hours)      | 12         |
| Minimum Space Free to enable Alert Log Scan (MB) | 500        |
'--------------------------------------------------+------------'

[root@lnx01 ~]# tfactl print directories
.------------------------------------------------------------------------------------------------------------------------------.
|                                                             lnx01                                                            |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| Trace Directory                    | Component                                                       | Permission | Added By |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /etc/oracle                        | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oraInventory/ContentsXML          | [INSTALL]                                                       | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oraInventory/logs                 | [INSTALL]                                                       | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/cfgtoollogs                | [CFGTOOLS]                                                      | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/@global/cvu        | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/acfs         | [ACFS]                                                          | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/core         | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/crsconfig    | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/crsdiag      | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/cvu          | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/evm          | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/output       | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/ovmmwallet   | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/ovmmwallets  | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/rhp          | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/scripts      | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/crsdata/lnx01/trace        | [CRS]                                                           | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/asm/+asm/+ASM/cdump   | [ASM]{ASM|instance=+ASM}                                        | public     | root     |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/asm/+asm/+ASM/trace   | [ASM]{ASM|instance=+ASM}                                        | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/clients/user_oracle/h | [DBCLIENT]{DBCLIENT|instance=user_oracle}                       | public     | root     |
| ost_2315295561_76/cdump            |                                                                 |            |          |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/clients/user_oracle/h | [DBCLIENT]{DBCLIENT|instance=user_oracle}                       | public     | root     |
| ost_2315295561_76/trace            |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/clients/user_oracle/h | [DBCLIENT]{DBCLIENT|instance=user_oracle}                       | public     | root     |
| ost_2315295561_82/cdump            |                                                                 |            |          |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/clients/user_oracle/h | [DBCLIENT]{DBCLIENT|instance=user_oracle}                       | public     | root     |
| ost_2315295561_82/trace            |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/crs/lnx01/crs/cdump   | [CRS]                                                           | public     | root     |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/cdb/CDB/cdump   | [RDBMS]{RDBMS|instance=CDB, RDBMS|database=cdb}                 | public     | root     |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/cdb/CDB/trace   | [RDBMS]{RDBMS|instance=CDB, RDBMS|database=cdb}                 | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/cdb1/CDB1/cdump | [RDBMS]{RDBMS|instance=CDB1, RDBMS|database=cdb1}               | public     | root     |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/cdb1/CDB1/trace | [RDBMS]{RDBMS|instance=CDB1, RDBMS|database=cdb1}               | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/db01/db01/cdump | [RDBMS]{RDBMS|instance=db01, RDBMS|database=db01}               | public     | root     |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/db01/db01/trace | [RDBMS]{RDBMS|instance=db01, RDBMS|database=db01}               | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/db11/db11/cdump | [RDBMS]{RDBMS|instance=db11, RDBMS|database=db11}               | public     | root     |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/db11/db11/trace | [RDBMS]{RDBMS|instance=db11, RDBMS|database=db11}               | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/db12c/db12c/cdu | [RDBMS]{RDBMS|instance=db12c, RDBMS|database=db12c}             | public     | root     |
| mp                                 |                                                                 |            |          |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/db12c/db12c/tra | [RDBMS]{RDBMS|instance=db12c, RDBMS|database=db12c}             | public     | root     |
| ce                                 |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/ecby_pitr_pdb1_ | [RDBMS]{RDBMS|instance=ecby, RDBMS|database=ecby_pitr_pdb1_cdb} | public     | root     |
| cdb/ecby/cdump                     |                                                                 |            |          |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/rdbms/ecby_pitr_pdb1_ | [RDBMS]{RDBMS|instance=ecby, RDBMS|database=ecby_pitr_pdb1_cdb} | public     | root     |
| cdb/ecby/trace                     |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/tnslsnr/lnx01/listene | [TNS]                                                           | public     | root     |
| r/cdump                            |                                                                 |            |          |
| Collection policy : No Exclusions  |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/diag/tnslsnr/lnx01/listene | [TNS]                                                           | public     | root     |
| r/trace                            |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/product/11.2/db_1/log/diag | [RDBMS]{RDBMS|instance=DBUA0, RDBMS|database=dbua0}             | public     | root     |
| /rdbms/dbua0/DBUA0/trace           |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/product/12.1.0.2/db_1/cfgt | [CFGTOOLS]                                                      | public     | root     |
| oollogs                            |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/product/12.1.0.2/db_1/inst | [INSTALL]                                                       | public     | root     |
| all                                |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/tfa/repository/suptools/ln | [OS]                                                            | public     | root     |
| x01/oswbb/oracle/archive           |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /oracle/tfa/repository/suptools/pr | [RDBMS]                                                         | public     | root     |
| w                                  |                                                                 |            |          |
| Collection policy : Exclusions     |                                                                 |            |          |
+------------------------------------+-----------------------------------------------------------------+------------+----------+
| /var/log                           | [OS, RACDBCLOUD]                                                | public     | root     |
| Collection policy : Exclusions     |                                                                 |            |          |
'------------------------------------+-----------------------------------------------------------------+------------+----------'

[root@lnx01 ~]# tfactl print hosts
Host Name : lnx01

[root@lnx01 ~]# tfactl print actions
.-----------------------------------------------------------.
| HOST | START TIME | END TIME | ACTION | STATUS | COMMENTS |
+------+------------+----------+--------+--------+----------+
'------+------------+----------+--------+--------+----------'

[root@lnx01 ~]# tfactl print collections
No diagnostic collections to print in TFA

[root@lnx01 ~]# tfactl print repository
.-----------------------------------------------.
|                     lnx01                     |
+----------------------+------------------------+
| Repository Parameter | Value                  |
+----------------------+------------------------+
| Location             | /oracle/tfa/repository |
| Maximum Size (MB)    | 1439                   |
| Current Size (MB)    | 5                      |
| Free Size (MB)       | 1434                   |
| Status               | OPEN                   |
'----------------------+------------------------'

Continuing on ... Part 2

Installing TFA(Trace File Analyzer) Collector

TFA(Trace File Analyzer) Collector 
Tool for Enhanced Diagnostic Gathering (Doc ID 1513912.2)

As described on MOS, Trace File Analyzer Collector (TFA) is a diagnostic collection utility to simplify 
diagnostic data collection on Oracle Clusterware/Grid Infrastructure, RAC and Single Instance Database systems.  
TFA is similar to the diagcollection utility packaged with Oracle Clusterware in that it collects and packages 
diagnostic data - however - TFA is MUCH more powerful than diagcollection with its ability to centralize and 
automate the collection of diagnostic information.

My Environment:

Linux lnx01 3.8.13-118.2.1.el6uek.x86_64 #2 SMP Thu Nov 26 20:37:55 PST 2015 x86_64 x86_64 x86_64 GNU/Linux

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

[oracle@lnx01 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        11G  7.2G  2.5G  75% /
tmpfs           2.9G  1.2G  1.7G  42% /dev/shm
/dev/sda1       479M   54M  396M  12% /boot
/dev/sdb1        30G   25G  3.3G  89% /oracle
/dev/sdd1       4.8G  3.3G  1.3G  73% /data01
/dev/sde1       9.8G  5.4G  3.9G  59% /data02
/dev/sdf1        20G  9.1G  9.6G  49% /data03

[oracle@lnx01 ~]$ ps -ef | grep smon
oracle    1809     1  0 03:44 ?        00:00:00 ora_smon_db11
oracle    1862     1  0 03:44 ?        00:00:00 ora_smon_db12c
oracle    1993     1  0 03:44 ?        00:00:00 asm_smon_+ASM
oracle    2324     1  0 03:46 ?        00:00:00 ora_smon_CDB


1.) Download:

On MOS: 1513912.2
you can download the version below, is the lastest version (04-2016):

TFA 12.1.2.4.0, file: TFALite_v12.1.2.7.0.zip

On this version as reported on MOS:

    New TFA tools - summary, events, changes, ps, pstack and param all with cluster support
    New dbglevel tool to help when setting CRS trace levels for multiple modules across nodes
    Cluster support for existing TFA tools alertsummary, grep and tail
    Version updates to Support Tools - DARDA, SQLT and ORAchk
    Support for diagnostics collection from ODA Dom0
    Support for Dom0 diagnostic collections on Exadata
    Critical Bug Fixes

2.) Preparing the Installation:

As root copy the ZIP file to a directory on Server:
after copy zip file to server:

unzip TFALite_v12.1.2.7.0.zip

[root@lnx01 tfa]# ls -ltr
total 87440
-rw-r--r-- 1 root root   583593 Mar  4 15:32 TFACollectorDocV121270.pdf
-r-xr-xr-x 1 root root 44414287 Mar  4 15:34 installTFALite
-rw-r--r-- 1 root root 44534701 Apr 29 04:07 TFALite_v12.1.2.7.0.zip

Oracle recommends install under $ORACLE_BASE

Note: i will update the bash_profile (root) with the variable below:

export ORACLE_BASE=/oracle

3.) JAVA

Prior to installing TFA you MUST install JRE 1.5 or higher.

On my case i will use the JAVA installed on GRID_HOME:

[oracle@lnx01 bin]$ ./java -version
java version "1.6.0_75"
Java(TM) SE Runtime Environment (build 1.6.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 20.75-b01, mixed mode)
[oracle@lnx01 bin]$ pwd
/oracle/grid/jdk/bin

My JAVA_HOME will be, i will update the bash_profile (ROOT and ORACLE):

export JAVA_HOME=/oracle/grid/jdk

4.) PERL

You need put PERL on the PATH variable:

export PATH=$PATH:$CRS_HOME/bin:/oracle/grid/perl/bin

[root@lnx01 ~]# perl -v

This is perl 5, version 14, subversion 1 (v5.14.1) built for x86_64-linux-thread-multi

5.) Install

variables:

JAVA_HOME=/oracle/grid/jdk
ORACLE_BASE=/oracle

./installTFALite -tfabase $ORACLE_BASE -javahome $JAVA_HOME

On my case the option:

[L]ocal

TFA Installation Log will be written to File : /tmp/tfa_install_5586_2016_04_29-04_51_01.log

Starting TFA installation

Using JAVA_HOME : /oracle/grid/jdk

Running Auto Setup for TFA as user root...

Would you like to do a [L]ocal only or [C]lusterwide installation ? [L|l|C|c] [C] : l
Installing TFA now...

Discovering Nodes and Oracle resources

Checking whether CRS is up and running

List of nodes in cluster
1. lnx01

Checking Status of Oracle Software Stack - Clusterware, ASM, RDBMS

. . . . . . . . .


TFA Will be Installed on lnx01...

TFA will scan the following Directories
++++++++++++++++++++++++++++++++++++++++++++

.-----------------------------------------------------------------------.
|                                 lnx01                                 |
+------------------------------------------------------------+----------+
| Trace Directory                                            | Resource |
+------------------------------------------------------------+----------+
| /oraInventory/ContentsXML                                  | INSTALL  |
| /oraInventory/logs                                         | INSTALL  |
| /oracle/cfgtoollogs                                        | CFGTOOLS |
| /oracle/diag/asm/+asm/+ASM/cdump                           | ASM      |
| /oracle/diag/asm/+asm/+ASM/trace                           | ASM      |
| /oracle/diag/clients/user_oracle/host_2315295561_76/cdump  | DBCLIENT |
| /oracle/diag/clients/user_oracle/host_2315295561_76/trace  | DBCLIENT |
| /oracle/diag/clients/user_oracle/host_2315295561_82/cdump  | DBCLIENT |
| /oracle/diag/clients/user_oracle/host_2315295561_82/trace  | DBCLIENT |
| /oracle/diag/crs/lnx01/crs/cdump                           | CRS      |
| /oracle/diag/rdbms/cdb/CDB/cdump                           | RDBMS    |
| /oracle/diag/rdbms/cdb/CDB/trace                           | RDBMS    |
| /oracle/diag/rdbms/cdb1/CDB1/cdump                         | RDBMS    |
| /oracle/diag/rdbms/cdb1/CDB1/trace                         | RDBMS    |
| /oracle/diag/rdbms/db01/db01/cdump                         | RDBMS    |
| /oracle/diag/rdbms/db01/db01/trace                         | RDBMS    |
| /oracle/diag/rdbms/db11/db11/cdump                         | RDBMS    |
| /oracle/diag/rdbms/db11/db11/trace                         | RDBMS    |
| /oracle/diag/rdbms/db12c/db12c/cdump                       | RDBMS    |
| /oracle/diag/rdbms/db12c/db12c/trace                       | RDBMS    |
| /oracle/diag/rdbms/ecby_pitr_pdb1_cdb/ecby/cdump           | RDBMS    |
| /oracle/diag/rdbms/ecby_pitr_pdb1_cdb/ecby/trace           | RDBMS    |
| /oracle/diag/tnslsnr/lnx01/listener/cdump                  | TNS      |
| /oracle/diag/tnslsnr/lnx01/listener/trace                  | TNS      |
| /oracle/product/11.2/db_1/log/diag/rdbms/dbua0/DBUA0/trace | RDBMS    |
| /oracle/product/12.1.0.2/db_1/cfgtoollogs                  | CFGTOOLS |
| /oracle/product/12.1.0.2/db_1/install                      | INSTALL  |
| /usr/tmp                                                   | ZDLRA    |
'------------------------------------------------------------+----------'


Installing TFA on lnx01:
HOST: lnx01     TFA_HOME: /oracle/tfa/lnx01/tfa_home



.-------------------------------------------------------------------------.
| Host  | Status of TFA | PID  | Port | Version    | Build ID             |
+-------+---------------+------+------+------------+----------------------+
| lnx01 | RUNNING       | null | 5000 | 12.1.2.7.0 | 12127020160303214632 |
'-------+---------------+------+------+------------+----------------------'

Running Inventory in All Nodes...

Enabling Access for Non-root Users on lnx01...

Adding Local Oracle Home Owners to TFA

Sucessfully added 'oracle' to TFA Access list.

.---------------------------------.
|        TFA Users in lnx01       |
+-----------+-----------+---------+
| User Name | User Type | Status  |
+-----------+-----------+---------+
| oracle    | USER      | Allowed |
'-----------+-----------+---------'


Summary of TFA Installation:
.--------------------------------------------------.
|                       lnx01                      |
+---------------------+----------------------------+
| Parameter           | Value                      |
+---------------------+----------------------------+
| Install location    | /oracle/tfa/lnx01/tfa_home |
| Repository location | /oracle/tfa/repository     |
| Repository usage    | 0 MB out of 1439 MB        |
'---------------------+----------------------------'


TFA is successfully installed...


Usage : /oracle/tfa/bin/tfactl <command> [options]
<command> =
          start        Starts TFA
          stop         Stops TFA
          enable       Enable TFA Auto restart
          disable      Disable TFA Auto restart
          print        Print requested details
          access       Add or Remove or List TFA Users
          purge        Delete collections from TFA repository
          directory    Add or Remove or Modify directory in TFA
          host         Add or Remove host in TFA
          diagcollect  Collect logs from across nodes in cluster
          collection   Manage TFA Collections
          analyze      List events summary and search strings in alert logs.
          set          Turn ON/OFF or Modify various TFA features
          toolstatus     Prints the status of TFA Support Tools
          run <tool>     Run the desired support tool
          start <tool>   Starts the desired support tool
          stop <tool>    Stops the desired support tool
          syncnodes      Generate/Copy TFA Certificates
          diagnosetfa    Collect TFA Diagnostics
          uninstall      Uninstall TFA from this node

For help with a command: /oracle/tfa/bin/tfactl <command> -help

6.) Pos-Installation

Put the variable below on the bash_profile (ROOT and ORACLE)
check your TFA_HOME on the installation output 

export TFA_HOME=/oracle/tfa/lnx01/tfa_home

Include the path below on the PATH variable, for tfactl:

/oracle/tfa/bin

7.) Checking TFA

[root@lnx01 ~]# tfactl print status

.--------------------------------------------------------------------------------------------.
| Host  | Status of TFA | PID  | Port | Version    | Build ID             | Inventory Status |
+-------+---------------+------+------+------------+----------------------+------------------+
| lnx01 | RUNNING       | null | 5000 | 12.1.2.7.0 | 12127020160303214632 | COMPLETE         |
'-------+---------------+------+------+------------+----------------------+------------------'

Next.... Using TFA


 

Golden Gate – Multitenant (Non CDB to PDB)

 

-- References:
http://www.oracle.com/technetwork/database/multitenant/
learn-more/ogg-multitenant-2408073.pdf

https://docs.oracle.com/goldengate/1212/gg-winux/GIORA/
config_containerdb.htm#GIORA987

Case:
Replication on Oracle Database 12c with databases on the same server.
Source: Non CDB
Target: CDB

Source: SID: DB12C
target: SID: CDB - Pluggable Database: PDB3

GOLDEN_GATE_HOME: /oracle/product/GG/12c

Server: lnx01 - 10.130.1.36

Both must be on ARCHIVE mode
-------------------------------------------------------------------------------
1.) Preparing Source/Target

- Logging:

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER DATABASE FORCE LOGGING;
ALTER TABLE sys.seq$ ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;

- streams_pool_size, at least 1g 
- ENABLE_GOLDENGATE_REPLICATION, parameter set to TRUE
- Create Tablespace /User on both sides, on target you need create inside PDB

- Source:

create tablespace ts_ggate datafile '/data03/oradata/DB12C/datafile/ts_ggate_01.dbf' size 8m autoextend on next 8m maxsize 8g;
create user ggate identified by ggate default tablespace ts_ggate;
grant connect , resource to ggate;
grant select any dictionary, select any table to ggate;
grant create table to ggate;
grant flashback any table to ggate;
grant execute on dbms_flashback to ggate;
grant execute on utl_file to ggate;
grant dba to ggate;

exec dbms_goldengate_auth.grant_admin_privilege('ggate');

- Target:

create tablespace ts_ggate datafile '/data03/CDB/ts_ggate_01.dbf' size 8m autoextend on next 8m maxsize 8g;
create user c##ggate identified by ggate container=all;
alter user c##ggate default tablespace TS_GGATE container=current;
grant connect , resource to c##ggate;
grant select any dictionary, select any table to c##ggate;
grant create table to c##ggate;
grant flashback any table to c##ggate;
grant execute on dbms_flashback to c##ggate;
grant execute on utl_file to c##ggate;
grant dba to c##ggate;

exec dbms_goldengate_auth.grant_admin_privilege('C##GGATE',container=>'all');

- Configure UNDO:

UNDO_MANAGEMENT=AUTO
UNDO_RETENTION=86400 
UNDO_RETENTION can be adjusted upward in high-volume environments.

- Executing: sequence.sql from GG_HOME on both sides

Source:

sqlplus / as sysdba
@/oracle/product/GG/12c/sequence.sql
ggate

Target:

sqlplus / as sysdba
alter session set container=pdb3;
@/oracle/product/GG/12c/sequence.sql
c##ggate

2.) Test environment:

On Source:
create user app identified by app default tablespace users;
grant connect , resource to app;
alter user app quota unlimited on users;

create table app.t1 
(num number, 
 text varchar2(100),
 dt date);
 
 create table app.t2
 (num number, 
 text varchar2(100),
 dt date);
 
 create table app.t3
 (num number, 
 text varchar2(100),
 dt date);
 
ALTER TABLE app.t1 ADD CONSTRAINT pk_t1 PRIMARY KEY (num);
ALTER TABLE app.t2 ADD CONSTRAINT pk_t2 PRIMARY KEY (num);
ALTER TABLE app.t3 ADD CONSTRAINT pk_t3 PRIMARY KEY (num);

create sequence app.seq1 nocache order;
create sequence app.seq2 nocache order;
create sequence app.seq3 nocache order;

declare 
i number;
begin
for i in 1..100 loop
 insert into app.t1 values (app.seq1.nextval,'TEST1',sysdate);
 insert into app.t2 values (app.seq2.nextval,'TEST2',sysdate);
 insert into app.t3 values (app.seq3.nextval,'TEST3',sysdate);
end loop
commit;
end;
/

exec dbms_stats.gather_schema_stats('APP');

-- Copying the structure for PDB3;
create tablespace users 
datafile '/data03/CDB/PDB3/ts_users_01.dbf' 
size 1m autoextend on next 1m maxsize 16g;

create user app identified by app default tablespace users;
grant connect , resource to app;
alter user app quota unlimited on users;

create table app.t1 
(num number, 
 text varchar2(100),
 dt date);
 
 create table app.t2
 (num number, 
 text varchar2(100),
 dt date);
 
 create table app.t3
 (num number, 
 text varchar2(100),
 dt date);
 
ALTER TABLE app.t1 ADD CONSTRAINT pk_t1 PRIMARY KEY (num);
ALTER TABLE app.t2 ADD CONSTRAINT pk_t2 PRIMARY KEY (num);
ALTER TABLE app.t3 ADD CONSTRAINT pk_t3 PRIMARY KEY (num);

create sequence app.seq1 nocache order;
create sequence app.seq2 nocache order;
create sequence app.seq3 nocache order;

- Check TNS for the PDB, on my case PDB3 on target

- On the Multitenant, we need grant Privileges to root user;
alter session set container=pdb3;

grant connect , resource to c##ggate;
grant select any dictionary, select any table to c##ggate;
grant create table to c##ggate;
grant flashback any table to c##ggate;
grant execute on dbms_flashback to c##ggate;
grant execute on utl_file to c##ggate;
grant dba to c##ggate;

[oracle@lnx01 admin]$ tnsping pdb3

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 22-APR-2016 05:47:24

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

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = lnx01)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PDB3)))
OK (10 msec)
[oracle@lnx01 admin]$

[oracle@lnx01 admin]$ sqlplus c##ggate/ggate@pdb3

SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 22 06:20:42 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Last Successful login time: Fri Apr 22 2016 05:31:43 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

3.) Configuring GOLDEN GATE

- GLOBALS on TARGET

cd %GG_HOME% 
# ggsci

GGSCI (lnx01) 1> sh echo $ORACLE_SID

CDB

DBLOGIN USERID c##ggate@pdb3, PASSWORD ggate

ADD CHECKPOINTTABLE c##ggate.chktable
EDIT PARAMS ./GLOBALS
CHECKPOINTTABLE c##ggate.chktable

4.) First Load:

- Source:

#GGSCI

DBLOGIN USERID ggate, PASSWORD ggate

ADD EXTRACT extfirst, SOURCEISTABLE

EDIT PARAMS extfirst

EXTRACT extfirst
SETENV (ORACLE_HOME="/oracle/product/12.1.0.2/db_1")
SETENV (ORACLE_SID="db12c")
USERID ggate, PASSWORD ggate
RMTHOST 10.130.1.36, MGRPORT 7809
RMTTASK replicat, GROUP repfirst
TABLE app.*;

- Target

#GGSCI

DBLOGIN USERID c##ggate@pdb3, PASSWORD ggate
ADD REPLICAT repfirst, SPECIALRUN

EDIT PARAMS repfirst

REPLICAT repfirst
SETENV (ORACLE_HOME="/oracle/product/12.1.0.2/db_1")
SETENV (ORACLE_SID="CDB")
USERID c##ggate@pdb3, PASSWORD ggate
ASSUMETARGETDEFS
WILDCARDRESOLVE IMMEDIATE
MAP app.*, TARGET app.*;

- Source:
#GGSCI
ADD SCHEMATRANDATA APP ALLCOLS

START EXTRACT extfirst

- Target:
info replicat repfirst

- Checking Target:
sqlplus / as sysdba
alter session set container=pdb3
exec dbms_stats.gather_schema_stats('APP');

select owner, table_name , num_rows
from dba_tables
where owner='APP';

OWNER TABLE_NAME NUM_ROWS
---------- -------------------- --------------------
APP T3 100
APP T2 100
APP T1 100

5.) OnGoing Manager

SOURCE
#GGSCI

DBLOGIN USERID ggate, PASSWORD ggate

edit params mgr

PURGEOLDEXTRACTS /oracle/product/GG/12c/dirdat/ex, USECHECKPOINTS
Autostart Replicat R*
AUTORESTART Replicat *, WaitMinutes 1, Retries 3
Autostart Extract E*
AUTORESTART Extract *, WaitMinutes 1, Retries 3

stop manager!
exit
GGSCI

DBLOGIN USERID ggate, PASSWORD ggate

==> Note, with this configuration all processes starting with
==> E* and R* will be started automaticaly, so REPFIRST and EXTFIRST
==> also, is better delete these process before start

GGSCI (lnx01 as ggate@db12c) 4> delete extfirst
Deleted EXTRACT EXTFIRST.

GGSCI (lnx01 as c##ggate@CDB/PDB3) 2> delete repfirst
Deleted REPLICAT REPFIRST.

start manager

6.) OnGoing Extract - Source

mkdir -p /oracle/product/GG/12c/dirdat/DB12c

#GGSCI
edit params extdb12c

EXTRACT extdb12c
SETENV (ORACLE_HOME="/oracle/product/12.1.0.2/db_1")
SETENV (ORACLE_SID="db12c")
USERID ggate, PASSWORD ggate
LOGALLSUPCOLS
UPDATERECORDFORMAT COMPACT
TRANLOGOPTIONS EXCLUDEUSER ggate
DDL INCLUDE MAPPED OBJNAME APP.*
DDLOPTIONS ADDTRANDATA, GETREPLICATES, GETAPPLOPS
BR BROFF
EOFDELAY 1
FLUSHSECS 1
ENCRYPTTRAIL AES192
EXTTRAIL /oracle/product/GG/12c/dirdat/DB12c/ex
TABLE APP.*;
SEQUENCE APP.*;

#GGSCI
add trandata APP.*

7.) OnGoing Pump - Source

#GGSCI
edit params pmpdb12c

EXTRACT pmpdb12c
SETENV (ORACLE_HOME="/oracle/product/12.1.0.2/db_1")
SETENV (ORACLE_SID="db12c")
USERID ggate, PASSWORD ggate
RMTHOST 10.130.1.36, MGRPORT 7809
-- Specify the remote trail on the secondary system:
RMTTRAIL /oracle/product/GG/12c/dirdat/DB12c/rm
PASSTHRU
-- Specify tables to be captured:
TABLE APP.*;
SEQUENCE APP.*;

8.) OnGoing Replicat - Target
#GGSCI

DBLOGIN USERID c##ggate@pdb3, PASSWORD ggate

edit params repdb12c

REPLICAT repdb12c
SETENV (ORACLE_HOME="/oracle/product/12.1.0.2/db_1")
SETENV (ORACLE_SID="CDB")
USERID c##ggate@pdb3, PASSWORD ggate
ASSUMETARGETDEFS
DISCARDFILE /oracle/product/GG/12c/dirdat/repdb12c.dsc, PURGE
REPORTCOUNT EVERY 1 MINUTES, RATE
DDLOPTIONS UPDATEMETADATA
DDLERROR DEFAULT IGNORE RETRYOP
EOFDELAY 1
MAP APP.*, TARGET APP.*;

9.) Registering Process
#GGSCI
- Source:
register extract extdb12c database
add extract extdb12c, integrated tranlog, begin now 
add exttrail /oracle/product/GG/12c/dirdat/DB12c/ex, 
extract extdb12c, megabytes 10

add extract pmpdb12c, exttrailsource /oracle/product/GG/12c/dirdat/DB12c/ex
add rmttrail /oracle/product/GG/12c/dirdat/DB12c/rm, extract pmpdb12c, 
megabytes 10

- Target:
#GGSCI
DBLOGIN USERID c##ggate@pdb3, PASSWORD ggate

Add Replicat repdb12c exttrail /oracle/product/GG/12c/dirdat/DB12c/rm, checkpointtable c##ggate.chktable

10.) Starting

- Source

GGSCI (lnx01 as ggate@db12c) 26> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT STOPPED EXTDB12C 00:00:00 00:04:29
EXTRACT STOPPED PMPDB12C 00:00:00 00:04:07
REPLICAT STOPPED REPDB12C 00:00:00 00:01:10

CREATE WALLET
ADD MASTERKEY

start EXTDB12C
start PMPDB12C

- Target:
DBLOGIN USERID c##ggate@pdb3, PASSWORD ggate

start REPDB12C

11.) Testing:

- Source:

sqlplus / as sysdba

declare 
i number;
begin
for i in 1..100 loop
 insert into app.t1 values (app.seq1.nextval,'TEST1',sysdate);
 insert into app.t2 values (app.seq2.nextval,'TEST2',sysdate);
 insert into app.t3 values (app.seq3.nextval,'TEST3',sysdate);
 commit;
end loop
commit;
end;
/

exec dbms_stats.gather_schema_stats('APP');

select owner, table_name , num_rows
from dba_tables
where owner='APP';

OWNER TABLE_NAME NUM_ROWS
-------------------- -------------------- --------------------
APP T1 200
APP T2 200
APP T3 200

- Target:

sqlplus / as sysdba
alter session set container=pdb3;
exec dbms_stats.gather_schema_stats('APP');

select owner, table_name , num_rows
from dba_tables
where owner='APP';

OWNER TABLE_NAME NUM_ROWS
-------------------- -------------------- --------------------
APP T1 200
APP T2 200
APP T3 200

Oracle Database File System (DBFS) 11gR2

References:
https://oracle-base.com/articles/11g/dbfs-11gr2
DBFS resource not starting as crs resource (Doc ID 1908868.1)
https://oracle-base.com/articles/11g/dbfs-11gr2#creating_a_file_system
https://docs.oracle.com/cd/E11882_01/appdev.112/e18294/adlob_client.htm#ADLOB45998

Tested on:
Oracle Database 11g Enterprise Edition Release 2

x86_64 GNU/Linux

1.) Install Package on Linux as Root

yum install kernel-devel
yum install fuse fuse-libs

[root@lnx01 ~]# rpm -qa | grep kernel-devel
kernel-devel-2.6.32-573.22.1.el6.x86_64

root@lnx01 ~]# rpm -qa | grep fuse
fuse-libs-2.8.3-4.0.2.el6.x86_64
fuse-2.8.3-4.0.2.el6.x86_6

2.) Setup Database

sqlplus / as sysdba

create tablespace ts_dbfs datafile '/data03/db11//ts_dbfs_01.dbf' size 10m autoextend on next 10m;

create user dbfs_owner identified by dbfs default tablespace ts_dbfs;
alter user dbfs_owner quota unlimited on ts_dbfs;

GRANT CREATE SESSION, RESOURCE, CREATE VIEW, DBFS_ROLE TO dbfs_owner;

cd $ORACLE_HOME
cd rdbms
cd admin

sqlplus dbfs_owner/dbfs

@dbfs_create_filesystem.sql ts_dbfs FS_DBFS

3.) Mount

- As root:

mkdir -p /mnt/dbfs
chown oracle:oinstall /mnt/dbfs

usermod -a -G fuse oracle
id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),499(fuse)

export ORACLE_HOME=/oracle/product/11.2/db_1
echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr_local_lib.conf
ln -s $ORACLE_HOME/lib/libclntsh.so.11.1 /usr/local/lib/libclntsh.so.11.1
ln -s $ORACLE_HOME/lib/libnnz11.so /usr/local/lib/libnnz11.so
ln -s /lib64/libfuse.so.2 /usr/local/lib/libfuse.so.2
ldconfig
ln -s $ORACLE_HOME/bin/dbfs_client /sbin/mount.dbfs
chmod +x /bin/fusermount

- As Oracle:
dbfs_client dbfs_owner@DB11 /mnt/dbfs

- In another session as Oracle User:

[oracle@lnx01 dbfs]$ pwd
/mnt/dbfs
[oracle@lnx01 dbfs]$ ls -ltra
total 4
drwxrwxrwx 3 root root 0 Apr 20 04:33 FS_DBFS
drwxr-xr-x. 3 root root 4096 Apr 20 05:08 ..
drwxr-xr-x 3 root root 0 Apr 20 05:28 .

- umount

fusermount -u /mnt/dbfs

4.) Using the DBFS (Password):

dbfs_client dbfs_owner@DB11 --command ls -a -l dbfs:/FS_DBFS/
Password:
drwxr-xr-x root root 0 Apr 20 04:33 .sfs

dbfs_client dbfs_owner@DB11 --command mkdir dbfs:/FS_DBFS/test1

dbfs_client dbfs_owner@DB11 --command ls -a -l dbfs:/FS_DBFS/
Password:
drwx------ oracle oinstall 0 Apr 20 05:34 dbfs:/FS_DBFS/test1
drwxr-xr-x root root 0 Apr 20 04:33 .sf

5.) Wallet

As you can see, every time the dbfs_client ask for password and to start the DBFS the session is in HOLD.
So, to avoid this problem let's use WALLET;

- Stop the session in HOLD, with CTRL+C, the filesystem will be stoped;

As Oracle user:

mkdir -p $HOME/oracle/wallet

$ORACLE_HOME/bin/mkstore -wrl $HOME/oracle/wallet -create
--> Passwords must have a minimum length of eight characters 
 and contain alphabetic characters combined with numbers 
 or special characters.

--> DB11 here is my TNS entry
mkstore -wrl $HOME/oracle/wallet -createCredential DB11 dbfs_owner dbfs

- Mounting the File System:

nohup dbfs_client -o wallet /@db11 /mnt/dbfs &

[oracle@lnx01 dbfs]$ ls -ltr
total 0
drwxrwxrwx 4 root root 0 Apr 20 05:34 FS_DBFS
[oracle@lnx01 dbfs]$ pwd
/mnt/dbfs

dbfs_client /@DB11 --command ls -a -l dbfs:/FS_DBFS/

drwx------ oracle oinstall 0 Apr 20 05:34 dbfs:/FS_DBFS/test1
drwxr-xr-x root root 0 Apr 20 04:33 .sfs

6.) MOUNT with FSTAB

- to umount: 
fusermount -u /mnt/dbfs

- Add on FSTAB:

/sbin/mount.dbfs#dbfs_owner@db11 /mnt/dbfs fuse rw,user,noauto,direct_io 0 0

- Create File:

cat /sbin/mount.dbfs

#!/bin/bash
export ORACLE_HOME=/oracle/product/11.2/db_1
nohup $ORACLE_HOME/bin/dbfs_client $@ << FEEDPWD &
dbfs
FEEDPWD

chmod 775 /sbin/mount.dbfs
chgrp fuse /sbin/mount.dbfs

- As ORACLE user
mount /mnt/dbfs
 
[oracle@lnx01 db_1]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 11G 7.2G 2.5G 75% /
tmpfs 2.9G 1.2G 1.8G 40% /dev/shm
/dev/sda1 479M 54M 396M 12% /boot
/dev/sdb1 30G 25G 3.4G 88% /oracle
/dev/sdd1 4.8G 3.2G 1.4G 71% /data01
/dev/sde1 9.8G 5.4G 3.9G 59% /data02
/dev/sdf1 20G 6.6G 13G 36% /data03
dbfs 5.3M 136K 5.2M 3% /mnt/dbfs <<-- DBFS

[oracle@lnx01 FS_DBFS]$ pwd
/mnt/dbfs/FS_DBFS
[oracle@lnx01 FS_DBFS]$ ls -ltr
total 0
drwx------ 2 oracle oinstall 0 Apr 20 05:34 test1
[oracle@lnx01 FS_DBFS]$

[oracle@lnx01 test1]$ touch myDBFS.txt
[oracle@lnx01 test1]$ ls -ltr
total 0
-rw-r--r-- 1 oracle oinstall 0 Apr 20 06:04 myDBFS.txt
[oracle@lnx01 test1]$ pwd
/mnt/dbfs/FS_DBFS/test1
[oracle@lnx01 test1]$

-- Now is possible use dbfs_client without password:

dbfs_client /@DB11 --command ls -a -l dbfs:/FS_DBFS/
drwx------ oracle oinstall 0 Apr 20 06:04 dbfs:/FS_DBFS/test1
drwxr-xr-x root root 0 Apr 20 04:33 .sfs

Golden Gate – Part 2 (Configuration)

Continuing my previous post, now we will configure the environment to replicate
data from WINDOWS  to LINUX.
Here we will create the environment on Windows and configure GG for
the first load.

==> SOURCE Environment:

 Windows: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
 SID: DB01
 schema: appuser
 
- Objects:

create table appuser.t1 
(num number,
 text varchar2(100),
 dt date)
tablespace ts1;

create table appuser.t2 
(num number,
 text varchar2(100),
 dt date)
tablespace ts1;

create table appuser.t3 
(num number,
 text varchar2(100),
 dt date)
tablespace ts1;

ALTER TABLE appuser.t1 ADD CONSTRAINT pk_t1 PRIMARY KEY (num);
ALTER TABLE appuser.t2 ADD CONSTRAINT pk_t2 PRIMARY KEY (num);
ALTER TABLE appuser.t3 ADD CONSTRAINT pk_t3 PRIMARY KEY (num);

create sequence appuser.seq_t1 
minvalue 1 maxvalue 999999999999 
nocache order increment by 1;

create sequence appuser.seq_t2 
minvalue 1 maxvalue 999999999999 
nocache order increment by 1;

create sequence appuser.seq_t3 
minvalue 1 maxvalue 999999999999 
nocache order increment by 1;

declare 
i number;
begin
 for i in 1..100 loop
 insert into appuser.t1
 values
 (appuser.seq_t1.nextval, 'GOLDEN GATE TEST:' || TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS'),SYSDATE);

 insert into appuser.t2
 values
 (appuser.seq_t2.nextval, 'GOLDEN GATE TEST:' || TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS'),SYSDATE);

 insert into appuser.t3
 values
 (appuser.seq_t3.nextval, 'GOLDEN GATE TEST:' || TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS'),SYSDATE); 
 end loop;
 commit;
end;
/

exec dbms_stats.gather_schema_stats('APPUSER');
select owner, table_name, num_rows 
from dba_tables where owner='APPUSER';

OWNER TABLE_NAME NUM_ROWS
--------------- -------------- ------------
APPUSER T1 100
APPUSER T2 100
APPUSER T3 100

- Archivelog Mode

 Changing Windows Database to Archivelog mode:
 dest: D:\app\candrade\oradata\DB01\ARCH
 
 SQL> alter system set log_archive_dest_1='location=D:\app\candrade\oradata\DB01\ARCH' scope=both;

 System altered.

 SQL> shut immediate
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> startup mount;
 ORACLE instance started.

 Total System Global Area 2147483648 bytes
 Fixed Size 3834152 bytes
 Variable Size 671092440 bytes
 Database Buffers 1459617792 bytes
 Redo Buffers 12939264 bytes
 Database mounted.
 SQL> alter database archivelog;

 Database altered.

 SQL> alter database open;

 Database altered.

 SQL> archive log list;
 Database log mode Archive Mode
 Automatic archival Enabled
 Archive destination D:\app\candrade\oradata\DB01\ARCH
 Oldest online log sequence 50
 Next log sequence to archive 52
 Current log sequence 52

- Checking TNSNAMES.ora and LISTENER:

 * TNS entry from DB11(linux 11g instance) on Windows
 
 C:\Scripts>tnsping db11

 TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 - Production on 12-APR-2016 14:28:05

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

 Used parameter files:
 d:\app\candrade\product\12.1.0\dbhome_1\network\admin\sqlnet.ora


 Used TNSNAMES adapter to resolve the alias
 Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.130.1.36)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = db11)))
 OK (0 msec)

==> TARGET Environment:

Linux: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
SID: db11
schema:
create tablespace ts_app datafile '/data03/db11/ts_app_01.dbf' size 10m autoextend on next 10m maxsize 8g;
create user appuser identified by appuser default tablespace ts_app;
grant connect, resource to appuser;

- Archivelog Mode

 Changing lunux database 11g to archivelog mode
 dest: /data03/db11/arch

 SQL> alter system set log_archive_dest_1='location=/data03/db11/arch' scope=both;

 System altered.

 SQL> shut immediate;
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> startup mount;
 ORACLE instance started.

 Total System Global Area 835104768 bytes
 Fixed Size 2217952 bytes
 Variable Size 230688800 bytes
 Database Buffers 595591168 bytes
 Redo Buffers 6606848 bytes
 Database mounted.
 SQL> alter database archivelog;

 Database altered.

 SQL> alter database open;

 Database altered.

 SQL> archive log list;
 Database log mode Archive Mode
 Automatic archival Enabled
 Archive destination /data03/db11/arch
 Oldest online log sequence 4
 Next log sequence to archive 6
 Current log sequence 6

 SQL> select owner, table_name, num_rows
 from dba_tables where owner='APPUSER'; 2

 no rows selected

- Checking TNSNAMES.ora
 
 * TNS entry for DB01(windows instance) into TNSNAMES.ORA on WINDOWS and LINUX (11g home)
 
 [oracle@lnx01 admin]$ tnsping DB01IP

 TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 12-APR-2016 08:19:50

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

 Used parameter files:


 Used TNSNAMES adapter to resolve the alias
 Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.130.1.19)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DB01)))
 OK (0 msec) 
 
==> Golden Gate configuration

On this moment we have:
 1.) Golden gate installation on Windows 12c, linux DB 11g and linux DB 12c;
 2.) All database instances on ARCHIVELOG mode;
 3.) All tnsnames.ora "pinging" the DBs;

First i would like to make easier our setup creating some alias on Linux and seting up some variables on (Linux and Windows).

- Windows:

 Configure PATH to have GG HOME: C:\Magno\Techs\GoldenGate\home:

 C:\Scripts>ggsci

 Oracle GoldenGate Command Interpreter for Oracle
 Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401
 Windows x64 (optimized), Oracle 12c on Dec 18 2015 20:34:51
 Operating system character set identified as windows-1252.

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

- LINUX
 
 On this case we have 2 databases on Linux (11g and 12c)
 
 [oracle@lnx01 ~]$ alias
 alias db='. /home/oracle/dba/scripts/db_env.sh'
 alias db11='. /home/oracle/dba/scripts/db11_env.sh'
 alias gg11='/oracle/product/GG/11g/ggsci'
 alias gg12='/oracle/product/GG/12c/ggsci'
 alias grid='. /home/oracle/dba/scripts/grid_env.sh'
 
 [oracle@lnx01 scripts]$ cat grid_env.sh
 echo --------------------------------------
 echo GRID INFRASTRUCTURE
 echo --------------------------------------

 export ORACLE_BASE=/oracle
 export ORACLE_SID=+ASM
 export GRID_HOME=/oracle/grid
 export ORACLE_HOME=/oracle/grid

 export PATH=/usr/sbin:$PATH
 export PATH=$ORACLE_HOME/bin:$PATH

 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
 export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
 export DISPLAY=10.130.1.73:0.0
 
 [oracle@lnx01 scripts]$ cat db11_env.sh
 echo ---------------------------
 echo ORACLE DATABASE 11g
 echo --------------------------
 cat /etc/oratab | grep ":/"
 export ORACLE_SID=db11

 echo ""
 echo "ORACLE_SID: " $ORACLE_SID

 export ORACLE_BASE=/oracle
 export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1
 export GRID_HOME=/oracle/grid

 export PATH=/usr/sbin:$PATH
 export PATH=$ORACLE_HOME/bin:$PATH:/oracle/product/GG/11g

 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$GG_HOME_11g
 export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
 
 [oracle@lnx01 scripts]$ cat db_env.sh
 echo ---------------------------
 echo ORACLE DATABASE 12c
 echo --------------------------
 cat /etc/oratab | grep ":/"
 export ORACLE_SID=CDB

 echo ""
 echo "ORACLE_SID: " $ORACLE_SID

 export ORACLE_BASE=/oracle
 export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
 export GRID_HOME=/oracle/grid

 export PATH=/usr/sbin:$PATH
 export PATH=$ORACLE_HOME/bin:$PATH:$GG_HOME_12c

 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$GG_HOME_12c
 export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
 
 - Testing:
 
 [oracle@lnx01 scripts]$ db11
 ---------------------------
 ORACLE DATABASE 11g
 --------------------------
 db01:/oracle/product/12.1.0.2/db_1:N
 CDB:/oracle/product/12.1.0.2/db_1:N
 +ASM:/oracle/grid:N # line added by Agent
 db11:/oracle/product/11.2/db_1:N # line added by Agent

 ORACLE_SID: db11
 [oracle@lnx01 scripts]$ gg11

 Oracle GoldenGate Command Interpreter 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 00:54:38
 Operating system character set identified as UTF-8.

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


 [oracle@lnx01 scripts]$ db
 ---------------------------
 ORACLE DATABASE 12c
 --------------------------
 db01:/oracle/product/12.1.0.2/db_1:N
 CDB:/oracle/product/12.1.0.2/db_1:N
 +ASM:/oracle/grid:N # line added by Agent
 db11:/oracle/product/11.2/db_1:N # line added by Agent

 ORACLE_SID: CDB
 [oracle@lnx01 scripts]$ gg12

 Oracle GoldenGate Command Interpreter for Oracle
 Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
 Linux, x64, 64bit (optimized), Oracle 12c on Dec 12 2015 02:56:48
 Operating system character set identified as UTF-8.

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

 - Logging:
 
 sqlplus / as sysdba
 ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
 ALTER DATABASE FORCE LOGGING;

 SQL> SELECT supplemental_log_data_min, force_logging 
 FROM v$database;

 SUPPLEME FORCE_LOGGING
 -------- ---------------------------------------
 YES YES

 alter system switch logfile;
 
 - GG user:
 https://docs.oracle.com/goldengate/1212/gg-winux/GIORA/user_assignment.htm#GIORA552
 
 create tablespace ts_ggate datafile 'D:\APP\CANDRADE\ORADATA\DB01\ts_ggate_01.dbf' size 8m autoextend on next 8m maxsize 8g;
 create user ggate identified by ggate default tablespace ts_ggate;
 grant connect , resource to ggate;
 grant select any dictionary, select any table to ggate;
 grant create table to ggate;
 grant flashback any table to ggate;
 grant execute on dbms_flashback to ggate;
 grant execute on utl_file to ggate;
 grant dba to ggate;
 
 exec dbms_goldengate_auth.grant_admin_privilege('ggate');
 
 - Enabling GG on Database:
 
 ENABLE_GOLDENGATE_REPLICATION=true
 
 SQL> show parameter golden

 NAME TYPE VALUE
 ------------------------------------ ----------- --------------
 enable_goldengate_replication boolean FALSE
 
 SQL> alter system set ENABLE_GOLDENGATE_REPLICATION=true scope=both;

 System altered.

 SQL> show parameter golden

 NAME TYPE VALUE
 ------------------------------------ ----------- -------------------
 enable_goldengate_replication boolean TRUE
 
 - UNDO:
 By default, Oracle GoldenGate uses Flashback Query to fetch the values from the undo (rollback) tablespaces. 
 That way, Oracle GoldenGate can reconstruct a read-consistent row image as of a 
 specific time or SCN to match the redo record.

 For best fetch results, configure the source database as follows:

 UNDO_MANAGEMENT=AUTO
 UNDO_RETENTION=86400 
 UNDO_RETENTION can be adjusted upward in high-volume environments.
 
 - MEMORY
 https://docs.oracle.com/goldengate/1212/gg-winux/GIORA/setup.htm#GIORA234
 
 set STREAMS_POOL_SIZE at least with 1 GB;
 
 - DBMS_GOLDENGATE
 
 SQL> exec dbms_goldengate_auth.grant_admin_privilege('ggate');

 PL/SQL procedure successfully completed.
 
 - EXTRACT
 
 cd %GG_HOME% 
 # ggsci
 
 DBLOGIN USERID ggate, PASSWORD ggate
 
 ADD CHECKPOINTTABLE ggate.chktable
 EDIT PARAMS ./GLOBALS
 CHECKPOINTTABLE ggate.chktable
 
 edit params EXTWS12C <== EXTRACT for WINDOWS - Oracle 12c
 
 EXTRACT EXTWS12C
 USERID ggate, PASSWORD ggate
 LOGALLSUPCOLS
 UPDATERECORDFORMAT COMPACT
 TRANLOGOPTIONS EXCLUDEUSER ggate
 DDL INCLUDE MAPPED
 DDLOPTIONS ADDTRANDATA, GETREPLICATES, GETAPPLOPS
 BR BROFF
 EOFDELAY 1
 FLUSHSECS 1
 ENCRYPTTRAIL AES192
 EXTTRAIL C:\Magno\Techs\GoldenGate\home\dirdat\lt <== "Create this directory before start"
 SEQUENCE appuser.seq_t1;
 SEQUENCE appuser.seq_t2;
 SEQUENCE appuser.seq_t3;
 TABLE appuser.*;
 
 - DATA PUMP EXTRACT:
 Note: 
 - This port 7810 is not the default, because i have 2 DBs.
 - this directory must be created before start: /oracle/product/GG/11g/dirdat/rt on TARGET system
 - 10.130.1.36 My IP on TARGET system, the same that i have on LISTENER.
 
 EXTRACT PMPWS12C
 -- Specify database login information as needed for the database:
 USERID ggate, PASSWORD ggate
 RMTHOST 10.130.1.36, MGRPORT 7810
 -- Specify the remote trail on the secondary system:
 RMTTRAIL C:\Magno\Techs\GoldenGate\home\dirdat\pn
 PASSTHRU
 -- Specify tables to be captured:
 SEQUENCE appuser.seq_t1;
 SEQUENCE appuser.seq_t2;
 SEQUENCE appuser.seq_t3;
 TABLE appuser.*;
 
 - MGR on Windows:
 
 EDIT PARAMS MGR
 
 PORT 7809
 USERID ggate, PASSWORD ggate
 PURGEOLDEXTRACTS C:\Magno\Techs\GoldenGate\home\dirdat\ex, USECHECKPOINTS
 Autostart Extract E*
 AUTORESTART Extract *, WaitMinutes 1, Retries 3
 Autostart Replicat R*
 AUTORESTART Replicat *, WaitMinutes 1, Retries 3
 
2.) LINUX Setup:

 [oracle@lnx01 rt]$ db11
 ---------------------------
 ORACLE DATABASE 11g
 --------------------------
 db01:/oracle/product/12.1.0.2/db_1:N
 CDB:/oracle/product/12.1.0.2/db_1:N
 +ASM:/oracle/grid:N # line added by Agent
 db11:/oracle/product/11.2/db_1:N # line added by Agent

 ORACLE_SID: db11

 - Logging:
 
 sqlplus / as sysdba
 ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
 ALTER DATABASE FORCE LOGGING;

 SQL> SELECT supplemental_log_data_min, force_logging 
 FROM v$database;

 SUPPLEME FORCE_LOGGING
 -------- ---------------------------------------
 YES YES

 alter system switch logfile;
 
 - GG user:
 https://docs.oracle.com/goldengate/1212/gg-winux/GIORA/user_assignment.htm#GIORA552
 
 create tablespace ts_ggate datafile '/data03/db11/ts_ggate_01.dbf' size 8m autoextend on next 8m maxsize 8g;
 create user ggate identified by ggate default tablespace ts_ggate;
 grant connect , resource to ggate;
 grant select any dictionary, select any table to ggate;
 grant create table to ggate;
 grant flashback any table to ggate;
 grant execute on dbms_flashback to ggate;
 grant execute on utl_file to ggate;
 grant dba to ggate;
 
 # ggsci
 
 DBLOGIN USERID ggate, PASSWORD ggate
 
 ADD CHECKPOINTTABLE ggate.chktable
 EDIT PARAMS ./GLOBALS
 CHECKPOINTTABLE ggate.chktable
 
 edit params rep11g
 
 REPLICAT rep11g
 ASSUMETARGETDEFS
 DISCARDFILE /oracle/product/GG/11g/discard/rep11g.dsc, PURGE
 USERID ggate, PASSWORD ggate
 REPORTCOUNT EVERY 1 MINUTES, RATE
 DDLOPTIONS UPDATEMETADATA
 DDLERROR DEFAULT IGNORE RETRYOP
 EOFDELAY 1
 MAP appuser.*, TARGET appuser.*;
 
 GGSCI (lnx01 as ggate@db11) 32> info all

 Program Status Group Lag at Chkpt Time Since Chkpt

 MANAGER RUNNING
 
 - MGR on Linux:
 
 EDIT PARAMS MGR
 
 PORT 7810
 USERID ggate, PASSWORD ggate
 PURGEOLDEXTRACTS /oracle/product/GG/11g/dirdat/ex, USECHECKPOINTS
 Autostart Extract E*
 AUTORESTART Extract *, WaitMinutes 1, Retries 3
 Autostart Replicat R*
 AUTORESTART Replicat *, WaitMinutes 1, Retries 3
 ACCESSRULE, PROG REPLICAT, IPADDR 10.130.1.19, ALLOW
 
 - restart
 
 GGSCI (lnx01) 7> stop manager
 Manager process is required by other GGS processes.
 Are you sure you want to stop it (y/n)?y

 Sending STOP request to MANAGER ...
 Request processed.
 Manager stopped.

 GGSCI (lnx01) 8> start manager
 Manager started.

 GGSCI (lnx01) 9> info manager

 Manager is running (IP port lnx01.7810, Process ID 7500).
 
3.) First Load:
 
 - SOURCE:
 
 exp cmagno/pwd file=appuser.dmp rows=n indexes=y grants=y constraints=y owner=appuser
 imp cmagno/pwd@db11 file=appuser.dmp fromuser=appuser touser=appuser ignore=y grants=y constraints=y indexes=y
 
 #GGSCI
 ADD EXTRACT load1, SOURCEISTABLE

 EDIT PARAMS load1

 EXTRACT load1
 USERID ggate, PASSWORD ggate
 RMTHOST 10.130.1.36, MGRPORT 7810
 RMTTASK replicat, GROUP load2
 TABLE appuser.*;

 - Target
 
 #GGSCI
 ADD REPLICAT load2, SPECIALRUN

 EDIT PARAMS load2

 REPLICAT load2
 USERID ggate, PASSWORD ggate
 ASSUMETARGETDEFS
 WILDCARDRESOLVE IMMEDIATE
 MAP appuser.*, TARGET appuser.*;
 
 - Source:
 
 START EXTRACT load1
 
 - Target:
 info replicat load2
 
 sqlplus / as sysdba
 exec dbms_stats.gather_schema_stats('APPUSER');
 SQL> select owner, table_name, num_rows
 from dba_tables where owner='APPUSER';
 2
 OWNER TABLE_NAME NUM_ROWS
 ------------------------------ ------------------------------ ----------
 APPUSER T3 100
 APPUSER T2 100
 APPUSER T1 100
-------------------------------------------------------------------------------
Next.. Configuration for ONGOING replication on GG.. to be continued