---
title: "创建oracle表空间"
author: "winhyt"
date: "2010-10-17T00:20:19Z"
tags: ["Oracle"]
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2010-10-17T00:21:20Z"
id: 786598
url: "https://winhyt.iteye.com/blog/786598"
---

一、创建临时表空间
<span style="color:red">下面的语句是错误的：如果创建临时表空间 需要加上temporary 关键字，否则就会报
	“ORA-02180: 无效的 CREATE TABLESPACE 选项“错误</span>create  tablespace ts_tab_tmp
 tempfile 'e:\oracle\product\10.2.0\oradata\orcl\ts_tab_tmp.dbf' 
 size 100M 
 autoextend on next 2M 
 maxsize 1024M 
 extent management local;

正确的命令语句是：
create temporary  tablespace ts_tab_tmp
 tempfile 'e:\oracle\product\10.2.0\oradata\orcl\ts_tab_tmp.dbf' 
 size 100M 
 autoextend on next 2M 
 maxsize 1024M 
 extent management local;

二、创建表空间：
	create tablespace ts_tab_base 
   datafile 'e:\oracle\product\10.2.0\oradata\orcl\ts_tab_base.dbf' 
   size 100M 
   autoextend on next 2M
   maxsize 1024M
   extent management local;	
三、创建用户并制定表空间
	create user crm_app_user
    identified by bss_crm_xxp15
    default tablespace ts_tab_base
    temporary tablespace ts_tab_tmp;
四、给创建的用户赋权：
	<span style="color:red">--如果不知道该赋什么权限给用户可以通过下面两个语句查找具有类似功能的用户 
select *  from dba_sys_privs where grantee = 'SCOTT'

select * from dba_role_privs where grantee = 'SCOTT'</span>
--给用户赋权
grant CONNECT,RESOURCE to crm_app_user;