200709月份工作记录

20070904
------------------------------

 1.   诊断系统中的锁   
    
 

  1. select   /*+   NO_MERGE(a)   NO_MERGE(b)   NO_MERGE(c)   */   'Wait'   "Status",   a.username,   a.machine,   a.sid,   a.serial#,   a.last_call_et   "Seconds",   b.id1,   c.sql_text   "SQL"      
  2.  from   v$session   a,   v$lock   b,   v$sqltext   c      
  3.  where   a.username   is   not   null      
  4.  and   a.lockwait   =   b.kaddr      
  5.  and   c.hash_value   =a.sql_hash_value      
  6.  union      
  7.  select   /*+   NO_MERGE(a)   NO_MERGE(b)   NO_MERGE(c)   */   'Lock'   "Status",   a.username,   a.machine,   a.sid,   a.serial#,   a.last_call_et   "Seconds",   b.id1,   c.sql_text   "SQL"      
  8.  from   v$session   a,   v$lock   b,   v$sqltext   c      
  9.  where   b.id1   in      
  10.  (select   /*+   NO_MERGE(d)   NO_MERGE(e)   */   distinct   e.id1      
  11.  from   v$session   d,   v$lock   e      
  12.  where   d.lockwait   =   e.kaddr)      
  13.  and   a.username   is   not   null      
  14.  and   a.sid   =   b.sid      
  15.  and   b.request=0      
  16.  and   c.hash_value   =a.sql_hash_value;      

  Status有两种状态,LOCK表明该进程锁住了某个资源,WAIT表示该进程正在等待某个资源。  
  Username,   Machine分别为ORACLE用户名及机器名  
  SID,SERIAL#可用于随后的解锁操作  
  Seconds表示该进程最后一次进行操作至当前的时间(秒)  
  ID1,   锁标识。某个LOCK状态的ID1与某个WAIT状态的ID1相同,可说明锁的正是另一个进程等待的。  
  SQL:   锁住资源的SQL语句  
   
  2.   解除锁  
   
  诊断出锁的状态后,若发现该阻塞其它用户进程的进程是正常操作中,则可通知该用户对其进行提交,从而达到释放锁资源的目的;若为非正常操作,即,其状态为"inactive",且其Seconds已为较多长时间,则可执行以下语句将该进程进行清除,系统会自动对其进行回滚,从而释放锁住的资源。     
 

sql 代码
  1. alter   system   kill   session   'sid,   serial#';   

20070905
------------------------
jsf中commandLink 在dataTable无法提交的问题原因未知(估计是jsf Bug,搞死人了...),但是找到的解决办法有两个:

(1) 在页面加<x:saveState id="messageInfoAddBB" value="#{messageInfoAddBB}"/>标签,延长request周期;
(2) 在faces-config.xml中的<managed-bean-scope>request</managed-bean-scope> 将request 改成 session;

20070906
------------------------
jsf中的<inputText>主建再第一次请求的时候把页面渲染存入session,第二次调的时候还是调第一次的结果,根本不调后台的getter方法。
解决办法在调用该页面前或调用后让faces重新渲染

java 代码
  1. FacesContext context = FacesContext.getCurrentInstance();   
  2.   Application application = context.getApplication();   
  3.   ViewHandler viewHandler = application.getViewHandler();   
  4.   UIViewRoot viewRoot = viewHandler.createView(context, context   
  5.     .getViewRoot().getViewId());   
  6.   context.setViewRoot(viewRoot);   
  7.   context.renderResponse();   
  8.   

20070907
------------------------

oracle 导入指定表空间的问题,如果userA导出数据的时候指定表空间,这时想将userA的Dmp包导入userB的表空间中,采用的办法两个:

1. Pre-create the table(s) in your desired tablespace:

.Import the dump file using INDEXFILE= option.
.Edit this indexfile to remove remarks and modify the destination tablespace.
.Run this indexfile against your database to create the required tables in the appropriate tablespace.
.Import the tables with the IGNORE = Y option.
在IMP时,使用INDEXFILE形成建表和索引的脚本文件,手工修改文件(调整各项存储参数),先将表结构建立起来,再导入数据(使用IGNORE=Y,INDEXES=N),再手工创建索引

2. Change the user's quota on tablespace

.Revoke the "UNLIMITED TABLESPACE" privilege from the user.
.Revoke the user's quota from the tablespace where the objects were exported from. This will force IMP to create tables in the user's default tablespace.
.Import the tables.

alter user B quota 0m on tablespace_a;

imp ...... fromuser=A to user=B

用户对象从一个表空间example导入到另外一个表空间test1
exp hr/hr  file=e:\hr.dmp log=e:\hrexp.log owner=hr
revoke unlimited tablespace from hr;
alter user hr quota 0 on example;
建test1用户,默认表空间为test1,临时表空间temp,对test1表空间无限额。
修改hr用户的设置:
alter user hr quota 200m on test1;或alter user hr quota unlimited on test1;
最后imp即可:
imp hr/hr file=e:\hr.dmp log=e:\hrimp.log fromuser=hr touser=test1

20070916
------------------------

Comet框架的学习笔记:

Comet技术是基于HTTP长两连接的“服务器推”技术。是用于WEB即时消息的应用,如WebIm、股票实时信息、监控等在b/s架构上实现的技术。

Comet的有两种“服务器推”模型 :

1. 基于AJAX的长轮询模型,区别于传统的 AJAX 应用在于:

 服务器端会阻塞请求直到有数据传递或超时才返回;

 客户端 JavaScript 响应处理函数会在处理完服务器返回的信息后,再次发出请求,重新建立连接。

 当客户端处理接收的数据、重新建立连接时,服务器端可能有新的数据到达;这些信息会被服务器端保存直到客户端重新建立连接,客户端会一次把当前服务器端所有的信息取回。

2.基于 Iframe 及 htmlfile 的流(streaming)方式

 iframe 是很早就存在的一种 HTML 标记, 通过在 HTML 页面里嵌入一个隐蔵帧,然后将这个隐蔵帧的 SRC 属性设为对一个长连接的请求,服务器端就能源源不断地往客户端输入数据.


Pushlet 是一个开源的 Comet 框架。

20070917
------------------------
查看回滚段

sql 代码
  1. select a.NAME, b.EXTENTS, b.RSSIZE,b.XACTS,b.WAITS,b.GETS,b.OPTSIZE,b.STATUS   
  2. from v$rollname a,v$rollstat b   
  3. where a.USN = b.USN  

如果XACTS(活动事务)大于1,表示回滚段有争用,需要增加回滚段数目。

如果WAITS大于1,也表示需要增加回滚段数目。

20070921
------------------------

sql 代码
  1. 内连接   
  2. select * from (select '1' a, '2' b from dual) t1,(select '3' c, '2' d from dual) t2 where t1.b=t2.d;   
  3. 等价于   
  4. select * from (select '1' a, '2' b from dual) t1 join (select '3' c, '2' d from dual) t2 on t1.b = t2.d;   
  5.   
  6. 右外连接   
  7. select * from (select '1' a, '2' b from dual) t1,(select '3' c, '2' d from dual) t2 where t1.a(+)=t2.d;   
  8. 等价于   
  9. select * from (select '1' a, '2' b from dual) t1 right outer join (select '3' c, '2' d from dual) t2 on t1.a = t2.d;   
  10.   
  11. 左外连接   
  12. select * from (select '1' a, '2' b from dual) t1,(select '3' c, '2' d from dual) t2 where t1.a=t2.d(+);   
  13. 等价于   
  14. select * from (select '1' a, '2' b from dual) t1 left outer join (select '3' c, '2' d from dual) t2 on t1.a = t2.d;   
  15.   
  16. URL本地的表示方法   
  17. sheet1.addHyperlink(new WritableHyperlink(col++,row,new URL("file:///d:/工作日志.txt")));   
  18.   


20070927
------------------------
今天发现一个codePress的Web 代码编辑器 ,可以实现代码着色,google codePress:)

sql 代码
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值