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、接下来,直接切换回原用户,直接建表就可以了

猜你喜欢

转载自blog.csdn.net/wenyusuran/article/details/83621783