2024年5月11日发(作者:)

在创建用户之前,先要创建表空间:

其格式为:格式: create tablespace 表间名 datafile '数据文件名' size 表空间大

小;

如:

SQL> create tablespace news_tablespace datafile

'F:oracleproduct10.1.0oradatanewsnews_' size 500M;

其中'news_tablespace'是你自定义的表空间名称,可以任意取名;

'F:oracleproduct10.1.0oradatanewsnews_'是数据文件的存放位置,

'news_'文件名也是任意取;'size 500M'是指定该数据文件的大小,也就是表空

间的大小。

现在建好了名为'news_tablespace'的表空间,下面就可以创建用户了:

其格式为:格式: create user 用户名 identified by 密码 default tablespace 表

空间表;

如:

SQL> create user news identified by news default tablespace

news_tablespace;

默认表空间'default tablespace'使用上面创建的表空间。

接着授权给新建的用户:

SQL> grant connect,resource to news; --表示把 connect,resource权限授予

news用户

SQL> grant dba to news; --表示把 dba权限授予给news用户

授权成功。

ok! 数据库用户创建完成,现在你就可以使用该用户创建数据表了!

1.建表空间

create tablespace hoteldata datafile

'D:'size 200m

autoextend on next 10m maxsize unlimited;

2.建用户

create user hotel identified by hotel default tablespace hoteldata account

unlock;//identified by 后面的是密码,前面的是用户名

3.用户授权

grant resource,connect,RECOVERY_CATALOG_OWNER to hotel ;