您的位置:首页 > 其它

得到当前用户的session id和修改和表空间查看

2015-03-24 10:13 309 查看
--得到当前用户的session id

SELECT SID FROM V$MYSTAT WHERE ROWNUM =1;

--cps206改成你想要的global_name 然后重启数据库

ALTER DATABASE RENAME GLOBAL_NAME TO cps206 ;

-- 查看表空间已使用情况

select a.tablespace_name,

round(a.bytes / 1024 / 1024) "Sum MB",

round((a.bytes - b.bytes) / 1024 / 1024) "used MB",

round(b.bytes / 1024 / 1024) "free MB",

round(((a.bytes - b.bytes) / a.bytes), 2) "percent_used"

from (select tablespace_name, sum(bytes) bytes

from dba_data_files

group by tablespace_name) a,

(select tablespace_name, sum(bytes) bytes, max(bytes) largest

from dba_free_space

group by tablespace_name) b

where a.tablespace_name = b.tablespace_name

order by ((a.bytes - b.bytes) / a.bytes) desc;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐