標籤

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)

2011年8月30日 星期二

Linux 硬碟簡單的測速

# hdparm -tT /dev/sda

/dev/sda:
Timing cached reads: 29992 MB in 1.99 seconds = 15061.91 MB/sec
Timing buffered disk reads: 438 MB in 3.01 seconds = 145.69 MB/sec

這個是 SAS 15K 的速度


-T

Perform timings of cache reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test. If the -t flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.


-t

Perform timings of device reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading through the buffer cache to the disk without any prior caching of data. This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without any filesystem overhead. To ensure accurate measurements, the buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl. If the -T flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.

The Secrets of Oracle ASSM and Freelists

http://www.akadia.com/services/ora_freelists.html

2011年8月29日 星期一

Accessing Microsoft SQL Server from Linux using DBD::Sybase

http://www.perlmonks.org/?node_id=392385
Accessing Microsoft SQL Server from Perl
by Lindsay Leeds (2004 Sep 20)
Recently, I made yet another attempt to get Perl to access Microsoft SQL Server using DBD. Usually, when I want to connect to a Microsoft SQL Server, it is from Perl on Windows. So I take the easy route and use DBD::ODBC and use an ODBC connection. This time though, I wanted to connect to Microsoft SQL Server 2000 from a Linux box. Having no ODBC to fall back on, I looked for native DBD driver of some sort.
It took me several hours of struggling to make it work. I almost gave up several times, so I am writing outline to help anyone else trying to accomplish this same task.
In the end, we will use the DBD::Sybase perl module from CPAN to access the Microsoft SQL Server. Before we can do that however, we must first compile the freetds library.

Note: From now on I will refer to Microsoft SQL Server as SQL Server. Please do not confuse this with a generic sql server. We can all now pause to gripe about the lack of imagination in product naming at Microsoft.
Compiling Freetds
Download and compile freetds from http://www.freetds.org/.

once you unzip and untar it, enter the directory and run:
./configure --prefix=/usr/local/freetds --with-tdsver=7.0
make
make install
Configuring Freetds
Now we have the freetds compiled, but we still have configure it. This is the part that threw me off and is so different from other DBD drivers. The DBD::Sybase driver will ultimately be affected by the contents of the /usr/local/freetds/etc/freetds.conf file. If that file is not configured correctly, your DBD::Sybase connection will fail.
Okay, now that we have established there is a relationship between the freetds.conf file and the DBD::Sybase module, let's edit the freetds.conf file.
The strategic modifications I made to the freetds.conf file were:
1) uncomment the following lines and modify if necessary:
try server login = yes
try domain login = no
Note: this forces the module to attempt a database login instead of a domain login. I could not get domain login to work, though I will admit I did not try very hard.
2) uncomment the following line and modify if necessary:
tds version = 7.0
This supposedly sets the default tds version to establish a connection with. I have only SQL Server 2000 servers, and they won't talk at any lower version. So I set it to 7.0. If for some reason you had older SQL Servers, you might leave it at the default 4.2.
3) create a server entry for my server sql1:
[sql1] host = sql1 port = 1433 tds version = 8.0
Note: My server here is sql1. Ping sql1 worked, so I am sure I can resolve it using DNS. You can also specifcy an ip address instead of the host name. The sql1 in the brackets is just a descriptor. It could be 'superduperserver' and it would still work as long as my 'host =' is set correctly. I tried 'tds version 7.0' for my SQL Sever 2000 and it worked. Version 5.0 though resulted in an error. You might want to verify your SQL Server is listening on port 1433 with a 'netstat -a -n' run from the command line on the SQL Server.
At this point you can verify your configuration.
/usr/local/freetds/bin/tsql -S sql1 -U sqluser
You will then be prompted for a password and if everything is well, you will see a '1)' waiting for you to enter a command. If you can't get the 1) using tsql, I doubt your DBD::Sybase perl code is going to work. Please note that sqluser is not an Active Directory/Windows Domain user, but an SQL Server user.
Compiling DBD::Sybase
Now that we have the freetds library prerequisite for DBD::Sybase installed and configured, we can compile the DBD::Sybase perl module. Obtain it from www.cpan.org if you haven't already.
once you have untarred it and are in the directory, run:
export SYBASE=/usr/local/freetds
perl Makefile.PL
make
make install
Note: The export line is to let the compilation process know where to find the freetds libraries.



2013/08/29
今天重新compile DBD::Sybase,有一些問題,故記下來以便以後會用到:
1. /usr/local/freetds/etc/freetds.conf內容
 [xxx] --db
    host = xxx.xxx.xxx.xxx --ip
        port = 1433
        client charset = UTF-8 --不然有亂碼
        tds version = 8.0
2.使用 root 來 perl -MCPAN -e shell ,(不要sudo,environment variable好像不會過去) 需要

2-1 export SYBASE=/usr/local/freetds
2-2 test 會有很多錯誤,用force install DBD::Sybase


Using DBD::Sybase
You are now ready to test your DBD::Sybase module.
#!/usr/bin/perl

use DBI;

$dsn = 'DBI:Sybase:server=sql1';

my $dbh = DBI->connect($dsn, "sqluser", 'password');
die "unable to connect to server $DBI::errstr" unless $dbh;

$dbh->do("use mydatabase");

$query = "SELECT * FROM MYTABLE";
$sth = $dbh->prepare ($query) or die "prepare failed\n";
$sth->execute( ) or die "unable to execute query $query error $DBI::errstr";

$rows = $sth->rows ;
print "$row rows returned by query\n";

while ( @first = $sth->fetchrow_array ) {
foreach $field (@first) {
print "field: $field\n";
}
}
Good luck!

Private strand flush not complete 说明

http://blog.csdn.net/tianlesoftware/article/details/6015400

Conclusion:
You can disregard these messages as normal messages.

This issue is infact not a bug and is expected behavior.


landscape showing wrong temperature on HP Proliants

http://ubuntuforums.org/showthread.php?t=1641633

hpasmcli explanation :
http://jreypo.wordpress.com/2011/02/16/hp-proliant-servers-management-with-hpasmcli/

hpasmcli download : (hp-health package)
http://downloads.linux.hp.com/SDR/downloads/ProLiantSupportPack/Ubuntu/pool/non-free/

VPD example

Oracle Document

1. create policy function
create or replace package dm_pkg_vpd is
  function predicate (aSchema varchar2, aName varchar2) return varchar2;
end dm_pkg_vpd;
create or replace package body dm_pkg_vpd is
  function predicate (aSchema varchar2, aName varchar2) return varchar2 is
  begin
    if user = 'XXX' then
      return 'rownum <= '||to_char(trunc(dbms_random.value(500,2500)));
    else
      return null;
    end if;
  end;

begin
  null;
end dm_pkg_vpd;


2. add policy
要由有執行 dbms_rls權限的人執行,policy function也掛在此較方便例如以下的zzz
限制xxx.yyy被access的policy例子如下

begin dbms_rls.add_policy(
  object_schema => 'xxx',
  object_name => 'yyy',
  policy_name => 'TEST',
  policy_function => 'dm_pkg_vpd.predicate',
  function_schema=>'zzz'
);
end;
/

关于dbms_random包的用法

http://space.itpub.net/13387766/viewspace-421429

1.dbms_random.random 随机返回一个整数

SQL> select dbms_random.random from dual;

RANDOM
----------
602118895

2.dbms_random.normal 随机返回一个number

SQL> select dbms_random.normal from dual;

NORMAL
----------
-0.4376674

3.dbms_random.string(opt,len) 随机返回字符串

opt取值

'u'或'U' 返回大写字母

SQL> select dbms_random.string('U',4) FROM DUAL;

DBMS_RANDOM.STRING('U',4)
--------------------------------------------------------------------------------
MIRV

'l'或'L' 返回小写字母

SQL> select dbms_random.string('l',3) from dual;

DBMS_RANDOM.STRING('L',3)
--------------------------------------------------------------------------------
vjr
'a'或'A' 大小写字母混合

SQL> select dbms_random.string('a',5) from dual;

DBMS_RANDOM.STRING('A',5)
--------------------------------------------------------------------------------
isCQH

‘x'或'X' 大写字母和数字混合

SQL> select dbms_random.string('X',6) FROM DUAL;

DBMS_RANDOM.STRING('X',6)
--------------------------------------------------------------------------------
VLJY12

‘p'或'P' 任意可显示字符

SQL> select dbms_random.string('p',7) from dual;

DBMS_RANDOM.STRING('P',7)
--------------------------------------------------------------------------------
QrO!nBx

4.dbms_random.value 返回0和1之间的一个随机数


SQL> select dbms_random.value from dual;

VALUE
----------
0.29034936

5.dbms_random.value(low,high) 返回low和high之间的一个随机数

SQL> select dbms_random.value(1,7) from dual;

DBMS_RANDOM.VALUE(1,7)
----------------------
1.3264166628757

ors.

2011年8月26日 星期五

MOTD in Ubuntu

MOTD -> Message Of The Day ,就是登入 Shell 會看到的訊息。
Ubuntu 9.04 裡面用了一個 update-motd 的套件來管理它,所以會定時變動一些資訊,比較生動
關於它的設定都放在 /etc/update-motd.d ,會按照號碼來執行,想要新增或變動訊息也是在這裡
預設也會增加排程 /etc/cron.d/update-motd,固定十分鐘來更新一次
另外平時要手動更新的話可以使用 update-motd 就可以了

將目錄下的全部檔案內容全部顯示

oracle@aot-dwp01:~$ find /proc/acpi/thermal_zone -type f |xargs cat

0 - Active; 1 - Passive
critical (S5): 31 C
passive: 10 C: tc1=4 tc2=4 tsp=60 devices=CPU0
temperature: 8 C
state: ok

PP BADI : WORKORDER_UPDATE



Finding BADI in any SAP transaction

One of the options to consider when a need arise to change the standard out of the box SAP feature is to take advantage of Business Add ins , or in short, BADIs. BADIs are basically exit classes which are integrated in the SAP transaction program, and are called during execution, usually with run time variables which can be modified. By taking advantage of these BADIs, application developers can change these variables during run time, based on the business rules, and transfer the values back to the main SAP transaction application, there by modifying the way in which standard out of the box SAP transaction work.

The 2 transactions of notice when coming to BADIs are SE18 and SE19, where we implement the BADIs using our own classes. These classes use the same interface as that of the BADI class.

Having said that, many a times, the issue I have run into, especially in a new environment is how to find these exit points/BADIs that are available for a given transaction. One option is to spend a very long time debugging and keeping a close eye on each and every call that is made in the SAP program. However, this is not an option when it comes to web transactions because web applications time out.

The BADI class we implement is considered an Instance of the actual BADI class. For SAP to find out if a BADI has any active implementations, it first calls a static method called “getInstance()” of class : CL_EXITHANDLER. If we set a break point within this method, the execution will break for every single BADI that is implemented in the SAP transaction.

Hence, set a Break point in: CL_EXITHANDLER=>GET_INSTANCE()

While this is a sure shot way of finding BADIs in a transaction, the down part of this method is that there will be too many break point hits. The most effective method to find BADIs is to go to SDN and check out the user forums. However, if all else fails, the method I detailed below will get you the BADI you are looking for.


add in 2011/08/27 : for finding user exits ->

set break point for function module : call customer-function 'xxx'

CO02 user exits

CO02 user exits example (include activate projects in CMOD)

2011年8月25日 星期四

vlookup

VLOOKUP(A1,Sheet2!A:B,2,FALSE)

Parameter1 (A1) : source sheet 要比對的欄位
Parameter2 (Sheet2!A:B) : target sheet 要被比對的哪些欄位
Parameter3 (2) : target sheet 被比對後,傳回的欄位
Parameter4 (FALSE) : 是否模糊比對

2011年8月22日 星期一

Library Cache Miss Ratio

  • Executions - The number of times a pin was requested for objects of this namespace.
  • Cache Misses - Any pin of an object that is not the first pin performed since the object handle was created, and which requires loading the object from disk.

  • Hit Ratio should be < 1%, else increase SHARED_POOL_SIZE in init.ora
  • select sum(PINS) Executions,  sum(RELOADS) cache_misses,
    sum(RELOADS) / sum(PINS) miss_ratio
    from v$librarycache

    SQL Cache Hit Ratio

  • Pins - The number of times a pin was requested for objects of this namespace.
  • Reloads - Any pin of an object that is not the first pin performed since the object handle was created, and which requires loading the object from disk.

  • Hit Ratio should be > 85%


  • select sum(PINS) Pins,
    sum(RELOADS) Reloads,
    round((sum(PINS) - sum(RELOADS)) / sum(PINS) * 100,2) Hit_Ratio
    from v$librarycache

    Data Dict Hit Ratio

  • Gets - Total number of requests for information on the data object.
  • Cache Misses - Number of data requests resulting in cache misses

  • Hit Ratio should be > 90%, else increase SHARED_POOL_SIZE in init.ora


  • select sum(GETS),
    sum(GETMISSES),
    round((1 - (sum(GETMISSES) / sum(GETS))) * 100,2)
    from v$rowcache

    Buffer Hit Ratio

  • Consistent Gets - The number of accesses made to the block buffer to retrieve data in a consistent mode.
  • DB Blk Gets - The number of blocks accessed via single block gets (i.e. not through the consistent get mechanism).
  • Physical Reads - The cumulative number of blocks read from disk.

  • Logical reads are the sum of consistent gets and db block gets.
  • The db block gets statistic value is incremented when a block is read for update and when segment header blocks are accessed.
  • Hit Ratio should be > 80%, else increase DB_BLOCK_BUFFERS in init.ora


  • select sum(decode(NAME, 'consistent gets',VALUE, 0)) "Consistent Gets",
    sum(decode(NAME, 'db block gets',VALUE, 0)) "DB Block Gets",
    sum(decode(NAME, 'physical reads',VALUE, 0)) "Physical Reads",
    round((sum(decode(name, 'consistent gets',value, 0)) +
    sum(decode(name, 'db block gets',value, 0)) -
    sum(decode(name, 'physical reads',value, 0))) /
    (sum(decode(name, 'consistent gets',value, 0)) +
    sum(decode(name, 'db block gets',value, 0))) * 100,2) "Hit Ratio"
    from v$sysstat

    Buffer Hit Ratio
    • Consistent Gets - 從Block Buffer取得之前查詢過的資料
    • DB Block Gets - 藉由single block取得的blocks(不必經由一致性計算機制)
    • Physical Reads - 從Disk取得blocks的累計數字
    • Logical reads are the sum of consistent gets and db block gets.
    • The db block gets statistic value is incremented when a block is read for update and when segment header blocks are accessed.
    • Hit Ratio 應該大於80%, 否則要增加DB_BLOCK_BUFFERS(init.ora)

    Linux monitoring tools and statistics files

    1 單一process觀看
    pidstat -d 2
    pidstat -d | sort -nk 3
    iotop -d 2
    好用啊...


    2 overall 系統觀看

    Here is a list of various Linux monitoring tools and statistics files:

    Overall Tools:
    top, vmstat, sar, ps, pstree, ipcs

    CPU:
    top, mpstat, tload, /proc/cpuinfo, x86info

    Memory:
    free, /proc/meminfo, slabtop, /proc/slabinfo, ipcs

    I/O:
    iostat, vmstat, sar

    sar examples:

    To display CPU utilization:
      sar 3 100
    To display paging activity:
      sar -B 3 100
    To display swapping activity:
      sar -W 3 100
    To display block I/O activity:
      sar -b 3 100
    To display block I/O activity for each block device:
      sar -d 3 100
    To display network activity:
      sar -n DEV 3 100
    
    
    
    Linux monitoring tools and statistics files
    
    
    

    aio-max-size

    For RHEL 3 it is recommended to set aio-max-size to 1048576 since Oracle uses I/Os of up to 1MB. It controls the maximum I/O size for asynchronous I/Os. Note this tuning parameter is not applicable to 2.6 kernel, i.e RHEL 4.

    Enable AIO Support

    empty / free up memory caches

    To free pagecache:
    echo 1 > /proc/sys/vm/drop_caches

    To free dentries and inodes:

    echo 2 > /proc/sys/vm/drop_caches

    To free pagecache, dentries and inodes:

    echo 3 > /proc/sys/vm/drop_caches

    As this is a non-destructive operation and dirty objects are not freeable, the user should run “sync” first!

    add/drop policy

    begin dbms_rls.add_policy(object_schema => 'xxx',object_name => 'xxx',policy_name => 'xxx',policy_function => 'xxx.xxx',function_schema=>'xxx'); end;
    /

    begin dbms_rls.drop_policy(object_schema => 'xxx',object_name => 'xxx',policy_name => 'xxx'); end;
    /

    2011年8月21日 星期日

    create spfile

    1. 如果Oracle已經startup unmount,是不能create spfile from pfile;否則會出現ORA-32002: cannot create SPFILE already being used by the instance
    2. 在shutdown後,用SQL*PLUS進入,顯示Connected to an idle instance.;此時可以create spfile from pfile;
    3. create pfile from spfile則隨時可以

    ora-27061 solution ?

    1. disk_asynch_io=false,filesystemio_options=none or filesystemio_options=directio (Oracle init parameter)
    2. _aiowait_timeouts = 250 (Oracle init parameter)
    SQL>alter system set "_aiowait_timeouts" = 300 scope=spfile;
    3. fs.aio-max-nr = 10485760 (/etc/sysctl.conf)

    Oracle11g Hidden Parameters

    Oracle11g Hidden Parameters

    SELECT ksppinm, ksppstvl, ksppdesc
    FROM x$ksppi x, x$ksppcv y
    WHERE x.indx = y.indx
    AND translate(ksppinm,'_','#') like '#%'
    order by ksppinm;

    Online Tutoriale Enabling Asynchronous I/O Support

    Online Tutoriale Enabling Asynchronous I/O Support

    2011年8月20日 星期六

    What do filesystemio_options and disk_asynch_io Do?

    From Metalink note 432854.1

    What do filesystemio_options and disk_asynch_io Do?
    disk_asynch_io is a kind of master switch, which turns on or off Async I/O to database files on any type of storage, whether it's raw device or filesystem. The filesystemio_options parameter gives finer control over I/O to database files on filesystems. It allows you to turn off async I/O to filesystem files but keep async I/O to raw devices if the "master" switch disk_asynch_io is set to true.

    Instance initialization parameter filesystemio_options has four options:
    1. "asynch" : means buffered I/O + Async I/O
    2. "directIO" : means Direct I/O only
    3. "setall" : means Direct I/O + Async I/O
    4. "none" : disables Async I/O and Direct I/O

    One should always use at least Direct I/O with OCFS/OCFS2. In fact one does not have choice as the database automatically adds that mode whenever it sees the file is on an OCFS volume or OCFS2 volume mounted with the datavolume mount option.
    If the user wants aio with OCFS/OCFS2, use setall.
    If the user wants aio with ASM/ASMlib, he is expected to set filesystemio_options=setall and disk_asynch_io=true, this is because ASM's io is transparent to RDBMS, but these 2 parameters will impact the behaviors of RDBMS, please see Note 413389.1 .

    filesystemio_options


    The hidden _filesystemio_options parameter was introduced in Oracle version 8.1.7 to control the use of program selectable direct I/O and asynchronous I/O against file system based database files. It is no longer a hidden parameter from release 9.2 onwards. The following table shows the values that can be used when setting this parameter.

    Buffered I/ODirect I/O
    Synchronous I/OnonedirectIO
    Asynchronous I/Oasynchsetall

    Databases that use a combination of say raw log files and raw tempfiles with file system based datafiles may wish to use kernelized asynchronous I/O against the raw files, but to avoid inefficient threaded asynchronous I/O against the datafiles. This can be done by allowing disk_asynch_io to default to TRUE, but setting filesystemio_options to either none or directIO. Similarly, the parameter may need to be set to either directIO or setall to avoid buffered I/O against file systems that support direct I/O but do not provide a direct I/O mount option. The default value for this parameter is asynch, regardless of the disk_asynch_io parameter setting.


    ORA-30372解决方法

    11G 建立較低版本的materialized view時,如果較低版本的Oracle又用VPD(Virtual Private Database),則會產生ORA-30372 error

    Solution:
    1) 網路上普遍的版本
    create materialized view mv1
    refresh fast with rowid USING TRUSTED CONSTRAINTS
    as
    select * from table2@inst2;

    2) 自己找到的solution(感覺是去避掉bug,因為disable policy/drop policy 都不行避掉ora-30372 source DB=Oracle 9i on Windows)

    在source DB的另一個schema(比如yyy),
    create or replace view zzz
    as
    select * from xxx.zzz;

    在target
    DB
    create database link www
    connect to yyy identified by uuu
    using vvv;

    create materialized view zzz
    refresh complete
    start with sysdate next to_char(sysdate+1)
    as
    select * from zzz@www;

    ubuntu 版本 指令查詢

    lsb_release -a

    Oracle : kewastUnPackStats

    办法1:
    show parameter control_management_pack_access;
    control_management_pack_access string DIAGNOSTIC+TUNING
    alter system set control_management_pack_access='none' scope=BOTH;

    办法2:
    打补丁:
    p8730312_112010_Linux-x86-64.zip

    2011年8月19日 星期五

    Ubuntu 小畫家

    sudo apt-get install kolourpaint

    tsclient : 啟動copy & paste功能



    rdesktop

    第一,請打開port:3389
    第二,輸入sudo apt-get install rdesktop
    第三,使用已經完成的rdesktop工具:rdesktop 192.168.x.x
    ok啦!

    其他參數如下:
    -f 全螢幕
    -a 16色
    -u xxxx 使用用戶名稱xxxx登入
    -p xxxx 使用用戶密碼xxxx登入
    -r clipboard:PRIMARYCLIPBOARD 讓兩邊電腦的剪貼簿可以互通,重要啊!
    -r disk:wj=/home/magicgod mount上一台磁碟,功能很強大




    --------------------以上,以下,皆參照http://4i4u.com/blog/rdesktop-ubuntu-windows/網站-------------------
    更多参数:

    -u xxxxxx 登录用户,可选
    -p xxxxxx 登录密码,可选
    -r clipboard:PRIMARYCLIPBOARD 重要,剪贴板可以与远程桌面交互
    -a 16 颜色,可选,不过最高就是16位
    -z 压缩,可选
    -g 1024×768 分辨率,可选,缺省是一种比当前本地桌面低的分辨率
    -P 缓冲,可选
    -r disk:wj=/home/magicgod 映射虚拟盘,可选,会在远程机器的网上邻居里虚拟出一个映射盘,功能很强,甚至可以是软盘或光盘
    -r sound:off 关闭声音,当然也可以把远程发的声音映射到本地来。

    重定向:

    这时才发现它原来也可以将本地磁盘带到远端,而且连中文文件名也支持。只要加上 -r 参数就可以了。它除了可以将本地磁盘带到远端以外,还支持串口和打印机,这下 Windows 上远程桌面客户端的功能在 Linux 上都齐了。-r 参数的格式如下:
    -r comport:COM1=/dev/ttyS0 // 将串口 /dev/ttyS0 重定向为 COM1
    -r comport:COM1=/dev/ttyS0,COM2=/dev/ttyS1 // 多个串口重定向
    -r disk:floppy=/mnt/floppy // 将 /mnt/floppy 重定向为远程共享磁盘 ‘floppy’
    -r disk:floppy=/mnt/floppy,cdrom=/mnt/cdrom,root=/,c=/mnt/c // 多个磁盘重定向
    -r clientname= // 为重定向的磁盘设置显示的客户端名称
    -r lptport:LPT1=/dev/lp0 // 将并口 /dev/lp0 重定向为 LPT1
    -r lptport:LPT1=/dev/lp0,LPT2=/dev/lp1 // 多个并口重定向
    -r printer:mydeskjet // 打印机重定向
    -r printer:mydeskjet=”HP LaserJet IIIP” // 打印机重定向
    -r sound:[local|off|remote] // 声音重定向

    ubuntu远程桌面到Windows

    我知道的有两种方法:

    1)使用Terminal Server Client
    打开Applications -> Internet -> Terminal Server Client,在“General”选项里要填入的内容如下:
    Computer: (要远程连接到的机器的IP地址或者机器名,如192.168.111.2)
    User Name: (远程机器帐户的用户名)
    Password: (远程机器账户的密码)
    然后,"Local Resources"里可以根据需要选中“Add my local drive to the remote computer".
    最后,点击”Connect",就可以连接上了。
    2)从终端执行rdesktop命令:
    rdesktop是ubuntu远程桌面连接的命令,几个基本参数如下:
    -u 后接用户名
    -p 后接用户密码
    -f 全屏进入
    最后加上远程机器的IP地址就行了。如要连接到192.168.111.2的机器,可以在终端输入如下命令:
    $sudo rdesktop -r daniel -p ****** -f 192.168.111.2
    这样就可以了,不过有两点说明一下:一是输入的密码不是*,而是你所输入的字符;二是如果全屏进入后,推出全屏的方法是:Ctrl + Alt + Enter.

    解決PDF中文亂碼

    解決PDF中文亂碼

    關於 Ubuntu 下的 gnome-terminal (終端機)小秘訣

    小弟一直覺得 putty/pietty 很好用,尤其是滑鼠的複製與貼上特性。(用滑鼠左鍵 highlight 便是選取,右鍵即為貼上)
    而我會覺得這特性好用,是因為沒有多餘的動作,迅速、確實,也跟我十幾年前用 SunOS (後來改叫做 Solaris)工作站時的印象一樣。不過有人說 putty 那樣的控制方法並不符合 X-Window 的標準。

    而現在工作環境改為 Ubuntu Linux,對於它內建的 Gnome-Terminal 終端機有一點卡卡的感覺,畢竟一些常用鍵盤或滑鼠捷徑都跟習慣不太一樣。

    找了一些 Gnome-Terminal 的資料,我想可以稍補不足,大家參考一下吧。

    • 滑鼠左鍵選取 (highlight) 之後,按滑鼠中鍵可以貼上。(若滑鼠沒有中鍵,則同時按下左右兩鍵效果相同)。
    • 在其他視窗用滑鼠左鍵選取 (highlight) 之後,在 terminal 裡按滑鼠中鍵可以貼上。(不需 Ctrl-C 複製)所以滑鼠中鍵就類似 putty 右鍵的效果。
    • 滑鼠左鍵連點兩次,可以快速選取字詞。
    • 滑鼠左鍵連點三次,可以快速選取整行。
    • 將檔案拖曳進 terminal,可以直接出現檔案完整路徑。(這個特性 M$ Windows 系列的 cmd 也支援)
    • 將其他視窗選取文字拖曳進 terminal,可以直接貼上該文字。(不過中文會變亂碼)
    • Ctrl-Insert 組合鍵可以複製。(或者可以用 Shift-ctrl-C,只是要按三個鍵我覺得很不順就是了。)
    • Shift-Insert 組合鍵可以貼上。(或者可以用 Shift-ctrl-V)
    • 「!!」兩個驚嘆號可以重複上一個執行的完整指令。跟按鍵盤向上鍵不同的是,你可以像這樣用: 「vi /etc/apt/sources.list」啊~權限不足,改輸入「sudo !!」
    • 如果你真的很想用 Ctrl-C 複製,Ctrl-V 貼上,那也可以。
      按 Alt-F2 / 執行 gconf-editor / apps / gnome-terminal / keybindings / 找到 copy 或 paste / 點一下修改

    2011年8月18日 星期四

    NVL + PL/SQL + Inner View performance issue



    1. PL/SQL看來不管是否null,都會執行此inner view的SQL
    2. 直接下SQL的話,只會在null時,才會執行inner view 的SQL

    PUSH_PRED 實現條件



















    1. outer join
    2. 不能有group by 之類的group function(???後來我有另一個例子是OK)

    select /*+ index(d) push_pred(b)*/
    a.objek matnr,d.atbez,a.atwrt,a.atflv,b.atwtb ,a.atinn,c.msehi,c.atnam
    from sap_ausp a
    left join (select a.atinn,a.atwrt,b.atwtb
    from sap_cawn a,sap_cawnt b
    where a.atinn = b.atinn
    and a.atzhl = b.atzhl
    --group by a.atinn,a.atwrt,b.atwtb
    ) b on a.atinn = b.atinn and a.atwrt = b.atwrt
    left join sap_cabn c on a.atinn = c.atinn
    left join sap_cabnt d on a.atinn = d.atinn
    where a.objek = r1.matnr
    group by a.objek,d.atbez,a.atwrt,a.atflv,b.atwtb ,a.atinn,c.msehi,c.atnam

    sysctl

    -a Display all values currently available.

    修改值 /etc/sysctl.conf file.

    fs.aio-max-nr = 1048576

    After you have done so you can activate your settings by executing the following command:

    sysctl -p /etc/sysctl.conf


    The current aio pending operations shows on /proc/sys/fs/aio-nr, the maximum is on /proc/sys/fs/aio-max-nr, if you are hitting the maximum AIO try to increase it, we set this to 1000000 here on /etc/sysctl.conf (fs.aio-max-nr = 1000000).

    2011年8月12日 星期五

    [转] ubuntu Linux/Mint 下实现动态桌面壁纸 原理

    不知大家在使用ubuntu时有没有注意到,ubuntu下是可以实现多张壁纸动态切换的,好像Win7下也有类似的功能(曾经使用win7一段时间)。我也是最近才注意到这点,下面是在ubuntu10.04下实验的,之前版本的应该也可以。 
    实现原理是使用一个xml文件来记录可供切换选择的壁纸。下面展示的是10.04中自带的一个样例。 
    首先说明一下,ubuntu默认的壁纸存放在/usr/share/backgrounds/目录下的,在该目录中还有一个cosmos(意思是“宇宙”)目录,cosmos里面的xml文件就是实现动态桌面壁纸切换功能的了。 
     
    jarson@jarson-laptop:/usr/share/backgrounds/cosmos$ ls 
    background-1.xml      cloud.jpg  earth-horizon.jpg   helix-nebula.jpg  sombrero.jpg 
    blue-marble-west.jpg  comet.jpg  galaxy-ngc3370.jpg  jupiter.jpg       whirlpool.jpg 
    jarson@jarson-laptop:/usr/share/backgrounds/cosmos$ cat background-1.xml  
    <background> 
      <starttime>   starttime标签设置动画(幻灯片)开始的时间,可根据自己制作的时间设定,这个应该不影响实际要实现的功能 
        <year>2009</year> 
        <month>08</month> 
        <day>04</day> 
        <hour>00</hour> 
        <minute>00</minute> 
        <second>00</second> 
      </starttime> 
    <!-- This animation will start at midnight. -->    "animation"动画的意思 
      <static>  "static"静态的意思 
        <duration>1800.0</duration>  duration标签设置持续的时间,以秒为单位。 
        <file>/usr/share/backgrounds/cosmos/cloud.jpg</file>  file标签指定壁纸存放的路径 
      </static> 
      <transition> "transition"切换的意思 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/cloud.jpg</from> from ... to从壁纸A切换到壁纸B。 
        <to>/usr/share/backgrounds/cosmos/comet.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/comet.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/comet.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/earth-horizon.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/earth-horizon.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/earth-horizon.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/helix-nebula.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/helix-nebula.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/helix-nebula.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/jupiter.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/jupiter.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/jupiter.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/sombrero.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/sombrero.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/sombrero.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/whirlpool.jpg</to> 
      </transition> 
      <static> 
        <duration>1800.0</duration> 
        <file>/usr/share/backgrounds/cosmos/whirlpool.jpg</file> 
      </static> 
      <transition> 
        <duration>5.0</duration> 
        <from>/usr/share/backgrounds/cosmos/whirlpool.jpg</from> 
        <to>/usr/share/backgrounds/cosmos/cloud.jpg</to> 
      </transition> 
    </background> 
    注意from ... to要构成一个循环。 
    设置动态桌面壁纸有两个好的功能:1、满足自己设置多张壁纸的需要;2、时间提醒,例如我这里设置半小时切换一次,这样每次桌面变换时,我就会知道半个小时又过去了。。。 
     
    设置好后的应用方法:右键桌面->更改桌面背景->添加,在弹出对话框的右下方那里选择“全部文件”(默认是“图像”),然后找到你定义好的动态桌面壁纸的xml文件,双击添加就可以了。

    gcin + Ubuntu 11.04 icon消失

    1. gsettings get com.canonical.Unity.Panel systray-whitelist -- 列出icon list
    2. gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Mumble', 'Wine', 'dropbox', 'hp-systray', 'gcin']"
    3. 重新登入

    2011年8月11日 星期四

    gcin + im-switch and how to restart X Session

    目前在 Debian體系的且火紅的Ubuntu,預設的輸入法是SCIM,一旦要移除SCIM輸入法又會導致大量的中文核心系統會跟著被移除,在某種方面 gcim比scim來的穩定,比如SCIM和aMSN就會有卡卡的情形(也有可能是筆者自己的問題),有時打個訊息要卡個老半天的,筆者因此改用gcim 當作預設的系統輸入法,就解決了此不順的問題。如何更改系統預設使用gcim,請參考如下設定。
    1. $ sudo apt-get update
    2. $ sudo apt-get install gcin gcin-qtk3-immodule
    3. $ sudo im-switch -s gcin <=如此可將系統預設輸入法更改成gcin
    4. $ sudo im-switch -s scim <=如此可將系統預設輸入法更改成scim
    5. 登出系統->重新登入->開始享用新的輸入法吧


    How to restart X session :
    1. ps -ef|grep dm
        可以看到系統是使用何種 desk manager
        在linux mint我找到mdm
    2. /etc/init.d/mdm restart

    tw.archive.ubuntu.com apt-get掛站處理方法

    /etc/apt# vim sources.list
    :1,$s/tw.archive.ubuntu.com/mirror.nttu.edu.tw/g

    VIM字串搜尋與取代
    s(substitute)指令可搜尋某行列範圍。
    g(global)指令則可搜尋整個編輯緩衝區的資料。
    s指令以第一個滿足該條件的字串為其取代的對象,若該行有數個滿足該條
    件的字串,也僅能取代第一個,若想取代所有的字串則需加上g參數。
      :1,$s/old/new/g        將檔案中所有的『old』改成『new』。
      :10,20s/^/   /         將第10行至第20行資料的最前面插入5個空白。
      :%s/old/new/g          將編輯緩衝區中所有的『old』改成『new』

    SAP : FTP test program

    RSFTP001                       SAPFTP Version
    RSFTP002                       Execute FTP Command
    RSFTP003                       FTP put / get Test
    RSFTP004                       FTP Copy
    RSFTP005                       SAPFTP check
    RSFTP006                       FTP command list
    RSFTP007                       Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
    RSFTP008                       Test FB:FTP_CLIENT_TO_R3 / FTP_R3_TO_CLIENT
    RSFTP009                       Test FTP put with Verify

    2011年8月10日 星期三

    Oracle : Database Link without tnsnames.ora

    create public database link xxx
      connect to xxx identified by xxx
      using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.xxx.xxx)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=xxx)))';

    2011年8月9日 星期二

    2011年8月7日 星期日

    System information disabled due to load higher than 1

    Ubuntu apt-get upgrade後,login出現

     System information disabled due to load higher than 1


    解決方法 : (不知為何,但如此之後就沒有以上訊息)

    oracle@aot-dwd01:~$ sudo apt-get install landscape-common
    正在讀取套件清單... 完成
    正在重建相依關係
    正在讀取狀態資料... 完成
    landscape-common 已經是最新版本了。
    以下套件是被自動安裝進來的,且已不再會被用到了:
      xulrunner-1.9.1-gnome-support
    使用 'apt-get autoremove' 來將其移除。
    升級 0 個,新安裝 0 個,移除 0 個,有 0 個未被升級。
    oracle@aot-dwd01:~$ sudo apt-get autoremove xulrunner-1.9.1-gnome-support
    正在讀取套件清單... 完成
    正在重建相依關係
    正在讀取狀態資料... 完成
    下列套件將會被【移除】:
      xulrunner-1.9.1-gnome-support
    升級 0 個,新安裝 0 個,移除 1 個,有 0 個未被升級。
    此操作完成之後,會空出 193kB 的磁碟空間。
    是否繼續進行 [Y/n]?Y
    (正在讀取資料庫 ... 系統目前共安裝了 192732 個檔案和目錄。)
    正在移除 xulrunner-1.9.1-gnome-support ...

    oracle@aot-dwd01:~$ exit
    logout
    Linux aot-dwd01 2.6.31-23-server #75-Ubuntu SMP Fri Mar 18 19:23:09 UTC 2011 x86_64

    To access official Ubuntu documentation, please visit:
    http://help.ubuntu.com/

      System information as of Mon Aug  8 12:27:11 CST 2011

      System load:  0.11                Temperature:         33 C
      Usage of /:   24.1% of 141.53GB   Processes:           145
      Memory usage: 47%                 Users logged in:     0
      Swap usage:   0%                  IP address for eth0: 10.56.34.69

      Graph this data and manage this system at https://landscape.canonical.com/

    Last login: Mon Aug  8 12:11:18 2011 from aot-sharenb001.huko.aot.com.tw
    oracle@aot-dwd01:~$

    2011年8月2日 星期二

    virtualbox VDI VMDK VHD選哪個啊?

    vhd能在windows7 旗舰版下打开无需工具
    vmdk 是vm虚拟机的格式 可以被支持
    vdi是virtualbox自己的格式

    SAP : 修改工單component所用的operation

    user exit :
    SMOD (t code) -> PPCO0001 -> EXIT_SAPLCOBT_001

    接下來呼叫
            CALL FUNCTION 'CO_BT_RESB_READ_WITH_KEY'
              EXPORTING
                "FLG_RESBD             = ''
                "NO_MAKTX              = 'X'
                "NO_STATXT             = 'X'
                rsart_imp             = wa_resb-rsart
                rsnum_imp             = wa_resb-rsnum
                rspos_imp             = wa_resb-rspos
                "NO_READ_FROM_DB       = ''
             IMPORTING
               index_exp             = nindex
               resbd_exp             = wa_resbd
             EXCEPTIONS
               NOT_FOUND             = 1
               OTHERS                = 2
                      .
            IF sy-subrc = 0.


    修改wa_resbd的值後,再呼叫以下FM,修改RESB table
    ...
    ...
    ...
              CALL FUNCTION 'CO_BT_RESB_UPDATE'
                  EXPORTING
                    resb_new             = wa_resbd
                    tabix_old            = nindex
                          .
            ENDIF.