Oracle
DROP TABLE SHER_TEMP;
CREATE TABLE SHER_TEMP
(
COL1 VARCHAR2(9) NOT NULL
)
;
INSERT INTO SHER_TEMP VALUES (‘78444177’);
DB2
| Instance Name | Service Name | Port Number |
|---|---|---|
| DB2 | db2j_DB2 | 55000 |
Creates a creates a HTTP service on above port
db2iupgrade /j:”text_search”
DB2 Export
export to filename.del of del select select col1, col2 from .
DB2 Import
db2 ‘import from filename.del of del method p (1, 2) insert into . (col1, col2)’
DB2 Event Monitor
create event monitor db2activities for activities write to file maxfiles 1 maxfilesize 200 replace
DB2 Lookup
db2look -d -i username -e -w password -z -tw -o ddl.sql
DB2 Create Index
create index . on . (col1, col2) allow reverse scans page split symmetric collect sampled detailed statistics;
DB2 Runstats
db2 -v runstats on table . with distribution and detailed indexes all
DB2 Check last run stats info
select TABNAME,STATS_TIME from syscat.tables where tabname in (‘CONTACT’);
DB2 Advise
login to db server
db2advis -d -q -i sqlfile.in -t 5 -m I > sqlfile.out
–#SET FREQUENCY 100 (this line to be inserted into the sqlfile.in to give an indication of load among multiple sql statements)
DB2 Cleanup SUSPECT Table
db2 “alter table .suspectaugment drop foreign key F1_SUSPA”
db2 “truncate .suspect immediate”
db2 “alter table .suspectaugment add constraint F1_SUSPA foreign key (suspect_id) references suspect(suspect_id)”
DB2 load data
db2 “import from filename.del of del method p (1, 2) messages output.log insert into . (col1, col2)”
db2 “load client from filename.del of del insert into . copy yes to /dev/null” — worked. set proper access to del file, say 770, 755. Follow this by set integrity below.
db2 “set integrity for . immediate checked”
load from /dev/null of del replace into .;
db2 “set integrity for . immediate checked”
DB2 Set path
export PATH=$PATH:/opt/ibm/db2/V9.7/bin:
DB2 Alter table (Drop not null)
alter table alter column drop not null;
reorg table ;
DB2 describe index
db2 describe indexes for table . show detail
DB2 backup restore
db2 attach to db2 user using db2 backup database user using to c:/db2backups
db2 restore database user using from c:/db2backups taken at 20160408153909 into
db2 restart database
db2 list tablespaces show detail
DB2 Catalog
catalog tcpip node node2 remote server catalog database as at node node2
DB2 User Defined Function
CREATE FUNCTION DB2ADMIN.GETXSDDATETIME(mdmtimestamp VARCHAR(100))
RETURNS VARCHAR(100)
EXTERNAL NAME ‘ASIDATEUTIL!GETXSD’
LANGUAGE java
PARAMETER STYLE JAVA
DETERMINISTIC
FENCED
NOT NULL CALL
NO SQL
NO EXTERNAL ACTION
NO SCRATCHPAD
ALLOW PARALLEL;
db2 “CALL sqlj.install_jar (‘file:C:/jarfile.jar’,”)”
DB2 Trigger backup and drop
db2look -d -z -t -e -i -w > file.out
DROP TRIGGER .
DB2 Drivers
IBM DB2 Universal Driver Type 4
——————————————————————————–
DRIVER CLASS: com.ibm.db2.jcc.DB2Driver
DRIVER LOCATION: db2jcc.jar and db2jcc_license_cu.jar
(Both of these jars must be included)
JDBC URL FORMAT: jdbc:db2://[:]/
JDBC URL Examples:
jdbc:db2://127.0.0.1:50000/SAMPLE
IBM DB2 Universal Driver Type 2
——————————————————————————–
DRIVER CLASS: com.ibm.db2.jcc.DB2Driver
DRIVER LOCATION: db2jcc.jar and db2jcc_license_cu.jar
(Both of these jars must be included)
JDBC URL FORMAT: jdbc:db2:
JDBC URL Examples:
jdbc:db2:sample
DB2 Execute SQL files
db2 -tvf upd_inqlvlquery.sql | tee upd_inqlvlquery.log
db2 -td; -vf triggers.sql
DB2 Query CLOB
SELECT CAST(CAST( AS CLOB(1073741824)) as varchar(32000)) FROM .;
SELECT XMLSERIALIZE( AS VARCHAR(10000)) FROM .;
DB2 current timestamp
select current timestamp as runtime from sysibm.sysdummy1;
Linux
cd /opt/IBM/MDM/HTTP*/logs
x=$(grep ‘ 200 ‘ access_log | grep -c ’20/Nov/2017’)
y=$(grep ‘ 500 ‘ access_log | grep -c ’20/Nov/2017’)
z=$((x+y))
s=$((x*100/z))
echo Found : $x
echo Not Found: $y
echo Found %: $s
// Delete lines from a file that match a pattern
sed –in-place ‘/matchpattern/d’ filename
TAR
tar czvf sher.tgz /apps/temp/mainDir –exclude=/apps/temp/mainDir/subDir2
Run jar
java -cp jarname.jar arguments
Change mod to be writable by group (eg: chmod -R g+w folder_name) after creation or replacement. Otherwise you might lose the privilege as the sudo restart will change the owner back to admin.
Please don’t use 777, use 775. The developers are all part of group and you wouldn’t want other people delete the whole folder.
// remove duplicates
sort garbage.txt | uniq -u
word count
wc -l < file.txt
Linux Version Info
$ cat /etc/*-release
$ uname -a
linux bit info
$ uname -m
update jar
jar uf name.jar com jar uf AdaptiveServiceInterface.jar com
// Linux Change Logon
su –
sudo su –
NOHUP
nohup some_command > /dev/null 2>&1& # doesn’t create nohup.out
MDM
Enable SAM (Service Activity Monitoring)
SELECT * FROM CONFIGELEMENT WHERE NAME LIKE ‘%Report%’;
UPDATE CONFIGELEMENT SET VALUE = ‘true’, LAST_UPDATE_DT = CURRENT TIMESTAMP WHERE NAME LIKE ‘%Report%’;
Enable performance monitoring log
UPDATE .CONFIGELEMENT SET VALUE = ‘true’, LAST_UPDATE_DT = CURRENT TIMESTAMP WHERE NAME LIKE ‘%Performance%enabled’;
UPDATE .CONFIGELEMENT SET VALUE = 6, LAST_UPDATE_DT = CURRENT TIMESTAMP WHERE NAME = ‘/IBM/DWLCommonServices/PerformanceTracking/level’;
Enable PME Timer log
========================================================================================
To change the logging levels, In WebSphere Application Server admin console, add / set the following in logging of the InfoSphere MDM application server.
Login WebSphere console, navigate to
Troubleshooting – > Logs and trace – > Your MDM Server – > Diagnostic trace service
– You can define your own trace file name and maximum file size, or use the default (trace.log)
– Select “Change Log Detail Levels”, append current log level with the following to enable timer log.
*=info: com.ibm.mdm.eme.core.Timer=fine
With persistent changes (configured on Configuration Tab), MDM restart is required. With temporary changes (configured on Runtime Tab), changes will be taken affect without MDM restart.
Sample for the trace.log:
[9/1/11 19:57:45:188 EDT] 00000032 Timer 1 com.ibm.mdm.eme.core.util.Timer log |search|5 ms|2 ms|1 ms|7 bkts|1,2,3,5 bktroles|3 cands|1 matches|
[9/1/11 19:57:45:190 EDT] 00000033 Timer 1 com.ibm.mdm.eme.core.util.Timer log |update|11 ms|
[9/1/11 19:57:45:205 EDT] 0000002d Timer 1 com.ibm.mdm.eme.core.util.Timer log |search|27 ms|26 ms|0 ms|13 bkts|1,2,3,5 bktroles|2 cands|0 matches|
[9/1/11 19:57:45:209 EDT] 00000031 MatchingServi I com.ibm.mdm.eme.core.MatchingServiceImpl searchWithProband No candidates found.
============================================================================================
Enable XSLT Logs (ASI)
========================================================================================
*=info: com.ibm.xltxe.*=fine
com.ibm.xltxe.rnm1.xtq.xslt.drivers.XSLTExecutable=fine:com.ibm.xltxe.rnm1.xtq.xslt.drivers.XSLTPreparer=fine:com.ibm.xltxe.rnm1.xtq.xpath.drivers.XPathExecutable=fine:com.ibm.xltxe.rnm1.xtq.xpath.drivers.XPathPreparer=fine
Configelement comparison
——————————
SELECT SRC1.NAME, SRC1.VALUE, SRC1.VALUE_DEFAULT, SRC2.VALUE, SRC2.VALUE_DEFAULT FROM
(SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT) SRC1 LEFT OUTER JOIN
(SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT) SRC2 ON SRC1.NAME = SRC2.NAME
UNION
SELECT SRC1.NAME, SRC1.VALUE, SRC1.VALUE_DEFAULT, SRC2.VALUE, SRC2.VALUE_DEFAULT FROM
(SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT) SRC1 LEFT OUTER JOIN
(SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT) SRC2 ON SRC1.NAME = SRC2.NAME;
IBM Log Analyzer for MDM
SAM Analysis (Run from IBM HRE 1.7 – C:\IBM\SDP\runtimes\base_v7_stub\java\jre)
set JRE_HOME=C:\IBM\SDP\runtimes\base_v7_stub\java\jre
set JRE_HOME=C:\IBM\SDP\runtimes\base_v8_stub\java\jre
java -jar C:\Progra~2\IBM\LogAnalyzer-11.5.0\LogAnalyzer\LogAnalyzer-11.5.0.jar -l MDMSamLog -f C:\Progra~2\IBM\LogAnalyzer-11.5.0\LogAnalyzer\logs\transactiondata.log -ts “2016-05-06 06:00:00” -te “2016-05-06 11:00:00” -c n -y n -p “May06Forenoon” -d C:\Progra~2\IBM\LogAnalyzer-11.5.0\LogAnalyzer\results
Scripts
// Self attempt – Working
// works for ASI
tail -n 0 -F /apps/IBM/WebSphere/AppServer/profiles//logs/RequestResponseMessage.log | \
while read LINE; do
if [[ $LINE == *Service*Operation* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/ServiceTime>.*/,/’ -e ‘s/<\/Operation>/,/’ -e ‘s/<\/Name>//’ -e ‘s/<\/Version>.*//’
elif [[ $LINE == *ServiceTime\>\<DWLControl* ]]; then
value=”$(echo “$LINE” | sed -e ‘s/2.*<port://’ -e ‘s/Response .*/,/’ -e ‘s/<\/ServiceTime>.*//’)”
echo ${value##*,},${value%,*}
elif [[ $LINE == *ResultCode*FATAL* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/mdm:ServiceTime>.*/,/’ -e ‘s/<\/mdm:RequestType>.*//’
fi
done
MYVAR=”/var/cpanel/users/joebloggs:DNS9=domain.com”
NAME=${MYVAR%:*} # get the part before the colon
NAME=${NAME##*/} # get the part after the last slash
echo $NAME
declare -A animals=( [“key1″]=”val1” [“key2″]=”val2”)
// Self attempt – Working
// works for ASI
tail -n 0 -F RequestResponseMessage.log | \
while read LINE; do
if [[ $LINE == *Service*Operation* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/ServiceTime>.*/,/’ -e ‘s/<\/Operation>/,/’ -e ‘s/<\/Name>//’ -e ‘s/<\/Version>.*//’
elif [[ $LINE == *ServiceTime\>\<DWLControl* ]]; then
echo “$LINE” | sed -e ‘s/2.*<port://’ -e ‘s/Response .*/,/’ -e ‘s/<\/ServiceTime>.*//’
elif [[ $LINE == *ResultCode*FATAL* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/mdm:ServiceTime>.*/,/’ -e ‘s/<\/mdm:RequestType>.*//’
fi
done
// Missing admin client ids loop
while read -r var;
do
db2 -x “select count(*) from contequiv where admin_client_id = ‘$var’ and admin_sys_tp_cd = 100007 and x_end_date is not null” |
while read -r dbvar;
do
if [ “$dbvar” -eq 0 ]; then
echo $var >> missingAdminIds.out
fi
done
done < adminIds.txt
extract failed requests
grep -rh ‘,’ * | sed ‘s/<\/TCRMService>\,//g’ > personRetry.txt
JMeter
———–Ant Trigger with HTML Report——————
C:\Users\sheriff\JMeter\ProjectFolder>ant -Dshow-data=y -Dtest=jmeterprojectfile -Djmeter.home=C:\apache-jmeter-3.2
ant -Dshow-data=y -Dtest=jmeterprojectfile -Djmeter.home=C:\apache-jmeter-3.2
Buildfile: C:\Users\Sheriff\JMeter\ProjectFolder\build.xml
———–JMeter Non GUI Trigger with APDEX Report——————
cd C:\Users\sheriff\JMeter\ProjectFolder
jmeter -n -t file.jmx -l out.csv -e -o “C:\Users\sheriff\JMeter\ProjectFolder\out”
JMeter Scripts
BirthDateIncrement
${__javaScript(var d = new Date();d.setFullYear(0001\,0\,1);d.setDate(d.getDate() + ${__counter(FALSE)});new Date(d.getTime()).toISOString().substring(0\,10);)}
BirthDateRandom
${__javaScript(var d = new Date();d.setDate(d.getDate() – ${__Random(0,100000)});new Date(d.getTime()).toISOString().substring(0\,10);)}
Current time including ms
${__javaScript(var d = new Date();new Date(d.getTime()).toISOString();)}
${__javaScript(var d = new Date();new Date(d.getTime());)}
${__javaScript(var d = new Date();new Date(d.getTime(yyyy-mm-dd hh:mm:ss));)}
BirthDate
${__time(yyyy-MM-dd)}
${__javaScript(var d = new Date();d.setDate(d.getDate() – ${__Random(0,100000)});new Date(d.getTime()).toISOString().substring(0\,10);)}
Time in milliseconds + Random 4 Digit
${__V(${__time()}${__Random(1000,9999)})}
ClearCase
cleartool mkview -tag -str Domain_Release_shdev@/vobs/ -stgloc ccviewstg
cleartool setview
clearfsimport -preview -recurse -nset C:\ccviews\Domain_Release_shdev\MDM\JavaModule\* C:\ccviews\Domain_Release_shdev\MDM\JavaModule
// UCM Activity details
cleartool descr -l activity:@/vobs/
cleartool lsactivity -contrib activity:@/vobs/
// Baseline details
cleartool describe baseline:@/vobs/
cleartool describe stream:Domain_Release_int@/vobs/
cleartool describe stream:Domain_Release_shdev@/vobs/
cleartool diffbl -activities baseline:@/vobs/
cleartool lsbl -component your_copmponent@\yourPVob -stream your_integration_stream@\yourPVob -level PRODUCTION-short’
// Find CRs between two baselines
cleartool diffbl -activities baseline:@/vobs/ | grep -v “deliver”
cleartool diffbl -activities baseline:@\/vobs\/IBM_Proj “/ – /g’ | sed ‘s/”//g’ | sed ‘s/>>//g’ | sed ‘s/->//g’
// Baseline diff – activity details
cleartool setview sheriff_Domain_Release_int_view
cleartool diffbl -activities baseline:@\/vobs\/IBM_Proj “/ – /g’ | sed ‘s/”//g’ | sed ‘s/>>//g’ | sed ‘s/->//g’ > bsldiff.log
@/vobs/
while read -r var;
do
cr=$(echo $var | cut -c1-10)
echo $cr
cleartool descr -l activity:$cr@/vobs/
done < bsldiff.log > sher.log
// Baseline comparison
–working–
cd ~
cd shershell
rm -f bsldiffdetails.txt
cleartool setview sheriff_Domain_Release_int_view
cleartool diffbl -activities baseline:@\/vobs\/IBM_Proj “/ – /g’ | sed ‘s/”//g’ | sed ‘s/>>//g’ | sed ‘s/->//g’ | grep “CR00*” | grep “deliver” > bsldiffdetails.log
while read -r var;
do
cr=$(echo $var | cut -c1-10)
echo $cr
cleartool descr -l activity:$cr@/vobs/ > acttemp.log
cat acttemp.log >> bsldiffdetails.txt
done < bsldiffdetails.log
exit 0
// Stream activity details
–working–
cd ~
cd shershell
rm -f strdayact.txt
cleartool setview sheriff_Domain_Release_view
cleartool describe stream:Domain_Release_int@/vobs/ | grep “CR00*” > temp.log
tac temp.log >> strallact.log
while read -r var;
do
cr=$(echo $var | cut -c1-10)
echo $cr
today=$($echo date +”%Y-%m-%d”)
echo $today
cleartool descr -l activity:$cr@/vobs/ > acttemp.log
if grep -q “$today” acttemp.log; then
cat acttemp.log >> strdayact.txt
else
break
fi
done < strallact.log
rm *.log
exit 0
DOS
findstr /S “string1” “string2” c:\users\sheriff\*.txt > sher.txt
DOS port usage
Display all ports – netstat -n
Display a specific port – netstat -n | find “2810”
DOS Runas
C:\Users\Sheriff>runas /noprofile /user:db2admin “C:\Program Files (x86)\IBM\SQLLIB\BIN\db2cw.bat”
Enter the password for db2admin:
Attempting to start C:\Program Files (x86)\IBM\SQLLIB\BIN\db2cw.bat as user “db2admin” …
WAS
The below setting was used to terminate long running queries that was triggered from the transaction after 120 seconds.
webSphereDefaultQueryTimeout = 120 (In seconds)
syncQueryTimeoutWithTransactionTimeout = false
(Or)
webSphereDefaultQueryTimeout = 0(In seconds)
syncQueryTimeoutWithTransactionTimeout = true
Run as admin from cmd window
cd c:\IBM\WebSphere\AppServer\bin
manageprofiles -delete -profileName AppSrv01
manageprofiles -validateAndUpdateRegistry
manageprofiles -create -profileName AppSrv01 -profilePath “C:\IBM\WebSphere\AppServer\profiles\AppSrv01”
MISC
sonar-runner -Dsonar.sources=”C:\MDM\Workspaces\Release10\CustomExtensionModule”
Excel
COUNTIF(B:B,B2)
Add comma to end of column text
=”‘”&A1&”‘,”
— Excel Macro to save multiple tabs in a sheet to multiple csv files
Public Sub SaveWorksheetsAsCsv()
Dim WS As Excel.Worksheet
Dim SaveToDirectory As String
SaveToDirectory = “C:\”
For Each WS In ThisWorkbook.Worksheets
WS.SaveAs SaveToDirectory & WS.Name, xlCSV
Next
End Sub
Castor XML Code Gen
Usage: -i schema filename -is input source for XML schema [-package package name] [-dest destination directory] [-resourcesDestination resources destination directory] [-line-separator (unix | mac | win)] [-f ] [-h ] [-verbose ] [-fail ] [-nodesc ] [-gen-mapping mapping filename] [-types types] [-type-factory collections class name] [-nomarshall ] [-testable ] [-sax1 ] [-binding-file filename] [-generateImportedSchemas ] -case-insensitive -nameConflictStrategy [-classPrinter ] [-useOldFieldNaming ]
-i C:\Users\sheriff\Schema.xsd -dest C:\Users\sheriff\SherCastor\src -package com.sher.xml.model -binding-file C:\Users\sheriff\SherCastor\xml\binding.xml
java -cp %classpath% org.exolab.castor.builder.SourceGeneratorMain -i Schema.xsd -package test
java -cp %classpath%;.; org.exolab.castor.builder.SourceGeneratorMain -i Schema.xsd -package com.sher.cem.xml.model
set classpath = c:/progra~2/castor-1.3.3/castor-1.3.3-codegen.jar;c:/progra~2/castor-1.3.3/castor-1.3.3.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-core.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-ddlgen.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-jdo.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-xml.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-xml-schema.jar;
java -cp %classpath%;.; org.exolab.castor.builder.SourceGeneratorMain -i C:\Users\sheriff\schema.xsd -dest C:\Users\sheriff\Yard\src -package test -binding-file C:\Users\sheriff\Yard\subbinding.xml
XML Schema Validation
WebSphere Version Check
/apps/IBM/WebSphere/AppServer/java/jre/bin/java com.ibm.xml.xlxp.scan.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java org.apache.xalan.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java org.apache.xml.serializer.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java org.apache.xerces.impl.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java -version
/apps/IBM/WebSphere/AppServer/bin/versionInfo.sh
Manual Heap Dump Windows
wsadmin>set objectName [$AdminControl queryNames WebSphere:type=JVM,process=server1,node=Node01,*]
WebSphere:name=JVM,process=server1,platform=proxy,node=Node01,j2eeType=JVM,J2EEServer=server1,version=7.0.0.27,type=JVM,mbeanIdentifier=JVM,cell=Node01Cell,spec=1.0
wsadmin>$AdminControl invoke $objectName generateHeapDump
C:\Program Files (x86)\IBM\SDP\runtimes\base_v7\profiles\AppSrv01\bin\.\heapdump.20140318.192444.10100.0001.phd
wsadmin>
jconsole dumpJavaNameSpace DWLCommonServicesEJB.jar DWLServiceController -report long
WebServices Security
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken
com.ibm.websphere.security.registry.propagateExceptionsToClient
com.ibm.websphere.ejbcontainer.poolSize
Specifies the size of the pool for the specified bean type. This property applies to stateless, message-driven, and entity beans. If you do not specify a default value, the container default value, 50 and 500, are used.
Set the pool size for a given entity bean as: beantype=[H]min,[H]max [:beantype=[H]min,[H]max…]
The beantype element is the Java EE name of the bean, formed by concatenating the application name, the # character, the module name, the # character, and the name of the bean, that is, the string assigned to the field in the deployment descriptor of the bean. The min and max elements are the minimum and maximum pool sizes for that bean type. Do not specify the square brackets shown in the previous prototype; they denote optional additional bean types that you can specify after the first bean type. Each bean type specification is delimited by a colon (:).
Use an asterisk (*) as the value of beantype to indicate that all bean types are to use those values unless overridden by an exact bean-type specification somewhere else in the string; for example: *=30,100
To specify a default value, omit either the min or max value but retain the comma (,) between the two values; for example:
Dcom.ibm.websphere.ejbcontainer.poolSize=ivtApp#ivtEJB.jar#ivtEJBObject=125,1327