---
title: "Oracle 中的一些命令"
author: "rubys"
date: "2009-08-16T12:01:00Z"
tags: []
slug: "oracle"
draft: false
lastmod: "2009-10-29T13:44:45Z"
id: 472046
url: "https://rubys.iteye.com/blog/472046"
---

查看当前用户所属的表空间：  
    select tablespace\_name from user\_tablespaces;  
查看数据库所有的表空间\[查看的用户得有查看的权限]：  
    select tablespace\_name from dba\_tablespaces;  
查看用户的表空间配额：  
    select * from user(dba)\_ts\_quotas;  
查看用户或角色系统权限：  
    select * from dba\_sys\_privs;  
    select * from user\_sys\_privs;  
    select * from dba\_sys\_privs where grantee='用户名';  
查看角色所包含的权限：  
    select * from role\_sys\_privs;  
查看用户对象权限：  
    select * from dba\_tab\_privs;  
    select * from all\_tab\_privs;  
    select * from user\_tab\_privs;  
查看所有角色：  
    select * from dba\_roles;  
查看用户所拥有的角色：  
    select * from dba\_role\_privs;  
    select * from user\_role\_privs;  
查看 oracle 中提供的系统权限：  
    select * from sys.system\_privilege\_map;  
向某一用户授予不限制的表空间：      
    grant unlimited tablespace to 用户名  
修改表空间配额：  
    alter user 用户名 quota 10M on 表空间名  
收回系统权限：  
    revoke system\_privs from {user|role|public}  
用户锁定及解锁  
　　alter user 用户名 account lock(unlock)

查找某一表中的字段的注释：

     select * from user\_col\_comments where table\_name='表名\[大写]'

查找表的注释：

     select * from user\_tab\_comments where table\_name='表名\[大写]'