前言:有错误及未尽之处欢迎评论指正!!!
1、查看所有表空间的语句
select * from dba_tablespaces;
2、查看所有表空间位置
SELECT FILE_NAME,TABLESPACE_NAME,AUTOEXTENSIBLE FROM dba_data_files;
3、创建表空间(注意创建表空间最好加引号,不然如果是小写会出问题)
create tablespace "TEST_SPACE"
logging
datafile '/home/oracle/app/oracle/oradata/orcl/TEST_SPACE.dbf' size 1024M autoextend on next 1024M maxsize unlimited extent
management local segment space management auto;
增加表空间的dbf文件
ALTER TABLESPACE TRUECMS ADD DATAFILE
'/data/oracle/oradata/orcl/TRUECMS07.dbf' SIZE 30720M
AUTOEXTEND ON NEXT 5M MAXSIZE 30720M;
允许已存在的数据文件自动增长
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\EDWTEST\APP03.DBF'
AUTOEXTEND ON NEXT 5M MAXSIZE 100M;
手工改变已存在数据文件的大小
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\EDWTEST\APP02.DBF' RESIZE 100M;
给表空间增加文件
alter tablespace 表空间名称 add datafile 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\TEST04.DBF' size 10 g autoextend ON next 100 m maxsize unlimited;
4、创建用户
-- Create the user
create user TEST
identified by "1"
default tablespace TEST_SPACE
temporary tablespace TEMP
profile DEFAULT;
-- Grant/Revoke role privileges
grant connect to TEST;
grant dba to TEST;
grant resource to TEST;
-- Grant/Revoke system privileges
grant unlimited tablespace to TEST;
5、删除小写的错误的表空间 名称
drop tablespace "test_space";