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

创建oracle用户,给用户授权

时间:2017-02-22 13:07:48      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:新建   count   cal   creat   grant   bytes   font   user   select   

1、查询所有表空间

select dbf.tablespace_name,

dbf.totalspace "总量(M)",

dbf.totalblocks as 总块数,

dfs.freespace "剩余总量(M)",

dfs.freeblocks "剩余块数",

(dfs.freespace / dbf.totalspace) * 100 "空闲比例"

from (select t.tablespace_name,

sum(t.bytes) / 1024 / 1024 totalspace,

sum(t.blocks) totalblocks

from dba_data_files t

group by t.tablespace_name) dbf,

(select tt.tablespace_name,

sum(tt.bytes) / 1024 / 1024 freespace,

sum(tt.blocks) freeblocks

from dba_free_space tt

group by tt.tablespace_name) dfs

where trim(dbf.tablespace_name) = trim(dfs.tablespace_name);

2、查询表空间HBZF的信息(如无可用的表空间需要新建一个表空间

select t.*  from sys.dba_data_files t where t.tablespace_name =‘HBZF‘;

3、创建新的用户

create user bthb_wjgl

  identified by "bthb_wjgl"

  default tablespace HBZF 

  profile DEFAULT

  ACCOUNT UNLOCK;

4、给用户授权

grant connect,dba to bthb_wjgl;

5、查询HBZF表空间的所有用户

select * from dba_users t where t.default_tablespace =‘HBZF‘

创建oracle用户,给用户授权

标签:新建   count   cal   creat   grant   bytes   font   user   select   

原文地址:http://www.cnblogs.com/lkzp123456/p/6428198.html

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