2. oracle创建表空间、用户并设置默认表空间、授权

1.创建用户并设置默认表空间

create tablespace tablespacename datafile 'tablespacename.dbf' size 200m autoextend on next 10m maxsize unlimited;(oracle默认位置)

create tablespace tablespacename datafile 'D:\orcletablespace\tablespacename.dbf' size 200m autoextend on next 10m maxsize unlimited;
create temporary tablespace temptablespacename tempfile 'D:\orcletablespace\temptablespacename.dbf' size 200m autoextend on next 32m maxsize 2048m extent management local;
create user username  identified by password default tablespace tablespacename temporary tablespace temptablespacename;

grant connect,resource,dba to username;

附:

--删除数据库用户
drop user test cascade;

--查询用户对应的表空间及临时表空间
select t.username,t.default_tablespace, t.temporary_tablespace from dba_users t ;

--查询表空间及其对应的物理路径
select tablespace_name, file_id,file_name, round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name;

--给原表空间扩展物理文件
alter tablespace TEST add datafile '/oracle/data/dbf/TEST_EXTEND.dbf' size 1000m autoextend on next 200m maxsize 4000m;
alter tablespace TEST add datafile '/oracle/data/dbf/TEST_EXTEND.dbf' size 1000m autoextend on next 200m maxsize unlimited;

--查询oracle中directory路径

select * from dba_directories;

 

原文地址:https://www.cnblogs.com/zkx4213/p/3929034.html