Oracle常用查询语句
1、查共有多少个表空间
select * from Dba_Tablespaces;
2、查询所有用户对应有哪些表空间的权限
select a2.username,a1.privilege from dba_sys_privs a1 , user_role_privs a2 where a1.privilege = '表空间名' and a1.grantee =a2.granted_role;
3、查询某个用户下面有哪个表空间
select distinct a.tablespace_name from dba_segments a where a.owner ='用户名';
4、删除表空间
(PS:如果想要删除的干净点直接复制这句话就可以:drop tablespace 表空间名字 including contents and datafiles;)
drop tablespace 表空间名 including contents and datafiles;
5,修改用户TEST的密码为TEST0
alter user TEST identified by TEST0;
6,数据库用户被锁定后解锁用户
alter user ,TEST account unlock;
7,查看数据库具体版本;
select * from product_component_version;
8,执行指定路径下的sql脚本
SQL>@路径/文件名.sql;
9,显示当前连接用户
show user
10,查看表空间存储情况
select segment_name,sum(bytes),count(*) ext_quan from dba_extents where tablespace_name='表空间名' and segment_type='TABLE' group by tablespace_name,segment_name;