Oracle用户、表空间

表空间

创建表空间来存储用户创建的表
创建表空间需要权限,使用管理员权限登录sqlplus

不使用密码,用管理员权限登录sqlplus

打开cmd窗口,输入sqlplus /nolog 然后输入connect / as sysdba;就可使用管理员权限登录sqlplus

新建表空间
/*
创建表空间的语法
create tablespace 表空间名 datafile '表空间文件存储路径' size 大小
 autoextend on(开启自动扩大空间) next 大小 maxsize 大小(每次增加多少表空间,表空间最大容量)
*/
create tablespace testdemo_data datafile 'G:\app\myoracledata\testdemo_data.dbf' 
size 10M autoextend on next 5M maxsize 50M;
删除表空间
/*
删除表空间语法
drop tablespace 表空间名;
*/
drop tablespace testdemo_data; //这样只是删除表空间,并没有删除表空间文件
drop tablespace testdemo_data including contents and datafiles;

用户

新建用户
/*
新建用户语法
create user 用户名 identified by 密码 default tablespace 表空间名
用户新建的表都会存储到盖表空间中
*/
create user testdemo identified by testdemo default tablespace testdemo_data;
修改密码
/*
修改密码语法
alter user 用户 identified by 密码;
*/
alter user testdemo identified by test;
删除用户
/*
删除用户语法
drop user 用户;
*/
drop user testdemo;

用户授权

新建的用户是处于锁定状态,不能够登录数据库,要授权后才可以登录。

授权语法:grant 权限 to 用户
grant create session to testdemo //给用户登录权限
grant create table to testdemo //给用户创建表的权限
grant create view to testdemo //给用户创建视图的权限
grant create procedure to testdemo //给用户创建存储过程的权限
…….oracle对权限管理很严格,一般给普通用户的权限可以使用oracle系统内置的两个角色完成。(角色是什么,在后面的文章中详细说)
grant connect,resource to testdemo;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值