2016年8月26日 星期五

Oracle Query Alert Log fvia SQL

http://www.dba-oracle.com/t_11g_dbgalertext_alert_log_sql.htm

http://www.dba-oracle.com/t_oracle_alert_log_sql_external_tables.htm


11可以查 X$DBGALERTEXT

11以前要用外部文件的方式

create directory BDUMP as '/u01/app/oracle/admin/mysid/bdump';

create table 
   alert_log ( msg varchar2(80) )
organization external (
   type oracle_loader
   default directory BDUMP
   access parameters (
      records delimited by newline
   )
   location('alrt_mysid.log')
)
reject limit 1000;


Oracle 8i DDL Trigger

https://docs.oracle.com/cd/A87860_01/doc/appdev.817/a76939/toc.htm

https://docs.oracle.com/cd/A87860_01/doc/appdev.817/a76939/adg13trg.htm#6366

https://docs.oracle.com/cd/A87860_01/doc/appdev.817/a76939/adg14evt.htm#998000

https://docs.oracle.com/cd/A87860_01/doc/appdev.817/a76939/adg14evt.htm#1000872

2016年7月25日 星期一

Sublime 3 big5

依照
http://blog.miniasp.com/post/2014/01/06/Useful-tool-Sublime-Text-3-Quick-Start.aspx

先用 ESC + ` 打開主控台

然後到

https://sublime.wbond.net/installation#st3

這個網頁複製貼上 先裝 Package Control

然後透過 Package Control 做 install package

裝  ConvertToUTF8

  1. 將 %APPDATA%\Sublime Text 3\Packages\ConvertToUTF8\ConvertToUTF8.sublime-settings" 預設設定檔,複製到 %APPDATA%\Sublime Text 3\Packages\User\ 目錄下。
  2. 然後直接透過 Sublime Text 3 編輯這個位於 User 目錄下的ConvertToUTF8.sublime-settings 檔案。
  3. 將 encoding_list 字集定義對調,讓 BIG5 擺在首位: 

2016年6月14日 星期二

linux remove disk



http://www.redhatgeek.com/linux/remove-a-disk-from-redhatcentos-linux-without-rebooting-the-system

先 umount 停止IO
echo "offline" > /sys/block/sdc/device/state

echo "1" > /sys/block/sdc/device/delete







=======END=========

CentOS7 postfix 2.10 openwebmail 3 安裝記錄

參考
http://www.wkb.idv.tw/moodle/mod/page/view.php?id=7831&lang=zh_tw



mkdir /home01


先把 yum 跟 wget 設 ftp proxy

wget ftp://openwebmail.org/pub/openwebmail/el7/openwebmail-el7.repo -e use_proxy=yes -e ftp_proxy=172.22.x.x:3128

vim /etc/yum.conf
加
proxy=http://172.22.x.x:3128

然後
yum update

yum --downloadonly --downloaddir=/usr/local/src install openwebmail perl-CGI-SpeedyCGI perl-Authen-PAM perl-HTML-Template

這時候有的東西是
openwebmail-2.54-1.el7.noarch.rpm               perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
openwebmail-data-2.54-1.el7.noarch.rpm          perl-IO-Compress-2.061-2.el7.noarch.rpm
perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm

缺了
perl-CGI-SpeedyCGI
perl-Authen-PAM
perl-HTML-Template


SpeedyCGI  要從 EPEL 裝

參考
https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/

yum install epel-release
yum update


繼續安裝
rm -f openwebmail*.rpm  (把 2.54 的 openwebmail 砍掉 等等要抓新的)
rpm -Uvh *.rpm  (把其他的裝進去)
yum install perl-Authen-PAM perl-CGI-SpeedyCGI perl-HTML-Template


來裝本體
cd /var/www
wget http://openwebmail.acatysmoof.com/download/current/openwebmail-current.tar.gz -e use_proxy=yes -e ftp_proxy=172.22.x.x:3128

tar zxvf ./openwebmail-current.tar.gz

ln -s /var/www/data/openwebmail /var/www/html/openwebmail
cd /var/www/html/openwebmail/
ln -s redirect.html index.html
cp /usr/bin/speedy /usr/bin/speedy_suidperl
chmod 4555 /usr/bin/speedy_suidperl

cd /var/www/cgi-bin/openwebmail/
sed -i -e 's/perl -T/speedy_suidperl -T -- -T\/tmp\/speedy/' openwebmail*.pl

vim etc/openwebmail.conf


#ow_cgidir          /usr/local/www/cgi-bin/openwebmail
ow_cgidir               /var/www/cgi-bin/openwebmail

#ow_htmldir              /usr/local/www/data/openwebmail
ow_htmldir              /var/www/data/openwebmail

新增
mailspooldir            /var/spool/mail
use_homedirspools       yes


cd /var/www/cgi-bin/openwebmail/
cp defaults/dbm.conf .

改 /var/www/cgi-bin/openwebmail/etc/dbm.conf
dbm_ext .pag
dbmopen_ext none
dbmopen_haslock no


cd /var/www/cgi-bin/openwebmail/
chmod 777 ./misc/tools/wrapsuid/wrapsuid.pl ./misc/tools/wrapsuid/wrapsuid.pl /var/www/cgi-bin/openwebmail/openwebmail*.pl
chmod 660 ./misc/tools/wrapsuid/wrapsuid.pl
chmod 4755 openwebmail*.pl


touch /var/log/openwebmail.log
chown root.mail /var/log/openwebmail.log
chmod -R 777 /var/www/cgi-bin/openwebmail/etc/sessions/

然後改 /etc/postfix/main.cf

#inet_protocols = all
inet_protocols = ipv4

#inet_interfaces = localhost
inet_interfaces = all

#mydestination = $myhostname, localhost.$mydomain, localhost
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, webmail.$mydomain, *****.$mydomain

home_mailbox = Mailbox

mynetworks = 127.0.0.0/8, 192.168.0.0/24, 172.22.0.0/16, blahblah
relay_domains = $mydestination
myhostname = ms3.xxxxx
mydomain = xxxxx
myorigin = $mydomain


service postfix restart



出現
YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!
cd /var/www/cgi-bin/openwebmail/
chmod 4755 openwebmail*.pl

./openwebmail-tool.pl --init

出現

登入失敗︰系統確認錯誤。
請返回然後 再試一次.

cd /var/www/cgi-bin/openwebmail/
cp defaults/auth_unix.conf .
vim auth_unix.conf

passwdfile_plaintext    /etc/passwd
#passwdfile_encrypted   /etc/master.passwd
passwdfile_encrypted    /etc/shadow
#passwdmkdb             /usr/sbin/pwd_mkdb
passwdmkdb              none
check_expire            no
check_nologin           no
#check_shell            no
check_shell            yes

service httpd restart


錯誤訊息觀察

Perl 直譯器產生的問題
/var/log/httpd/error.log

openwebmail 自己的問題
/var/log/openwebmail.log

Postfix 寄信的問題
/var/log/maillog








設定  dovecot

/etc/dovecot/dovecot.conf

#protocols = imap pop3 lmtp
protocols = pop3

#listen = *, ::
listen = *

/etc/dovecot/conf.d/

10-auth.conf

#disable_plaintext_auth = yes
disable_plaintext_auth = no

10-logging.conf

#mail_debug = no
mail_debug = yes

(  log 位置預設在 /var/log/maillog . 可以用 doveadm log find 確認)

10-mail.conf

#mail_location = 
mail_location = mbox:~/imap:INBOX=~/Mailbox

10-ssl.conf

#ssl = required
ssl = no




改 hostname

/etc/hosts

用 NetworkManager 的話 可以用


hostnamectl set-hostname server1.cyberciti.biz --static
 systemctl restart systemd-hostnamed
hostnamectl status




SMTP 指令測試

http://www.yuki-onna.co.uk/email/smtp.html

telnet mail.domain.ext 25

HELO local.domain.name
MAIL FROM: mail@domain.ext
RCPT TO: mail@otherdomain.ext

DATA
Subject:-type subject here-
- MAIL_BODY -
.
QUIT

在 openwebmail.conf 裡面可以把 webdisk / sshterm 等等的關掉 . 可參考 defaults/openwebmail.conf



============END===========