1. 程式人生 > >ORACLE 新建資料庫及許可權賦予

ORACLE 新建資料庫及許可權賦予

新裝的oracle資料庫,預設的表空間是ORCL,現在想建立一個新的庫,在新庫下面建表。

按照如下步驟:

以system超級管理員使用者進入

1、首先,建立(新)使用者: create user username identified by password;

username:新使用者名稱的使用者名稱 password: 新使用者的密碼

也可以不建立新使用者,而仍然用以前的使用者,如:繼續利用scott使用者
2.建立表空間:
    create tablespace tablespacename datafile 'd:\data.dbf' size xxxm;
    tablespacename:表空間的名字
    d:\data.dbf':表空間的儲存位置
    xxx表空間的大小,m單位為兆(M)
create tablespace BIGDATATEAM datafile 'D:\ORACLE\ORADATA\BIGDATATEAM.dbf' 
        size 100m 
       autoextend on next 32m maxsize 2048m
3.將空間分配給使用者:
   alert user username default tablespace tablespacename;
   將名字為tablespacename的表空間分配給username 

alter user suyd default tablespace BIGDATATEAM
4.給使用者授權:
   grant create session,create table,unlimited tablespace to username;
grant create session,create table,unlimited tablespace to suyd

5、接下來,直接切換回原使用者,直接建表就可以了