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

Oracle创建用户、表空间并设置权限

时间:2016-04-27 12:32:18      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

代码:

sqlplus /nolog

conn / as sysdba

//创建账号
create user techrpt_data identified  by techrpt_data ;

//创建临时表空间
create temporary tablespace TECHRPT_DATA_TEMP
tempfile D:\ORACLE\ORADATA\ORCL\TECHRPT_DATA_TEMP.dbf
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;

//将空间分配给用户
alter user techrpt_data temporary tablespace TECHRPT_DATA_TEMP;

//创建表空间
create tablespace TECHRPT_DATA 
logging  
datafile D:\ORACLE\ORADATA\ORCL\TECHRPT_DATA.ora 
size 50m  
autoextend on  
next 50m maxsize 2048m  
extent management local; 

//将空间分配给用户
alter user techrpt_data default tablespace TECHRPT_DATA ;

grant sysdba to techrpt_data;
grant connect,resource to techrpt_data;
grant create session to techrpt_data;
grant create any sequence to techrpt_data;
grant create any table to techrpt_data;
grant delete any table to techrpt_data;
grant insert any table to techrpt_data;
grant select any table to techrpt_data;
grant unlimited tablespace to techrpt_data;
grant execute any procedure to techrpt_data;
grant update any table to techrpt_data;
grant create any view to techrpt_data;

commit;

quit;


//删除用户
sqlplus
system/manager@orcl as sysdba
drop user techrpt_data cascade;



//用SYS登录,授权给相应的用户,授权SQL如下: (在执行菜单里你可以禁止统计,或在v$session,v$sesstat和v$statname 表里获得选择权限。)
grant select on v_$statname to techrpt_data; 
grant select on v_$sesstat to techrpt_data; 
grant select on v_$session to techrpt_data; 
grant select on v_$mystat to techrpt_data; 


//修改密码
SET ORACLE_SID = 你的SID名称
sqlplus/nolog
connect/as sysdba
alert user sys identified by sys
alert user system identified by system

//删除表空间
drop tablespace techrpt_data including contents and datafiles;

 

Oracle创建用户、表空间并设置权限

标签:

原文地址:http://www.cnblogs.com/s0611163/p/5438003.html

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