Oracle ユーザーのテーブルスペース、テーブルスペースパス、ロール、権限の確認

1.現在のユーザのデフォルトのテーブルスペースを表示する
select username,default_tablespace from user_users;
–XUSER XUSER_DATA

2.テーブル空間を検索、臨時テーブルスペースを含む
select tablespace_name from dba_tablespaces;
–XUSER_TEMP
–XUSER_DATA
3.テーブル空間のパスを検索
select name from v$datafile
–/u01/app/oracle/oradata/orcl/xuser_data.dbf
4.テーブルスペースパスのを検索
select * from DBA_DATA_FILES;
–/u01/app/oracle/oradata/orcl/xuser_data.dbf

5.一時表スペースのパスを検索
select * from dba_temp_files;
–/u01/app/oracle/oradata/orcl/xuser_temp.dbf

6.ユーザーのロールを検索
select * from user_role_privs;
–XUSER CONNECT
–XUSER DBA
–XUSER RESOURCE

7.ユーザのシステム権限を検索
select * from user_sys_privs;
–XUSER UNLIMITED TABLESPACE
8.テーブルの空サイズ、利用状況
select dbf.tablespace_name,
dbf.totalspace “総量(M)",
dbf.totalblocks as ブロックの合計数,
dfs.freespace “残量(M)",
dfs.freeblocks “残りのブロック",
(dfs.freespace / dbf.totalspace) * 100 “アイドル割合"
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)

9.一時表スペースのサイズ、使用状況
SELECT D.TABLESPACE_NAME,SPACE “SUM_SPACE(M)",BLOCKS SUM_BLOCKS,
USED_SPACE “USED_SPACE(M)",ROUND(NVL(USED_SPACE,0)/SPACE*100,2) “USED_RATE(%)",
NVL(FREE_SPACE,0) “FREE_SPACE(M)"
FROM
(SELECT TABLESPACE_NAME,ROUND(SUM(BYTES)/(1024*1024),2) SPACE,SUM(BLOCKS) BLOCKS
FROM DBA_TEMP_FILES
GROUP BY TABLESPACE_NAME) D,
(SELECT TABLESPACE_NAME,ROUND(SUM(BYTES_USED)/(1024*1024),2) USED_SPACE,
ROUND(SUM(BYTES_FREE)/(1024*1024),2) FREE_SPACE
FROM V$TEMP_SPACE_HEADER
GROUP BY TABLESPACE_NAME) F
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)

DataBase

Posted by arkgame