转载请注明来源:http://blog.csdn.net/loongshawn/article/details/50458950
相关文章:
切换到system用户,执行语句获取表空间文件路径。
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name
创建名为PRO的表空间,初始大小1500M,超过1500M自动增加,每次100M,最大容量10000M。
路径为/opt/oracle/data/data01/rdbms/obak/datafile/obak_pro_01.dbf
create tablespace PRO
logging
datafile '/opt/oracle/data/data01/rdbms/obak/datafile/obak_pro_01.dbf'
size 1500m
autoextend on
next 100m maxsize 10000m
extent management local;
有时候表空间会不足,需要人为的扩展。这里,我们新建了一个表空间文件obak_pro_03.dbf
ALTER TABLESPACE PRO ADD
DATAFILE '/opt/oracle/data/data01/rdbms/obak/datafile/obak_pro_03.dbf' SIZE 1500M
AUTOEXTEND ON NEXT 100M MAXSIZE 10000M;
新建用户dba_user,密码abcd1234,所属表空间PRO。
create user dba_user identified by abcd1234 DEFAULT TABLESPACE PRO;
当然,会有权限遗漏,可自行按需添加。
GRANT
CREATE SESSION, CREATE ANY TABLE, CREATE ANY VIEW ,CREATE ANY INDEX, CREATE ANY sequence,CREATE ANY PROCEDURE,
ALTER ANY TABLE, ALTER ANY sequence,ALTER ANY PROCEDURE,
DROP ANY TABLE, DROP ANY sequence,DROP ANY VIEW, DROP ANY INDEX, DROP ANY PROCEDURE,
SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE
TO dba_user;
如果出现下述异常:
insert into CAR_BRAND (CB_ID, CB_NAME)
values (7, '荣威')
ORA-01950: no privileges on tablespace 'USERS'
Done.
SQL>
则表明创建的用户没有表空间的操作权限,需要进行赋权:
ALTER USER dealer QUOTA UNLIMITED ON USERS;
接下来执行数据插入,执行正常!