查询系统中默认的表空间
SCOTT@orcl 10:58:13> select username ,default_tablespace from dba_users;
创建用户,并指定默认的表空间为TBS_01(TBS_01)必须为系统查询存在的表空间
SCOTT@orcl 11:00:07> create user zhangww identified 123456 default tablespace TBS_01;
授予用户权限
SCOTT@orcl 11:04:24> grant dba to zhangww;
切换用户
SCOTT@orcl 11:05:12> conn zhangww/123456
创建表
ZHANGWW@orcl 11:05:30> create table st1(id number);
查询表空间,因为没插入数据所以没为数据库分配表空间
ZHANGWW@orcl 11:10:44> select segment_name,tablespace_name from user_segmen where segment_name=‘st1‘;
select segment_name,tablespace_name from user_segments where segment_name=‘ST1‘;
no rows selected
插入数据
ZHANGWW@orcl 11:13:08> insert into st1 values (1);
再次查询表空间;可以查询到结果
ZHANGWW@orcl 11:16:20> select segment_name,tablespace_name from user_segmen where segment_name=‘ST1‘;
删除用户zhangww,若该用户没进行任何的操作时,可以删除此用户否则会报如下错误:
SCOTT@orcl 11:19:00> drop user zhangww;
drop user zhangww;
drop user zhangww
*
ERROR at line 1:
ORA-01922: CASCADE must be specified to drop ‘ZHANGWW‘
解决方法:
SCOTT@orcl 11:19:04> drop user zhangww cascade;
本文出自 “7240173” 博客,请务必保留此出处http://wwdyl.blog.51cto.com/7240173/1394746