zoukankan      html  css  js  c++  java
  • Oracle入门基础

    使用SQLplus工具登录连接

    开始-》运行CMD-》
    
    C:UsersAdmininstrator> sqlplus
    
    请输入用户名:sys@orcl as sysdba
    输入口令:root
    
    SQL> 
    
    或者直接输入 sqlplus sys/root@orcl as sysdba 进入

    查询当前用户

    SQL>show user;
    

    启用被锁定的用户username

    SQL> alter user username account unlock;
    

    创建表空间 (默认永久数据文件为xx.dbf,设置大小为100M,每次自增涨100M,TEMPFILE表示零时数据文件,根据需要而定)

    SQL>CREATE  [TEMPORARY] TABLESPACE tablespace_name TEMPFILE | DATAFILE 'xx.dbf' SIZE 100M  AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED 
    

      查看表空间的信息(注意大小写)

    SQL>SELECT * FROM dba_data_files WHERE TABLESPACE_NAME=‘TEST';
    

      修改表空间的状态(联机或者脱机)

    SQL>ALTER TABLESPACE tablesapce_name ONLINE | OFFLINE
    

      查询表空间的状态

    SQL>SELECT status from dba_tablespaces WHERE tablespace_name = 'spacename';
    

      删除表空间(选项为删除表空间的同时删除数据文件)

    SQL>DROP TABLESPACE tablespace_name [INCLUDING CONTENTS]
    

    创建用户(需要有创建用户的权限

      创建一个用户名为test的用户,密码为password,默认表空间为A,零时表空间为B

    SQL>create user test identified by password default tablespace A temporary tablespace B;
    

      删除用户

    SQL>drop user testl;
    

      给表空间授权    

        grant create session to test;          //授予test用户创建session的权限,即登陆权限
        grant unlimited tablespace to test;     //授予test用户使用表空间的权限
        grant create tablespace to test;         //授予test用户创建表空间的权限
        grant alter tablespace to test;        //授予test用户修改表空间的权限
        grant drop tablespace to test;       //授予test用户删除表空间的权限
        grant manage tablespace to test;      //授予test用户管理表空间的权限
        grant create table to test;         //授予创建表的权限(包含有create index权限, alter table, drop table权限)
        grant create view to test;             //授予用户操作视图的权限(包含有alter view, drop view权限)
        grant create trigger to test;          //授予用户操作触发器的权限(包含有alter trigger, drop trigger权限)
        grant create procedure to test;       //授予用户操作存储过程的权限(包含有alter procedure, drop procedure 和function 以及 package权限)
        grant create sequence to test;        //授予用户操作序列的权限:(包含有创建、修改、删除以及选择序列)
        grant select any dictionary to test;           //允许从sys用户所拥有的数据字典表中进行选择

  • 相关阅读:
    python的gui库tkinter
    python图像处理库Pillow基本使用方法
    github配置SSH proxy
    python的pandas库读取csv
    学习app开发思路
    shell脚本中四则运算
    shell脚本实例三
    shell脚本实例二
    shell脚本实例一
    LINUX系统下的shell命令---grep、sed、awk
  • 原文地址:https://www.cnblogs.com/jinxiblog/p/6245273.html
Copyright © 2011-2022 走看看