ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle学习笔记-1

Oracle学习笔记-1

原创 Linux操作系统 作者:dakulaDL 时间:2009-09-18 15:03:13 0 删除 编辑

       真的是空间,里面空荡荡的,自己都看不下去了,所以打算把学习的过程记录在这里,希望这次能够坚持下来,不再是三分钟热血,新手涂鸦,高人可以飘过了.

        Oracle数据字典

       数据字典里面存储用户信息,用户权限信息,数据对象信息,约束条件和统计分析数据库的视图等,通常情况不能手工修改数据字典里的信息(也不建议这么做).

      有两个系统视图DICTIONARY(同义词DICT),DICT_COLUMNS存储数据字典功能的描述

      DICTIONARY      包含全部数据字典表的名称和解释,

     DICT_COLUMNS   包含全部数据字典表的字段的名称和解释

可惜都是英文的,翻译也挺费劲.

查看用户和默认表空间

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;

前缀user_一般代表用户本身的对象

前缀user_一般代表用户能访问的所有对象

前缀dba_一般代表系统管理员能看见的对象,包括一些系统对象等.

查看用户下所有的表

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;

查看索引个数和类别

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');

 查看某表的约束条件

 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;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11289933/viewspace-615010/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2008-09-16

  • 博文量
    23
  • 访问量
    96487