Oracle创建表空间及用户--亲测有效

创建表空间

create tablespace FLAS_LOG--表空间名称
datafile '/oracle/oradata/flas_log/flas_log.dbf'--表空间的文件地址
size 1M autoextend on next 50M maxsize unlimited;--autoextend on:自增;next 50M:自增的大小;maxsize unlimited:不限制最大空间

创建用户

create user FLAS_LOG--用户名
identified by "FLAS_LOG"--密码
default tablespace FLAS_LOG--默认表空间
profile DEFAULT--profile设为默认
ACCOUNT UNLOCK;--解锁用户

设置权限

grant dba to FLAS_LOG;--授DBA权限
grant unlimited tablespace to FLAS_LOG;--表空间无限增长权限

删除

drop tablespace FLAS_LOG including contents and datafiles cascade constraint;--删除表空间

==================================================================================================

--以system用户登录,查找需要删除的用户:
--查找用户
select  * from dba_users;
--查找工作空间的路径
select * from dba_data_files; 
--删除用户
drop user FLAS_LOG cascade;
--删除表空间
drop tablespace 表空间名称 including contents and datafiles cascade constraint;
--例如:删除用户名成为LYK,表空间名称为LYK
--删除用户,及级联关系也删除掉
drop user LYK cascade;
--删除表空间,及对应的表空间文件也删除掉
drop tablespace LYK including contents and datafiles cascade constraint;
--授权
grant connect to user_name;
grant create indextype to user_name;
grant create job to user_name;
grant create materialized view to user_name;
grant create procedure to user_name;
grant create public synonym to user_name;
grant create sequence to user_name;
grant create session to user_name;
grant create table to user_name;
grant create trigger to user_name;
grant create type to user_name;
grant create view to user_name;
grant unlimited tablespace to user_name;
alter user user_name quota unlimited on tbs_name;

猜你喜欢

转载自blog.csdn.net/weixin_44182586/article/details/108458861