【common】oracle
解决锁表:
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='PORTALSP28'---username这里要大写
找到serial#,这里的sid就是上面的session_id
3.alter system kill session ‘sid,serial#’
另外tomcat/bin下面加了一个stop.sh脚本文件用来停止tomcat进程:
#!/bin/sh
cur_path=`pwd`
ps_no=`ps -ef |grep $cur_path |awk '{print $2}'`
kill -9 $ps_no
查看数据库表空间剩余
select tablespace_name,(bytes)/1024/1024 from dba_free_space;
查看表空间使用和剩余
select ff.s tablespace_name,
ff.b total,
(ff.b - fr.b) usage,
fr.b free,
round((ff.b - fr.b) / ff.b * 100) || '% ' usagep
from (select tablespace_name s, sum(bytes) / 1024 / 1024 b
from dba_data_files
group by tablespace_name) ff,
(select tablespace_name s, sum(bytes) / 1024 / 1024 b
from dba_free_space
group by tablespace_name) fr
where ff.s = fr.s;
查看表空间数据文件
select * from dba_data_files;