Thursday, 5 April 2018

FB APPS DBA


NLS Time Settings
alter session set nls_date_format='DD-MON-YYYY HH24:MI';
Disk Space/File resize
du -sh * | sort | head -n 10
truncate alert_GTMDEV2.log --size 10GB
svc-dbatools
sudo -s -u svc-dbatools
sqlplus apps password
sqlplus `history | grep -v grep | grep apps | grep -oh  "\w*apps/\?\w\+" | tail -n 1`

Loop through
for i in `cat servers.lst`
do
 ssh -t  $i "sudo su - oracle <<'EOF'
  whoami;
  exit;
 EOF
"
done
ADF
-XX:+FlightRecorder
ODS
[kchandran@prn-elysium01 ~]$ sudo -u svc-dbatools -s
[sudo] password for kchandran:

Open LogMon config
vi `cat /etc/cron.d/fbit_crontab | grep ogMon| awk '{print $9}'`
EBS
rsync
rsync -avzptl /path/ target:/path/
Standby
 STARTUP
ALTER DATABASE RECOVER  managed standby database using current logfile disconnect from session parallel 24
Patch Apply
adop phase=apply patches=17237429 apply_mode=hotpatch
Weblogic Admin Port Number"
grep  s_wls_adminport $CONTEXT_FILE
Get OS Watcher log file
log files from 4 pm to 7 pm 
cp /var/log/oswatcher/*/`hostname`_*_17.10.12.1[4567]00.dat.gz ./
Log Files for EBS
a) OPMN and OHS log files
zip -r /tmp/`uname -n`_`date +%m%d%y.%H%M`_OPMN_OHS.zip \
$IAS_ORACLE_HOME/instances/*/diagnostics/logs/OHS/*/*log* \
$IAS_ORACLE_HOME/instances/*/diagnostics/logs/OPMN/opmn/*

b) WebLogic Server
zip -r /tmp/`uname -n`_`date +%m%d%y.%H%M`_FMW.zip $IAS_ORACLE_HOME/../wlserver_10.3/common/nodemanager $EBS_DOMAIN_HOME/servers/oa*/logs/*out* $EBS_DOMAIN_HOME/servers/oa*/logs/*log* $EBS_DOMAIN_HOME/servers/forms*/logs/*out* $EBS_DOMAIN_HOME/servers/forms*/logs/*log* $EBS_DOMAIN_HOME/servers/AdminServer/logs/*out* $EBS_DOMAIN_HOME/servers/AdminServer/logs/*log* $EBS_DOMAIN_HOME/sysman/log/* $EBS_DOMAIN_HOME/servers/oac*/adr/diag/ofm/EBS_domain_*/oac*/incident/* $EBS_DOMAIN_HOME/servers/forms_s*/adr/diag/ofm/EBS_domain_*/forms_s*/incident/*
Chef
Logfile:
/var/chef/outputs/chef.last.out
TasteTester
Delete
hg bookmarks --delete 'deleted' 'recipes/'
Disable Chef client
pulse -c stop
Find Chef Tier
cat /etc/chef/run-list.json
Resync Master for Error
hg update master
Get XML Value"
  grep -oPm1 "(?<=<TAG>)[^<]+"
Find Weblogic Home
cat /etc/oraInst.loc
cd /opt/app/oraInventory/ContentsXML
grep OracleHome inventory.xml
or
cat /opt/app/oraInventory/ContentsXML/inventory.xml | grep "OracleHome" | cut -d' ' -f 3 | cut -d "=" -f 2 | cut -d '"' -f 2
Create DBA File
cd $FND_SECURE 
java oracle.apps.fnd.security.AdminDesktop apps/<pass> CREATE NODE_NAME=<Hostname>.thefacebook.com IP_ADDRESS=<IP> DBC=SCMDEVP1.dbc
Linux
Purge alert log file
tail -n100000 alert_PROD.log > 1.log ;
mv alert_PROD.log alert_PROD.log_old ;
cp 1.log alert_PROD.log ;
Find all files and move to directory
find . -type f -exec mv {} ./old_logfiles/ \;
find . -mtime +250 -type f -exec rm -rf {} \;
find -name "*.sh" -type f | xargs  grep 'Xms768m'
CD to directory and untar files recursively
for i in `ls ` ; do cd $i;j=`ls`;echo $j;tar -xvf $j ;cd ../; done;
for i in `ls`;do let k=($k+1) ;mkdir $k;mv $i $k; cd $k;tar -xvf $i;cd ../ ; done;
Backup current directory and create similar:
cd /u02/oraprod
echo "Move current backup"
mv PROD_hotbkp  "PROD_hotbkp_"`date +"%m-%d-%Y"`
mkdir PROD_hotbkp
Concurrent Request
kill -9 `ps -ef|grep FNDLIBR|grep -v grep|awk '{print $2}'`
Grep search and kill process
ps -ef | grep FNDL | awk '{print "kill -9 "$2 }'
Send Mail
mail -s "testing Mail" karthikeyanc.gdc@petrofac.com < one.html
Search Text in Two files
for i in `cat objects.lst | grep -v -e '^$' |sort` ; do grep "$i" create_user.sql ; done;

BASH  promt 
export PS1="${USER}@${HOSTNAME}:${PWD}$"
Get TNS STRING
tnsping $TWO_TASK | grep 'Attempting to contact' | sed -e "s,Attempting to contact ,$TWO_TASK=,g"
Apps Password
history | grep apps/ | grep -v grep |grep 'sqlplus' | tail -n1 | awk '{print $3}'
Backup APPS and INST 
cd $APPL_TOP/../../../ ; nohup tar -cf - apps | gzip >
/u02/applprod/PROD_apps_coldbkp/"$TWO_TASK"_apps_coldbkp_"`date +"%m-%d-%Y"`".tar.gz &
cd $INST_TOP/../../../ ; nohup tar -cf - inst | gzip >
/u02/applprod/PROD_apps_coldbkp/"$TWO_TASK"_inst_coldbkp_"`date +"%m-%d-%Y"`".tar.gz &
Find version of the File ADident
find $APPL_TOP  -name "ap_trx_missing_event_fix.sql" -prune -o -path './admin' -exec adident Header {} \;
Remove .swp file
rm `ls .*.swp`
Find Weblogic Version
grep "WebLogic Server" $MW_HOME/registry.xml | grep version| awk '{print $4}'
Find Apex Version
select comp_name, version, status from dba_registry where comp_name like '%Express%';
Restore unzip 
nohub cat /archive/backup/PROD_coldbkp_2Mar2013/db_tech_st11.tar.gz | gunzip | tar -xvf - &
Find most recent file created inside directory recursively
find  -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2 | tail -n 1
While Loop Infinite
while : ;do echo "Enter..."; ps -ef | grep 28793  | grep -v grep ; sleep 1; done;
ps command breaker
ps -ef | grep 439 | grep -v grep |tr -s ' ' | cut -d' ' -f 8- | sed -e 's/[ |:]/\n\t/g'
top command
top -c
Vi
set nocompatible
set backspace=2
ForLoop
for i in $(seq 1 6); do  ssh frc-finprdapp0$i "ps -ef | grep [D]weblogic.Name=oaco " | awk '{print $2 "  " $9}' ; done;

source /usr/local/bin/appenv OMSPRD

java -classpath $IAS_ORACLE_HOME/../oracle_common/modules/oracle.javacache_11.1.1/cache.jar:$IAS_ORACLE_HOME/../oracle_common/modules/oracle.odl_11.1.1/ojdl.jar oracle.ias.cache.CacheUtil watch -config=$EBS_DOMAIN_HOME/config/fmwconfig/servers/oacore_server13/javacache_MONITOR.xml << EOF
lc
exit
EOF

for i in `cat list.lst | awk '{print $1}'` ; do grep $i test.lst | awk '{ print $3 "  " $4}'; done;
Login to server
for i in $(seq 0 9); do ssh -t kchandran@frc-omgdevapp1$i "sudo su - applmgr;" ; done
Refresh log file
ls -lrt /oraclesw/automation/refresh/logs/SCMOCUP2_refresh_* | tail -n 1 | awk '{print $9}'

Check Tar Gzip corruption
gunzip -c file.tar.gz | tar t > /dev/null

No comments:

Post a Comment