2016年6月9日 星期四

jsp file upload

jsp file upload

http://www.tutorialspoint.com/jsp/jsp_file_uploading.htm
http://commons.apache.org/proper/commons-fileupload/using.html
http://stackoverflow.com/questions/16993934/retrieve-file-and-parameters-in-jsp-from-post-request

ORACLE 過 purge

CLOB 搬移
http://www.dba-oracle.com/t_alter_table_move_index_constraint.htm


找 CLOB Column
 select table_name from dba_tab_columns where OWNEr='SCOTT' and data_type='CLOB';
  select table_name from dba_tab_columns where OWNEr='SCOTT' and data_type like '%LOB%';
  
Assuming that I have table "TEST" in USERS TableSpace

CREATE TABLE TEST
(
TEST_ID NUMBER NOT NULL,
TEST_NAME CLOB,
CONSTRAINT PK_TEST PRIMARY KEY(TEST_ID)
)
/


SQL> ALTER TABLE TEST MOVE TABLESPACE EXAMPLE;

Above command will move the table to new tablespace but will not move the CLOB segment and it will still be in original tablespace. This is because LOB data is stored outside of the table.
Check the tablespace of the CLOB column by issuing following sql.

SQL> SELECT index_name, tablespace_name
FROM user_indexes WHERE table_name = ‘TEST’;

INDEX_NAME TABLESPACE_NAME
—————————— —————-
SYS_IL0000073575C00002$$ USERS

In order to move CLOB column to different tablespace, we have to issue following command.

SQL> ALTER TABLE TEST MOVE LOB(TEST_NAME) STORE AS (TABLESPACE EXAMPLE);

In above example, TEST_NAME is the CLOB column which we want to move to new tablespace and EXAMPLE is target tablespace. Above command will successfully move LOB segments to the new tablespace. We can verify it by issuing same sql again.

SQL> SELECT index_name, tablespace_name
FROM user_indexes WHERE table_name = ‘TEST’;

INDEX_NAME TABLESPACE_NAME
—————————— —————
SYS_IL0000073575C00002$$ EXAMPLE

ORACLE parameter file (PFILE , SPFILE)

CREATE PFILE='/tmp/initoradbtst.ora.2016053102' from spfile='/oracle/10g/product/10.2.0/db/dbs/spfileoradbtst.ora';

CREATE spfile='/oracle/10g/product/10.2.0/db/dbs/spfileoradbtst.ora' from PFILE='/oracle/10g/product/10.2.0/db/dbs/initoradbtst.ora'  ;


10g 這邊只能 create pfile from spfile 或是 creare spfile form pfile

會在 ORACLE_HOME/dbs 底下先找 spfile 跟 pfile . (順序要再確認)

在啟動的時候可以指定 startup PFILE='絕對路徑';


--controll file 比較麻煩 要 recreate  . 而且 scn 不對還要 resetlog

2016年6月2日 星期四

Squid3 ubuntu



Squid3 安裝


http://www.ez2o.com/Blog/Post/Ubuntu-Install-Proxy-Server-Squid


apt-get install squid

vi /etc/squid3/squid.conf

設定允許所有人連入 Proxy :

將 http_access allow localhost  改為 http_access allow all

將 http_access deny all 註解

/etc/init.d/squid restart

在 Wget 使用 proxy


Via ~/.wgetrc file:
use_proxy=yes http_proxy=127.0.0.1:8080
or
via -e options placed after the URL:
wget ... -e use_proxy=yes -e http_proxy=127.0.0.1:8080 ...

用 ftp proxy 的時候 用 -e ftp_proxy=127.0.0.1:8080


在 yum 使用 proxy



$ export http_proxy=http://proxy:3128
$ export ftp_proxy=http://proxy:3128
$ yum update
If you want to make the proxy settings permanent, you can add a proxy directive to /etc/yum.conf:
$ grep proxy /etc/yum.conf
proxy=http://proxy:3128











=END

AWK 使用 Quota ' '

https://www.gnu.org/software/gawk/manual/html_node/Quoting.html

$ awk 'BEGIN { print "Here is a single quote <'\''>" }'
-| Here is a single quote <'>

$ awk "BEGIN { print \"Here is a single quote <'>\" }"
-| Here is a single quote <'>

$ awk 'BEGIN { print "Here is a single quote <\47>" }'
-| Here is a single quote <'>
$ awk 'BEGIN { print "Here is a double quote <\42>" }'
-| Here is a double quote <">

$ awk -v sq="'" 'BEGIN { print "Here is a single quote <" sq ">" }'
-| Here is a single quote <'>







==END