Wednesday, December 22, 2010

TQ-LR-Put in one file

function(char action_name[25])

{

static long calls;

typedef long time_t;

long fs=fopen("D:\\datainuse.txt","a+");

time_t t;

time(&t);

fprintf(fs,"%d\t%s\t%s",calls,action_name,ctime(&t));

fclose(fs);

calls++;

}

TQ-UNIX

---------------gunzip <> file

------------kill the process

ps -ef | grep java ---to get the process id

kil -9 Process id

-----------to start server

./startServer.sh server1

.........for disk space

df -k/g

aix configuration:

prtconf |pg

--------------manual heapdump

Go to server->profiles->profileName->bin

wsadmin.sh

set ObjectName [$AdminControl completeObjectName type=JVM,process=server1,*]

$AdminControl invoke $ObjectName generateHeapDump

------------------nmon commands

App server - nmon_aix53 -F /u02/ibm/WebSphere/AppServer/profiles/AppSrv01/bin/nmon/metrics/appsrv_nmonstat.csv -t -r -s15 -c3000

Db server - nmon_aix53 -F /u01/sqllib/nmon_aix53/metrics/dbsrv_nmonstat.csv -t -r -s15 -c3000

----- cat SystemOut_* |grep -i Currency |wc –l’

---- grep -c "Failed to get byte stream error response message for resource id "Sparrow ATM Transactions"" SystemOut.log

--- grep -F "Failed to get byte stream error response message for resource id" SystemOut.log

----

interactive nmon

\nmon

c-cpu

m-memory

t -top process

---installing nmon

The tool is one stand-alone binary file (a different file for each AIX or Linux version) that you can install in five seconds and if you type fast, probably less. Installation is simple:

* Copy the nmonXX.tar.Z file to the machine - if using FTP, remember to use binary mode. Note: in XXX this example will be replaced by the version.

* To uncompress the file run uncompress nmonXX.tar.Z

* To extract the files run tar xvf nmonXX.tar

* Read the README file.

* Start nmon by typing the command nmon

* If you are the root user you may need to type ./nmon

This is under review to make it simpler

Extra notes for using nmon 9 for AIX 4 only

1. You must be the root user or allow regular users to read the /dev/kmem file by typing the following command (as root):

chmod ugo+r /dev/kmem

2. If you want the disk statistics, then also run (as root):

chdev -l sys0 -a iostat=true

Extra notes for using nmon 10 for AIX 5.1 only

You will need to have installed the libperfstat library from the AIX CDROMs.

This is in bos.perf.libperfstat package or nmon will fail to start and report it is missing.

To run interactively

Just type the name of the nmon tool for your operating system - see the FAQ section if you cann not work this out. Then use the one-key commands to see the data you want and to hid it again. For example, to get Cpu, Memory, and Disk statistics, start nmon and type: cmd

To get help information while running interactively, type h

To get more help information

* For brief details, type nmon -?

* For full details, type nmon -h

Hints and Tips:

* The Microsoft Windows telnet is not recommend as it is a very poor terminal emulator.

* Use a larger window than 80x25 characters.

* The developer uses VNC and putty to display nmon from a Windows machine.

* On AIX with X Windows, the "dtterm" terminal emulator allows colours and nmon can use these to light information.

Capturing data to a file for later analysis and graphing

Run nmon with the -f or -F flag. See nmon -h for the details, but as an example, to run nmon for an hour capturing data snapshots every 15 seconds for an hour (15*240=3600 seconds) use:

* nmon -f -s 15 -c 240

* nmon -fT -s 15 -c 240

The second line also captures the top processes. Both of these will create the output file in the current directory called: _date_time.nmon

This file is in a comma separated values format and can be imported into a spread sheet directly.

* FOR Lotus 1-2-3 ONLY (NOT RECOMMENDED ANY LONGER)

* If you are using Lotus 1-2-3 the file needs to be sorted before importing. On AIX, follow this example: sort -A mymachine_311204_1030.nmon > xxx.csv

This sorting is not required for the Excel version of the nmon analyser.

Hints and Tips:

* To load this into a spreadsheet, check the spreadsheet documentation for loading comma-separated value (.csv) data files. Many spreadsheets accept this data as just one of the possible files to load or provide an import function to do this. Many spreadsheets have fixed maximum numbers of columns and rows.

* We suggest you collect a maximum of 300 snapshots to avoid hitting these issues and to make a nice looking graph. Also not a 1024x768 computer screen with 350 data points would only have approximately two pixels per data. There is little purpose in having more data points.

* When you are capturing data to a file, the nmon tool disconnects from the shell, to ensure that it continues running even if you log out. This means that nmon can appear to crash, but it is still running in the background.

Sample output for nmon

Take this link to see the nmon Sample On Screen Output

Ideas for the next release for AIX wanted

These are the current ideas for the next release:

* Proper pop-down menu system for selecting the statistics to be displayed

* User decides which stats appear first = at the top of the screen

* Disk stats by Volume Group

* Detailed paging space file use, sizes, %used, active, auto etc.

Please vote now by email to the author or forward any other ideas.

Ideas for the next release of Linux wanted

The Linux version is the prime focus for the next release and there are many functions to be added. As Linux get in more production use it is important the production style performance monitoring and tuning becomes available. Classic Linux tuning involves rebuilding the kernel and added modules or packages. In many sites this is just not acceptable and passive monitoring (like nmon) is the only option. Some of the options are:

* Upgrade to the nmon 10 user interface - now in nmon for Linux 11

* Add NFS support - now in nmon for Linux 11

* Add kernel stats to run queues, context switches, fork etc. - some in nmon for Linux 11

* User Defined Disk Groups - now in nmon for Linux 11

If you have any suggestions or more importantly know where the data can be found, please let me know via email.

-------Aix Performance

http://www.ibm.com/developerworks/aix/library/au-aix7memoryoptimize2/index.html?ca=drs-

---------------netstat

netstat -s -f inet

netstat -a -I interface

To display detailed data of active sockets, enter the following command:

netstat -aon

To display the routing table, enter the following command:

netstat -rn

to capture Session info

netstat -A | grep "tcp" | grep "blraix-ubt2"

TCP/IP Troubleshooting in AIX Using Network Packet Traces-http://www.theillien.com/Sys_Admin_v12/html/v08/i12/a6.htm

--------------check this for TCP throughput on AIX

http://www.ibm.com/developerworks/aix/library/au-aix5_cpu/index.html

--------------------------The below ULR gives information to understand VMSTAT data.

http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.prftungd/doc/prftungd/mem_usage_vmstat.htm

------------------------IOSTAT

DB

iostat -t -T -f 10 3600 |grep /ubpt01 > /db2data1/IOSTAT/Dbiostat_`date +%Y%m%d%H%M`.csv

APP

iostat -t -T -f 10 3600 |grep /ibm > /ibm/WebSphere7/AppServer/profiles/AppSrv01/logs/Appiostat_`date +%Y%m%d%H%M`.csv

TQ-Oracle

---count machine connected

select count (*),machine from V$session group by machine

-------- deadloack counts

path:/oraUB/admin/UB46BF35/udump

ls *.trc|wc -l

DEADLOCK DETECTED ( ORA-00060 )

two types of deadlocks:

transaction:solution application design

session head : solution inittrans

---- shut down oracle

oracle user id login

export oracle_sid = dbname

sqlplus / as sysdba

shutdown immediate

start oracle

startup

alternate:

sqlplus /nolog

connect sys as sysdba

password:oracle

----- import of full oracle

impdp system/oracle directory=DPUMP_DIR dumpfile=opics.dmp logfile=opics_110210.log FULL =Y

---oracle table export

expdp wasadmin/wasadmin TABLES=bankfusion.BFTB_TASK,bankfusion.BFTB_TASKLIST,bankfusion.BFTB_TASKMESSAGE,bankfusion.BFTB_TASKMSGRECIPNT,bankfusion.BFTB_TASKGROUP directory=DPUMP_DIR

------------oracle explain plan

explain plan for

--QUERY

SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());

---Run the same query against multiple SQL Server AND Oracle instances - This may come handy.

http://www.pythian.com/news/4683/run-the-same-query-against-multiple-sql-server-and-oracle-instances

----Execute as user system

select to_char(max(last_analyzed),'dd mm yyyy:hh.mi.ss') from dba_tables

where owner like 'WAS%'

If you have imported DB afresh, please run the runstats script available in SVN. Next time onwards stats gathering will be done automatically every night by Oracle itself.

---DPUMP_DIR /oracle/admin/mmdb/dpump_dest

TQ-DB2

-----------to know description for table

select * from syscat.tables where tabname='BFTB_JOB'

-----------------to know timings of the table

select current_timestamp from sysibm.sysdummy1;

db2 connect to U11S9B15 user using db2isnt1

db2 set current schema = bankfusion

db2 terminate

------------show db details

list db2 utilities show detail

-------------To restart Db server

db2stop force

db2start

db2 terminate

db2 activate database UBP128N

--------

Db2 locktimeout:

db2 connect to u14s8b7

db2 get db cfg for u14s8b7 | grep LOCK

db2 update db cfg for u14s8b7 using LOCKTIMEOUT 15

----- to alter column size in db2

alter table bankfusion.BFTB_JOB alter column BFPARAMETERS set data type BLOB(5120)

---- db2 backup

db2 force applications all

db2 backup db UB15PF7 to directory_or_device

db2 restore db UB15PF7 from /ubperf/backups/BackUp_UB15PF7_EOM_MBT212_22july/ replace existing

---------to list databases

db2 list database directory

---------------current date updates in column

select * from table name where trunc(coulmn name)=trunc(current_date)

db back up

db2 backup db UB15PF3 to /ubpt01/backups/backup_UB15PF3_29Mar10_MBTBuild40

----to take import

db2 import from tab1.ixf of ixf messages tab1.msg REPLACE_CREATE into wasadmin.closeoff

db2 import from tab1.ixf of ixf messages tab1.msg REPLACE_CREATE into wasadmin.closeoff

db2 import from tab179.ixf of ixf messages tab179.msg insert into cbs.CBTB_BUSINESSEVENT

---to take export

db2move UB15PF7 export -tn BFTB_CONTENTIONCONTEXT,CLOSEOFF,UBTB_DELINQUENCYPROFILE,UBTB_GENERALPROVISION,UBTB_GENERALPROVISIONHIST,UBTB_GENPROVISIONTAG,UBTB_INTERESTACCRUALACCOUNTS

------------db2explain plan

db2expln -d UB15PF7 -z ";" -q "select * from cbs.cbtb_code where cbreference='CUSTOMERTYPE';" –g –t

--------------db2 get db cfg – for database level parameters

db2 get dbm cfg – for instance level parameters the below set of parameters specify the number of agents

Priority of agents (AGENTPRI) = SYSTEM

Agent pool size (NUM_POOLAGENTS) = AUTOMATIC(100)

Initial number of agents in pool (NUM_INITAGENTS) = 0

Max number of coordinating agents (MAX_COORDAGENTS) = AUTOMATIC(200)

Max number of client connections (MAX_CONNECTIONS) = AUTOMATIC(MAX_COORDAGENTS)

To update the parameters

db2 update dbm cfg using NUM_POOLAGENTS

To list the number of connections to a database

Connect to the database and issue the command

db2 list application show detail

------------Run this on the DB to get the list of tables created with the associated tablespaces-

select a.tabname, a.owner, DECODE(a.type, 'V', 'VIEW', (DECODE(a.type,'T','TABLE',a.type))) , b.TBSPACE

from syscat.tables a, syscat.tablespaces b

where tabschema in ('WASADMIN', 'BRANCH', 'BANKFUSION', 'CBS', 'DB2INST1', 'DB2PM', 'DMSTAGE', 'LOANORG', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS', 'UBINTERFACE' )

and a.TBSPACEID = b.TBSPACEID

order by TBSPACE

--------------------------------The main DB2 import modes include:

  • INSERT adds the input data to the table without changing any existing data.
  • INSERT_UPDATE adds new input data to the table, or updates existing rows with input data that has matching primary key values.
  • REPLACE deletes all existing data from the table (by truncating the data object) and then inserts the input data.
  • REPLACE_CREATE deletes all data from an existing table and then inserts the input data. If the table does not exist, this mode creates the table prior to inserting the input data. This mode is only valid with PC/IXF input files.

Further reference:

http://www.ibm.com/developerworks/data/library/techarticle/dm-0501melnyk/

----------------------statements for backing up tables

  • create table wasadmin.collateraldtlbackup like wasadmin.collateraldtl
  • insert into wasadmin.collateraldtlbackup select * from wasadmin.collateraldtl

Change table names as needed.

---------------------db2stop - Stop DB2 Command

Stops the current database manager instance.

db2stop can be executed as a system command or a CLP command.

Related reference

This topic can be found in: Command Reference.