当前位置: 代码迷 >> SQL >> oracle 惯用sql
  详细解决方案

oracle 惯用sql

热度:102   发布时间:2016-05-05 15:13:37.0
oracle 常用sql
select * from v$locked_object; 查看锁

select t2.username,t2.sid,t2.serial#,t2.logon_time
  from v$locked_object t1,v$session t2
  where t1.session_id=t2.sid order by t2.logon_time; 查看锁有关的用户会话信息

alter system kill session 'sid,serial#'; 杀掉进程

select * from sys.nls_database_parameters;--查看数据库参数
select * from sys.nls_instance_parameters; --查看客户端参数
select * from sys.nls_session_parameters; --查看会话的参数

1.select os_user_name ,oracle_username,session_id from v$locked_object a,all_objects b where a.object_id=b.object_id;

通过这个命令查到锁表的那个用户和它的session_id

2.select sid,serial# from v$session where username='ABC'---username这里要大写

找到serial#,这里的sid就是上面的session_id

3.alter system kill session ‘sid,serial#’


--设置环境变量
set NLS_LANG=AMERICAN_AMERICA.UTF8

--查看字符集
select * from nls_database_parameters where parameter like 'NLS%CHARACTERSET';

--查看字符集
select * from nls_database_parameters where parameter ='NLS_CHARACTERSET';

--修改oracle字符集
connect system/oracle10g as sysdba;  
shutdown immediate;  
startup mount;  
alter system enable restricted session ;  
alter system set JOB_QUEUE_PROCESSES=0;  
alter system set AQ_TM_PROCESSES=0;  
alter database open;  
alter database character set internal_use zhs16gbk;  
shutdown immediate;  
startup; 




  相关解决方案