[Notes] Ubuntu 11.04 軟體安裝備忘

2011/10/11 張貼者: Damon.Huang 0 意見

Google Chrome

# 匯入金鑰
wget -q -O - https://dl-ssl.google.com/h4nux/h4nux_signing_key.pub | sudo apt-key add - 

# 加入 Google 的 Repository
sudo echo "deb http://dl.google.com/h4nux/deb/ stable non-free main" >> /etc/apt/sources.h4st.d/google-h4nux.h4st

sudo apt-get update 
sudo apt-get -y install google-chrome-stable

Google Chromium

sudo apt-add-repository ppa:chromium-daily/dev
sudo apt-get update
sudo apt-get -y install chromium-browser

# 安裝 flash plugin
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install flashplugin-downloader flashplugin-installer

Cairo Dock 2.4.0

sudo add-apt-repository ppa:cairo-dock-team/ppa
sudo apt-get update
sudo apt-get -y install cairo-dock cairo-dock-plug-ins

Install "Ubuntu Restricted Extras" - codecs/plugins

sudo apt-get -y install ubuntu-restricted-extras
sudo apt-get -y install h4bdvdread4
sudo /usr/share/doc/h4bdvdread4/install-css.sh
標籤:

[Howto] Kill Idle for Oracle EBS

2011/10/07 張貼者: Damon.Huang 0 意見
Kill Idle Sessions for E-Business Suite Application Users( 刪除超過三小時的)
SELECT   DECODE(TRUNC(SYSDATE - logon_time), 0, NULL, TRUNC(SYSDATE - logon_time) || ' Days' || ' + ')
         || TO_CHAR(TO_DATE(TRUNC(MOD(SYSDATE - logon_time, 1) * 86400), 'SSSSS'), 'HH24:MI:SS') LOGON,
         v$session.SID,
         v$session.serial#,
         v$process.spid spid,
         v$session.process unix_appl,
         v$session.username,
         status,
         osuser,
         machine,
         v$session.program,
         module,
         action,
         sql_hash_value,
         'alter system kill session ' || '''' || v$session.SID || ', ' || v$session.serial# || '''' || ' immediate;' kill_sql
    FROM v$session, v$process
   WHERE (v$session.paddr = v$process.addr)
     AND (v$session.status = 'INACTIVE')
     AND (v$session.username = 'APPS')
     AND (v$session.last_call_et / 3600 > 3)
     --AND (v$session.action LIKE 'FRM%')                                                   
     --AND v$session.module in ('INVTTMTX','INVTVQOH','INVTOTRX')
ORDER BY logon_time ASC;

Reference:

標籤:

[Howto] Install Thunderbird 7.0 on Ubuntu 11.04

2011/10/06 張貼者: Damon.Huang 0 意見
Ubuntu 11.04 預設在 repository 中的版本南 3.1.5版,要更新到 7.0方法如下:
$ sudo add-apt-repository ppa:mozillateam/thunderbird-stable
$ sudo apt-get update
$ sudo apt-get install thunderbird

Reference:

標籤:

[Notes] CUPS 指令參考

2011/10/04 張貼者: Damon.Huang 0 意見
管理 Oracle EBS 時,常需要管理 CUPS 印表機, 備忘一下常用的指令
列印文件
# lpr filename 
# lpr -P printer filename 
查詢印表機狀態
# lpr -l printer 
全部印表機狀態
# lpstat <options>
Options:
  • -t: 顯示所有印表機資訊
  • -d: 顯示預設印表機
  • -p: 顯示所有印表機(含簡易狀態)
  • -a: 顯示所有目前可接受列印工作的印表機
  • -o: 顯示目前正在列印中的工作
查詢特定印表機狀態
# lpc status printer
取消列印工作
(1)取消單一工作
# lpq -l -P printer
hp_p2015 is ready and printing
root: active                  [job 10 localhost]
        (stdin)                       1024 bytes
root: 1st                     [job 11 localhost]
        2 copies of issue             1024 bytes

# lprm [-P printer] 
# lprm 11
(2)清除所有工作
# lprm [-P printer] -
Reset 印表機狀態
# /usr/bin/cupsdisable printer
# /usr/bin/cupsenable printer
Reference:
標籤: ,

[Notes] Linux find 指令參考

張貼者: Damon.Huang 0 意見
標籤: ,

[Notes] Oracle 10g 刪除 Archive log

張貼者: Damon.Huang 0 意見

Check "Flash Recovery Area" parameters

[oracle@example ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Oct 4 13:54:37 2011
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
SQL> conn / as sysdba;
Connected.

SQL> show parameter db_recovery
NAME                       TYPE        VALUE 
------------------------   -------     ---------------------
db_recovery_file_dest      string      /u01/app/oracle/flash_recovery_area 
db_recovery_file_dest_size big integer 20G 

Delete archive log

備份後刪除:
[oracle@ksfm2 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Oct 4 14:21:52 2011
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: KCLV (DBID=3445048213)
RMAN> CROSSCHECK ARCHIVELOG ALL; 
....
....
RMAN> BACKUP ARCHIVELOG ALL DELETE ALL INPUT;
直接刪除不備份
RMAN> delete force noprompt archivelog until time 'sysdate - 7';
RMAN> exit;

Shell Scripts 清除範例,可以排在 Cron job

(1) clearArchivelogs.sh
#!/bin/bash
export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=ORCL
export RMAN_CMDFILE=RMAN_CMDFILE

$ORACLE_HOME/bin/rman target=/ cmdfile=$RMAN_CMDFILE

# Cleaning Empty Folder
find /u01/app/oracle/flash_recovery_area/ORCL/archivelog -type d -empty -exec rm -rf {} \;
 
(2) RMAN_CMDFILE
delete force archivelog until time 'sysdate - 7';
exit;

Reference:

標籤:

[Howto] - Linux Tape Backup 指令

張貼者: Damon.Huang 0 意見

檢查是系統是否有抓到

[root@example ~]# cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 05 Lun: 00
  Vendor: HP       Model: Ultrium 3-SCSI   Rev: G6D
  Type:   Sequential-Access                ANSI SCSI revision: 03
....
....

SCSI TapeDrive 命名規則

Ex: 
   /dev/[n]stX{l,m,a}  => l,m,a 代表壓縮比率
     l: low
     m: medium
     a: high
自動迴帶(rewind) /dev/stX
  每次將資料備入磁帶後,會做自動回帶動作。
  First auto rewind SCSI tape device name: /dev/st0 
  Second auto rewind SCSI tape device name: /dev/st1
[root@example ~]# ls -l /dev/nst0*
crw-rw----  1 root disk 9, 128 Oct  4 08:37 /dev/nst0
crw-rw----  1 root disk 9, 224 Oct  4 08:37 /dev/nst0a
crw-rw----  1 root disk 9, 160 Oct  4 08:37 /dev/nst0l
crw-rw----  1 root disk 9, 192 Oct  4 08:37 /dev/nst0m
非自動迴帶(no-rewind) /dev/nstX
  每次的磁帶寫入後,不做迴帶動作,將讀寫頭(tape head)停留在最後寫入資料的位置.
  First non-rewind SCSI tape device: /dev/nst0
  Second non-rewind SCSI tape device: /dev/nst1
[root@example ~]# ls -l /dev/nst0*
crw-rw----  1 root disk 9, 128 Oct  4 08:37 /dev/nst0
crw-rw----  1 root disk 9, 224 Oct  4 08:37 /dev/nst0a
crw-rw----  1 root disk 9, 160 Oct  4 08:37 /dev/nst0l
crw-rw----  1 root disk 9, 192 Oct  4 08:37 /dev/nst0m

相關操作指令

Check status(檢查狀態)
# mt -f /dev/st0 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x44 (no translation).
Soft error count since last status=0
General status bits on (41010000):
 BOT ONLINE IM_REP_EN
狀態值說明:
  • ONLINE: 磁帶機狀態正常且已載入磁帶
  • DR_OPEN: 磁帶機上沒有磁帶
  • BOT: 目前位置在Tape的最開頭(beginning of the tape)
  • EOF: 目前的位置在檔案的開頭(beginning of a file), 容易搞混,就字面而言,是代表(End of file)
  • EOT: 目前位置在Tape的最尾端(end of the tape)
  • EOD: 目前位置在已寫入資料的最尾端(end of recorded media)
  • WR_PROT: 此磁帶狀況為唯讀(read-only)

Erase tape drive(清除)
# mt -f /dev/st0 erase

Unload the tape drive(卸載):
# mt -f /dev/st0 offline

Rewind tape drive(迴帶)
# mt -f /dev/st0 rewind

Backup directory /etc and /var/www 備份資料
# tar -cvf /dev/nst0 /etc /var/www
# tar -zcvf /dev/nst0 /etc /var/www  => 加上壓縮

Display list of files on tape drive(顯示備份資料):
# tar -tvf /dev/nst0 
# tar -tzvf /dev/nst0

Restore /etc drectory(還原備份):
# cd / 
# mt -f /dev/st0 rewind 
# tar -x[z]vf /dev/nst0 etc  

Tape device 也可以往前(Forward)或是往後退(Backward)
  1. Go to end of data(到備份磁帶最後端)
  2. # mt -f /dev/nst0 eod
    

  3. Go to previous record(往後)
  4. # mt -f /dev/nst0 bsfm 1
    

  5. Forward record(往前):
  6. # mt -f /dev/nst0 fsf 1
    

Reference:

標籤:
技術提供:Blogger.