zoukankan      html  css  js  c++  java
  • Oracle 查询用户所有表、表的索引、存储过程、存储函数和视图信息

    1.查询某个用户的所有表

    select * from all_tables where owner='SCOTT';--SCOTT为用户名,用户名必须是大写

    2.查看当前登录的用户的表:

    select * from user_tables;

    3.查询表的触发器信息

    select trigger_name from all_triggers where table_name='EMP';--EMP为表名称,表名称必须大写

    4.查询出触发器的详细信息

    select * from all_source where name='HELLO_WORLD' and  type='TRIGGER' --name和type值都必须大写

    5.查询存储过程信息

    --存储过程和存储函数信息表 
    select
    * from all_procedures where object_name='ADD_SAL';--object_name为存储过程名称,必须大写。可以根据owner字段查询用户的存储过程和存储函数信息

     --查询存储过程详细信息

    select * from all_source where type='PROCEDURE' and name='ADD_SAL'--name为存储过程名称,必须大写

    6.索引信息:

    user_indexes 系统视图存放是索引的名称以及该索引是否是唯一索引等信息,

    user_ind_columns 统视图存放的是索引名称,对应的表和列等

    select * from all_indexes  where table_name='EMP';

    select * from user_ind_columns where table_name='EMP'

      7.视图

       1)查看当前用户视图:

    select * from user_views;

    2)查看所有视图信息:

    select * from all_views

    总结:

    查看当前用户相关信息:

    --查询当前用户的视图、表、触发器、存储函数和存储过程、索引等信息
    select *  from user_views;
    select * from user_tables;
    select * from user_triggers;
    select * from user_procedures ;
    select * from user_indexes
    --查看当前用户的角色  
    select * from user_role_privs
    --查看当前用户的系统权限和表级权限  
    select * from user_sys_privs;  
     select * from user_tab_privs;  
    --显示指定用户所具有的系统权限  
    select * from dba_sys_privs where grantee='GAME';  

    查看表或所有者的相关信息:

    select * from all_views;
    select * from all_triggers where  table_name='EMP';
    select * from all_procedures where object_name='ADD_SAL';
    select * from all_indexes where table_name='EMP';
    select * from all_source
  • 相关阅读:
    java api 中的设计模式之组合(composite)
    Java api 中设计模式之适配器模式(Adapter)
    win 7 C盘清理
    centos 与 redhat 以及 mysql 与 Oracle
    tsung生成报表时报错
    对MySQL的死连接Sleep的进程的来源研究[转]
    商派ecstore后台配置微信支付应该注意的问题
    商派crm的内存计算组件配置mysql5.6的问题
    php-curl无法编译
    ecstore目录系统预占字符
  • 原文地址:https://www.cnblogs.com/wsy0202/p/12496708.html
Copyright © 2011-2022 走看看