oracle经常用到的 语句(未完待续)
来源:互联网 发布:java闰年的判断 编辑:程序博客网 时间:2024/04/29 09:37
1、查询所有表空间的大小和名称
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name
2、查看表空间物理文件的名称和大小
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name;
3、查看表空间的使用状况
select sum(bytes)/(1024*1024) free_space,tablespace_name
from dba_free_space
group by tablespace_name;
4、查询用户属于哪个表空间
select username,default_tablespace from dba_users order by username;
5、知道表空间名,显示该表空间下包含的表
select * from all_tables where tablespace_name='表空间名' (大写)
6、知道表名,查看属于哪个表空间
select tablespace_name,table_name from user_tables where table_name='表名称';
7、两个用户间表的复制和查询,授权语句
grant select any table to 用户;
select 'grant all on'||table_name||'to user2;'from all_tables where owner=upper('user1');
8、查询本用户下所有的表和试图
select * from user_tab_comments ;
9、将用户移动到指定表空间
alter user andyu default tablespace test;
10、查看表的约束与索引
select table_name,constraint_name,constraint_type from user_constraints(或者DBA_constraints)
where table_name='大写表名'
select * from user_indexes (或者all_indexes)
where table_name='大写表名'
11、查询数据文件
SELECT FILE_ID,FILE_NAME FROM DBA_DATA_FILES;
12、查询表空间及其关联的数据文件
select ts.tablespace_name,df.file_name,df.file_id,df.status
from dba_tablespaces ts,
(select tablespace_name,file_id,file_name,status
from dba_data_files
union all
select tablespace_name,file_id,file_name,status
from dba_temp_files) df
where ts.tablespace_name=df.tablespace_name
13、权限与角色的查询
① select * from dba_roles;查询有多少角色
② select * from dba_role_privs where grantee='用户名(大写)' 用户拥有的角色
③select * from dba_sys_privs where grantee='角色名(大写)' 角色的系统权限
select * from dba_tab_privs where grantee='角色名(大写)' 角色的对象权限
识别’低效执行’的SQL语句
- oracle经常用到的 语句(未完待续)
- 笔试面试经常考察的知识点收集(未完待续)
- 逆向技术用到的相关工具(未完待续。。。)
- ORACLE常用监控语句(未完待续)
- 经常用到的 编程语句
- [Oracle]学习Oracle数据库的简单笔记(未完待续)
- Oracle数据库的逻辑结构未完待续、、、
- Oracle学习笔记(未完待续)
- 速成笔记:Oracle(未完待续....)
- Oracle DBA常用命令(未完待续)
- 一些经常用到的SQL语句
- 开发中经常用到的sql语句:
- mysql常用语句【未完待续】
- oracle 日期经常用到的转换
- 经常用到的oracle系统视图
- 经常用到的导入导出oracle
- Oracle经常用到的一些函数
- 追求最强的vim(未完待续)
- asp.net的menu控件在ie8 中的问题
- PopupWindow和按键消息
- iPhone:The truth about synchronous NSURLConnection
- Yelp.VS.Angie’s List,谁将获胜?
- javascript中的正则匹配函数exec(),test(),match()
- oracle经常用到的 语句(未完待续)
- 栅格那点儿事(零)
- oracle 行列转化
- 并查集
- java线程之Thread(大部分内容来自于think in java 3th,Bruce Eckel)
- 无密码验证ssh连接设置
- testetsetsetestsets
- ffmpeg和SDL指南2---输出到屏幕
- The example of Using Executors