1. 查找字段中的换行符
select * from lggzw.gzw_cent_conversation where content like '%'||chr(13)||chr(10)||'%'
2. 查看锁表原因,并进行解锁锁定的表
2.1. ORACLE中查看当前系统中锁表情况
查询SQL如下:
--内容更丰富
select
s.sid,
s.serial#,
lock.oracle_username,
lock.os_user_name,
dba.object_name,
lock.locked_mode
from v$locked_object lock, dba_objects dba, v$session s, v$process p
where dba.object_id = lock.object_id
and lock.session_id = s.sid
and object_name = '表名';
--比较简洁能直接看出表名
select
b.owner TABLEOWNER,
b.object_name TABLENAME,
c.OSUSER LOCKBY,
c.USERNAME LOGINID,
c.sid SID,
c.SERIAL# SERIAL
from v$locked_object a,dba_objects b, v$session c
where b.object_id = a.object_id
AND a.SESSION_ID =c.sid;
2.2查询是什么SQL引起了锁表的原因,SQL如下:
select
l.session_id sid,
s.serial#,
l.locked_mode,
l.oracle_username,
s.user#,
l.os_user_name,
s.machine,
s.terminal,
a.sql_text,
a.action
from v$sqlarea a, v$session s, v$locked_object l
where l.session_id = s.sid and s.prev_sql_addr = a.address
order by sid, s.serial#;
2.3ORACLE解锁的方法
alter system kill session 'SID,serial#'; --SID和Serial#共同确定一唯一的session。
3 oracle 中的空间计算
--1.计算面积
select
c.code,
c.gridname,
round(SDO_GEOM.SDO_AREA(c.GEOM, m.diminfo,'unit=SQ_METER'))
from worknet_poly c, MDSYS.USER_SDO_GEOM_METADATA m
where m.table_name = 'WORKNET_POLY'
and m.COLUMN_NAME = 'GEOM';
4 在plsql中导入sql文件
start D:\aa.sql
网友评论