码迷,mamicode.com
首页 > 数据库 > 详细

Oracle入门基础

时间:2017-01-03 19:06:15      阅读:284      评论:0      收藏:0      [点我收藏+]

标签:字典   space   选择   用户管理   proc   instr   apc   ict   next   

使用SQLplus工具登录连接

开始-》运行CMD-》

C:\Users\Admininstrator> 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用户所拥有的数据字典表中进行选择

 

Oracle入门基础

标签:字典   space   选择   用户管理   proc   instr   apc   ict   next   

原文地址:http://www.cnblogs.com/jinxiblog/p/6245273.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!