----------------+++++++++++++++++++++++++++++++++------------------------------------------------
--建表空间
--注意:表空间的字节不能过大!
/*第1步:创建临时表空间 */
create temporary tablespace test_temp
tempfile 'D:\oracle\product\10.2.0\oradata\orcl\test_temp.dbf'
size 100m
autoextend on
next 50M maxsize 100M
extent management local;
/*第2步:创建数据表空间 */
create tablespace test
nologging
datafile 'D:\oracle\product\10.2.0\oradata\orcl\test.dbf'
size 500M
autoextend on
next 50 maxsize 500m
extent management local;
/*第3步:创建用户并指定表空间 */
create user test identified by test
default tablespace test
temporary tablespace test_temp;
/*第4步:给用户授予权限 */
grant connect to test with admin option;
grant dba to test with admin option;
grant unlimited tablespace to test with admin option;
-- 赋予用户密码
alter user test identified by oracle;
----------------+++++++++++++++++++++++++++++++++------------------------------------------------
--创建用户
create user han identified by oracle default tablespace
users Temporary TABLESPACE Temp;
--授予用户han开发人员的权利
grant connect,resource,dba to han;
--删除了user,只是删除了该user下的schema objects,是不会删除相应的tablespace的。
drop user han cascade;
--删除表空间
DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES;
----------------+++++++++++++++++++++++++++++++++------------------------------------------------
--创建表
create table table_test(
id number(9) not null primary key,
test_name varchar2(40) not null
)
--查询表
select * from table_test;
--修改表的名称
rename table_test to table_test_rename;
--显示表结构,需要在命令窗口里输入该代码.eg:SQL> DESCRIBE classes_rename;
describe table_test_rename;
--删除表
drop table table_test_rename;
----------------+++++++++++++++++++++++++++++++++------------------------------------------------