有时候需要导出某用户下的所有table、view、sequence、trigger等信息,下面的SQL可以将这些信息select出来:
select * from user_tables;
select * from user_views;
select * from user_sequences;
select * from user_triggers;
查看当前用户的缺省表空间
SQL>select username,default_tablespace from user_users;
查看当前用户的角色
SQL>select * from user_role_privs;
查看当前用户的系统权限和表级权限
SQL>select * from user_sys_privs;
SQL>select * from user_tab_privs;
查看用户下所有的表
SQL>select * from user_tables;
1、用户
查看当前用户的缺省表空间
SQL>select username,default_tablespace from user_users;
查看当前用户的角色
SQL>select * from user_role_privs;
查看当前用户的系统权限和表级权限
SQL>select * from user_sys_privs;
SQL>select * from user_tab_privs;
显示当前会话所具有的权限
SQL>select * from session_privs;
显示指定用户所具有的系统权限
SQL>select * from dba_sys_privs where grantee=’GAME’;
2、表
查看用户下所有的表
SQL>select * from user_tables;
查看名称包含log字符的表
SQL>select object_name,object_id from user_objects
where instr(object_name,’LOG’)>0;
查看某表的创建时间
SQL>select object_name,created from user_objects where object_name=upper(‘&table_name’);
查看某表的大小
SQL>select sum(bytes)/(1024*1024) as “size(M)” from user_segments
where segment_name=upper(‘&table_name’);
查看放在ORACLE的内存区里的表
SQL>select table_name,cache from user_tables where instr(cache,’Y')>0;
3、索引
查看索引个数和类别
SQL>select index_name,index_type,table_name from user_indexes order by table_name;
查看索引被索引的字段
SQL>select * from user_ind_columns where index_name=upper(‘&index_name’);
查看索引的大小
SQL>select sum(bytes)/(1024*1024) as “size(M)” from user_segments
where segment_name=upper(‘&index_name’);
4、序列号
查看序列号,last_number是当前值
SQL>select * from user_sequences;
5、视图
查看视图的名称
SQL>select view_name from user_views;
查看创建视图的select语句
SQL>set view_name,text_length from user_views;
SQL>set long 2000; 说明:可以根据视图的text_length值设定set long 的大小
SQL>select text from user_views where view_name=upper(‘&view_name’);
6、同义词
查看同义词的名称
SQL>select * from user_synonyms;
7、约束条件
查看某表的约束条件
SQL>select constraint_name, constraint_type,search_condition, r_constraint_name
from user_constraints where table_name = upper(‘&table_name’);
SQL>select c.constraint_name,c.constraint_type,cc.column_name
from user_constraints c,user_cons_columns cc
where c.owner = upper(‘&table_owner’) and c.table_name = upper(‘&table_name’)
and c.owner = cc.owner and c.constraint_name = cc.constraint_name
order by cc.position;
8、存储函数和过程
查看函数和过程的状态
SQL>select object_name,status from user_objects where object_type=’FUNCTION’;
SQL>select object_name,status from user_objects where object_type=’PROCEDURE’;
查看函数和过程的源代码
SQL>select text from all_source where owner=user and name=upper(‘&plsql_name’);
相关推荐
oracle数据库表空间常用查询以及相关操作命令,实际开发中遇到的点滴备忘录
因为平时比较常用,所以贡献给大家希望大家使用,其实还可以通过命令实现表空间的扩展之类的,大家也可以试试
Oracle DBA常用运维命令大全
ORACLE常用命令 一、ORACLE的启动和关闭 1、在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a、启动ORACLE系统 oracle>svrmgrl SVRMGR>connect internal SVRMGR>startup ...
oracle 11g常用命令,如表及表空间、查询所有的链接、更改oracle dblink 最大数限制
oracle命令大全及关于oracle 1000问 日志管理,表空间管理,表,索引等等等等,非常好的资源,和大家共享!
总结了ORACLE常用命令,包含日志管理、表空间管理、用户管理等方面的操作!
在Oracle常用命令中查看表结构sqlplus 然后输入系统用户名和密码 2.创建表空间登陆别的用户 conn 用户名/密码; 3 create tablespace 空间名 4 datafile 'c:\空间名' size 15M --表空间的存放路径,初始值为15M 5 ...
Oracle常用命令2(用户、角色管理) Oracle常用命令3(DDL、DML、TCL、DCL、序列) Oracle常用命令4(表分区) Oracle常用命令5(同义词、视图、索引) Oracle常用命令6(PL/SQL) Oracle常用命令7(游标) ...
oracle常用命令,查看表空间物理文件名称及大小,查看表空间使用情况,查看oracle当前的被锁对象,查看正在执行sql的发起者程序。
导入导出 远程连接 创建表空间 用户 常用查看表列字段 误删系统数据文件处理
ORACLE常用命令之二,表空间管理方面的命令
Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
linux下Oracle常用命令,如启动数据库、启动监听、建用户、建表空间等
Oracle 表 空 间 和 用户操作,常用命令,索引常规应用
Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结.pdf
总结了oracle 数据库的常用命令, 包括创建用户,创建表,排序,增加表空间等
资源中有4个总结文档,包括oracle常用操作命令,oracle的导入导出,表空间的创建,查询一个数据库中所有语句等
oracle里的常用命令 第一章:日志管理 第二章:表空间管理 第三章:表 ... 第十二章: BACKUP and RECOVERY
Oracle新建表空间及用户的一些常用Oracle命令! 非常实用!