zoukankan      html  css  js  c++  java
  • oracle_sql语句的大全

    # 建立数据库struts
      CREATE DATABASE IF NOT EXISTS struts DEFAULT CHARACTER SET GBK;

    1.登录:
    (管理员)conn sys/password as sysdba;
            connect / as sysdba;
    主要管理员:
     sys;//系统管理员,拥有最高权限
     system;//本地管理员,次高权限
     scott;//普通用户,密码默认为tiger,默认未解锁
    2.用管理员查看XE(数据库)里所有的用户:
        select username from dba_users;
    3.oracle 帐号scott被锁定 如何解锁
        1)conn sys/sys as sysdba;//以DBA的身份登录
        2)alter user scott account unlock;// 然后解锁
        3)conn scott/tiger //弹出一个修改密码的对话框,修改一下密码就可以了
    4.创建用户,修改密码:
        create user xxx identified by password;;//在管理员帐户下,创建用户xxx

        alert user scott identified by tiger;//修改密码
    5.授予权限;
        新建的用户没有任何权限,必须授予权限
      grant create session to xxx;//授予xxx用户创建session的权限,即登陆权限
      grant unlimited tablespace to xxx;//授予xxx用户使用表空间的权限

      grant create table to xxx;//授予创建表的权限

      grante drop table to xxx;//授予删除表的权限

      grant insert table to xxx;//插入表的权限

      grant update table to xxx;//修改表的权限

      grant all to public;//这条比较重要,授予所有权限(all)给所有用户(public)

      2、oralce对权限管理比较严谨,普通用户之间也是默认不能互相访问的,需要互相授权

      

      grant select on tablename to xxx;//授予xxx用户查看指定表的权限

      grant drop on tablename to xxx;//授予删除表的权限

      grant insert on tablename to xxx;//授予插入的权限

      grant update on tablename to xxx;//授予修改表的权限

      grant insert(id) on tablename to xxx;

      grant update(id) on tablename to xxx;//授予对指定表特定字段的插入和修改权限,注意,只能是insert和update

      grant alert all table to xxx;//授予xxx用户alert任意表的权限

      五、撤销权限

      基本语法同grant,关键字为revoke

      六、查看权限

      select * from user_sys_privs;//查看当前用户所有权限

      select * from user_tab_privs;//查看所用用户对表的权限
    七、权限传递
        即用户A将权限授予B,B可以将操作的权限再授予C,命令如下:

      grant alert table on tablename to xxx with admin option;//关键字 with admin option

      grant alert table on tablename to xxx with grant option;//关键字 with grant option效果和admin类似
    八、角色

      角色即权限的集合,可以把一个角色授予给用户

      create role rolename;//创建角色

      grant create session to rolename;//将创建session的权限授予myrole

      grant rolename to xxx;//授予xxx用户rolename的角色

      drop role rolename;删除角色
    =====================================
    DDL:
    1.创建表:
    ——---未完待续
        

  • 相关阅读:
    cmd utf-8 just run:CHCP 65001
    PHP5已注册的hash函数
    php扩展开发笔记1
    configure: error: cannot find neither zip nor jar, cannot continue
    configure: error: cannot compute suffix of object files: cannot compile
    configure: error: I suspect your system does not have 32-bit developement libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to b
    /usr/bin/ld: crt1.o: No such file: No such file or directory
    近两周工作总结
    我觉得好用的VS扩展(不定期更新)
    vmware虚拟机无法ping通宿主机,但宿主机可以ping通虚拟机
  • 原文地址:https://www.cnblogs.com/westward/p/5230790.html
Copyright © 2011-2022 走看看