Oracle 创建用户以及表空间Sql

—创建表空间
CREATE TABLESPACE REGISTRY //创建表空间test_data
LOGGING
DATAFILE ‘E:\oracledata\oracledata\REGISTRY_DATA.DBF’ //创建的数据文件
SIZE 32M //初始大小
AUTOEXTEND ON //数据文件自动扩容
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;

—创建 用户

语法格式:create user userName identified by password;

一般创建用户都需要制定默认的属性:
1、认证方式
2、认证密码
3、默认的永久表空间,临时表空间
4、表空间配额
5、用户账号状态(locked or unlocked)
6、密码状态(expired or not)

所有的数据都包含有内部账户(internal accounts),这些自动创建的用户,使得特别的
oracle特性或者组件拥有他们自己的schema。为保证这些账户被未经授权的使用,这些
账户是lock的,密码设置为expire。

用户创建过程中的注意事项:
1、对temporary tablespace不能指定配额。
2、如果没有为用户指定默认表空间,将使用system表空间,强烈建议指定默认表空间。
3、默认表空间不能是undo tablespace或者temporary tablespace。
4、如果没有为用户指定默认表空间,临时表空间,用户将使用system表空作为默认表空间
与临时表空,强烈避免出现此种状况。

创建的用户的sql格式:

create user oracleusr –用户名:oracleuser
identified by oracle —登陆验证密码:oracle (密码是大小写敏感的)
default tablespace users –用户的默认表空间:users
quota 10m on users —默认表空间中可以使用的空间配额:10MB
temporary tablespace temp –用户使用的临时表空间
password expire; —密码状态,过期。登陆的时候要求用户修改。

创建yygh格式案例:
0-------------创建用户
create user yygh identified by yygh  default tablespace REGISTRY
quota 40m on users 
temporary tablespace temp;   
1-------------赋予用户权限
grant create session to yygh;//授予yygh用户创建session的权限,即登陆权限

grant connect,resource to yygh;  ---登录和资源权限

  grant unlimited tablespace to yygh;//授予yygh用户使用表空间的权限

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

  grant delete any table to yygh;//授予删除表的权限

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

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

grant select any table to yygh;  ----查询表的权限

grant create any sequence to yygh;----创建序列

  grant select any table to yygh;–查询表的权限

grant execute any procedure to yygh;  ---执行存储过程的权限

grant create any view to yygh;  ---创建视图的权限

参考资料

【1】http://www.cnblogs.com/shlcn/archive/2011/07/21/2112879.html
【2】http://blog.csdn.net/small____fish/article/details/7920126
【3】http://blog.csdn.net/starnight_cbj/article/details/6792364

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

老王学Java

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值