Show running processes in Oracle DB
Oracle tip: Script แสดง query ที่ทำงานอยู่บน Oracle database (คล้ายๆ คำสั่ง show processlist บน MySQL) show_processlist.sh
How to trim space from bash variable
Tip เล็กๆ ในการลบ space (ช่องว่าง) ที่อยู่ในตัวแปรของ bash shell ต้องการลบ space ด้านหลัง ให้ใช้ sed 's/ *$//g' ตัวอย่าง echo " www ezylinux com " | sed 's/ *$//g'
How to turn off Oracle password expiration
โดย default แล้ว User บน Oracle จะมีอายุ password สูงสุด 180 วัน ซึ่ง user จำเป็นต้องทำการเปลี่ยน password ใหม่ แต่ถ้าหากไม่ต้องการให้มีการกำหนดอายุของ password ก็สามารถทำได้โดยแก้ไขค่า PASSWORD_LIFE_TIME ให้เป็น unlimited บน profile ที่ user คนนั้นใช้งานอยู่
How to fix chroot return “Exec format error”
ปัญหาการรันคำสั่ง chroot แล้วได้รับ error “Exec format error” ในขณะที่เข้าโหมด rescue บน Red Hat/ CentOS โดยมีข้อความ error แบบด้านล่าง chroot: failed to run command `/bin/bash': Exec format error
How to count blank lines and non-blank lines in a file
เทคนิคสำหรับการนับบรรทัดว่างและการนับบรรทัดที่ไม่ว่างใน shell เพื่อนำไปต่อยอดการใช้งานหรือแก้ไขปัญหาต่างๆครับ วิธีการนับบรรทัดว่างในไฟล์ [tum@ezylinux ~]$ grep "^$" /path/to/textfile | wc -l
Export mysql database based on a where condition
MYSQLDUMP เป็นโปรแกรมที่เอาไว้ใช้ในการ export data จาก MySQL database ซึ่งโดยการใช้งานทั่วไปแล้วนิยมนำ MYSQLDUMP มาใช้ในการ export ข้อมูลออกมาหมดทั้งหมด (table หรือ database) แต่ถ้าหากต้องการ export ข้อมูลบางส่วนออกมาด้วยการใช้ where ก็สามารถทำได้เช่นกัน โดยให้ใช้ option –where แล้วตามด้วยเงื่อนไขต่างๆ ดังตัวอย่างด้านล่างนี้ export ข้อมูลเป็น SQL format
How to read pcap file in Linux CLI using tcpdump
ไฟล์ pcap (packet capture) ที่ได้มาจาก tcpdump หรืออุปกรณ์ network อื่นๆ จะเป็น binary file ซึ่งไม่สามารถเปิดอ่านผ่าน text editor เช่น vi, nano หรือโปรแกรมอ่านไฟล์อื่นๆ เช่น less cat ได้ ดังตัวอย่าง
Installing MySQL 5.6 using the MySQL yum repository
Oracle ได้ออก MySQL Yum repository เพื่อช่วยให้สามารถติดตั้งและ update MySQL server ได้สะดวกยิ่งขึ้น โดยในขั้นต้นจะรองรับ Linux distro ดังนี้ Red Hat/Oracle Enterprise Linux/CentOS 6 Fedora 18 และ 19
[Bug] Invalid of GRANT command will breaks replication
MySQL 5.6 มี bug ที่ควรระวัง คือการรันคำสั่ง GRANT privileges บน PhpMyAdmin อาจทำให้เกิด slave หยุด replicate ข้อมูลได้ (bug report: http://bugs.mysql.com/bug.php?id=68892) หลังจากได้ใช้งาน MySQL 5.6 (version 5.6.14-1) แบบ replication ก็พบปัญหาการใช้งานเมื่อทำการ GRANT สิทธิให้กับ user บน…
How to redirect stdout and stderr to log file
วิธีการ redirect standard output และ standard error ไปเก็บไว้ยัง log file การ redirect stdout and stderr ไปยัง log file ที่ถูกต้อง command > /path/to/log 2>&1 ระบบจะทำการ redirect stdout ไปยัง log file และพร้อมกับ…