---
title: "ORACLE创建表空间及用户"
author: "primarykeylw"
date: "2012-07-10T09:07:41Z"
tags: ["Oracle"]
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2012-09-07T21:40:54Z"
id: 1583756
url: "https://primarykeylw.iteye.com/blog/1583756"
---

oracle下载地址:
http://www.cnblogs.com/wenlg/archive/2010/05/19/1738893.html
----------------------------------------------------------------------
Oralce中创建表空间和用户 博客分类： oraclesql
.
一、安装oracle10g数据库：

指定全局数据库名：solid；数据库口令：solid

 

二、用户通过PL/SQL登录：

1、dba连接到数据库的命令：

1)        命令窗口中执行conn  / as  sysdba（或者直接在PL/SQL中输入用户名和密码登陆）

2)        输入用户名：sys

3)        选择数据库sid：solid

4)        连接为：sysdba

5)        确定即可

 

三、通过命令创建表空间和用户：

1、    创建临时表空间

create temporary tablespace test_temp
tempfile 'D:/oracle/product/10.2.0/oradata/solid/test_temp01.dbf'
size 100M
autoextend on
next 32m maxsize 1024M
extent management local;
说明：temporary关键字指定了该表空间为临时表空间；tempfile关键字为临时表空间存放路径。

 

2、    创建数据表空间

create tablespace test_data
datafile 'D:/oracle/product/10.2.0/oradata/solid/test_data01.dbf'
size 100M
autoextend on
next 32M maxsize 1024M
extent management local;

说明：datafile关键字为数据表空间存放路径。

 

3、    在数据表空间中创建用户

create user solidwang identified by solidwang
default tablespace test_data
temporary tablespace test_temp;

说明：solidwang分别为用户名和密码；test_data为数据表空间，test_temp为临时表空间。

 

4、    为用户分配权限：

grant connect, resource to solidwang;

             

四、通过命令删除表空间和用户：

1、    删除表空间

drop tablespace test_data including contents and datafiles

2、    删除用户

drop user solidwang cascade

      

五、创建表命令：

1、    创建表

create table leave_words
(
 id varchar2(2) primary key,
 title varchar2(10),
 content varchar2(100),
 leavedata date
);


