Sample Schemas facility in Oracle Database 11G

Author: Bruno Reis da Silva (techdatabasket.com),
Revised by : Cleber Jose Campos Martins and Carlos Magno de Andrade Junior

Posted in June 2016

Original Version on OTN

During Oracle Corporation read the documentation, you can find some references and examples using so-called users Sample Schemas , which includes well – known users of the administrators of databases, such as the Scott users, RH, SH and many others. These users have a wide variety of objects that can be of great use in simulations of everyday situations in the database.

Thinking about it, the main focus will be installing the Sample Schemas. The installation environment used is an operating system Oracle Linux 6.3 with 32-bit CPU processing version along with an Oracle database version 11.2.0.3.0.

Therefore, the installation package will be used to “p10404530_112030_platform_6of7.zip”. However, if you are using another operating system platform, download the package related to your system is necessary in the “My Oracle Support (MetaLink).”

Thus, to make the installation of Samples Schemas you must follow the following steps:

  • Download installation software related to the operating system used:

As I mentioned earlier:

– Operating system: Linux 6.3
– Installation Package: p10404530_112030_LINUX_6of7.zip
– CPU processing Version: 32 bit

  • Unzipping the installation package:
 [Oracle @ tech_machine] $ unzip p10404530_112030_LINUX_6of7.zip 
 Archive: p10404530_112030_LINUX_6of7.zip 
 creating: examples / 
 creating: examples / doc / 
 creating: examples / doc / dcommon / 
 creating: examples / doc / dcommon / css / 
 inflating: examples / doc / dcommon / css / blafdoc.css 
 inflating: examples / doc / dcommon / css / bp_layout.css 
 Extracting: examples / doc / dcommon / css / darbbook.css 
 inflating: examples / doc / dcommon / css / doccd.css 
 creating: examples / doc / dcommon / dtds / 
 inflating: examples / doc / dcommon / dtds / targetdatabase.dtd 
 creating: examples / doc / dcommon / gifs /

 ... (List of all the unzipped files) 

 inflating: examples / stage / Components / oracle.sqlj.companion / 11.2.0.3.0 / 1 / DataFiles / filegroup1.jar 
 inflating: examples / stage / Components / oracle.sqlj.companion / 11.2.0.3.0 / 1 / DataFiles / filegroup3.jar 
 inflating: examples / stage / Components / oracle.sqlj.companion / 11.2.0.3.0 / 1 / DataFiles / filegroup2.jar 
 creating: examples / stage / sizes / 
 Extracting: examples / stage / sizes / oracle.companionCD.db.DB.sizes.properties 
 inflating: examples / stage / oracle.companionCD.db.11_2_0_3_0.xml 
 inflating: examples / stage / invDetails.properties 
 inflating: examples / stage / install1.jar 
 creating: examples / stage / GlobalVariables / 
 inflating: examples / stage / GlobalVariables / variable.properties 
 inflating: examples / stage / GlobalVariables / globalvar.xml 
 inflating: examples / stage / oracle.companionCD.db.11_2_0_3_0_1316395524086.bak 
 inflating: examples / readme.html
  • Installing Samples Schemas: After unzipping the file, a directory will be created with the name of “examples” and within it is contained the runInstaller which is the file used during installation:
  • Location of runInstaller startup script:
 [Oracle @ tech_machine] $ cd examples 
 [Oracle @ tech_machine] $ ls ltr 
 Total 60 
 -rwxr-xr-x.  1 oracle oinstall 3473 Aug 22 2011 welcome.html 
 -rwxr-xr-x.  1 oracle oinstall 10009 Sep 22 2011 runInstaller 
 drwxr-xr-x.  12 oracle oinstall 4096 Sep 22 2011 stage 
 drwxr-xr-x.  2 oracle oinstall 4096 Sep 22 2011 response 
 drwxr-xr-x.  4 oracle oinstall 4096 Sep 22 2011 install 
 drwxr-xr-x.  6 oracle oinstall 4096 Sep 22 2011 doc 
 -rwxr-xr-x.  1 oracle oinstall 28122 Sep 22 2011 readme.html
  • Starting the runInstaller script:
 [Oracle @ tech_machine] $ ./runInstaller 
 Starting Oracle Universal Installer ...
 Checking Temp space: must be greater than 120 MB.  Actual 1158 MB Passed 
 Checking swap space: must be greater than 150 MB.  Actual 3555 MB Passed 
 Checking monitor: must be configured to display at least 256 colors.  Current 16777216 Passed 
 Preparing to launch Oracle Universal Installer from / tmp / OraInstall2016-06-11_09-00-09PM. 
 Please wait ... [oracle @ tech_machine] $
  • Download Software Updates: In this option you can enter your credentials for access to Metalink, use pre-downloads or simply skip this step through the “Skip updates software”:

1. Download Software Updates

  • Specifying the installation location of Samples Schemas:

2. Installation Location

  • Verification of prerequisites: In this section will be performed to check the basic requirements for installing the Sample Schemas successfully happen.

3. Checking of the prerequisites

  • Installation Summary: this step will show a summary of the installation information.

4. Installation Summary

  • Installation Progress: Party where, in fact, the packages containing the information of the Sample Schemas, begin to be installed.

5. Installation Progress

  • End of installation: After the installation, a screen will be displayed informing the completion of the same. Finally, simply click the “Close” button.

6. Termination of the installation

After installing the package you can find several scripts in the $ ORACLE_HOME / demo / schema, which can be installed. Thus, following the example of a HR user installation, which is the smallest and the simplest user-called Sample Schemas, by running the hr_main.sql script, which in addition to ordering the information to the user creation inside the base data, will create the objects, popular tables and collect statistics for the HR user during its creation.

 [Oracle @ tech_machine] $ sqlplus "/ as sysdba"
 SQL * Plus: Release 11.2.0.3.0 Production on Mon Jun 13 10:51:16 2016
 Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 Connected to: 
 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production 
  With the Partitioning, OLAP, Data Mining and Real Application Testing options
 SQL> @ hr_main.sql
 specify password for the HR parameter 1: 
 Enter value for 1: *********
 specify default tablespeace HR is the parameter 2: 
 Enter value for 2: USERS
 specify temporary table space for the HR parameter 3: 
 Enter value for 3: TEMP
 specify password for SYS the parameter 4: 
 Enter value for 4: *********
 specify the log path parameter 5: 
 Enter value for 5: /u01/app/oracle/product/11.2.0/dbhome_1/demo/schema/human_resources

After creating the user, we can already perform the tests with the user created. As described above, the Samples Schemas are quite used in the documentation of Oracle Corporation, as the example below is contained in the section “8 Managing a Materialized View Replication Environment” manual “Database Advanced Replication Management API Reference” performing a refresh of a materialized view:

 [Oracle @ tech_machine] $ sqlplus "/ as sysdba"
 SQL * Plus: Release 11.2.0.3.0 Production on Mon Jun 13 11:33:18 2016
 Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 SQL> BEGIN
 DBMS_MVIEW.REFRESH (
 list => 'hr.departments_mv' 
 method =>) '?';
 END;
 /

CONCLUSION:

Samples Schemas can assist the Database Administrator in the simulation of a real environment on a day-to-day of it. Another point to note is that during these simulations you can use your own testing of official documentation of Oracle Corporation, since it makes use of own Samples Schemas in presenting their examples.

REFERENCE:

[1] https://docs.oracle.com/cd/E11882_01/server.112/e10707/rarmanmv.htm#REPMA389
[2] https://docs.oracle.com/cd/E18283_01/server.112/e10831/installation.htm#I6806


Bruno Reis da Silva is Brazilian, Scientist Computer, Database Administrator Oracle / MySQL for over five years and professional certificate in database administration. Specialist administration and database infrastructure with experience in the implementation and management of database environments with Data Warehouse, Business Intelligence, database security, performance tuning , and high availability. He has managed the databases of major Brazilian and international companies. It also shares information on your blog techdatabasket.com.

Cleber Jose Campos Martins is Brazilian, Oracle Database Administrator for over 15 years and professionally OCP certificate for versions 10g, 11g and 12c and Oracle RAC 11g Release 2 and Grid Infrastructure Administration .With experience in versions 7 will 12c in companies like IBM, Marisa Lojas and DPaschoal.

Carlos Magno de Andrade Junior, now working as Database Architect eProseed in Europe, with over 15 years of experience in Oracle database, having worked in companies like Oracle Corporation, IBM, HSBC, among others. It also shares information on your blog ezdba.wordpress.com.

This article was reviewed by the Oracle product team and is in accordance with the standards and practices for the use of Oracle products.

LogMiner – Pluggable Database

Log Miner on Multitenant 12c

The following steps will show you some differences to use LogMiner with Pluggable
databases. At this time i will use Flat File for the dictionary.

References:
http://docs.oracle.com/database
/121/SUTIL/GUID-3417B738-374C-4EE3-B15C-3A66E01AE2B5.htm#SUTIL019

--> PDBS:
select * from v$pdbs;

              CON_ID                 DBID NAME                      OPEN_MODE
-------------------- -------------------- ------------------------- ----------
                   2           1147477011 PDB$SEED                  READ ONLY
                   3           3291301321 PDB1                      READ WRITE
                   5           4142533224 PDB3                      READ WRITE

--> Archive Status
--> The time below will be used on DBMS_LOGMNR.start_logmnr

08:42:41 SQL> archive log list;

Database log mode          Archive Mode
Automatic archival             Enabled
Archive destination            /data01/CDB/archives
Oldest online log sequence     167
Next log sequence to archive   169
Current log sequence           169

--> Simulating some operations on PDBs

alter session set container=pdb1;

select name, open_mode from v$pdbs;

NAME                                     OPEN_MODE
---------------------------------------- ----------
PDB1                                     READ WRITE

create table test.test_pdb1
(num number,
 text varchar2(10))
tablespace TS_PDB1;

insert into test.test_pdb1 values (1,'test 1');
insert into test.test_pdb1 values (2,'test 2');
insert into test.test_pdb1 values (3,'test 3');
insert into test.test_pdb1 values (4,'test 4');

commit;

delete test.test_pdb1 where num = 2;
commit;

update test.test_pdb1 set text='UPDATE 3' where num=3;
commit;

select * from test.test_pdb1;

                 NUM TEXT
-------------------- ----------
                   1 test 1
                   3 UPDATE 3
                   4 test 4


alter session set container=pdb3;
 
select name, open_mode from v$pdbs;

NAME                                     OPEN_MODE
---------------------------------------- ----------
PDB3                                     READ WRITE

create table test.test_pdb3
(num number,
text varchar2(10))
tablespace users;

insert into test.test_pdb3 values (1,'test 1');
insert into test.test_pdb3 values (2,'test 2');
insert into test.test_pdb3 values (3,'test 3');
insert into test.test_pdb3 values (4,'test 4');
commit;

update test.test_pdb3 set text='ERROR';
commit;

select * from test.test_pdb3;

                 NUM TEXT
-------------------- ----------
                   1 ERROR
                   2 ERROR
                   3 ERROR
                   4 ERROR

-------------------------------- STARTING HERE ---------------------------------

alter session set container=cdb$root;

select name, open_mode from v$pdbs;

NAME                                     OPEN_MODE
---------------------------------------- ----------
PDB$SEED                                 READ ONLY
PDB1                                     READ WRITE
PDB3                                     READ WRITE

alter system switch logfile;
--> The time below will be used on DBMS_LOGMNR.start_logmnr

09:04:13 SQL> archive log list;

Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /data01/CDB/archives
Oldest online log sequence     173
Next log sequence to archive   175
Current log sequence           175

--> At this time we will work with archived logs below:

/data01/CDB/archives/1_168_900491294.dbf
/data01/CDB/archives/1_169_900491294.dbf
/data01/CDB/archives/1_170_900491294.dbf
/data01/CDB/archives/1_171_900491294.dbf
/data01/CDB/archives/1_172_900491294.dbf
/data01/CDB/archives/1_173_900491294.dbf
/data01/CDB/archives/1_174_900491294.dbf

Note:

http://docs.oracle.com/database/121/SUTIL/GUID-EF8A932F-7E71-4995-893E-E583B90007C2.htm#SUTIL4227

Using a Flat File Dictionary in a CDB

"You cannot take a dictionary snapshot for an entire CDB in a single flat file. 
You must be connected to a distinct PDB, and can take a snapshot of only that 
PDB in a flat file. Thus, when using a flat file dictionary, you can only mine 
the redo logs for the changes associated with the PDB whose data dictionary is 
contained within the flat file."

1.) Creating the dictionary PDB1

alter session set container=pdb1;
create directory scripts as '/home/oracle/dba/scripts';
exec dbms_logmnr_d.build('minerPDB1.dic', 'SCRIPTS', dbms_logmnr_d.store_in_flat_file);

!ls -ltr /home/oracle/dba/scripts/minerPDB1.dic
-rw-r--r-- 1 oracle oinstall 44592353 May 17 10:14 /home/oracle/dba/scripts/minerPDB1.dic

2.) Creating the Dictionary PDB3

alter session set container=pdb3;
create directory scripts as '/home/oracle/dba/scripts';
exec dbms_logmnr_d.build('minerPDB3.dic', 'SCRIPTS', dbms_logmnr_d.store_in_flat_file);

!ls -ltr /home/oracle/dba/scripts/minerPDB3.dic
-rw-r--r-- 1 oracle oinstall 44638808 May 17 10:16 /home/oracle/dba/scripts/minerPDB3.dic

3.) Including Archived Logs to be mined for PDB1:

exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_168_900491294.dbf',Options=>dbms_logmnr.NEW);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_169_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_170_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_171_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_172_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_173_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_174_900491294.dbf',Options=>dbms_logmnr.ADDFILE);

4.) Starting the miner for PDB1:

BEGIN
DBMS_LOGMNR.start_logmnr (
dictfilename => '/home/oracle/dba/scripts/minerPDB1.dic',
starttime => TO_DATE('17-MAY-2016 08:42:41', 'DD-MON-YYYY HH:MI:SS'),
endtime => TO_DATE('17-MAY-2016 09:04:13', 'DD-MON-YYYY HH:MI:SS'),
options => DBMS_LOGMNR.COMMITTED_DATA_ONLY);
END;
/

5.) Collecting Information for PDB1

desc v$logmnr_contents

select count(*), TABLE_NAME
FROM v$logmnr_contents
GROUP BY TABLE_NAME;

select count(*) from v$logmnr_contents where table_name like '%TEST_PDB%';

            COUNT(*)
--------------------
                   7


col operation format a10
col sql_redo format a80
col sql_undo format a80
col username format a10

select username, operation, sql_redo, sql_undo 
from  v$logmnr_contents
where table_name ='TEST_PDB1';
                   
LogMiner1
                   
6.) Finishing for PDB1

exec DBMS_LOGMNR.END_LOGMNR;

7.) Including Archived Logs to be mined for PDB3:

exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_168_900491294.dbf',Options=>dbms_logmnr.NEW);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_169_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_170_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_171_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_172_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_173_900491294.dbf',Options=>dbms_logmnr.ADDFILE);
exec dbms_logmnr.add_logfile(LogFileName=>'/data01/CDB/archives/1_174_900491294.dbf',Options=>dbms_logmnr.ADDFILE);

8.) Starting the miner for PDB3:

BEGIN
DBMS_LOGMNR.start_logmnr (
dictfilename => '/home/oracle/dba/scripts/minerPDB3.dic',
starttime => TO_DATE('17-MAY-2016 08:42:41', 'DD-MON-YYYY HH:MI:SS'),
endtime => TO_DATE('17-MAY-2016 09:04:13', 'DD-MON-YYYY HH:MI:SS'),
options => DBMS_LOGMNR.COMMITTED_DATA_ONLY);
END;
/

9.) Collection Information for PDB3

desc v$logmnr_contents

select count(*), TABLE_NAME
FROM v$logmnr_contents
GROUP BY TABLE_NAME;

select count(*) from v$logmnr_contents where table_name like '%TEST_PDB%';

            COUNT(*)
--------------------
                   9


col operation format a10
col sql_redo format a80
col sql_undo format a80
col username format a10

select username, operation, sql_redo, sql_undo 
from  v$logmnr_contents
where table_name ='TEST_PDB3';

LogMiner2
                   
10.) Finishing for PDB3

exec DBMS_LOGMNR.END_LOGMNR;

TFA(Trace File Analyzer) on OHAS

References:
Making Applications Highly Available Using 11gR2 Grid Infrastructure 
(Doc ID 1105489.1)

On this post i will show how to add the TFACTL as a resource on CRS, on my case 
is a standalone installation, so will be on 
OHAS (Oracle High Availability Services).

1.) Changes as ROOT:

cd $TFA_HOME
chmod -R o+r *
chmod -R o+x *

Include Oracle on /etc/sudoers to execute TFACTL as root, on my case oracle has
right to execute anything as root, check with your sysadmin.

oracle  ALL=(ALL) NOPASSWD: ALL

On /etc/sudoers set the option below:
Defaults    !requiretty

2.) Script:
To automate the process, we need create a script with CRS application standard. 
You can find on (Doc ID 1105489.1).
This script should be created as Grid owner.
-----------------------------------------------------------------------------
#!/bin/sh
# Author: Carlos Magno
########################################
logfile=/tmp/tfacrs.out
lockfile=/oracle/tfa/lnx01/tfa_home/tfa.lock
CMD=/oracle/tfa/bin/tfactl
PIDosw=`ps -ef | grep TFAMain | grep -v grep | awk '{print $2}'`
vPar=$1
echo "Option:" $vPar >> $logfile
case $1 in
  'start')
    echo `/bin/date` " start " `/usr/bin/id` >> $logfile
    if [ -e $lockfile ]; then
       echo "TFA already started" >> $logfile
    else
      sudo $CMD $vPar
    fi
    RET=$?
    ;;
  'stop')
    echo `/bin/date` " stop " `/usr/bin/id` >> $logfile

    if [ -e $lockfile ]; then
           sudo $CMD $vPar
    else
       echo "TFA not running" >> $logfile
    fi
    RET=$?
    ;;
  'clean')
    echo `/bin/date` " clean " `/usr/bin/id` >> $logfile
    sudo kill -9 $PIDosw
    RET=0
    ;;
  'check')
    echo `/bin/date` " check " `/usr/bin/id` >> $logfile
    if [ -e $lockfile ]; then
          echo "CHECK - TFA is running" >> $logfile
      RET=0
    else
      echo "CHECK - TFA is not running" >> $logfile
      RET=1
    fi
    tail -1  $logfile
    ;;
  *)
    echo `/bin/date` " unknown " `/usr/bin/id` >> $logfile
    RET=0
    ;;
esac
if [ $RET -eq 0 ]; then
  exit 0
else
  exit 1
fi
-----------------------------------------------------------------------------
After created the script, you need execute:
chmod +x <script name>

execute some tests with the script. On my case my script is:
/home/oracle/dba/scripts/oracle_exec_tfa.sh
./oracle_exec_tfa.sh (start|stop|clean|check)

To check: /tmp/tfacrs.out
3.) Adding on CRS
crsctl add resource TFACRS.ora -type ora.local_resource.type -attr 
"AUTO_START=always,ACTION_SCRIPT=/home/oracle/dba/scripts/oracle_exec_tfa.sh"

4.) Start Resource
crsctl start resource TFACRS.ora
crsctl stat res -t

CRSCTL_TFACTL

Log on CRS to check:
/<ORACLE BASE>/diag/crs/<HOSTNAME>/crs/trace/ohasd_scriptagent_oracle.trc

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 ...

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