顯示包含「AIX」標籤的文章。顯示所有文章
顯示包含「AIX」標籤的文章。顯示所有文章

2012年4月14日星期六

How to add logical volume and filesystem by command


For Logical Volume :
Example :

Logical Volume Name : lv06
Filesystem Type : jfs2
Volume Group Name   : rootvg
Logical Partition : 508
Physical Volume Name : hdisk3


Command : mklv -y'lv06' -t'jfs2' rootvg 508 hdisk3

For Filesystem :
Example :
Mount point : /share
Block Size : 4096

crfs -v jfs2 -d'lv06' -m'/share' -A''`locale yesstr | awk -F: '{print $1}'`'' -p'rw' -a agblksize='4096


How to Extend file system size
chfs -a size='138412032' /share

How to handle "Fork too many process"


For example,

The maximum process is now 500 and you need set it to 1000

1. lsattr -El sys0 |grep max results shows that maximum process allowed is 500.
2. ulimit shows unlimited.
3. The /etc/security/limits shows unlimited.
chdev -l sys0 -a maxuproc='1000'
Please take care that this change is re boot required.

Please also consider the following factor
No. of Concurrent Users x @1 job
System Demons ~15+ jobs
No. of integration productions x @10+ jobs

How to monitor the I/O of a specified application



I had found the following explanation from internet :

Quote :
To monitor the I/O activity for logical and physical volumes only, while controlling the monitored intervals using the trcon and trcoff commands, enter:

filemon -d -o fmon.out -O pv,lv

The filemon command automatically starts the system trace and puts itself  in the background. After this command, you can enter the unmonitored application programs and system commands to be run at this time, then enter:
trcon

After this command, you can enter the monitored application programs and system commands to be run at this time, then enter:
trcoff

After this command, you can enter the unmonitored application programs and system commands to be run at this time, then enter:

trcon

After this command, you can enter the monitored application programs and system commands to be run at this time, then enter:

trcstop

In this example, the -O flag is used to restrict monitoring to logical and physical volumes only. Only those trace events that are relevant to logical and physical volumes are enabled. Also, as a result of using the -d flag, monitoring is initially deferred until the trcon command is issued. System tracing can be intermittently disabled and reenabled using the trcoff and trcon commands, so that only specific intervals are monitored.

Example :
/usr/bin/filemon -o $LOG -O lf,lv,pv
sleep 10
trcstop

2012年4月12日星期四

How to Perform Date Calculation in AIX

How to Perform Date Calculation in AIX

1. Create a unix script with the following content :
#!/bin/sh
#

date
date '+%m%d%Y'
TZ=HKT+40
date
date '+%m%d%Y'

2. Run the script and you should get back the following result ::

Sat Jan 2 12:42:36 HKT 2010
01022010
Fri Jan 1 12:42:36 HKT 2010
01012010

Remaks :

24-hours before => TZ=HKT+16
48-hours before => TZ=HKT+40

2012年4月11日星期三

How to use awk to check array length


$ echo "1 2 4" | awk '{print NF}'
3 -> 3 characters in an array
$ echo "1 2 6 4" | awk '{print NF}'
4 -> 4 characters in an array

How to backup and Restore a volume group(VG)


Lists the contents of a rootvg backup. For example:

listvgbackup -f /dev/rmt0

Restoring a Backup

Restoring a User Volume Group Backup

restvg -f backup_location

Remakes the user volume group and restores the contents of the backup. The following are two

examples:

restvg -f /dev/cd0

restvg -f /savevg_images/savevg1

Restoring a User Volume Group Backup Minimizing Space

restvg -s -f backup_location

Remakes the user volume group and restores the contents of the backup while minimizing the

space required. The following are two examples:

restvg -s -f /dev/cd0

restvg -s -f /savevg_images/savevg1

Restoring Files from a rootvg Backup

restorevgfiles -d restore_location -f backup_location list_of_files

Restores the specified files from a rootvg backup. The following are two examples:

restorevgfiles -d /tmp -f /dev/cd0 ./tmp/file1 ./tmp/file2 ./tmp/file3
restorevgfiles -d /tmp -f /images/rootvg_image1 ./tmp/file1 ./tmp/file2 ./tmp/file3
Restoring Files from a User Volume Group Backup
restorevgfiles -s -d /tmp -f backup_location list_of_files
Restores the specified files from a rootvg backup. The following are two examples:
restorevgfiles -s -d /tmp -f /dev/cd0 ./pictures/pic1 ./pictures/pic2
restorevgfiles -s -d /tmp -f /savevg_images/savevg1 ./pictures/pic1 ./pictures/pic2

Setup DNS in AIX


1. add the following to /etc/resolv.conf
domain          xyz.org.hk
nameserver      192.168.1.196
nameserver      192.168.1.194

2. add the following to /etc/netsvc.conf
hosts = local, bind

Remarks:

1. if the first dns server is down, it cannot resolv name.

Check Backup Tape Block Size


用以下的腳本可以很方便地知道備份帶的塊大小(Block Size)和類型(Type):

#!/bin/ksh

tctl rewind

chdev -l rmt0 -a block_size=0

dd if=/dev/rmt0 bs=128k of=blksz_file count=1

echo Tape Block Size = $(ls -l ./blksz_file | awk '{print $5}')

echo Tape Format = $(file ./blksz_file | while read a b;do echo $b;done)

Display Controller Rechargeable Battery Information


Display Controller Rechargeable Battery Information

sisraidmgr -M -o0 -l'sisioa0'  

Change Paging Size in AIX


chps -s'4' hd6

4 = 4 LP
1 LP = 1PP
if PP=256MB
4 LP = 1024 MB

/etc/swapspaces

swapon -a

The lsps command, mkps command, rmps command, swap command, swapon
       command, swapoff command.

       The Paging space in Operating system and device management explains
       paging space and its allocation policies.

       The File systems in Operating system and device management provides
       information on working with files.

       For information on installing the Web-based System Manager, see Chapter
       2: Installation and System Requirements in AIX 5L Version 5.3 Web-based
       System Manager Administration Guide.

       The System management interface tool in Operating system and device
       management explains the structure, main menus, and tasks that are done
       with SMIT.

Paging File can be added online.

Backup Filesystem using command "backup"


backup -f'/dev/rmt0' -'0' /home
0=> full backup

Shell Script using array


Content of t.sh :
#!/bin/sh
#

ADMIN=(1 2 3)

echo ${ADMIN[0]}
echo ${ADMIN[1]}
echo ${ADMIN[2]}
echo ${ADMIN[@]}     #show all
echo ${#ADMIN[@]} #how many item with arrange

[root@system]# ./t.sh
1
2
3
3

Common Tape Control Command


lsdev -Cc tape -> to check tape

TAR folder Test append to tape rmt1(using ".1")
tar -cvf /dev/rmt1.1 ./Test

mt -f /dev/rmt1.1 fsf 1 -> move the tape pointer forward
mt -f /dev/rmt1.1 bsf 1 -> move the tape pointer backward
mt -f /dev/rmt1.1 rewind -> rewind to the beginning

will move advance 1
tar -tvf /dev/rmt0.1

Common Printing Command


Add queue

/usr/lib/lpd/pio/etc/piomisc_ext mkpq_remote_ext  -q 'PRINTER1' -h '172.16.1.86' -r 'P1' -t 'aix' -C 'FALSE' -d 'Location 1 - Printer 1'

Name of QUEUE to add                               [ PRINTER1]
* HOSTNAME of remote server                          [172.16.1.86]
* Name of QUEUE on remote server                     [P1]
  Type of print spooler on remote server              AIX Version 3 or 4     +
  Backend TIME OUT period (minutes)                  []                       #
  Send control file first?                            no                     +
  To turn on debugging, specify output               []

      file pathname
  DESCRIPTION of printer on remote server            [Location 1 - Printer 1]

change queue
/usr/bin/chque -q 'PRINTER1' -a"host = "'192.168.1.86' -a"rq = " |
  |   'P3' -a"s_statfilter = "'/usr/lib/lpd/bsdshort' -a"l_statfilter = "'/u |
  |   sr/lib/lpd/bsdlong'


remove print queue
/usr/sbin/piomisc_base two_devices rmpq  'LAB_BIOCHM_PRT1'


-- To  print
lp -dprinter1 /tmp/test

-- To list the print queue
lpstat

-- To enable it if it is down
enable printer1

-- To cancel a print job
cancel job_no.

----------------
/usr/lib/lpd/pio/etc/piomisc_ext mkpq_remote_ext  -q 'printer1' -h 'printer1' -r 'P1' -t 'aix' -C 'FALSE'

AIX iowait high explanation


iostat

% iowait Shows the percentage of time that the CPU or CPUs were idle during
which the system had an outstanding disk I/O request.

-> If iowait is high, it mean CPU need to wait for I/O since the disk is too busy(please also check the tmact)

vmstat

id CPU idle time.

wa CPU idle time during which the system had outstanding disk/NFS I/O
request(s). See detailed description above.

id high is ok, it mean the system it not busy

wa high is just similar to the case of iowait high in iostat.

AIX ftpaccess setup


Create puseronly for ftpaccess in AIX
1. create dev/null under target folder
   /share/ftp/autovue/upl

according to /usr/samples/tcpip/anon.ftp

# make $FTPHOME dev/null entry
mkdir dev
#do equiv of mknod dev/null c 2 2
/usr/sbin/mknod dev/null c $(ls -l /dev/null | awk '{print $5, $6}' | tr -d ,)
chmod 555 dev
chown root dev
chgrp system dev

2. Add right permission for group and others to dev/null

3. Add the following line in /etc/ftpaccess.ctl
################################################################################
# FTP Access Control -> Take Effect Immediately -> No Need to Restart Subsystem
################################################################################
#
# Read Only Folders -> No matter what the folder right is
# writeonly : disable get command to specific folders
# readonly : disable put/delete command to specific folders
# readwrite: allow any action
# These setting apply to all users include root
# e.g.
# writeonly: /share/prd/writeonly
# readonly: /share/prd/readeonly
# readwrite: /share/prd/readwrite
#
# Anonymous Login
# with "p" = Need User Password
# Normally Nth show to user but can upload files,
# but ls command can show files
# Symbolic Link Not Work For Both "useronly" and "puseronly"
# This will override the above setting i.e. overwrite readonly setting
# e.g.
# puseronly: targetuser
# pgrouponly: targetgrp
puseronly: auvueupl,auvuednl,autovue

4. Add restrict user list to /etc/ftpusers
Please add according to your /etc/passwd

Examples :
########################################################################
# The following users will be restricted from ftp login
########################################################################
root
daemon
bin
sys
adm
uucp
guest
nobody
lpd
lp
invscout
snapp
ipsec
nuucp
esaadmin
#targetusr
#targetadm
#targetsys
########################################################################
# Allow Users List
########################################################################
#auvueupl
#auvuednl
#autovue

How to Clear AIX Front Panel Error LED


To clear the orange led, you should go to
# diag --> Task selection --> Identify and Attention Indicators --> Set

Some Command I always used in AIX

Common Commands in AIX Common Commands in AIX

1. Check Top Process
    topas -P

2. Check Disk I/O
    topas -D

3. Check error report within a range
    errpt -a -s 1101000008 -e 1118235908 | more
                     MMDDHHMMYY    MMDDHHMMYY

4. Display the PGIN, SIZE, RSS, LIM, TSIZ, TRS, %CPU, %MEM fields of all processes
    ps gv

5.  Get the status of all subsystem or subserver.
    lssrc -a

6. Display all user account attributes : user id and home directory.
    lsuser -c -a id home ALL | sed '/^#.*/d' | tr ':' '\011'  

    Remarks :
    sed '/^#.*/d' : remove the line "#name:id:home"
    tr : Translate character ":" to "tab(\011)"

7. Display devices "disk" in the system and their characteristics.
    lsdev -H -C -c disk

    Remarks :
    -H : Display the Header Information
           name   status    location description

8. Display devices "processor" in the system and their characteristics.
    lsdev -Cc processor

9. Display attribute characteristics and possible values of attributes for device "proc0" in the system.
    lsattr -El proc0

10. Display devices "memory" in the system and their characteristics.
      lsdev -Cc memory

11. Display attribute characteristics and possible values of attributes for device "mem0" in the system.
      lsattr -El mem0

14. Display attribute characteristics and possible values of attributes for device "hdisk0" in the system.
      lsattr -El hdisk0

15. Restart a subsystem
      refresh -s syslogd

16. Monitors activity and reports statistics on network I/O and network-related CPU usage.
      netpmon

      Remarks :
      Run trcstop command to signal end of trace.

17. Display System Configuration
      lscfg
      prtconf

      Remarks :
      lscfg -v : Display vital product data (VPD) such as part numbers, serial numbers
      lscfg -p : Display the platform-specific device information.

18. Check AIX Maintenance Level
      instfix -i|grep ML
      or
      instfix -ik 4330-04_AIX_ML

19. Check Installed Package
      lslpp -l

20. Check File over 1M
      find / -xdev -size +1048576c -ls
      find /usr -xdev -size +1048576c -ls

21. Run command together with command "find"
      find . | xargs grep bc
      or
      find /root/scripts | xargs grep bc

22. Monitor the CPU usage per process with command "ps"
      ps auwx

23. General Command for device management
      cfgmgr : refresh and update device database
      lsdev : list  device
      mkdev -l :  change specific device status to "Available"
      rmdev -l  : change specific device to "Defined"
      rmdev -d  : remove specific device

How to Enable Async I/O for Sqlplus

How to Enable Async I/O for Sqlplus How to Enable Async I/O for Sqlplus

If you hit the following error, it mean you had hit the async I/O problem.

SQL> connect / as sysdba
exec(): 0509-036 Cannot load program oracleebsprd because of the following errors:
        0509-130 Symbol resolution failed for /usr/lib/libc.a[aio_64.o] because:
        0509-136   Symbol kaio_rdwr64 (number 0) is not exported from
                   dependent module /unix.
        0509-136   Symbol listio64 (number 1) is not exported from
                   dependent module /unix.
        0509-136   Symbol acancel64 (number 2) is not exported from
                   dependent module /unix.
        0509-136   Symbol iosuspend64 (number 3) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait (number 4) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait64 (number 5) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait_timeout (number 6) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait_timeout64 (number 7) is not exported from
                   dependent module /unix.
        0509-026 System error: Error 0
        0509-192 Examine .loader section symbols with the
                 'dump -Tv' command.
ERROR:
ORA-12547: TNS:lost contact

Make Asynchronous I/O available on system, following the next steps to set it up:
1. Log in as root
2. Type:
    mkdev -l aio0
    This command attempts to verify that Asynchronous I/O services are running (available on system),
    if not, they are started.
3. To ensure it is configured at each system restart :
    a. Type: smitty aio
    b. Select the menu item "Change/Show Characteristics of Asynchronous I/O"
    c. Change the field "STATE to be configured at system restart"
        from DEFINED to AVAILABLE.

Step 3 will toggle the state to be configured at system restart to be available, making
asynchronous I/O available with each system reboot.

Check Patch Version

instfix -ik 4330-04_AIX_ML