1 查看undo資料表空間的undo段
select segment_name,tablespace_name from dba_rollback_segs;
2 查看線上undo segment資訊
select * from v$rollname;
3 查看資料庫上所有角色
select * from dba_roles;
4 查看某個使用者的角色
select granted_role,admin_option from dba_role_privs where grantee='SCOTT';
5 查看某角色所擁有的許可權
select role,privielege,admin_option from role_sys_privs where role='角色名稱';
6 同義字
其實就是資料庫等的一個別名,如果很長的話可以用這個別名來代替,比如
create public synonym book for xxx.xxxxx;
7 oracle建議資料表空間大小
系統資料表:400M
使用者表:120M
暫存資料表:100M
索引表:70
工具表:12M
復原表:250M
8 查看當前資料庫各個資料表空間使用方式:
select df.tablespace_name "資料表空間名",totalspace "總空間M",freespace "剩餘空間M",round((1-freespace/totalspace)*100,2) "使用率%"
from
(select tablespace_name,round(sum(bytes)/1024/1024) totalspace
from dba_data_files
group by tablespace_name) df,
(select tablespace_name,round(sum(bytes)/1024/1024) freespace
from dba_free_space
group by tablespace_name) fs
where df.tablespace_name=fs.tablespace_name;
9 片段空間
合拼資料表空間的空閑空間: alter tablespace users coalesce;
整理自由空間片段
SMON進程會不斷掃描,合拼相鄰的自由空間,但要設定pctincrease非0,一般設定為1
alter tablespace temp default storage(pctincrease 1);