using tkprof for performance analysis

-- generate trace file

set linesize 5000
set pagesize 0
set trimspool on
set trims on
set heading off
set feedback off
SET TERMOUT OFF

alter session set timed_statistics = true; 
alter session set statistics_level=ALL; 
alter session set max_dump_file_size=UNLIMITED; 
alter session set tracefile_identifier='bad_10046'; 
ALTER SESSION SET EVENTS '10046 trace name context forever, level 8'; 
ALTER SESSION SET EVENTS '10053 trace name context forever, level 1'; 

@query

select * from dual;

-- analyze trace file and generate report
$ tkprof trace_file_name sys=no explain=user/pass@db sort='(prsela,exeela,fchela,execpu)' print=10


-- tkprof usage 
Usage: tkprof tracefile outputfile [explain= ] [table= ]
              [print= ] [insert= ] [sys= ] [sort= ]
  table=schema.tablename   Use 'schema.tablename' with 'explain=' option.
  explain=user/password    Connect to ORACLE and issue EXPLAIN PLAN.
  print=integer    List only the first 'integer' SQL statements.
  aggregate=yes|no
  insert=filename  List SQL statements and data inside INSERT statements.
  sys=no           TKPROF does not list SQL statements run as user SYS.
  record=filename  Record non-recursive statements found in the trace file.
  waits=yes|no     Record summary for any wait events found in the trace file.
  sort=option      Set of zero or more of the following sort options:
    prscnt  number of times parse was called
    prscpu  cpu time parsing
    prsela  elapsed time parsing
    prsdsk  number of disk reads during parse
    prsqry  number of buffers for consistent read during parse
    prscu   number of buffers for current read during parse
    prsmis  number of misses in library cache during parse
    execnt  number of execute was called
    execpu  cpu time spent executing
    exeela  elapsed time executing
    exedsk  number of disk reads during execute
    exeqry  number of buffers for consistent read during execute
    execu   number of buffers for current read during execute
    exerow  number of rows processed during execute
    exemis  number of library cache misses during execute
    fchcnt  number of times fetch was called
    fchcpu  cpu time spent fetching
    fchela  elapsed time fetching
    fchdsk  number of disk reads during fetch
    fchqry  number of buffers for consistent read during fetch
    fchcu   number of buffers for current read during fetch
    fchrow  number of rows fetched
    userid  userid of user that parsed the cursor

stop/start weblogic

-- admin server
${MW_HOME}/user_projects/domains/${DOMAIN_NAME}/servers/AdminServer/security/boot.properties

${MW_HOME}/user_projects/domains/${DOMAIN_NAME}/bin/stopWebLogic.sh
${MW_HOME}/user_projects/domains/${DOMAIN_NAME}/bin/startWebLogic.sh > wl_admin.log 2>&1 &

-- managed server
${MW_HOME}/user_projects/domains/${DOMAIN_NAME}/servers/wls_ods1/security/boot.properties

SERVER_NAME=wls_ods1
ADMIN_URL=t3://hostname.domain.com: 
$MW_HOME/user_projects/domains/${DOMAIN_NAME}/bin/stopManagedWebLogic.sh ${SERVER_NAME} ${ADMIN_URL}
nohup $MW_HOME/user_projects/domains/${DOMAIN_NAME}/bin/startManagedWebLogic.sh ${SERVER_NAME} ${ADMIN_URL} > wl.log 2>&1 &

get explain plan from AWR or SQLSET


select plan_table_output 
from table(dbms_xplan.DISPLAY_AWR(
     sql_id => '89xabc4z1abcd',
     plan_hash_value => 3001039988,
     format => 'TYPICAL'))
     ;  

select plan_table_output 
from table(dbms_xplan.DISPLAY_SQLSET(
     sqlset_name => 'SET_NAME',
     sql_id => '89xabc4z1abcd',
     plan_hash_value => 3001039988,
     format => 'TYPICAL',
     sqlset_owner => 'SYSTEM'))
     ;  

search audit trail

select * 
from dba_audit_trail t 
where trunc(t.timestamp) = to_date('2017-05-17', 'yyyy-mm-dd') 
and username not in ('DBSNMP')
and action_name not in ('LOGON', 'LOGOFF')
and obj_name = 'table_name'
;

some ldap commands

eusm createDomain 
  domain_name="" 
  realm_dn="dc=..,dc=.." 
  ldap_host="" 
  ldap_port= 
  ldap_user_dn="" 
  ldap_user_password="**"

oidctl connect=OIDDB 
  server=oidrepld 
  instance=1 
  componentname= 
  flags="-h  -p " 
  start | stop


oidcmprec operation=[reconcile | compare] 
  source=host1:port 
  destination=host2:port
  base='("cn=,cn=,cn=..,cn=..,cn=oraclecontext,dc=..,dc=..")' 
  scope=sub

oidcmprec operation=reconcile 
  source=host1:port 
  destination=host2:port 
  base='("cn=,cn=oraclecontext,dc=..,dc=..")' 
  scope=sub


ldapsearch -h  -p  -D cn= -w ** -b "dc=..,dc=.." "(cn=)"

ldapsearch -h  -p  -D cn= -w ** -b "cn=users,dc=..,dc=.." "(uid=)" 

check Linux packages


#!/bin/bash 

array=( 
  binutils-2.23.52.0.1.el7.x86_64 
  compat-libcap1-1.10-1.x86_64 
  compat-libstdc++-33-3.2.3-69.el7.x86_64 
  compat-libstdc++-33-3.2.3-69.el7.i686 
  gcc-4.8.2-0.el7.x86_64 
  gcc-c++-4.8.2-0.el7.x86_64 
  glibc-2.17-0.0.el7.i686 
  glibc-2.17-0.0.el7.x86_64 
  glibc-devel-2.17-0.0.el7.x86_64 
  ksh.x86_64 
  libgcc-4.8.2-00.el7.i686 
  libgcc-4.8.2-00.el7.x86_64 
  libstdc++-4.8.2-00.el7.x86_64 
  libstdc++-4.8.2-00.el7.i686 
  libstdc++-devel-4.8.2-00.el7.x86_64 
  libaio-0.3.109-00.el7.x86_64 
  libaio-devel-0.3.109-00.el7.x86_64 
  make-3.82-00.el7.x86_64 
  sysstat-10.1.5-00.el7.x86_64 
) 

len=${#array[*]} 
i=0 
line='-------------------------------------------------------------------' 
while [[ $i -lt $len ]]; do 
  req_pkg="^${array[$i]%%.*}" 
  req_arch="${array[$i]##*.}" 
  req_arch="${req_arch/6/.}"; req_arch="${req_arch/3/.}$" 
  curr_rpm=`rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" | grep ${req_pkg} | grep 

${req_arch}`; 
  if [ $(expr "${curr_rpm%%.*}" \>= "${req_pkg}") -eq 1 ]; 
  then 
    result1=pass; else result1=failed; 
  fi 
  printf "%s %s [$result1]\n" ${array[$i]} ${line:${#array[$i]}} 
  echo $curr_rpm; 
  let i++; 
done 

oracle database install

# set environment variable
export DISPLAY=hostname:0.0
export TMP=/u01/tmp
export TMPDIR=/u01/tmp

# check limits

--  open file descriptors (1024-65536)
$ ulimit -sn  
$ ulimit -Hn  

-- number of processes available to a single user (2047-16384)
$ ulimit -Su 
$ ulimit -Hu

-- size of the stack segment of the process (10240KB - 32768KB)
$ ulimit -Ss  
$ ulimit -Hs

# set limits (/etc/security/limits.conf)
oracle  hard    nproc   16384
oracle  soft    nproc   2047
oracle  hard    nofile  65536
oracle  soft    nofile  4096
oracle  hard    stack   32768
oracle  soft    stack   10240

./runIntaller

# dbca create database

export ORACLE_BASE=/uo1/app/oracle
export ORACLE_HOME=/uo1/app/oracle/product/12.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export DISPLAY=hostname:0.0

dbca