2.在創(chuàng)建用戶(hù)之前,先要?jiǎng)?chuàng)建表空間:
其格式為:格式: create tablespace 表間名 datafile '數(shù)據(jù)文件名' size 表空間大小;
如:
SQL> create tablespace news_tablespace datafile 'D:\oracle\product\10.1.0\oradata\lms_card\lms_card.dbf' size 500M;
其中'news_tablespace'是你自定義的表空間名稱(chēng),可以任意取名;'F:\oracle\product\10.1.0\oradata \news\news_data.dbf'是數(shù)據(jù)文件的存放位置,'news_data.dbf'文件名也是任意取;'size 500M'是指定該數(shù)據(jù)文件的大小,也就是表空間的大小。
3.現(xiàn)在建好了名為'news_tablespace'的表空間,下面就可以創(chuàng)建用戶(hù)了:
其格式為:格式: create user 用戶(hù)名 identified by 密碼 default tablespace 表空間表;
如:
SQL> create user test identified by test default tablespace news_tablespace;
默認(rèn)表空間'default tablespace'使用上面創(chuàng)建的表空間。
4.接著授權(quán)給新建的用戶(hù):
SQL> grant connect,resource to news; --表示把 connect,resource權(quán)限授予news用戶(hù)
SQL> grant dba to news; --表示把 dba權(quán)限授予給news用戶(hù)
授權(quán)成功。
ok! 數(shù)據(jù)庫(kù)用戶(hù)創(chuàng)建完成,現(xiàn)在你就可以使用該用戶(hù)創(chuàng)建數(shù)據(jù)表了!
轉(zhuǎn)載
天蒼蒼,野茫茫,風(fēng)吹草底見(jiàn)牛羊