1.首先,创建(新)用户:
create user username identified by password;
username:新用户名的用户名
password: 新用户的密码
也可以不创建新用户,而仍然用以前的用户,如:继续利用system用户
2.创建表空间:
create tablespace tablespacename datafile 'c:\data.dbf' size xxxm;
tablespacename:表空间的名字
d:\data.dbf':表空间的存储位置
xxx表空间的大小,m单位为兆(M)
3.将空间分配给用户:
alter user username default tablespace tablespacename;
将名字为tablespacename的表空间分配给username
4.给用户授权:
grant create session,create table,unlimited tablespace to username;
5.录之后创建表即可。
conn username/password;
以下为SQLPus运行过程:
SQL*Plus: Release 11.2.0.1.0 Production on 星期五
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: sys as sysdba
输入口令:
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user wangwei identified by wangwei;
用户已创建。
SQL> create tablespace myoracle datafile 'c:\File\data.dbf' size 100m;
表空间已创建。
SQL> alter user wangwei default tablespace myoracle;
用户已更改。
SQL> grant create session,create table,unlimited tablespace to wangwei;
授权成功。
SQL> conn wangwei/wangwei;
已连接。
SQL>