数据库
Oracle
新建用户和赋予不同用户相关的权限
create user user_name identified by password;`
select * from all_users; //查看所有用户
grant create table to user_name; //赋建表权限
grant create sequence, create view to user_name; //赋创建序列,视图权限
grant create SYNONYM to user_name; //赋创建同义词权限
grant create trigger to user_name; //赋创建触发器权限
grant create View,CREATE TABLE,CREATE SEQUENCE,create Trigger,create Synonym,create procedure To user_name;
select * from all_users where username='user_name'; //查询某个用户
select username from dba_users; //查询所有用户
drop user user_name cascade; //删除某个用户
alter user user_name identified by "new_password"; //修改用户密码
update set username='新用户名' where username='原用户名'; //修改用户名
grant SELECT ANY DICTIONARY to //查询数据字典
表空间
建表的时候需要创建相应的表空间,然后指定表空间(需要sysdba权限)
select username,default_tablespace from dba_users order by username;
//查询用户和对应的表空间
create tablespace group_1 datafile 'C:\Table\test.dbf' size 20m autoextend on next 5m maxsize 100m extent management local; //创建表空间
解释:
创建表空间名为:test
表空间文件:C:\Table\test.dbf
表空间大小:20m
每次自动扩展:5m
最大为:100m
extent management local :本地管理
alter user U_1_4_1_1 default tablespace test;
//将某用户指定到某个表空间alter user 数据库用户名
quota username unlimited on 表空间名;//如果不指定缺省表空间配额,则能建表但是没有记录
select username,default_tablespace from dba_users order by username;
//查询用户和对应的表空间