Saturday, 22 November 2014

File adapter logs in sap

/usr/sap/sid/DVEBMGS00/j2ee/cluster/server0/log/services/com.sap.aii.adapter.file.svc

cp default.*.trc /SID/temp/traces

Ex:
find . -name "*" -exec grep -l 4a7a7004-406a-00bb-e100-80000a2704a2 {} \;
find . -name "*" -exec grep -li B26ED981856C4225163DCE41F54B0BA6 {} \;

Also run the following commands from /usr/sap/SID/J<C>12/j2ee/cluster/server0/log
find . -name "*" -exec grep -li <message id> {} \;
This command will list files with a match for the failed message. Take a bakup of these files as well.


File system full sap in unix AIX

1. Check work directory for core dumps and log files with extension old.

Path : /usr/sap/<SID>/<instance>/work

rm *.old
rm core

2. If you find any huge file other than .old and java core file check the date last updated and nullify that file.

cp /dev/null <file name>

3. Check /usr/sap/<SID>/<instance>/j2ee/cluster/server0  directory for java core files.
If there are 2 nodes then you need you check for server1 also.

4.Check archive directory for old log files. (*.txt and *.zip files)

find /usr/sap/<SID>/<instance>/j2ee/cluster/server0/log/archive -name "*.txt" -mtime +2 | xargs ls
find /usr/sap/<SID>/<instance>/j2ee/cluster/server0/log/archive -name "*.zip" -mtime +2 | xargs ls

remove if found any files from the above command.

find /usr/sap/<SID>/<instance>/j2ee/cluster/server0/log/archive -name "*.txt" -mtime +2 | xargs rm
find /usr/sap/<SID>/<instance>/j2ee/cluster/server0/log/archive -name "*.zip" -mtime +2 | xargs rm


 find . -mtime -7 -type f -size +2000K

If you are unable to free up disk space in dev or qa, you can nullify the traces and close the ticket. Don't ever try this on production.

Example:
cd /usr/sap/SID/DVEBMGS02/j2ee/cluster/server0/log
find . -name "*.trc" -exec cp /dev/null {} \;
find . -name "*.log" -exec cp /dev/null {} \;

find /usr/sap/SID/DVEBMGS02/j2ee/cluster/server0/log/archive -name "*.zip" -mtime +2 | xargs ls
find /usr/sap/SID/DVEBMGS02/j2ee/cluster/server0/log/archive -name "*.zip" -mtime +2 | xargs rm

find /usr/sap/<SID>/<instance>/j2ee/cluster/server0/log/archive -name "*.zip" -mtime +2 | xargs rm

Colon (“:”) commands vi filex

:w
Write to file; defaults to the file name you gave it on invocation. If you didn't give it a file
name on the command line, it will gripe.
:w  filename
Save the file to filename
:q
Quit .In vim ,also exists from help
:q!
 Quit without saving.
:wq
Write to the file and quit (see also “ZZ”).
:r filename
Read in file (handy for “cut and paste” between two different files).
:e
Exit (without saving).
:e!
 Exit immediately, and don't ask about saving.
:d
 Delete the current line.
:h
 Go to online help.
:j
Delete the line below the cursor.
:n
 If you specified multiple files on the command line, go on to edit the next file.
:u
Undo the last operation.
:x
 Quick exit. Saves the file without being asked.
:n
 Go to line number n.
:-n
 Go up n lines.
:+n
 Go down n lines.


Editing files in vi

Backspace
Delete the character before the cursor
Del
Delete the character under the cursor
i
To insert text under the cursor(insert mode)
I
To insert text under the cursor starting from the beginning of the current line(insert mode)
a
Insert starting after current character.

A
Insert starting at the end of the line after the last character.

cc
 Delete the entire line and go into insert mode.

C
 Delete to the end of line and go to insert mode.

cw
Delete the current word and go into insert mode.

Y
Yank (copy current line to buffer). If you give this a number before it, it will “yank” the specified
number of lines after the cursor (including current line the cursor is on). Many commands also
have this enumerated functionality
dd
Delete (cut) the current line. Can be enumerated.
dw
Delete (cut) the current word. Can be enumerated.
D
Delete the current line (But leave the new line)
J
Join the next line with the current line.
o
 Insert after the current line.
O
Insert before the current line.
p
Put (paste) the lines in the buffer (from Y, dd, or x) after the current line. Can be enumerated.
P
 Put (paste) the lines in the buffer before the current line. Can be enumerated.
rc
Overwrite with character c, replace the current character.
R
Change to replace (overwrite) mode.
s
 Delete the current character and go to insert mode.
S
 Delete the current line and go to insert mode.
u
 Undo the last operation.
U
 Switch between undoing and redoing the last edit.
v
Visual: start the selection for a “d” (delete) or “Y” (yank). Type “v”, then move in a direction
using one of the movement keys to see what you have selected.
V
 Visual line: select the current line for delete or Yank.
x
 Delete (cut) the character under the cursor. Can be enumerated.
X
Delete (cut) the character after the cursor. Can be enumerated.
~
 Capitalize the current character.
= =
 Unindent the current line (type the equal sign twice).
.
Repeat the last command.
F1
Display only help

Moving Around in file using in vi mode

You can use a digit (1-9) followed by an “arrow key” to jump that many lines or letters in the direction –in other words , arrow key commands can be enumerated.

Command
Description
h or <-
Cursor left
l or ->
Cursor right
j or

Cursor down
k or                 

Cursor Up
^F or Pagedown
Move down one page
^B or Page Up
Move up one page
^U
Move half a page
^D
Move Down half a page
^E
Move the screen down one line
^Y
Move the screen up one line
+
Go to the beginning of the next line
-
Go to the beginning of the previous line
0(zero)
Go to the beginning of the current line
$
Go to the end of the current line
}
Go to the next blank line
{
Go to the previous
[[
Go to the beginning of the file
]]
Go to the end of the file
‘ ‘
Switch between beginning of file and current line
b
Go back one word or punctuation mark
B
Go back one word ,including punctuation marks
e
Go to the end of the next word ,  or punctuation marks
E
Go to the end of the next word , including punctuation marks
gg
Go to the top of the line
G
Go to the end of the file
^H
Go back to the character, including new lines
H
Go to the top of the current page
^P
Go up one line
L
Go to the bottom of current page
w
Go to the beginning of the next word or punctuation mark
W
Go to the beginning of the next word including punctuation mark
^Z
Suspend vi;use the fg command to resume
ZZ
Save and exit