[root@localhost ~]# su - oracle
[oracle@localhost ~]$ sqlplus /nolog
SQL> conn /as sysdba;
SQL> show user;
USER is "SYS"
SQL> select name from v$datafile;
//创建临时表空间
create temporary tablespace xsgj_temp
tempfile '/opt/oradata/WULIU/xsgj_temp.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
//创建数据表空间
create tablespace xsgj_data
logging
datafile '/opt/oradata/WULIU/xsgj_data.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
//创建用户并指定表空间 http://hovertree.com/menu/oracle/
create user xsgj identified by xsgjmm
default tablespace xsgj_data
temporary tablespace xsgj_temp;
//给用户授予权限
grant connect,resource to xsgj;
//授dba权限
grant dba to xsgj;
//授dblink权限
grant create public database link to xsgj;
//以后以该用户登录,创建的任何数据库对象都属于test_temp 和test_data表空间,这就不用在每创建一个对象给其指定表空间了。
附加:
表空间的位置可以用一下的查询语句来查询
select name from v$datafile;