Oracle基本授权命令

-- 首先需要创建一个表空间
--
1.创建表空间
--
2.规定文件路径
--
3.设定文件大小 自动增长打开
create  tablespace Product
datafile 
' e:\product.dbf '
size 10m autoextend 
on ;

-- 创建用户
--
1.创建用户
--
2.设定密码
--
3.设定默认的表空间
create   user  prod
identified 
by  prod
default  tablespace Product;

-- 删除用户
--
1.删除用户和用户所有的模式对象
--
2.删除用户
drop   user  prod  cascade ;
drop   user  prod;

-- 授权用户登陆数据库权限(system名下)
grant  connect  to  Prod;

-- 授权用户创建表权限(system名下)
grant  resource  to  Prod;

-- 用户a授权b操作表的权限
--
1.a给予b查询权限
--
2.a给予b更新权限
grant   select   on  a  to  b;
grant   update   on  a  to  b;

-- 创建表
create   table  ProductDetails
(
Pro_no 
number ,
Pro_id 
varchar2 ( 10 ),
Pro_name 
varchar2 ( 10 ),
Pro_price 
number ( 3 )
)
;

-- 察看表的数据类型
desc  ProductDetails;

-- 更新表(表必须为空)
--
1.修改表的字段
--
2.向表中添加新列
--
3.删除表的一个字段
alter   table  ProductDetails 
modify(Pro_no 
int   not   null   primary   key );
alter   table  ProductDetails 
add (Pro_count  int );
alter   table  ProductDetails 
drop  colum Pro_count;

转载于:https://www.cnblogs.com/shinepolo/articles/1190768.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值