2015年11月6日 星期五

顯示某個字元位前所有字

SELECT         SUBSTRING(PROD_NO, 1, CHARINDEX('4', PROD_NO)) AS Expr1
FROM             PRODUCT 

例如SELECT出二字串"123@gmail.com"及"456@gmail.com"
顯示出@之前的字串---變成"123"及"456"

參考來源:http://www.blueshop.com.tw/board/FUM20041006152735ZFS/BRD200301231022589AD.html

2015年10月28日 星期三

Zimbra

環境:
ISO 檔 -> CentOS-7-x86_64-Minimal-1503-01.iso
VM -> CPU:1CORE,RAM:4G,HD:200G,網卡:VMXNET 3

OS版本 -> CentOS Linux release 7.1.1503 (Core)
cat /etc/centos-release

打開啟用網路、設定IP(192.168.10.99)、hostname(zmail.gg168.com)
nmtui

安裝 perl
 yum install perl

安裝 VMwareTools mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/VMwareTools-9.10.0-2476743.tar.gz /tmp/
cd /tmp
tar -zxvpf VMwareTools-9.10.0-2476743.tar.gz
 cd vmware-tools-distrib/
./vmware-install.pl

刪除 VMwareTools 安裝檔、壓縮檔
 rm -rf vmware-tools-distrib VMwareTools-9.10.0-2476743.tar.gz

reboot 鳥哥最常用來重新開機的指令(或關機),可以配合寫入緩衝資料的 sync 指令動作
sync; sync; sync; reboot

檢查是否有執行
 /etc/init.d/vmware-tools status

yum install sudo sysstat libidn gmp libtool-ltdl compat-glib vixie-cron perl libstdc++.i686 nc unzip perl-core wget nmap sqlite -y

安裝 ifconfig
yum provides ifconfig
yum whatprovides ifconfig
yum install net-tools
# #安裝 traceroute
yum install  traceroute

vi /etc/hosts
只留這一行>>192.168.10.99 zmail.gg168.com zmail

chkconfig postfix off
service postfix stop
chkconfig sendmail off
service sendmail stop
vi /etc/sudoers
chkconfig iptables off
service iptables stop
chkconfig ip6tables off
service ip6tables stop

vi /etc/sysconfig/selinux
>>SELINUX=disabled

關防火牆 http://note.tc.edu.tw/932.html
service firewalld stop

下載安裝 zimbra
cd /tmp
wget https://files.zimbra.com/downloads/8.6.0_GA/zcs-8.6.0_GA_1153.RHEL7_64.20141215151110.tgz
tar -zxvpf  zcs-8.6.0_GA_1153.RHEL7_64.20141215151110.tgz
./install.sh

安裝完成後選項
6-4) Admin Password                           UNSET>>Password for admin@zimbra.168gg.com (min 6 characters): [SBmeBXtA] password
1-6) TimeZone:                                Asia/Taipei >> 57

檢視狀態
zimbra@zimbra:/~$ zmcontrol status

檢視憑證
/opt/zimbra/bin/zmcertmgr  viewdeployedcrt all |grep notAfter

安裝參考網址:
http://www.unixmen.com/install-zimbra-collaboration-suite-8-6-0-centos-7/
http://blog.revivalx.com/2015/03/10/how-to-install-zimbra-collaboration-suite-8-6-0-on-centos-7/
https://itservices.stanford.edu/service/emailcalendar/desktop/outlook/gal

2015年8月25日 星期二

MacBook Air 安裝 Win 7 鍵盤 滑鼠沒反應


OS X 10.8.5
Boot Camp 5.0.4(473)

安裝方式參考網址:
http://supera198.blogspot.tw/2013/07/2013-macbook-air-bootcamp.html

若找不到 BootCamp\Drivers\Intel\Chipset\WIN7 驅動可到 Intel 下載:
https://downloadcenter.intel.com/product/65855/Intel-USB-3-0-eXtensible-Host-Controller-Driver

解壓縮後
找出以下 12 個必需的驅動檔案,放在 BootCamp\Drivers\Intel\Chipset\WIN7 和下列位置

$WinPEDriver$\IntelxHCISetup\Drivers\HCSwitch\Win7\x64\iusb3hcs.cat
$WinPEDriver$\IntelxHCISetup\Drivers\HCSwitch\Win7\x64\iusb3hcs.inf
$WinPEDriver$\IntelxHCISetup\Drivers\HCSwitch\Win7\x64\iusb3hcs.sys
$WinPEDriver$\IntelxHCISetup\Drivers\HCSwitch\Win7\x64\WdfCoInstaller01009.dll
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\iusb3hub.cat
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\iusb3hub.inf
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\IUsb3Hub.man
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\iusb3hub.sys
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\iusb3xhc.cat
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\iusb3xhc.inf
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\iusb3xhc.man
$WinPEDriver$\IntelxHCISetup\Drivers\xHCI\Win7\x64\iusb3xhc.sys

以上方式還不行的話,可參考把 USB 安裝碟,打包 USB3.0 驅動至 USB 裡
http://www.macx.cn/thread-2098963-1-1.html


2015年8月11日 星期二

WAMP 2.5 install SAPRFC

Apache Version : 2.4.9
PHP Version : 5.5.12
Apache/2.4.9 (Win32)

1) Extract zip file saprfc-$VERSION$-$PHP_VERSION$.zip

2) Copy php_saprfc_PHP5.5_x86_ts.dll to your extensions directory (e.g. D:\wamp\bin\php\php5.5.12\)

3) Edit php.ini file (in windows system dircetory, e.g. D:\wamp\bin\apache\apache2.4.9\bin\) and add line: 'extension=php_saprfc_PHP5.5_x86_ts.dll'

4) Copy librfc32.dll (from SAPGUI install CD) to the windows system
     directory or simple install SAPGUI on your machine.

2015年8月7日 星期五

Windows 清除 DNS 暫存 Cache

C:\>ipconfig  /flushdns

Windows IP 設定

成功清除 DNS 解讀器快取。

2015年8月4日 星期二

FortiClinet 關閉自動啟動服務

How to stop FortiClient from starting automatically?

1.Shut down FortiClient from the system tray.
2.Run net stop fortishield on command prompt.
3.Run services.msc on command prompt
4.Look for FortiClient Service Scheduler. Switch Startup type to Manual.
5.Restart your computer.

參考來源:http://www.hongjun.sg/2014/12/how-to-stop-forticlient-from-starting.html

2015年6月10日 星期三

2015年5月4日 星期一

Reset autoincrement in Microsoft SQL

DBCC CHECKIDENT ("YourTableNameHere", RESEED, 1);

2015年3月17日 星期二

Google、Bing 搜尋紀錄移除

Google 電話:02-8729-6000
Bing 電話:0800-888-384(這好像是廣告服務的電話)
yahoo 是使用 Bing 搜尋引擎

Google 移除工具
https://www.google.com/webmasters/tools/removals?pli=1

Bing 移除工具
https://www.bing.com/webmaster/tools/content-removal

我提交不了,所以後來我用線上回報問題
https://support.discoverbing.com/default.aspx?mkt=zh-TW&productkey=bingcontentremoval&brand=&&ct=eformts&scrx=1

2015年3月10日 星期二

便宜網域、網域出租 (cgi.tw)

出租網域為 cgi.tw

一年 NTD 120 元,一個月才 NTD 10 元,歡迎承租~~~

例如:您想租的名稱為 king ,那麼您的網域是 king.cgi.tw

網站   www.king.cgi.tw
MAIL user@king.cgi.tw
相關服務網址,利用 freedns 都能自行設定

有興趣請留下您的聯絡方式

目前已出租:
chair.cgi.tw
edu.cgi.tw


PS:我會利用 freedns 來說明如何設定,非相關技術人員請勿嘗試。

2015年3月4日 星期三

Simple Invoices(CentOS 7)

環境參考本站的 CENTOS 7.0.1406 64bit LAMP

安裝參考:http://www.simpleinvoices.org/install

1.先切換到 www 目錄
#cd /var/html/www/

2.下載 Simple Invoices (版本超久沒更新)
#wget http://download.simpleinvoices.org/simpleinvoices/downloads/simpleinvoices.2011.1.zip

3.解壓縮;刪除壓縮檔
#unzip simpleinvoices.2011.1.zip;rm -rf simpleinvoices.2011.1.zip

4.修改 config.ini 
#vi simpleinvoices/config/config.ini


5.修改可寫入權限(Simple Invoices 會寫 Log、備份 DB…等)
chmod -Rv 777 tmp*

PS:若有權限上的問題應該是 SELinux 的問題,關掉是比較省麻煩,但較不安全,關掉方式可參考 http://blog.zwiegnet.com/linux-server/disable-selinux-centos-7/;要安全一點就設定 SELinux

6.輸 http://您的網址或IP/simpleinvoices 即可以進入 Web 安裝畫面


2015年3月3日 星期二

CENTOS 7.0.1406 64bit LAMP

OS:CentOS-7.0-1406-x86_64-Minimal.iso

#yum -y install rp-pppoe.x86_64

停止、關閉開機執行 NetworkManager
#systemctl stop NetworkManager.service
#systemctl disable NetworkManager.service

查看網卡名稱,我的叫 ens33
#ifconfig

設定 PPPOE
#pppoe-setup

重啟網路就會自動撥了
#/etc/init.d/network restart

以上 PPPOE 安裝參考:http://blog.kevinlinul.idv.tw/?p=174

安裝 MariaDB
#yum -y install mariadb-server mariadb

啟用、開啟開機執行 MariaDB
#systemctl start mariadb.service
#systemctl enable mariadb.service 

設定 MariaDB
#mysql_secure_installation

安裝 Apache
#yum -y install httpd

啟用、開啟開機執行 Apache
#systemctl start httpd.service
#systemctl enable httpd.service

開啟防火牆 80、443 ports
#firewall-cmd --permanent --zone=public --add-service=http
#firewall-cmd --permanent --zone=public --add-service=https
#firewall-cmd --reload

安裝 PHP 與 DB 相關套件
#yum -y install php
#yum -y install php-mysql
#yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel

重啟 Apache 讓套件生效
#systemctl restart httpd.service

檢視套件是否有成功安裝
#vi /var/www/html/info.php


安裝 下載套件、解壓縮套件
#yum install wget unzip

下載 phpmyadmin 4.3.11
#wget -O phpmyadmin.zip http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.11/phpMyAdmin-4.3.11-all-languages.zip?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Findex.php&ts=1425398362&use_mirror=nchc

解壓縮;更改目錄名稱;移除壓縮檔
#unzip phpmyadmin.zip; mv phpMyAdmin-4.3.11-all-languages/ phpdbadmin; rm -rf phpmyadmin.zip

到 phpdbadmin 目錄
#cd /var/www/html/phpdbadmin

複製 config.sample.inc.php 成 config.inc.php
#cp config.sample.inc.php config.inc.php

blowfish 加密
#vi config.inc.php
原 $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
改 $cfg['blowfish_secret'] = '隨便打'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

以上 LAM (MariaDB) P 安裝參考:http://ithelp.ithome.com.tw/question/10158428



其它參考如下

MariaDB
http://shaurong.blogspot.tw/2014/07/centos-7-mysql-mariadb.html

MySQL 安裝參考:
http://sharadchhetri.com/2014/07/31/how-to-install-mysql-server-5-6-on-centos-7-rhel-7/

2015年2月13日 星期五

ESXi 5.1 教學連結

一、安裝篇
(VMesxi 安裝篇-Day1) VMware ESXi 介紹
(VMesxi 安裝篇-Day2) VMware ESXi 5.1安裝和基本設定
(VMesxi 安裝篇-Day3) VMware vSphere Client 5.1下載安裝
(VMesxi 安裝篇-Day4) VMware vSphere Client 5.0下載安裝
(VMesxi 安裝篇-Day5) VMware ESXi 5.0輕鬆升級ESXi 5.1
(VMesxi 安裝篇-Day6) VMware ESXi 4.1輕鬆升級ESXi 5.0
(VMesxi 安裝篇-Day7) 使用USB隨身碟安裝 VMware ESXi 5.1
(VMesxi 安裝篇-Day8) VMware ESXi 5.1 安裝在USB隨身碟開機
(VMesxi 安裝篇-Day9) Install VMware tools for windows
(VMesxi 安裝篇-Day10) Install VMware tools for Linux

二、功能篇
(VMesxi 功能篇-Day11) VMware vSphere 5.1 基本設定(上)
(VMesxi 功能篇-Day12) VMware vSphere 5.1 基本設定(下)
(VMesxi 功能篇-Day13) VMware vSphere 5.1 新增VM虛擬機
(VMesxi 功能篇-Day14) VMware vSphere 5.1 NFS 掛載
(VMesxi 功能篇-Day15) VMware vSphere 5.1 iSCSI 掛載
(VMesxi 功能篇-Day16) VMware vSphere 5.1 CPU 資源分配
(VMesxi 功能篇-Day17) VMware vSphere 5.1 Memory 資源分配
(VMesxi 功能篇-Day18) VMware vSphere 5.1 Resource Pool(資源池)
(VMesxi 備份篇-Day19) VMware vSphere(ESXi) 虛擬硬碟格式介紹
(VMesxi 備份篇-Day20) VMware vSphere(ESXi) 虛擬硬碟工具 - vmkfstools(上)
(VMesxi 備份篇-Day20) VMware vSphere(ESXi) 虛擬硬碟工具 - vmkfstools(中)
(VMesxi 備份篇-Day20) VMware vSphere(ESXi) 虛擬硬碟工具 - vmkfstools(下)

三、備份篇
(VMesxi 備份篇-Day21) VMware ESXi 備份 ghettoVCB.sh 基本設定
(VMesxi 備份篇-Day22) VMware ESXi 備份 ghettoVCB.sh 進階設定
(VMesxi 備份篇-Day23) VMware ESXi 備份還原ghettoVCB-restore.sh 設定
(VMesxi 備份篇-Day24) VMware ESXi ghettoVCB 版本問題和錯誤訊息
(VMesxi 備份篇-Day25) VMware vSphere(ESXi) 5.1 OVF 備份
(VMesxi 備份篇-Day26) VMware vSphere(ESXi) 5.1 OVF 還原
(VMesxi 備份篇-Day27) VMware vSphere(ESXi) 5.1 vmx 還原虛擬機

四、監控篇
(VMesxi 監控篇-Day28) 監控軟體 Veeam ONE Free Edition 介紹
(VMesxi 監控篇-Day29) 監控軟體 Veeam ONE Free Edition 安裝
(VMesxi 監控篇-Day30) 監控軟體 Veeam ONE Free Edition - Monitor 設定
(VMesxi 監控篇-Day31) 監控軟體 Veeam ONE Free Edition - Monitor Alarms
(VMesxi 監控篇-Day32) 監控軟體 Veeam ONE Free Edition - Reporter 設定
(VMesxi 監控篇-Day33) 監控軟體 Veeam ONE Free Edition - Reporter 儀表板管理
(VMesxi 監控篇-Day34) 監控軟體 Veeam ONE Free Edition - Reporter 報表管理
(VMesxi 監控篇-Day35) 監控軟體 Veeam ONE Free Edition - Business View
(VMesxi 監控篇-Day35) 監控軟體 Veeam ONE Free Edition 6.0輕鬆升級6.5

Reference: http://blog.faq-book.com/?page_id=6276
http://ithelp.ithome.com.tw/question/10099216

iSCSI 多路徑示意圖


2015年2月4日 星期三

Oracle Enable/Disable Archive Log Mode 10g/11g

Enable Archive Log Mode
The following are the steps required to enable archive log mode on an Oracle 10g or 11g database.
Verify the database log mode.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[oracle@ora1 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 8 12:02:52 2010
 
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     25
Current log sequence           27
SQL>
The log mode is No Archive Mode. Note that Archive destination is USE_DB_RECOVERY_FILE_DEST. You can determine the path by looking at the parameter RECOVERY_FILE_DEST.
1
2
3
4
5
6
7
8
SQL> show parameter recovery_file_dest
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/flash_recovery
                                                 _area
db_recovery_file_dest_size           big integer 3852M
SQL>
By default, archive logs will be written to the flash recovery area. If you do not want to write archive logs to the flash recovery area you can set the parameter LOG_ARCHIVE_DEST_n to the location in which you wish to write archive logs.
1
2
3
4
5
6
7
8
9
10
11
SQL> alter system set log_archive_dest_1='LOCATION=/u02/app/oracle/oradata/orcl/arch' scope = both;
 
System altered.
 
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u02/app/oracle/oradata/orcl/arch
Oldest online log sequence     25
Current log sequence           27
SQL>
Now we shutdown the database and bring it backup in mount mode.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
 
Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             511708752 bytes
Database Buffers          331350016 bytes
Redo Buffers                5132288 bytes
Database mounted.
SQL>
Lastly all that is needed it set archive log mode and open the database.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SQL> alter database archivelog;
 
Database altered.
 
SQL> alter database open;
 
Database altered.
 
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/app/oracle/oradata/orcl/arch
Oldest online log sequence     25
Next log sequence to archive   27
Current log sequence           27
SQL>
We can now see that archive log mode is enabled. Notice that Automatic archive is enabled as well. In Oracle 9i an earlier another parameter needed to be set in order to enable automatic archiving. This in no longer the case in 10g and 11g as automatic archiving is enabled when the database is placed in archive log mode.
You can switch to the log file to see that an archive is written to archive log location.
1
2
3
4
5
6
7
8
9
10
11
SQL> alter system switch logfile;
 
System altered.
 
SQL> host
[oracle@ora1 ~]$ ls /u02/app/oracle/oradata/orcl/arch
1_27_711369564.dbf
[oracle@ora1 ~]$ exit
exit
 
SQL>
Disable Archive Log Mode
Note: It is recommended to perform a backup of the database (after a shutdown normal or immediate) prior to changing the archive status of a database.
The following are the steps required to disable archive log mode on an Oracle 10g or 11g database.
Verify the database log mode.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[oracle@ora1 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 8 12:54:05 2010
 
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/app/oracle/oradata/orcl/arch
Oldest online log sequence     26
Next log sequence to archive   28
Current log sequence           28
SQL>
The Database log mode is Archive mode. Next we shut down the database and bring up back up in mount mode.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
 
Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             511708752 bytes
Database Buffers          331350016 bytes
Redo Buffers                5132288 bytes
Database mounted.
SQL>
All that is left is to disable archive log mode and open the database.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SQL> alter database noarchivelog;
 
Database altered.
 
SQL> alter database open;
 
Database altered.
 
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u02/app/oracle/oradata/orcl/arch
Oldest online log sequence     26
Current log sequence           28
SQL>
As you can see, ARCHIVELOG mode has been disabled.