2010年1月31日星期日

opensolaris(solaris5.11)下如何mount ntfs 格式的usb disk?

opensolaris mount usb disk
################################################################
root@opensolaris:~/software# wget -c http://www.belenix.org/binfiles/FSWpart.tar.gz
--12:34:27--  http://www.belenix.org/binfiles/FSWpart.tar.gz
           => `FSWpart.tar.gz'
Resolving www.belenix.org... 204.152.191.108
Connecting to www.belenix.org|204.152.191.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 34,587 (34K) [application/x-gzip]
100%[====================================>] 34,587        41.66K/s
12:34:28 (41.58 KB/s) - `FSWpart.tar.gz' saved [34587/34587]
root@opensolaris:~/software# ls
FSWpart.tar.gz
root@opensolaris:~/software# gunzip -c FSWpart.tar.gz |tar xvf -
FSWpart/
FSWpart/pkgmap
FSWpart/pkginfo
FSWpart/install/
FSWpart/install/copyright
FSWpart/reloc/
FSWpart/reloc/usr/
FSWpart/reloc/usr/bin/
FSWpart/reloc/usr/bin/prtpart
FSWpart/reloc/usr/bin/prtpart.bin
FSWpart/reloc/usr/share/
FSWpart/reloc/usr/share/src/
FSWpart/reloc/usr/share/src/prtpart.c
root@opensolaris:~/software# ls
FSWpart  FSWpart.tar.gz
root@opensolaris:~/software# pkgadd -d . FSWpart
Processing package instance <FSWpart> from </root/software>
x86 Partition Table Dumper(i386) 0.1
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Author Moinak Ghosh
#
Using </> as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
Installing x86 Partition Table Dumper as <FSWpart>
## Installing part 1 of 1.
/usr/bin/prtpart
/usr/bin/prtpart.bin
/usr/share/src/prtpart.c
[ verifying class <none> ]
Installation of <FSWpart> was successful.
root@opensolaris:~/software#
root@opensolaris:~/software# wget -c http://www.belenix.org/binfiles/FSWfsmisc.tar.gz
--12:37:17--  http://www.belenix.org/binfiles/FSWfsmisc.tar.gz
           => `FSWfsmisc.tar.gz'
Resolving www.belenix.org... 204.152.191.108
Connecting to www.belenix.org|204.152.191.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4,286,525 (4.1M) [application/x-gzip]
100%[====================================>] 4,286,525     72.92K/s    ETA 00:00
12:38:03 (91.30 KB/s) - `FSWfsmisc.tar.gz' saved [4286525/4286525]
root@opensolaris:~/software#
root@opensolaris:~/software# gunzip -c FSWfsmisc.tar.gz  |tar xvf -
FSWfsmisc/
FSWfsmisc/pkgmap
FSWfsmisc/pkginfo
FSWfsmisc/install/
FSWfsmisc/install/copyright
FSWfsmisc/install/depend
FSWfsmisc/reloc/
FSWfsmisc/reloc/etc/
FSWfsmisc/reloc/etc/gnome-vfs-2.0/
FSWfsmisc/reloc/etc/gnome-vfs-2.0/modules/
FSWfsmisc/reloc/etc/gnome-vfs-2.0/modules/libntfs.conf
FSWfsmisc/reloc/usr/
FSWfsmisc/reloc/usr/bin/
FSWfsmisc/reloc/usr/bin/chattr
FSWfsmisc/reloc/usr/bin/lsattr
FSWfsmisc/reloc/usr/bin/ntfscat
FSWfsmisc/reloc/usr/bin/ntfscluster
FSWfsmisc/reloc/usr/bin/ntfscmp
FSWfsmisc/reloc/usr/bin/ntfsfix
FSWfsmisc/reloc/usr/bin/ntfsinfo
FSWfsmisc/reloc/usr/bin/ntfsls
FSWfsmisc/reloc/usr/bin/uuidgen
FSWfsmisc/reloc/usr/bin/xlsmounts
FSWfsmisc/reloc/usr/bin/xumount
FSWfsmisc/reloc/usr/include/
FSWfsmisc/reloc/usr/include/et/
FSWfsmisc/reloc/usr/include/et/com_err.h
FSWfsmisc/reloc/usr/include/ext2fs/
FSWfsmisc/reloc/usr/include/ext2fs/bitops.h
FSWfsmisc/reloc/usr/include/ext2fs/ext2_err.h
FSWfsmisc/reloc/usr/include/ext2fs/ext2_fs.h
FSWfsmisc/reloc/usr/include/ext2fs/ext2_io.h
FSWfsmisc/reloc/usr/include/ext2fs/ext2_types.h
FSWfsmisc/reloc/usr/include/ext2fs/ext2fs.h
FSWfsmisc/reloc/usr/include/ntfs/
FSWfsmisc/reloc/usr/include/ntfs/attrib.h
FSWfsmisc/reloc/usr/include/ntfs/attrlist.h
FSWfsmisc/reloc/usr/include/ntfs/bitmap.h
FSWfsmisc/reloc/usr/include/ntfs/bootsect.h
FSWfsmisc/reloc/usr/include/ntfs/collate.h
FSWfsmisc/reloc/usr/include/ntfs/compat.h
FSWfsmisc/reloc/usr/include/ntfs/compress.h
FSWfsmisc/reloc/usr/include/ntfs/debug.h
FSWfsmisc/reloc/usr/include/ntfs/device.h
FSWfsmisc/reloc/usr/include/ntfs/device_io.h
FSWfsmisc/reloc/usr/include/ntfs/dir.h
FSWfsmisc/reloc/usr/include/ntfs/endians.h
FSWfsmisc/reloc/usr/include/ntfs/gnome-vfs-method.h
FSWfsmisc/reloc/usr/include/ntfs/gnome-vfs-module.h
FSWfsmisc/reloc/usr/include/ntfs/index.h
FSWfsmisc/reloc/usr/include/ntfs/inode.h
FSWfsmisc/reloc/usr/include/ntfs/layout.h
FSWfsmisc/reloc/usr/include/ntfs/lcnalloc.h
FSWfsmisc/reloc/usr/include/ntfs/list.h
FSWfsmisc/reloc/usr/include/ntfs/logfile.h
FSWfsmisc/reloc/usr/include/ntfs/logging.h
FSWfsmisc/reloc/usr/include/ntfs/mft.h
FSWfsmisc/reloc/usr/include/ntfs/mst.h
FSWfsmisc/reloc/usr/include/ntfs/ntfstime.h
FSWfsmisc/reloc/usr/include/ntfs/rich.h
FSWfsmisc/reloc/usr/include/ntfs/runlist.h
FSWfsmisc/reloc/usr/include/ntfs/security.h
FSWfsmisc/reloc/usr/include/ntfs/support.h
FSWfsmisc/reloc/usr/include/ntfs/tree.h
FSWfsmisc/reloc/usr/include/ntfs/types.h
FSWfsmisc/reloc/usr/include/ntfs/unistr.h
FSWfsmisc/reloc/usr/include/ntfs/version.h
FSWfsmisc/reloc/usr/include/ntfs/volume.h
FSWfsmisc/reloc/usr/info/
FSWfsmisc/reloc/usr/info/libext2fs.info.gz
FSWfsmisc/reloc/usr/lib/
FSWfsmisc/reloc/usr/lib/e2initrd_helper
FSWfsmisc/reloc/usr/lib/fs/
FSWfsmisc/reloc/usr/lib/fs/ext2fs/
FSWfsmisc/reloc/usr/lib/fs/ext2fs/mount
FSWfsmisc/reloc/usr/lib/fs/ntfs/
FSWfsmisc/reloc/usr/lib/fs/ntfs/mount
FSWfsmisc/reloc/usr/lib/gnome-vfs-2.0/
FSWfsmisc/reloc/usr/lib/gnome-vfs-2.0/modules/
FSWfsmisc/reloc/usr/lib/gnome-vfs-2.0/modules/libntfs-gnomevfs.a
FSWfsmisc/reloc/usr/lib/gnome-vfs-2.0/modules/libntfs-gnomevfs.la
FSWfsmisc/reloc/usr/lib/gnome-vfs-2.0/modules/libntfs-gnomevfs.so.1.0.0
FSWfsmisc/reloc/usr/lib/libcom_err.a
FSWfsmisc/reloc/usr/lib/libext2fs.a
FSWfsmisc/reloc/usr/lib/libntfs.la
FSWfsmisc/reloc/usr/lib/libntfs.so.9.0.0
FSWfsmisc/reloc/usr/sbin/
FSWfsmisc/reloc/usr/sbin/badblocks
FSWfsmisc/reloc/usr/sbin/blkid
FSWfsmisc/reloc/usr/sbin/debugfs
FSWfsmisc/reloc/usr/sbin/dumpe2fs
FSWfsmisc/reloc/usr/sbin/e2fsck
FSWfsmisc/reloc/usr/sbin/e2image
FSWfsmisc/reloc/usr/sbin/e2label
FSWfsmisc/reloc/usr/sbin/filefrag
FSWfsmisc/reloc/usr/sbin/findfs
FSWfsmisc/reloc/usr/sbin/fsck.ext2
FSWfsmisc/reloc/usr/sbin/fsck.ext3
FSWfsmisc/reloc/usr/sbin/logsave
FSWfsmisc/reloc/usr/sbin/mke2fs
FSWfsmisc/reloc/usr/sbin/mkfs.ext2
FSWfsmisc/reloc/usr/sbin/mkfs.ext3
FSWfsmisc/reloc/usr/sbin/mklost+found
FSWfsmisc/reloc/usr/sbin/mkntfs
FSWfsmisc/reloc/usr/sbin/ntfsclone
FSWfsmisc/reloc/usr/sbin/ntfscp
FSWfsmisc/reloc/usr/sbin/ntfslabel
FSWfsmisc/reloc/usr/sbin/ntfsresize
FSWfsmisc/reloc/usr/sbin/ntfsundelete
FSWfsmisc/reloc/usr/sbin/tune2fs
FSWfsmisc/reloc/usr/share/
FSWfsmisc/reloc/usr/share/locale/
FSWfsmisc/reloc/usr/share/locale/cs/
FSWfsmisc/reloc/usr/share/locale/cs/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/cs/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/de/
FSWfsmisc/reloc/usr/share/locale/de/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/de/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/es/
FSWfsmisc/reloc/usr/share/locale/es/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/es/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/fr/
FSWfsmisc/reloc/usr/share/locale/fr/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/fr/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/it/
FSWfsmisc/reloc/usr/share/locale/it/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/it/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/nl/
FSWfsmisc/reloc/usr/share/locale/nl/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/nl/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/pl/
FSWfsmisc/reloc/usr/share/locale/pl/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/pl/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/rw/
FSWfsmisc/reloc/usr/share/locale/rw/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/rw/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/sv/
FSWfsmisc/reloc/usr/share/locale/sv/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/sv/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/locale/tr/
FSWfsmisc/reloc/usr/share/locale/tr/LC_MESSAGES/
FSWfsmisc/reloc/usr/share/locale/tr/LC_MESSAGES/e2fsprogs.mo
FSWfsmisc/reloc/usr/share/man/
FSWfsmisc/reloc/usr/share/man/man1/
FSWfsmisc/reloc/usr/share/man/man1/chattr.1
FSWfsmisc/reloc/usr/share/man/man1/lsattr.1
FSWfsmisc/reloc/usr/share/man/man1/uuidgen.1
FSWfsmisc/reloc/usr/share/man/man5/
FSWfsmisc/reloc/usr/share/man/man5/e2fsck.conf.5
FSWfsmisc/reloc/usr/share/man/man5/mke2fs.conf.5
FSWfsmisc/reloc/usr/share/man/man8/
FSWfsmisc/reloc/usr/share/man/man8/badblocks.8
FSWfsmisc/reloc/usr/share/man/man8/blkid.8
FSWfsmisc/reloc/usr/share/man/man8/debugfs.8
FSWfsmisc/reloc/usr/share/man/man8/dumpe2fs.8
FSWfsmisc/reloc/usr/share/man/man8/e2fsck.8
FSWfsmisc/reloc/usr/share/man/man8/e2image.8
FSWfsmisc/reloc/usr/share/man/man8/e2label.8
FSWfsmisc/reloc/usr/share/man/man8/filefrag.8
FSWfsmisc/reloc/usr/share/man/man8/findfs.8
FSWfsmisc/reloc/usr/share/man/man8/fsck.ext2.8
FSWfsmisc/reloc/usr/share/man/man8/fsck.ext3.8
FSWfsmisc/reloc/usr/share/man/man8/libntfs-gnomevfs.8
FSWfsmisc/reloc/usr/share/man/man8/logsave.8
FSWfsmisc/reloc/usr/share/man/man8/mke2fs.8
FSWfsmisc/reloc/usr/share/man/man8/mkfs.ext2.8
FSWfsmisc/reloc/usr/share/man/man8/mkfs.ext3.8
FSWfsmisc/reloc/usr/share/man/man8/mklost+found.8
FSWfsmisc/reloc/usr/share/man/man8/mkntfs.8
FSWfsmisc/reloc/usr/share/man/man8/ntfscat.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsclone.8
FSWfsmisc/reloc/usr/share/man/man8/ntfscluster.8
FSWfsmisc/reloc/usr/share/man/man8/ntfscmp.8
FSWfsmisc/reloc/usr/share/man/man8/ntfscp.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsfix.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsinfo.8
FSWfsmisc/reloc/usr/share/man/man8/ntfslabel.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsls.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsmount.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsprogs.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsresize.8
FSWfsmisc/reloc/usr/share/man/man8/ntfsundelete.8
FSWfsmisc/reloc/usr/share/man/man8/tune2fs.8
root@opensolaris:~/software#
root@opensolaris:~/software# pkgadd -d . FSWfsmisc
root@opensolaris:~/software# rmformat -l
Looking for devices...
     1. Logical Node: /dev/rdsk/c10t0d0p0
        Physical Node: /pci@0,0/pci1458,5006@1d,7/storage@1/disk@0,0
        Connected Device: ST350032 0NS
        Device Type: Removable
        Bus: USB
        Size: 476.9 GB
        Label: <Unknown>
        Access permissions: Medium is not write protected.
     2. Logical Node: /dev/rdsk/c7t0d0p0
        Physical Node: /pci@0,0/pci-ide@1f,2/ide@1/sd@0,0
        Connected Device: PIONEER  DVD-RW  DVR-212  1.24
        Device Type: DVD Reader/Writer
        Bus: IDE
        Size: <Unknown>
        Label: <Unknown>
        Access permissions: <Unknown>
root@opensolaris:~/software# mount -F ntfs /dev/rdsk/c10t0d0p0 /rmdisk/
root@opensolaris:~/software#
root@opensolaris:~/software# cd /rmdisk/
root@opensolaris:/rmdisk# ls
admin  a.txt  now  System Volume Information  three  www1  www2
root@opensolaris:/rmdisk#
成功了!
http://blogs.sun.com/mandalika/entry/mounting_windows_ntfs_on_open

疑似ARP attack 常用的cmd

arp attack原理很簡單,主要是利用arp protocol的弱點,我的理解是,攻擊的機器可以主動申請被攻擊的機器修改自己的 arp cache table, 問題就在這裡,所以,所有的攻擊和反攻擊也是圍繞它來進行

arp 的命令

[root@TEST2 ~]# arp  #主要是查詢本機內的arp cache table
Address                  HWtype  HWaddress           Flags Mask            Iface
server.aaa.com       ether   00:AA:BB:CC:DD:2C   C                     eth0
172.16.1.67              ether   00:1E:4F:C8:66:08   C                     eth0

如何獲得所有的本段的MAC呢?

發起一個廣播

ping –b <ip段>

例如

[root@CRRACTEST2 ~]# ping -b 172.16.1.255
WARNING: pinging broadcast address
PING 172.16.1.255 (172.16.1.255) 56(84) bytes of data.
64 bytes from 172.16.1.68: icmp_seq=1 ttl=64 time=0.320 ms
64 bytes from 172.16.1.124: icmp_seq=1 ttl=64 time=0.326 ms (DUP!)
64 bytes from 172.16.1.112: icmp_seq=1 ttl=64 time=0.501 ms (DUP!)
64 bytes from 172.16.1.17: icmp_seq=1 ttl=64 time=0.506 ms (DUP!)
64 bytes from 172.16.1.83: icmp_seq=1 ttl=64 time=0.530 ms (DUP!)
64 bytes from 172.16.1.31: icmp_seq=1 ttl=255 time=0.553 ms (DUP!)
64 bytes from 172.16.1.25: icmp_seq=1 ttl=64 time=1.12 ms (DUP!)
64 bytes from 172.16.1.200: icmp_seq=1 ttl=64 time=1.45 ms (DUP!)
64 bytes from 172.16.1.254: icmp_seq=1 ttl=64 time=2.46 ms (DUP!)
64 bytes from 172.16.1.250: icmp_seq=1 ttl=64 time=6.71 ms (DUP!)

目的是獲得(更新)arp cache table  <IP MAC>

[root@CRRACTEST2 ~]# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
172.16.1.25              ether   00:15:C7:8F:B6:D0   C                     eth0
172.16.1.67              ether   00:1E:5F:C6:44:08   C                     eth0
172.16.1.83              ether   00:0C:40:72:D4:21   C                     eth0
[root@CRRACTEST2 ~]#

 

如何根據MAC獲取IP呢?

arp -n |grep EC:4F  |awk '{print $1}'

nmap -sP 172.16.1.0/24 |grep arp -n |grep EC:6F  |awk '{print $1}'

[root@test ~]# rpm -Uvh fping-2.4-1.b2.2.el5.rf.x86_64.rpm
warning: fping-2.4-1.b2.2.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing...                ########################################### [100%]
   1:fping                  ########################################### [100%]

fping -v
fping: Version 2.4b2_to_ipv6 $Date: 2002/01/16 00:33:42 $
fping: comments to david@remote.net
fping -c 1 -g 172.16.1.0/24

 

如果發現arp cache table中發現2個ip對應MAC相同, 或者 gatway的不是缺省設定的,就有要引起懷疑了

另外,在gatway 的設定時儘量不要使用192.168.*.1 or 172.16.*.1類似的 IP地址, 而是使用 *.2 這樣也可以繞過一些attack tool

CRS-0184: Cannot communicate with the CRS daemon. 的處理

有一段時間沒有用RAC的測試環境了,重新啟動後,發現報錯了

[oracle@oracle01 ~]$ crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

我記得itpub上有人處理過類似的問題,今天終於有機會實踐一把了

在/var/tmp/有一個.oracle目錄

將這個目錄中的東西清空

rm –rf *

然後在root用戶下啟動crs

crsctl start crs

等待一段時間發現還是沒有辦法帶動起來crs全部的services

[oracle@oracle01 ~]$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....SM1.asm application    ONLINE    OFFLINE
ora....01.lsnr application    ONLINE    OFFLINE
ora....e01.gsd application    ONLINE    OFFLINE
ora....e01.ons application    ONLINE    OFFLINE
ora....e01.vip application    ONLINE    OFFLINE
ora....SM2.asm application    ONLINE    ONLINE    croracle02
ora....02.lsnr application    ONLINE    ONLINE    croracle02
ora....02.lsnr application    ONLINE    OFFLINE
ora....e02.gsd application    ONLINE    OFFLINE
ora....e02.ons application    ONLINE    ONLINE    croracle02
ora....e02.vip application    ONLINE    ONLINE    croracle02
ora....SM3.asm application    ONLINE    OFFLINE
ora....03.lsnr application    ONLINE    OFFLINE
ora....e03.gsd application    ONLINE    OFFLINE
ora....e03.ons application    ONLINE    OFFLINE
ora....e03.vip application    ONLINE    OFFLINE
ora....SM4.asm application    ONLINE    OFFLINE
ora....04.lsnr application    ONLINE    OFFLINE
ora....e04.gsd application    ONLINE    OFFLINE
ora....e04.ons application    ONLINE    OFFLINE
ora....e04.vip application    ONLINE    OFFLINE
ora....02.inst application    ONLINE    OFFLINE
ora....d1.inst application    ONLINE    OFFLINE
ora....d3.inst application    ONLINE    OFFLINE
ora....d4.inst application    ONLINE    OFFLINE
ora.crprod.db  application    ONLINE    OFFLINE

看到之後oracle02 這個node的服務啟動了

沒有辦法重新啟動服務器(我的是vmware 呵呵)

reboot後正常

 

[oracle@oracle01 ~]$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    croracle01
ora....01.lsnr application    ONLINE    ONLINE    croracle01
ora....e01.gsd application    ONLINE    ONLINE    croracle01
ora....e01.ons application    ONLINE    ONLINE    croracle01
ora....e01.vip application    ONLINE    ONLINE    croracle01
ora....SM2.asm application    ONLINE    ONLINE    croracle02
ora....02.lsnr application    ONLINE    ONLINE    croracle02
ora....02.lsnr application    ONLINE    OFFLINE
ora....e02.gsd application    ONLINE    ONLINE    croracle02
ora....e02.ons application    ONLINE    ONLINE    croracle02
ora....e02.vip application    ONLINE    ONLINE    croracle02
ora....SM3.asm application    ONLINE    OFFLINE
ora....03.lsnr application    ONLINE    OFFLINE
ora....e03.gsd application    ONLINE    OFFLINE
ora....e03.ons application    ONLINE    OFFLINE
ora....e03.vip application    ONLINE    ONLINE    croracle01
ora....SM4.asm application    ONLINE    OFFLINE
ora....04.lsnr application    ONLINE    OFFLINE
ora....e04.gsd application    ONLINE    OFFLINE
ora....e04.ons application    ONLINE    OFFLINE
ora....e04.vip application    ONLINE    ONLINE    croracle02
ora....02.inst application    ONLINE    ONLINE    croracle02
ora....d1.inst application    ONLINE    ONLINE    croracle01
ora....d3.inst application    ONLINE    OFFLINE
ora....d4.inst application    ONLINE    OFFLINE
ora.crprod.db  application    ONLINE    ONLINE    croracle02
[oracle@croracle01 ~]$

 

[oracle@oracle01 ~]$ sqlplus / as sysdba;

SQL*Plus: Release 11.1.0.6.0 - Production on Wed Feb 3 01:50:41 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> select * from v$active_instances;

INST_NUMBER
-----------
INST_NAME
--------------------------------------------------------------------------------
          1
croracle01.localdomain:crprod1

          2
croracle02.localdomain:croracle02

SQL>

 

看來reboot對oracle也是好使的!

2010年1月22日星期五

RedHat Linux NFS server and solaris NFS client 實驗

臨時需要將一個老舊的Solaris2.7上面的數據備份出來,但是這個Sun的server不支持USB,如何處理呢?

想了一個辦法NFS, NFS是sun開發的,估計應該支持,所以找了一個RedHat的server做個NFS server, 這個Solaris nfs方式mount上去

參考鳥哥的nfs server的設定:

RedHat端:

[oracle@oracle03 mnt_usb]$ cat /etc/exports
/mnt_usb  *(rw,no_root_squash)
[oracle@oracle03 mnt_usb]$

/mnt_usb是server機器的一個目錄文件

對任何機器都開放

當然前提是server端已經安裝了nfs server的軟件:

 

  /etc/init.d/portmap restart
  /etc/init.d/nfs start

驗證:
  netstat –ultn

  netstat -ultn |grep 111


  netstat -ultn |grep 2049

rpcinfo -p localhost

因為沒有設置防火牆,所以沒有安全方面的問題,如果你有,自己檢查一下

如果上述都正常,成功一半了

另一半在Soaris這裡

相對簡單:

root權限

建立一個目錄作為mount的節點:

# mkdir /backup

# mount -F nfs -o rw 172.16.12.24:/mnt_usb /backup

如果沒有報錯就說明成功了!

做一個備份的測試

test>tar cvf - ivantest |gzip -c >/backup/www1/ivantest.tar.gz
ivantest/
ivantest/a.txt
test>

沒有問題,從server哪裡可以看到,解壓也成功了

2010年1月21日星期四

Awk處理根據行處理文本的例子

現有一個測試文本

a.txt

107542 A000904
104005 A000426
  64636 A000347
  54304 A000900
  52480 A000901
  34814 A000930
  14346 A000562
  10239 A000929
   9821 A000782
  8515 A000417
   7161 A000599
   6961 A000813
   6845 A000422
   5676 A000092
   5329 A000685
   5288 A000547
   4939 A000834
   4829 A000903
   4804 A000011
   4245 A000010
   4161 A000302
   3831 A000550

如何取行號>10的呢?

[root@test tmp]# awk 'NR > 10 {print $1 "----" $2}' a.txt >/tmp/b.txt

查看b.txt的文本

b.txt
------------
7161----A000599
6961----A000813
6845----A000422
5676----A000092
5329----A000685
5288----A000547
4939----A000834
4829----A000903
4804----A000011
4245----A000010
4161----A000302
3831----A000550

如何取行號<10的呢?

[root@test tmp]# awk 'NR < 10 {print $1 "----" $2}' a.txt >/tmp/c.txt

c.txt
107542----A000904
104005----A000426
64636----A000347
54304----A000900
52480----A000901
34814----A000930
14346----A000562
10239----A000929
9821----A000782

第10行是什麼呢?

10    8515 A000417

[root@test tmp]# awk 'NR <= 10 {print $1 "----" $2}' a.txt >/tmp/d.txt
[root@CRRACTEST tmp]# cat d.txt
107542----A000904
104005----A000426
64636----A000347
54304----A000900
52480----A000901
34814----A000930
14346----A000562
10239----A000929
9821----A000782
8515----A000417
[root@test tmp]#

記錄一下,這個腳本對於大文本處理相當有用!

2010年1月14日星期四

帕肯森定律(Parkinson’sLaw)

 

工作总是拖延到它所能够允许最迟完成的那一天 .

(Work expands to fit the allotted time. )

學習,自勉!

Oracle tuning goals and techniques

oracle 9i tuning 教程总结的,不错,记录一下

tuning goals(主要是data buffer cache部分的) :
--servers find data in memory //数据尽量放在内存中
-- no waits on the buffer cache  //buffer cache上不要发生wait events
. Diagnostic measures
--wait events  //等待事件
--Cache hit ratio  //命中率
-- the v$db_cache_advice view  //data buffer的建议
.  tuning techniques
--reduce the number of blocks requires by sql  //sql尽量做到精确
--increase buffer cache size  // buffer cache的大小很重要
--use multiple buffer pools   //为不同性质的sql使用不同的buffer pool
-- cache tables //将小表放在内存中
-- bypass the cache for sorting and paralled reads. //绕过排序和并发读

2010年1月11日星期一

solaris 10 自身帶gcc make

嘗試在solaris10下編譯apache, 儘管已經下載了gcc但是還是不能通過

報錯“make: can not found”

手工運行一把,確實如此,怎麼辦呢?google

發現soalris下確實已經有了gcc和make的program,但是位置沒有在/usr/bin or /sbin/下

gcc 在這裏:

bash-3.00# cd /usr/sfw/bin

bash-3.00# ./gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with: /sfw10/builds/build/sfw10-patch/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/ccs/bin/as --without-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
bash-3.00#

bash-3.00# cd /usr/ccs/bin

bash-3.00# ./make
make: Fatal error: No arguments to build

不熟悉solaris, 發現沒有default home directory, 只好把加載到 /etc/profile文件中

PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin
export PATH

從新configure;make ;make install

+--------------------------------------------------------+
| You now have successfully built and installed the      |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the         |
| (initially created or preserved) configuration files   |
|                                                        |
|   /user/local/apache/conf/httpd.conf
|                                                        |
| and then you should be able to immediately fire up     |
| Apache the first time by running:                      |
|                                                        |
|   /user/local/apache/bin/apachectl start
|                                                        |
| Thanks for using Apache.       The Apache Group        |
|                                http://www.apache.org/  |
+--------------------------------------------------------+

ok, 記錄一下,備忘!

2010年1月10日星期日

Solaris 10 上如何安裝c/c++ 等的compilers?

最近在公司整理一個sun 450的服務器,從新安裝solaris 10, 居然可以成功的安裝10年前的Server, 進而想會不會有編譯環境呢?

gcc了一下沒有,我愛想在上面做的開發啥的,怎麼辦呢?google

發現sun 免費發放gcc的compliers

https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_SMI-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=GCC-4.2.1-G-F@CDS-CDS_SMI

安裝說明參考

http://cooltools.sunsource.net/gcc/4.2.0/install.html

我的實驗:

bash-3.00# ls
SUNW0scgfss421.tar.bz2  SUNWgccfss421.tar.bz2
bash-3.00# /bin/bunzip2 -c SUNWgccfss421.tar.bz2  |/bin/tar xf -
bash-3.00# /bin/bunzip2 -c SUNW0scgfss421.tar.bz2 |/bin/tar xf -

bash-3.00# pwd
/usr/local/gcc/bin
bash-3.00# ls
ats                              gccbug
bit                              gcov
c++                              sparc-sun-solaris2.10-c++
cpp                              sparc-sun-solaris2.10-g++
discover                         sparc-sun-solaris2.10-gcc
g++                              sparc-sun-solaris2.10-gcc-4.2.1
gcc
bash-3.00#

bash-3.00# ./gcc
gcc: no input files
bash-3.00#

參考Advanced Programming in the UNIX 2ed

寫個小例子測試一下:

bash-3.00# cat test.c
#include<stdio.h>
#include<dirent.h>

int main(int argc, char *argv[])
{
        DIR   *dp;
        struct dirent *dirp;

        if(argc != 2)
        {
                printf("usage: ls directory_name \n");
                return 1;
        }

        if((dp = opendir(argv[1]))== NULL)
                printf("can't open %s", argv[1]);

        while((dirp = readdir(dp)) !=NULL)
                printf("%s \n", dirp->d_name);

        closedir(dp);
        //exit(0);
        return 0;
}
bash-3.00#

bash-3.00# /usr/local/gcc/bin/gcc -o test test.c
bash-3.00#

bash-3.00# ./test
usage: ls directory_name
bash-3.00# ./test .
.
..
test.c
test.o
test
core
bash-3.00#

貌似可以了, 記錄一下備忘!

2010年1月8日星期五

Oracle - statspack報告中的 log file sync是意義?

官方文檔中:
redo synch time

The elapsed time of all redo sync writes calls in 10s of milliseconds.

redo sync writes

Usually, redo that is generated and copied into the log buffer need not be flushed out to disk immediately. The log buffer is a circular buffer that LGWR periodically flushes. Redo sync writes increments when changes being applied must be written out to disk due to a commit.

參考eygle的文章:

----------------------------------------------------------------------------

.等待事件

Event                               Waits   Timeouts  Time (cs)    (ms)   /txn
---------------------------- ------------ ---------- ----------- ------ ------
log file sync 14,466 2 4,150 3 1.0
db file sequential read 17,202 0 2,869 2 1.2
latch free 24,841 13,489 2,072 1 1.7
direct path write 121 0 1,455 120 0.0
db file parallel write 1,314 0 1,383 11 0.1
log file sequential read 1,540 0 63 0 0.1
....
log file switch completion 1 0 3 30 0.0

refresh controlfile command 23 0 1 0 0.0
LGWR wait for redo copy 46 0 0 0 0.0
....
log file single write 4 0 0 0 0.0


我们看到,这里log file sync和db file parallel write等待同时出现了.

显然log file sync在等待db file parallel write的完成.



这里磁盘IO肯定存在了瓶颈,实际用户的redo和数据文件同时存放在Raid的磁盘上,存在性能问题.

需要调整.



 



---------------------------------------------------



我猜測的是redo log file 所在的physical disk 有問題,或者io的問題,大體上沒有猜錯。



但是看了一下eygle的文章2004年的,差距啊



準備仔細研究一下statspack!



參考:



http://www.eygle.com/statspack/statspack14-LogFileSync.htm