我用system登录,创建了一个data1名的tablespace,及index1,temp1;然后建了一个用户test;
然后我再用test登录;
我用下面的语名建了个表,写了句数据,
create table persons
(PID varchar(5),
PNAME varchar(10))select * from personsinsert into persons values('22','qqq')commit
我用下面这句查出了表
select * from user_tables
但为什么找到的persons的TABLESPACE_NAME属性是SYSTEM而不是data1呢?我不是建了个test用户,并将它指到了data1;用它登录后再建的表吗?这是为什么啊??
然后我再用test登录;
我用下面的语名建了个表,写了句数据,
create table persons
(PID varchar(5),
PNAME varchar(10))select * from personsinsert into persons values('22','qqq')commit
我用下面这句查出了表
select * from user_tables
但为什么找到的persons的TABLESPACE_NAME属性是SYSTEM而不是data1呢?我不是建了个test用户,并将它指到了data1;用它登录后再建的表吗?这是为什么啊??
//一段示例,你自己在试试!
//创建临时表空间create temporary tablespace user_temp
tempfile 'D:\oracle\oradata\Oracle9i\user_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;//创建数据表空间
create tablespace test_data
logging
datafile 'D:\oracle\oradata\Oracle9i\user_data.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;//创建用户并指定表空间
create user username identified by password
default tablespace user_data
temporary tablespace user_temp;//给用户授予权限grant connect,resource to username;
create table persons
(PID varchar(5),
PNAME varchar(10)) tablespace data1
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
创建用户的时候有指定默认的表空间吗?create user username identified by password
default tablespace data1
temporary tablespace temp; ------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
Q Q 群:62697716
create user test identified by passwd default tablespace data1;
2.如果你有在该表空间上进行操作的权限的话,那么你在建表时可以指定该表所在的表空间。
create table persons
(PID varchar(5),
PNAME varchar(10))tablespace data1;
create user test identified by test
default tablespace data01
temporary tablespace temp01
quota 0 on system;
grant connect,resource to wesleyx;
create user test identified by test
default tablespace data01
temporary tablespace temp01
quota 0 on system;
grant connect,resource to test;
(C) 版权所有 1985-2001 Microsoft Corp.C:\Documents and Settings\Admin>sqlplus "/ as sysdba"SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 30 17:55:20 2009Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> create user test identified by test
2 default tablespace users
3 temporary tablespace temp;User created.SQL> grant connect,resource to test;Grant succeeded.SQL> conn test/test
Connected.
SQL> create table persons(id number,name varchar2(20));Table created.
SQL> select table_name,tablespace_name
2 from user_tables
3 where table_name='PERSONS';TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
PERSONS USERS是你自己的操作有问题吧
照着我的再做一遍试试
SQL> select * from v$version;BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
create tablespace data1 datafile
'G:\oracle\xiao\data1_01.dbf' size 200m
autoextend on next 20m;create tablespace index1 datafile
'G:\oracle\xiao\index1_01.dbf' size 200m
autoextend on next 20m;create temporary tablespace temp1 tempfile
'G:\oracle\xiao\temp1_01.dbf' size 200m
autoextend on next 20m;create undo tablespace undo1 datafile
'G:\oracle\xiao\undo1_01.dbf' size 200m
autoextend on next 20m;create user xiao identified by xiao
default tablespace data1
temporary tablespace temp1
quota 0 on system;grant connect,resource to xiao;----------------------------------------------------------------------
create table classes
(CID varchar(2),
CNAME varchar(10))select * from classesinsert into classes values('11','A01')commitselect * from user_tables where TABLE_NAME='classes'