1.假如现在已经建好名为'news'的数据库,此时在F:\oracle\product\10.1.0\oradata\
目录下已经存在news目录(注意:我的Oracle10g安装在F:\oracle下,若你的Oracle安装在别的目录,那么你新建的数据库目录就在*\product\10.1.0\oradata\目录下)。
2.在创建用户之前,先要创建表空间:
其格式为:格式: create tablespace 表间名 datafile '数据文件名' size 表空间大小;
如:
SQL> create tablespace news_tablespace datafile 'F:\oracle\product\10.1.0\oradata\news\news_data.dbf' size 500M;
其中news_tablespace
是你自定义的表空间名称,可以任意取名;F:\oracle\product\10.1.0\oradata\news\news_data.dbf
是数据文件的存放位置,news_data.dbf
文件名也是任意取;size 500M
是指定该数据文件的大小,也就是表空间的大小。
3.现在建好了名为news_tablespace
的表空间,下面就可以创建用户了:
其格式为:格式: create user 用户名 identified by 密码 default tablespace 表空间表;
如:
SQL> create user news identified by news default tablespace news_tablespace;
默认表空间default tablespace
使用上面创建的表空间。
4.接着授权给新建的用户:
SQL> grant connect,resource to news;
--表示把 connect,resource权限授予news用户
SQL> grant dba to news;
--表示把 dba权限授予给news用户
授权成功。
网友评论