oracle根据用户建表,oracle的建用户和表



----------------+++++++++++++++++++++++++++++++++------------------------------------------------

--建表空间

--注意:表空间的字节不能过大!

/*第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;

----------------+++++++++++++++++++++++++++++++++------------------------------------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值