2016年4月7日 星期四

Oracle Grant All Permission to User

BEGIN
    FOR t IN (select * from dba_tables where owner!='GGSTEST'
            AND owner not like '%SYS%'
            AND owner not like '%ORDDATA%'
            AND owner not like '%ADMIN%'
            AND owner not like '%APEX%'
            AND owner not like '%XDB%'
            AND owner not like '%FLOW_FILES%'
            AND owner not like '%OE%' AND iot_type IS NULL)
    LOOP
    EXECUTE IMMEDIATE 'GRANT ALL PRIVILEGES ON '|| t.owner ||'.' || t.table_name ||' TO TIPTOPGP';
    END LOOP;
    END;

2016年2月13日 星期六

SQL Server sp_addlinkedserver 之 insert,update, delete 方法

SQL Server 的 sp_addlinkedserver 很好用. 可是在連上去後要更新遠端主機上的資料可就不能用傳統的方式來update.
以下是 MSDN 上找的指定
Update :
  update openquery(linked1, 'select ssn from testlinked where ssn=2')
  set ssn=ssn + 1
Insert :
  insert openquery(linked1, 'select ssn from testlinked where 1=0') values (1000)
Insert From..
  insert openquery(linked1, 'select ssn from testlinked where 1=0')
  select myssn from mytable

delete openquery(linked1, 'select ssn from testlinked where ssn>100')

Install Plex Media Server on FreeNas 9.3.0

請先參考他的作法.
https://forums.freenas.org/index.php?threads/tutorial-how-to-install-plex-in-a-freenas-9-3-jail-updated.19412/

安裝完後
進 Shell
指令
jls -v
jexec 2 tcsh
echo plexmediaserver_enable="YES">>/etc/rc.conf  # 我是用VI 去編輯他為plexmediaserver_enable="YES"
設好參數 起動SERVER.
service plexmediaserver start

好了..管理時因為plex server 是用jails 方式來起動PLEX 他是無法存取外部的目錄所以要用以下指令把外在的目錄MOUNT 到jail 中.
先在jail 對映的目錄下建一個Picture 目錄
mkdir /mnt/MIRROR01/JailRoot/plexmediaserver_1/media/Picture
再將路徑用MOUNT 的方式放上去.
mount_nullfs /mnt/MIRROR01/Picture /mnt/MIRROR01/JailRoot/plexmediaserver_1/media/Picture



注意.不可使用ln 的方式來處理..因為進到jail 系統後ln 的目錄是無法被正確存取.

之後可在外部的OS上/etc/fstab 中加入以下MOUNT 資料..他開機就自動MOUNT 上去了.
/mnt/MIRROR01/Picture/ /mnt/MIRROR01/JailRoot/plexmediaserver_1/media/Picture/   nullfs   ro      0       0

2016年2月1日 星期一

Informix CSK netset 設定

informix netset32
client_locale=zh_tw.big5
db_locale=zh_tw.57352

ibm informix server = on_shm1
hostname = 172.16.1.9x
protocolname = onsoctcp
service name = 8001

2015年9月14日 星期一

4GL 日期的運算

日期1-日期2 = 幾天
在 IBM Genero 4GL 程式語言中. 日期的運算可真是.不好用
以下程式代碼看看. 看不懂我也無法救你了.
注意. 在資料中通常我們會用   l_d1 like  abc_table.date01 方式來宣告變數. 可是在作運算時他很白痴的不會自動轉方Datetime 再作運算 所以我會先把資料庫欄位先存到我自己的變數 如下 l_d1 datetime year to day 這樣在作運算時比較不會出錯. 一出錯 你的 l_i1 就一定是 NULL 值


 
  define l_d1 datetime year to day
  define l_d2 datetime year to day
  define l_i1 interval day(5) to day
  define l_l2 interval month to month
  let l_d1 = '2002-01-01'
  let l_d2 = '2015-09-01'
  let l_i1=  l_d2-l_d1
  display  l_i1
  let l_l2 = interval(1) month to month
  let l_d1 = l_d1 +  interval(1) month to month    #加一個月的日期
  let l_d1 = l_d1 -  interval(1) month to month    #減一個月的日期
  let l_d1 = l_d1 +  interval(1) year to year    #加一個年的日期
 
 
  if l_i1 > interval(365) day(5) to day then    #判斷式的用法
    display "over 1 year"
  else
    display "Yes 1 year"   
  end if

2015年8月20日 星期四

disk2vhd 的VHD 放到HYPER-V 無法開機


  1. 找出這系統的安裝CD,
    1.開機進安裝畫面
    2.選好 語言, KEY BOARD 等等. next
    3.repair your computer.. next
    4. command prompt . 命令字元
    5. bootrec /fixmbr
    bootrec /fixboot
    bootrec /scanos
    exit
    rebot

    如果第5項還作了還是進不了.
    請改用
    bootrec /rebuildbcd
    exit
     

2015年7月28日 星期二

單獨COMPILE RESOURCE.

請用  vs.net XXXX 命令提示字元 進入DOS 模式


單一COMPILE 各RESOURCE

resgen.exe /compile FRM_SALE001.en-US_BK.resx,GWStockWin.SALE.FRM_SALE001.en-US.resources
resgen.exe /compile FRM_SALE002.en-US.resx,GWStockWin.SALE.FRM_SALE002.en-US.resources
resgen.exe /compile FRM_SALE003.en-US.resx,GWStockWin.SALE.FRM_SALE003.en-US.resources



把所有RESOURCE 組成 resource.dll

Al.exe /t:lib /embed:GWStockWin.SALE.FRM_SALE001.en-US.resources /embed:GWStockWin.SALE.FRM_SALE002.en-US.resources /embed:GWStockWin.SALE.FRM_SALE003.en-US.resources /culture:"en-US" /out:"GWStockWin.resources.dll"