zoukankan      html  css  js  c++  java
  • Oracle数据库个人整理常用的表空间、用户、授权操作

    1、表空间相关sql

    -- 创建表空间名为test_tablespace_name,存储位置为D:DBoradataorcltest_tablespace_name.dbf,大小为128m,无限制,超出后每次增长10m
    create tablespace test_tablespace_name datafile 'D:DBoradataorcl	est_tablespace_name.dbf' size 128m autoextend on next 10m maxsize unlimited;
    -- 查看表空间名为test_tablespace_name信息
    SELECT file_name, tablespace_name, bytes, autoextensible
      FROM dba_data_files
     WHERE tablespace_name = 'test_tablespace_name';
    -- 删除表空间 test_tablespace_name
    alter tablespace test_tablespace_name offline;
    -- 将磁盘上的数据文件一同删除
    drop tablespace test_tablespace_name including contents and datafiles;

    2、用户相关sql

    -- 新建用户 test_user/test_password,指定表空间为test_tablespace_name
    create user test_user identified by test_password default tablespace test_tablespace_name temporary tablespace temp;
    -- 修改用户密码
    ALTER USER test_user identified by 123456;
    -- 删除用户
    DROP USER test_user CASCADE;
    -- 锁定用户
    alter user test_user account lock;
    -- 解锁用户
    alter user test_user account unlock;
    -- 查询用户信息
    select * from all_users;
    -- 更详细的用户信息
    select * from dba_users;

    3、授权相关sql

    -- 授予test_user用户dba权限
    grant resource, dba, connect, create any table, create any index, create any sequence, unlimited tablespace to test_user;
    -- 撤销test_user用户dba权限
    REVOKE resource, dba, connect, create any table, create any index, create any sequence, unlimited tablespace FROM test_user;
    --查看当前用户的系统权限
    select * from user_sys_privs;
    --查看当前用户的对象权限
    select * from user_tab_privs;
    --查看当前用户的所有角色
    select * from user_role_privs;

    4、数据导入导出

    --cmd下操作
    /********导出表******************/
    exp [用户名]/[密码]@[ip]/[数据库实例名] file=[文件名].DMP
    例如:
    exp admin/admin@127.0.0.1/ORCL file=D:jobdbbackadmin2011-08-12.DMP
    
    /********导入表******************/
    imp [用户名]/[密码]@[ip]/[数据库实例名] file=[文件名].DMP full=y
    例如:
    imp admin/admin@127.0.0.1/orcl file=D:jobdbbackadmin2011-08-12.DMP full=y
    /********导出表结构 不导出数据******************/
    exp [用户名]/[密码]@[ip]/[数据库实例名] file=[文件名].DMP rows=n
    例如:
    exp admin/admin@127.0.0.1/ORCL file=D:jobdbbackadmin2011-08-12.DMP rows=n

     

    yexiangyang

    moyyexy@gmail.com


     

  • 相关阅读:
    WordPress网站绑定多个域名的方法
    htpasswd 命令使用
    在Windows下用OpenSSL生成证书步骤
    WCF中关于List和数据的转换问题
    NET2.0的配置文件
    C# Attribute
    c#自定义属性
    VS2005中读写配置文件(方法二)
    c#的反射
    Asp.NET 操作配置文件 Steven Pei 博客园
  • 原文地址:https://www.cnblogs.com/moy25/p/8461354.html
Copyright © 2011-2022 走看看