日期:2014-05-16  浏览次数:20416 次

论坛数据库设计SQL建表一

使用前,采用oracle 10g数据库,通过写sql语句创建表空间,之后才好建表。

1.创建临时表空间:

CREATE TEMPORARY TABLESPACE bbs_temp
TEMPFILE 'D:\oradata\myoracle\bbs_temp.dbf'
SIZE 16M
AUTOEXTEND ON
NEXT 16M MAXSIZE 256M
EXTENT MANAGEMENT LOCAL;

?

2.创建表空间

CREATE TABLESPACE bbs_data
LOGGING
DATAFILE 'D:\oradata\myoracle\bbs_data.DBF'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;

?

3.?创建用户并制定表空间

CREATE USER ceran IDENTIFIED BY eason789
DEFAULT TABLESPACE bbs_data
TEMPORARY TABLESPACE bbs_temp;

?

4.给用户授予权限

GRANT
  CREATE SESSION, CREATE ANY TABLE, CREATE ANY VIEW ,CREATE ANY INDEX, CREATE ANY PROCEDURE,
  ALTER ANY TABLE, ALTER ANY PROCEDURE,
  DROP ANY TABLE, DROP ANY VIEW, DROP ANY INDEX, DROP ANY PROCEDURE,
  SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE
  TO ceran;