---
title: "oracle 表空间相关知识"
author: "z10one"
date: "2016-01-19T17:18:15Z"
tags: []
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2016-01-19T17:18:15Z"
id: 2272061
url: "https://z10one.iteye.com/blog/2272061"
---

--查看表空间及其路径  
select t1.name,t2.name  from v$tablespace t1,v$datafile t2 where t1.ts# = t2.ts#;

--创建临时表空间  
create temporary tablespace colectica\_temp  
tempfile 'D:\\APP\\ADMINISTRATOR\\ORADATA\\ORCL\\colectica\_temp.dbf'  
size 32m  
autoextend on  
next 32m maxsize 2048m  
extent management local;

--创建数据表空间  
create tablespace colectica\_data  
logging  
datafile 'D:\\APP\\ADMINISTRATOR\\ORADATA\\ORCL\\colectica\_data.dbf'  
size 32m  
autoextend on  
next 32m maxsize 2048m  
extent management local;

--创建用户并指定表空间  
create user colectica identified by colectica  
default tablespace colectica\_data  
temporary tablespace colectica\_temp;

--给用户授予权限  
grant connect,resource to colectica;

--表空间不够用 添加表空间  
alter tablespace colectica\_data add datafile 'D:\\APP\\ADMINISTRATOR\\ORADATA\\ORCL\\colectica\_data01.dbf' size 4056m;  
\--修改临时表空间  
 alter database tempfile 'D:\\APP\\ADMINISTRATOR\\ORADATA\\ORCL\\COLECTICA\_TEMP.dbf' resize 10240m;