標籤

4GL (1) 人才發展 (10) 人物 (3) 太陽能 (4) 心理 (3) 心靈 (10) 文學 (31) 生活常識 (14) 光學 (1) 名句 (10) 即時通訊軟體 (2) 奇狐 (2) 音樂 (2) 產業 (5) 郭語錄 (3) 無聊 (3) 統計 (4) 新聞 (1) 經濟學 (1) 經營管理 (42) 解析度 (1) 遊戲 (5) 電學 (1) 網管 (10) 廣告 (1) 數學 (1) 機率 (1) 雜趣 (1) 證券 (4) 證券期貨 (1) ABAP (15) AD (1) agentflow (4) AJAX (1) Android (1) AnyChart (1) Apache (14) BASIS (4) BDL (1) C# (1) Church (1) CIE (1) CO (38) Converter (1) cron (1) CSS (23) DMS (1) DVD (1) Eclipse (1) English (1) excel (5) Exchange (4) Failover (1) FI (57) File Transfer (1) Firefox (2) FM (2) fourjs (1) gladiatus (1) google (1) Google Maps API (2) grep (1) Grub (1) HR (2) html (23) HTS (8) IE (1) IE 8 (1) IIS (1) IMAP (3) Internet Explorer (1) java (3) JavaScript (22) jQuery (6) JSON (1) K3b (1) LED (3) Linux (112) Linux Mint (4) Load Balance (1) Microsoft (2) MIS (2) MM (51) MSSQL (1) MySQL (27) Network (1) NFS (1) Office (1) Oracle (125) Outlook (3) PDF (6) Perl (59) PHP (33) PL/SQL (1) PL/SQL Developer (1) PM (3) Postfix (2) postfwd (1) PostgreSQL (1) PP (50) python (1) QM (1) Red Hat (4) Reporting Service (28) ruby (11) SAP (234) scp (1) SD (16) sed (1) Selenium-WebDriver (5) shell (5) SQL (4) SQL server (8) SQuirreL SQL Client (1) SSH (2) SWOT (3) Symantec (2) T-SQL (7) Tera Term (2) tip (1) tiptop (22) Tomcat (6) Trouble Shooting (1) Tuning (5) Ubuntu (33) ufw (1) utf-8 (1) VIM (11) Virtual Machine (2) vnc (3) Web Service (2) wget (1) Windows (19) Windows (1) WM (6) youtube (1) yum (2)

2019年7月15日 星期一

合併多筆資料的某一欄位

https://jan6610.pixnet.net/blog/post/105389057-oracle-%E5%90%88%E4%BD%B5%E5%A4%9A%E7%AD%86%E8%B3%87%E6%96%99%E7%9A%84%E6%9F%90%E4%B8%80%E6%AC%84%E4%BD%8D



2019年7月11日 星期四

rcp 設定

http://space.itpub.net/8797129/viewspace-692501

rsh (remoteshell)
要配置无密码的rsh,有多种方法。例如:你可以配置/etc/hosts.equiv或者为每个用户生成一个.rhosts文件。配置时候,通常是写入一个允许的远程计算机名(当然,/etc/hosts中应该有相应的IP),此计算机名应该和DataStage配置文件中的fastname相同。
如果要配置root用户的rsh无密码登陆,还需要vi /etc/securetty,在里面添加rsh rexec rlogin,如果非root用户,这一步可以省去
1首先确认机器是否安装rsh包:
[oracle@linux ~]$ rpm -aq |grep rsh
rsh-0.17-25.4
rsh-server-0.17-25.4

2: 修改/etc/xinetd.d/rsh脚本文件
[root@linux ~]# vi /etc/xinetd.d/rsh
rsh 属于xinetd服务,修改/etc/xinetd.d/rsh脚本文件文件中的选项
将disable 设置为no
# default: on
# description: The rshd server is the server for the rcmd(3) routine and, \
#       consequently, for the rsh(1) program.  The server provides \
#       remote execution facilities with authentication based on \
#       privileged port numbers from trusted hosts.
service shell
{
        socket_type             = stream
        wait                    = no
        user                    = root
        log_on_success          += USERID
        log_on_failure          += USERID
        server                  = /usr/sbin/in.rshd
#       disable                 = yes
        disable                 = no
}

3.重启rsh服务
[root@linux ~]# service xinetd restart
Stopping xinetd: [  OK  ]
Starting xinetd: [  OK  ]

4. 检查是否启动: rsh server 监听和TCP 是514。
[root@linux ~]# netstat -an |grep 514
tcp        0      0 0.0.0.0:514                 0.0.0.0:*                   LISTEN    
unix  3      [ ]         STREAM     CONNECTED     44514

5:配置rsh server
修改/etc/securetty文件: echo rsh >>/etc/securetty
如果打算用root作为rsh用户的话:
先用root登录到机器A中进行以下操作:
[root@linux ~]#  echo "192.168.7.10 root" >>.rhosts   //允许192.168.0.10 以root访问
[root@linux ~]#  echo "192.168.7.15 root" >>.rhosts   
重启rsh server.
.rhosts一般位于 rsh server服务器相对应账号目录下比如root(与.bash_profile在同一目录)
查看是否配置成功:
[root@linux ~]# more .rhosts
192.168.7.10 root
192.168.7.15 root(Windows的話是使用者帳號)

6:配置vi /etc/hosts,加入对方的IP和机器名(hostname)。机器名可以参考127.0.0.1一行。
[root@linux ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               linux localhost.localdomain localhost
192.168.7.15            linux         #本机ip及机器名
192.168.7.10            hlht          #远程服务器ip及机器名(Windows的話是電腦主機名稱)

7:配置vi /etc/hosts.equiv
[root@linux ~]# vi /etc/hosts.equiv
127.0.0.1 localhost
192.168.7.10 hlht
192.168.7.15 linux

8:到/etc/pam.d/目录下,把rsh文件中的auth  required  pam_securetty.so一行用“#”封掉即可(注意修改红色字体一行:加#)
[root@hlht ~]# cd /etc/pam.d
[root@hlht pam.d]# vi rsh
#%PAM-1.0
# For root login to succeed here with pam_securetty, "rsh" must be
# listed in /etc/securetty.
auth       required     pam_nologin.so
#auth       required    pam_securetty.so
auth       required     pam_env.so
auth       required     pam_rhosts_auth.so
account    required     pam_stack.so service=system-auth
session    required     pam_stack.so service=system-auth

9:重启rsh server.
[root@linux ~]# service xinetd restart
Stopping xinetd: [  OK  ]
Starting xinetd: [  OK  ]

10:测试和注意的问题:
登录到192.168.7.10机器进行测试
看是否能看到结果。如果看到
[oracle@linux ~]$ rsh -l oracle 192.168.7.10 ps -ef
connect to address 192.168.7.10: Connection refused
Trying krb4 rsh...
connect to address 192.168.7.10: Connection refused
trying normal rsh (/usr/bin/rsh)
Permission denied.
这是由于权权限问题,一般是由于 .rhosts没有配置正确。.rhosts一般位于
rsh server服务器相对应账号目录下比如root(与.bash_profile在同一目录)
如果看到
[root@linux pam.d]# rsh -l root 192.168.7.10 env|grep PATH
connect to address 192.168.7.10: Connection refused
Trying krb4 rsh...
connect to address 192.168.7.10: Connection refused
trying normal rsh (/usr/bin/rsh)
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin
表示rsh配置成功,可以使用rcp进行远程拷贝。

2019年7月1日 星期一

用Perl的Mail::Sendmail模組寄送SMTP中文表頭


http://oldwww.geego.com.tw/tech_support/tech-tips-sending-utf8-smtp-header-using-perl-mail

電子郵件分成兩大部分:表頭及本文,表頭如果使用utf8字元的話,Perl的Mail::Sendmail模組在寄送後,收件人可能會看到亂碼,我們使用Encode模組來解決這個問題。

程式範例:

#!/usr/bin/perl

use utf8;
use Encode;

use Mail::Sendmail;

$sender = “奇科電腦 – Perl程式設計課程<perl@geego.com.tw> “;
$email = '奇科電腦 Perl團隊<perl.mail::sendmail@geego.com.tw>';

my $message = "奇科電腦: 這是一封用來測試Perl的Mail::Sendmail模組可否成功寄送utf8字元的郵件表頭.\n"

$sender = Encode::encode('MIME-Q', $sender); #避免header的內容變亂碼
$message = encode( "utf8", $message );

my %mail = ( To => "$email",
From => “$sender”,
'Content-type' => 'text/plain; charset="utf-8"',
Subject => "Perl’s Mail::Sendmail sending utf8 mail header",
Message => "$message" );

sendmail(%mail) or die $Mail::Sendmail::error;