查看被锁的表
select p.spid,a.serial#, c.object_name,b.session_id,b.oracle_username,b.os_user_name from v$process p,v$session a, v$locked_object b,all_objects c where p.addr=a.paddr and a.process=b.process and c.object_id=b.object_id
查看连接的进程
SELECT sid, serial#, username, osuser FROM v$session;
杀掉进程
alter system kill session 'sid,serial#';
查看当前用户下表的占用空间
Select Segment_Name, Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
查询所有对象占用空间
select owner, segment_name,sum(bytes/1024/1024) from dba_segments
group by owner,segment_name
查询数据库中各对象占用空间大小
Select Segment_Name,b.object_type, Sum(bytes)/1024/1024 From User_Extents a,user_objects b
where a.segment_name=b.object_name Group By Segment_Name,b.object_type order by object_type, Segment_Name
oracle 中去除字段中的回车符
update ywj_yxglobj set table_name = replace(table_name,chr(10),'')
where table_name like 'ACCT_INFO%'
ASCII()
c1是一字符串,返回c1第一个字母的ASCII码,他的逆函数是CHR()
SELECT ASCII('A') BIG_A,ASCII('z') BIG_z FROM empBIG_A BIG_z65 122
CHR(<i>)[NCHAR_CS]
i是一个数字,函数返回十进制表示的字符
select CHR(65),CHR(122),CHR(223) FROM empCHR65 CHR122 CHR223A z B
如何查出UNDO中的空间是被哪个session占用的?
SELECT r.name 回滚段名,
s.sid,
s.serial#,
s.username 用户名,
s.status,
s.SQL_ADDRESS,
t.cr_get,
t.phy_io,
t.used_ublk,
t.noundo,
substr(s.program, 1, 78) 操作程序
FROM sys.v_$session s,sys.v_$transaction t,sys.v_$rollname r
WHERE t.addr = s.taddr and t.xidusn = r.usn
查看表空间的名称及大小
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
查看表空间物理文件的名称及大小
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name;
查看回滚段名称及大小
select segment_name, tablespace_name, r.status,
(initial_extent/1024) InitialExtent,(next_extent/1024) NextExtent,
max_extents, v.curext CurExtent
From dba_rollback_segs r, v$rollstat v
Where r.segment_id = v.usn(+)
order by segment_name ;
查看控制文件
select name from v$controlfile;
查看日志文件
select member from v$logfile;
查看表空间的使用情况
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE"
FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME;
查看数据库库对象
select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status;
查看数据库的版本
Select version FROM Product_component_version
Where SUBSTR(PRODUCT,1,6)='Oracle';
查看数据库的创建日期和归档方式
Select Created, Log_Mode, Log_Mode From V$Database;
查询数据库中索引占用表空间的大小
select a.segment_name,a.tablespace_name,b.table_name,a.bytes/1024/1024 mbytes,a.blocks
from user_segments a, user_indexes b
where a.segment_name = b.index_name
and a.segment_type = 'INDEX' --索引
and a.tablespace_name='APPINDEX' --表空间
and b.table_name like '%PREP%' --索引所在表
order by table_name,a.bytes/1024/1024 desc
关键词标签:oracle
相关阅读
热门文章 Oracle中使用alter table来增加,删除,修改列oracle中使用SQL语句修改字段类型-oracle修使用低权限Oracle数据库账户得到管理员权限Oracle对user的访问控制
人气排行 ORACLE SQL 判断字符串是否为数字的语句Oracle中使用alter table来增加,删除,修改列的语法ORACLE和SQL语法区别归纳(1)oracle grant 授权语句如何加速Oracle大批量数据处理Oracle删除表的几种方法ORACLE修改IP地址后如何能够使用Oracle 10g创建表空间和用户并指定权限
查看所有0条评论>>