2017年1月20日 星期五

linux mpio



編輯 /etc/multipath.conf
把 blacklist {} 區段註解掉
然後把 default{} 區段打開

chkconfig multipathd on
service multipathd start

然後 fdisk -l 會看到多出 dm-n 的硬碟 但 dm-n 不能直接掛來用
要用 /dev/mapper/mpathNpN
詳細資料待查

引用

#vi /etc/multipath.conf
然後可以看到檔案裡面有這些東西
blacklist {
        devnode "*"
}

把這幾行mark掉吧
另外可以看到有一些本來被mark掉的
#defaults {
#       udev_dir                /dev
#       polling_interval        10
#       selector                "round-robin 0"
#       path_grouping_policy    multibus
#       getuid_callout          "/sbin/scsi_id -g -u -s /block/%n"
#       prio_callout            /bin/true
#       path_checker            readsector0
#       rr_min_io               100
#       max_fds                 8192
#       rr_weight               priorities
#       failback                immediate
#       no_path_retry           fail
#       user_friendly_names     yes
#}
這裡是設定一些multipath參數的地方
設定好就拿掉mark吧,如果不會設定的話直接拿掉mark也是可以的
存檔後就可以開啟service了
#chkconfig multipathd on
#service multipathd start
在啟動之前可以看到我硬碟是這樣
Disk /dev/sdb: 997.9 GB, 997999509504 bytes
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1306    10490413+  83  Linux
/dev/sdb2            1307        2612    10490445   83  Linux


Disk /dev/sdc: 997.9 GB, 997999509504 bytes
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1        1306    10490413+  83  Linux
/dev/sdc2            1307        2612    10490445   83  Linux

啟動之後可以看到多出幾個device
Disk /dev/dm-0: 997.9 GB, 997999509504 bytes
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

     Device Boot      Start         End      Blocks   Id  System
/dev/dm-0p1   *           1        1306    10490413+  83  Linux
/dev/dm-0p2            1307        2612    10490445   83  Linux

Disk /dev/dm-1: 10.7 GB, 10742183424 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 10.7 GB, 10742215680 bytes
255 heads, 63 sectors/track, 1306 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-2 doesn't contain a valid partition table

其中dm-0是sdb和sdc的合體,但是因為sdb和sdc有兩個partition,
所以multipath也順便把這兩個合成dm-1和dm-2,
這時候會發現在device下面找不到dm-0p1和dm-0p2可以用,
因為他放到/dev/mapper裡面去了,在裡面可以看到mpath1p1和mpath1p2分別就是兩個partition
如果要更改設定的話除了在multipath.conf裡面更改再重新啟動之外
也可以用multipath指令即時更新,另外"multipath -ll"也可以看到目前path的組成以及狀況





參考

http://tnth.pixnet.net/blog/post/26222957-linux%E4%B8%8A%E7%9A%84mpio

https://access.redhat.com/documentation/zh-TW/Red_Hat_Enterprise_Linux/6/html/DM_Multipath/mpio_setup.html

oracle enable / disable archive_n

相關參數
log_archive_dest_state_n
log_archive_dest_n

alter system set log_archive_dest_state_n=defer scope=both;

alter system set log_archive_dest_state_n=enable scope=both;

可以用  ALTER SYSTEM ARCHIVE LOG CURRENT 出清現有 redo

參考
https://docs.oracle.com/cd/B14117_01/server.101/b10755/initparams102.htm

LOG_ARCHIVE_DEST_STATE_n = { alternate | reset | defer | enable }


The LOG_ARCHIVE_DEST_STATE_n parameters (wheren = 1, 2, 3, ... 10) specify the availability state of the corresponding destination. The parameter suffix (1 through 10) specifies one of the ten corresponding LOG_ARCHIVE_DEST_n destination parameters.
Values:
  • enabled
    Specifies that a valid log archive destination can be used for a subsequent archiving operation (automatic or manual). This is the default.
  • defer
    Specifies that valid destination information and attributes are preserved, but the destination is excluded from archiving operations until re-enabled.
  • alternate
    Specifies that a log archive destination is not enabled but will become enabled if communications to another destination fail.
The LOG_ARCHIVE_DEST_STATE_n parameters have no effect on the ENABLE state for the LOG_ARCHIVE_DEST or LOG_ARCHIVE_DUPLEX_DEST parameters.


The V$ARCHIVE_DEST dynamic performance view shows values in use for the current session. The DEST_ID column of that view corresponds to the archive destination suffix n.


2016年11月4日 星期五

tftp 安裝

http://blog.xuite.net/arieslin2005blog/blog/53375149-%E5%AE%89%E8%A3%9D+Ubuntu+%E4%B8%8B%E4%BD%BF%E7%94%A8%E7%9A%84tftp+server+(tftpd-hpa+%E8%88%87+tftp-hpa)

* 安裝 tftpd-hpa server *
用 apt-get 下載並安裝 
root@ubuntu:~# apt-get install tftpd-hpa
修改設定檔 
root@ubuntu:~# vim /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"

如果是 Ubuntu 10.4 之前版本, 設定檔內容不同 (上面10.4之後的設定找了好久才找到!) 
 RUN_DAEMON="yes"
 OPTIONS="-l -c -s tftpboot"
 
建立共享目錄
root@ubuntu:~# mkdir /tftpboot
修改目錄下所有檔權限 (全開,以便上傳下載)
root@ubuntu:~# chmod 777 -R /tftpboot
修改目錄下所有檔擁有者及群組
root@ubuntu:~# chown nobody.nogroup -R /tftpboot
查看權限是否作用
root@ubuntu:~# ls /tftpboot -ld
drwxrwxrwx 2 nobody nogroup 4096 2011-10-10 09:51 /tftpboot
建立一個下載用的測試檔 
root@ubuntu:~# echo "This is a tftpd-hpa testfile" > /tftpboot/testfile
重啟 tftpd-hpa 服務
root@ubuntu:~# service tftpd-hpa restart
確認 tftp(69埠) 是否監聽中 
root@ubuntu:~# netstat -a | grep tftp
udp        0      0 *:tftp                  *:*   
root@ubuntu:~#


* 安裝 tftp-hpa client *
1. 用 apt-get 下載並安裝 
root@ubuntu:~# apt-get install tftp-hpa

2. VM本機連線測試
建立一個即將上傳的檔案 
root@ubuntu:~# echo "uploaded file" > 1.txt
連線到 localhost ip 
root@ubuntu:~# tftp 127.0.0.1
顯示詳細過程 
verbose
抓取檔案 
get testfile
放檔案上去 
put 1.txt
離開 
quit



2016年10月14日 星期五

be exported in conventional path

Table *** will be exported in conventional path.

在 EXP 時指定了  direct =y

根據  https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::p11_question_id:968789918647


A direct path export should not be considered the converse of a direct path load using SQLLDR (for those of you familiar with that option). A direct path export does not read directly from the datafiles and write to the DMP file. SQLLDR does write directly to the datafiles from the DAT files. Export in direct path mode simply bypasses the SQL evaluation buffer (where clause processing, column formatting and such). 90% of the path is the same, EXP is still reading buffers into the buffer cache, doing the same consistent read processing and so on. 

The speedup of the direct path export can be large however. The 10% of the processing that it cuts out, accounts for a much larger percentage of the run-time. For example, I have just exported about 100meg of data, and 1.2 million records. The direct path export took about one minute. The conventional path export on the other hand took three minutes. There is unfortunately no corresponding 'direct path import'. Import uses conventional SQL to insert the data back into tables. SQLLDR is still the way to go for high performance data loads. 

It should be noted that in direct path mode, you cannot use the QUERY= parameter to select a subset of rows. This makes sense given that DIRECT=Y is simply a way to bypass the SQL evaluation buffer and that is where the where clause processing would normally take place. 



2016年10月12日 星期三

virtualbox host to guest network

guest本來就會有一個NAT網卡

在 HOST 的 virtualbox 網路設定 新增一個 HOSTONLY NETWORK
然後給 guest 加一個 host only 的 網卡 附加到剛剛那個新增的網卡