Locations of visitors to this page

Tuesday, July 28, 2009

less than stellar

less than stellar

less-than-stellar
不尽如人意的,二流的

解释:
less-than-stellar
An english term meaning that something doesn't meet the expectations set in it or is less good than a similar thing coming before or after it. It is commonly used in the media and sometimes written like this: less-than-stellar.

Usage:
Those sales figures are less than stellar.
Godzilla 2000 was a less-than-stellar movie, and Dean Devlin's acting was less than stellar too.

Example from knifegirl's w/u on Falco:
Falco's third album, Falco 3, contained the single Rock Me Amadeus, which reached the top of those charts that measure such things in the U.S., Germany, Austria, and England. ... A few less-than-stellar albums followed,...

Similar terms:
substandard; dissatisfactory, half assed

例句:
In China, a Rocky Ascent for Basketball
Bonzi Wells, a less than stellar player in the N.B.A., frequently scored more than 40 points a game in the Chinese Basketball Association.

TV ratings soared, and foreign players found starring roles -- the top 15 scorers were non-Chinese, and players like Bonzi Wells and Dontae' Jones -- who had less than stellar N.B.A. careers -- frequently scored more than 40 points a game.

'Real Housewives of Atlanta' adds new face
Last season, fans of the show -- and some of the other housewives -- slammed Zolciak for her less-than-stellar voice.



-fin-

Friday, July 24, 2009

agent status shows negative available disk space

EM agent status shows negative available disk space
企业管理器代理状态显示可用磁盘空间为负数


问题:
Available disk space on upload filesystem    :    -7.17%
Collection Status                            : Disabled by Upload Manager
emctl status agent
出现上面的问题
但是df -h
才不到60%
10T,才用了6T

我都清了
也不成

Thread-35183520 ERROR upload: Exceeded max. amount of upload data: 2 files, 0.006033 MB Data. 104.26% of disk used. Disabling collections.
2009-07-21 20:13:42 Thread-35183520 WARN  collector: Disable collector
2009-07-21 20:13:42 Thread-35183520 ERROR collector: Collector state files cleaned, severity will be resent
2009-07-21 20:13:42 Thread-35183520 ERROR upload: Disabling Logging and Tracing: 1
这个就是错误

系统 是32位的
而patch只有64位的



回答:

你现在的文件大小超过设定的阈值了
所以显示为负的?
或者是你的硬盘太大了, 计算溢出了, 也是有可能的

先排除了如下问题
Problem: 'emctl status agent' Command Shows Collection Status Disabled By Upload Manager
upload目录文件大小超过了设定的阈值

后怀疑是硬盘太大导致, 果然发现是个BUG, AVAILABLE DISK SPACE ON UPLOAD FILESYSTEM IS NEGATIVE. 文档AGENT STATUS SHOWS AVAILABLE DISK SPACE AS A NEGATIVE VALUE说当agent所在的文件系统达到了TB级, 就会出现问题. 10.2.0.4确认了此BUG, 可以打补丁或升级到10.2.0.5版本.

因为服务器是32位的, 没有补丁可打, 后来把agent挪到了一个比较小的分区上, 解决了问题



-fin-

Thursday, July 23, 2009

ORA-01012 not logged on ORA-01012 没有登录

ORA-01012 not logged on
ORA-01012 没有登录


提问:
数据库的session 设置为150
而select count from v$session 才88
但是现在使用sqlplus / as sysdba进不去
sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 23 13:29:54 2009

Copyright  1982, 2007, Oracle.  All Rights Reserved.

Connected.
SQL> select count from v$session;
select count from v$session
*
ERROR at line 1:
ORA-01012: not logged on
alert.log没错啊?
没报错呀


回答:
sysdba连接数据库, 不能运行任何语句, 报错"ORA-01012: not logged on", 告警日志中没有报错信息
1.可能数据库后台进程数超过了数据库参数设置的最大值. 杀数据库后台进程或重启数据库
2.进程数可能超过系统用户的限制或内核限制. 检查系统日志和配置, 杀进程或重启数据库



外部链接:
ORA-01012: not logged on

ORA-01012: not logged on

Connecting to database in sql session getting this error ORA-01012: not logged on.


-fin-

how to setup client to use http proxy 客户端如何设置代理

how to setup client to use http proxy
客户端如何设置代理

设置代理的几种方法


1. 设置的环境变量
有很多应用程序支持从环境变量获取代理服务器的信息
环境变量名及格式如下:
http_proxy="http://username:password@your.proxy.server:port"
https_proxy="http://username:password@your.proxy.server:port"
ftp_proxy="http://username:password@your.proxy.server:port"
export http_proxy http_proxy ftp_proxy
变量名由"协议名"+"_proxy"组成, 类似的还有gopher_proxy, wais_proxy
变量值中的"http://"(好像)写不写都行

不需要通过代理的网址由no_proxy环境变量设定, 支持主机名和端口(好像支持通配符*), 多个用逗号分开, 如:
no_proxy="cern.ch,ncsa.uiuc.edu,some.host:8080"
export no_proxy

上述环境变量只是约定俗成的一种用法, 不是所有程序都支持, 格式上也有所差异
比如wget就支持http_proxy,https_proxy,ftp_proxy,no_proxy

外部链接:
Setting Up Clients To Use a Proxy
GNU Wget 1.11.4 Manual - 8.1 Proxies



2. 设置Gnome的代理配置
选择菜单Applications -> Preferences > Network Proxy, 进行配置
配置保存在$HOME/.gconf/system/http_proxy/%gconf.xml文件里
# cat $HOME/.gconf/system/http_proxy/%gconf.xml
<?xml version="1.0"?>
<gconf>
        <entry name="port" mtime="1248328099" type="int" value="3128">
        </entry>
        <entry name="host" mtime="1248328097" type="string">
                <stringvalue>192.168.11.16</stringvalue>
        </entry>
        <entry name="use_http_proxy" mtime="1248328817" type="bool" value="false">
        </entry>
</gconf>

这种方法对Gnome环境下的一些程序有效


3. 修改Java程序的系统属性
java命令后加上-D选项或程序中使用System.setProperty(String, String)方法
支持http, https, ftp, socks协议, 多个主机名用竖线分开
比如:
java -Dhttp.proxyHost=webcache.mydomain.com -Dhttp.proxyPort=8080 -Dhttp.noProxyHosts="localhost|host.mydomain.com" GetURL

Java5.0及之后版本, 还可在$JRE_HOME/lib/net.properties当中配置

外部链接:
Java Networking and Proxies
Java HTTP Proxy Settings


4. TOMCAT服务器
因为tomcat服务也是java程序, 所以也支持上一种方法
比如在启动脚本中配置JAVA_OPTS变量, 加上
-Dhttp.proxyHost=your.proxy.server
-Dhttp.proxyPort=port
-Dhttp.proxyUser=username
-Dhttp.proxyPassword=password 
等选项

或修改$CATALINA_HOME/conf/catalina.properties配置文件, 如
http.proxyHost=your.proxy.server
http.proxyPort=port
https.proxyHost=your.proxy.server
https.proxyPort=port


外部链接:
Set up an HTTP proxy for Tomcat Web Server


5. Android Emulator设置代理服务器
1)用第一种方式,支持环境变量http_proxy, 不支持no_proxy, https_proxy

2)或增加命令行选项
-http-proxy

3)或修改手机的系统配置表, 见外部链接


外部链接:
Android Emulator
Network Access
Tips: Howto Connect Android Emulator behind proxy
Set proxy for android web browser



-fin-

Wednesday, July 22, 2009

how to add and resize innodb log 如何增加innodb日志文件和修改大小

how to add and resize innodb log
如何增加innodb日志文件和修改其大小

关于"ib_logfile0 is of different size"错误的解决


重启mysql服务时,发现无法启动
# service mysqld restart
Stopping MySQL:                                            [  OK  ]
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]

查看日志/var/log/mysqld.log
# less /var/log/mysqld.log
...
090721 02:25:47  mysqld started
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 52428800 bytes!
090721  2:25:47 [ERROR] Default storage engine (InnoDB) is not available
090721  2:25:47 [ERROR] Aborting

090721  2:25:47 [Note] /usr/libexec/mysqld: Shutdown complete

090721 02:25:47  mysqld ended

显示错误"log file ./ib_logfile0 is of different size 0"
报告日志文件大小有误

原来是因为修改过一次配置文件, /etc/my.cnf中有关日志文件的配置被配置管理工具Puppet自动改成了
innodb_log_file_size = 50M
innodb_log_files_in_group = 3
而默认的, innodb日志文件只有2个, 大小是5M
# ls -l /var/lib/mysql/
total 20528
-rw-rw---- 1 mysql mysql 10485760 Jul 21 02:25 ibdata1
-rw-rw---- 1 mysql mysql  5242880 Jul 21 02:25 ib_logfile0
-rw-rw---- 1 mysql mysql  5242880 May 19 08:34 ib_logfile1
drwx------ 2 mysql mysql     4096 May 19 08:34 mysql
drwx------ 2 mysql mysql     4096 May 19 08:34 test
当mysql服务启动时自动检测innodb日志文件大小是否正确, 不正确则不能起来


然后修改配置文件, 大小改为默认的5M
innodb_log_file_size = 5M
innodb_log_files_in_group = 3

再重启还是起不来
# service mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]

日志显示, mysql启动还要检查日志文件的数量
090721 04:14:58  mysqld started
090721  4:14:58  InnoDB: Log file ./ib_logfile2 did not exist: new to be created
090721  4:14:58 [ERROR] Default storage engine (InnoDB) is not available
090721  4:14:58 [ERROR] Aborting

090721  4:14:58 [Note] /usr/libexec/mysqld: Shutdown complete

090721 04:14:58  mysqld ended

mysql发现第3个日志文件不存在, 但它不能自动创建
# ll
total 20528
-rw-rw---- 1 mysql mysql 10485760 Jul 21 02:25 ibdata1
-rw-rw---- 1 mysql mysql  5242880 Jul 21 02:25 ib_logfile0
-rw-rw---- 1 mysql mysql  5242880 May 19 08:34 ib_logfile1
-rw-rw---- 1 mysql mysql        0 Jul 21 04:14 ib_logfile2
drwx------ 2 mysql mysql     4096 May 19 08:34 mysql
drwx------ 2 mysql mysql     4096 May 19 08:34 test

ib_logfile是innodb存储引擎的日志文件, 记录innodb数据的变化, 相当于oracle的在线日志文件
修改数据内容时, 首先修改数据缓冲区的数据块, 然后将这个变化记录到日志文件里, 最后定时(或触发)刷新数据缓冲区中的脏数据块到数据文件.

修改日志文件大小的正确方法见手册13.2.5. Adding, Removing, or Resizing InnoDB Data and Log Files

1. 设置innodb_fast_shutdown参数等于1
查看innodb_fast_shutdown
mysql> show global variables like 'innodb_fast_shutdown';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1     |
+----------------------+-------+
1 row in set (0.00 sec)

mysql>
如果不等于1,那么改成1
mysql> set global innodb_fast_shutdown=1;
Query OK, 0 rows affected (0.00 sec)

mysql>

2.正常停止MySQL服务
service mysqld stop

mysqladmin shutdown
这步保证脏数据块都刷新到磁盘, 不再需要重做

3.修改my.cnf配置文件
innodb_log_file_size = 50M
innodb_log_files_in_group = 3

4.将原来的日志文件删除,改名或移到另外一个地方
# cd /var/lib/mysql
# mv ib_logfile0 ib_logfile0.bak
# mv ib_logfile1 ib_logfile1.bak
# mv ib_logfile2 ib_logfile2.bak

5.重启MySQL服务
# service mysqld start
Starting MySQL:                                            [  OK  ]

自动创建了3个日志文件
090722 02:48:05  mysqld started
090722  2:48:05  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 50 MB
InnoDB: Database physically writes the file full: wait...
090722  2:48:06  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 50 MB
InnoDB: Database physically writes the file full: wait...
090722  2:48:07  InnoDB: Log file ./ib_logfile2 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile2 size to 50 MB
InnoDB: Database physically writes the file full: wait...
090722  2:48:09  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
090722  2:48:09  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 44044.
InnoDB: Doing recovery: scanned up to log sequence number 0 44044
090722  2:48:09  InnoDB: Started; log sequence number 0 44044
090722  2:48:09 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
MySQL貌似工作正常




外部链接:
InnoDB logfiles
The Binary Log

High performance MySQL
By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek Balling


Log size differences create possibility of corruption
InnoDB Performance Tuning




-fin-

Tuesday, July 7, 2009

therefore and thereby

therefore and thereby
therefore和thereby区别


例句:
thereby
You use thereby to introduce an important result or consequence of the event or action you have just mentioned. (FORMAL)
Our bodies can sweat, thereby losing heat by evaporation.
A firm might sometimes sell at a loss to drive a competitor out of business, and thereby increase its market power.
ADV: ADV with cl
= thus

therefore
You use therefore to introduce a logical result or conclusion.
Muscle cells need lots of fuel and therefore burn lots of calories.
Nothing was to prevent him now from becoming the richest, and therefore the happiest, man in the world.
ADV: ADV with cl/group
= consequently


thereby
by that, by that mean, 意为"通过那种方式"

therefore
for that, for that reason, 意为"因为那种原因"

类似的还有hereby, hereof, hereto等一堆



外部链接
What is the difference between therefore and thereby?
Hereby / Thereby


-fin-

Monday, July 6, 2009

returning clause returning子句

returning clause
returning子句

使用RETURNING子句返回DML语句影响的记录的值
1.
drop table t purge;
create table t(a char, b int);
insert into t values ('a',1);
insert into t values ('b',3);
insert into t values ('c',4);
commit;

var v_a char
var v_b number
insert into t values ('d',2) returning a,b into :v_a,:v_b;
print v_a v_b
update t set b=9 where a='c' returning a,b into :v_a,:v_b;
print v_a v_b
delete t where a='b' returning a,b into :v_a,:v_b;
print v_a v_b

rollback;

SQL> var v_a char
SQL> var v_b number
SQL> insert into t values ('d',2) returning a,b into :v_a,:v_b;

1 row created.

SQL> print v_a v_b

V_A
--------------------------------
d


       V_B
----------
         2

SQL> update t set b=9 where a='c' returning a,b into :v_a,:v_b;

1 row updated.

SQL> print v_a v_b

V_A
--------------------------------
c


       V_B
----------
         9

SQL> delete t where a='b' returning a,b into :v_a,:v_b;

1 row deleted.

SQL> print v_a v_b

V_A
--------------------------------
b


       V_B
----------
         3

SQL>
对于INSERT语句, RETURNING返回的是插入后的值
对于UPDATE语句, RETURNING返回的是变更之后的值
对于DELETE语句, RETURNING返回的是删除前的值



2. RETURNING后面不仅可以是字段, 还可以是一个或多个表达式
var v_a varchar2(50)
var v_b number
var v_b2 number
insert into t values ('d',2) returning rowid,b into :v_a,:v_b;
print v_a v_b
update t set b=b+1 returning sum(b) into :v_b;
print v_b
delete t where a='b' returning rowid,sum(b) into :v_rid,:v_b;
delete t where a in ('b','c') returning min(b),sum(b) into :v_b,:v_b2;
print v_b v_b2
rollback;

SQL> var v_a varchar2(50)
SQL> var v_b number
SQL> var v_b2 number
SQL> insert into t values ('d',2) returning rowid,b into :v_a,:v_b;

1 row created.

SQL> print v_a v_b

V_A
--------------------------------------------------------------------------------------------------------------------------------
AAAFY8AAGAAAACPAAD


       V_B
----------
         2

SQL> update t set b=b+1 returning sum(b) into :v_b;

4 rows updated.

SQL> print v_b

       V_B
----------
        14

SQL> delete t where a='b' returning rowid,sum(b) into :v_rid,:v_b;
delete t where a='b' returning rowid,sum(b) into :v_rid,:v_b
                               *
ERROR at line 1:
ORA-00937: not a single-group group function


SQL> delete t where a in ('b','c') returning min(b),sum(b) into :v_b,:v_b2;

2 rows deleted.

SQL> print v_b v_b2

       V_B
----------
         4


      V_B2
----------
         9

SQL> rollback;

Rollback complete.

SQL>
表达式可以是rowid, 函数, 或是聚集函数(10g新特性)


3. RETURNING BULK COLLECT INTO返回多条记录
如果DML语句影响了多条记录, 而RETURNING子句后也不是聚集函数, 那么使用BULK COLLECT INTO一次返回多条记录
set serveroutpu on size unlimited
select * from t;
declare
  type t_t is table of t%rowtype index by binary_integer;
  v_t_a t_t;
begin
  update t set b=b+1 returning a,b bulk collect into v_t_a;
  for i in 1..v_t_a.count loop
    dbms_output.put_line(i||':a='||v_t_a(i).a||',b='||v_t_a(i).b);
  end loop;
  rollback;
end;
/
SQL> set serveroutpu on size unlimited
SQL> select * from t;

A          B
- ----------
a          1
b          3
c          4

SQL> declare
  2    type t_t is table of t%rowtype index by binary_integer;
  3    v_t_a t_t;
  4  begin
  5    update t set b=b+1 returning a,b bulk collect into v_t_a;
  6    for i in 1..v_t_a.count loop
  7      dbms_output.put_line(i||':a='||v_t_a(i).a||',b='||v_t_a(i).b);
  8    end loop;
  9    rollback;
 10  end;
 11  /
1:a=a,b=2
2:a=b,b=4
3:a=c,b=5

PL/SQL procedure successfully completed.

SQL>


4.使用中的限制

a.聚集函数和非聚集函数表达式不能一起用, 见前面的例子

b.聚集函数中不能用DISTINCT
select * from t;
var v_b number
update t set b=b+1 returning count(distinct b) into :v_b;
print v_b
rollback;
SQL> select * from t;

A          B
- ----------
a          2
b          4
c          5

SQL> var v_b number
SQL> update t set b=b+1 returning count(distinct b) into :v_b;
update t set b=b+1 returning count(distinct b) into :v_b
                             *
ERROR at line 1:
ORA-00934: group function is not allowed here


SQL> print v_b

       V_B
----------


SQL> rollback;

Rollback complete.

SQL>

c.聚集函数不能在INSERT语句里使用
var v_b number
insert into t values ('d',9) returning count(b) into :v_b;
print v_b
rollback;
SQL> var v_b number
SQL> insert into t values ('d',9) returning count(b) into :v_b;
insert into t values ('d',9) returning count(b) into :v_b
                                       *
ERROR at line 1:
ORA-00934: group function is not allowed here


SQL> print v_b

       V_B
----------


SQL> rollback;

Rollback complete.

SQL>

d.如果表达式包含主键字段或非空字段, 且存在BEFORE UPDATE触发器, UPDATE语句会失败
这是文档写的
"If the expr list contains a primary key column or other NOT NULL column, then the update statement fails if the table has a BEFORE UPDATE trigger defined on it."
但实际测试没有发现问题
alter table t modify (b not null);
alter table t modify (a primary key);
create or replace trigger tr_t
  before update on t for each row
begin
  :new.b := 2;
end;
/
var v_b number
var v_a number
update t set b=b+1 returning count(a),sum(b) into :v_b,:v_a;
print v_a v_b

e. INSERT INTO子查询不支持RETURNING
var v_b number
insert into t (select 'g',8 from t) returning sum(b) into v_b;
SQL> insert into t (select 'g',8 from t) returning sum(b) into v_b;
insert into t (select 'g',8 from t) returning sum(b) into v_b
                                    *
ERROR at line 1:
ORA-00933: SQL command not properly ended


SQL>

f.多表插入语句,MERGE语句,并行DML,远程对象,LONG类型,视图,INSTEAD OF触发器均不支持RETURNING
(都没测试过...)




外部链接:
DELETE
INSERT
UPDATE
RETURNING INTO Clause
Examples of Dynamic Bulk Binds


-fin-
Website Analytics

Followers