首页 > 代码库 > oracle

oracle

查看oracle server端字符集

select userenv(‘language‘) from dual;

如果显示如下,一个汉字占用两个字节

SIMPLIFIED CHINESE_CHINA.ZHS16GBK

如果显示如下,一个汉字占用三个字节

SIMPLIFIED CHINESE_CHINA.AL32UTF8

可以用以下语句查询一个汉字占用的字节长度

select lengthb(‘你‘) from dual;

oracle 锁表查询

--(1)锁表查询的代码有以下的形式:select count(*) from v$locked_object;select * from v$locked_object;
--(2)查看哪个表被锁select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;
--(3)查看是哪个session引起的select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time;
/*(4)杀掉对应进程执行命令:alter system kill session‘1025,41‘;其中1025为sid,41为serial#.*/

oracle