日期:2014-05-16  浏览次数:20390 次

oracle 表空间命令

?

oracle11g 创建表空间

*分为四步 */

/*第1步:创建临时表空间 ?*/

create temporary tablespace user_temp ?

tempfile 'D:\oracle\oradata\Oracle9i\user_temp.dbf'?

size 50m ?

autoextend on ?

next 50m maxsize 20480m ?

extent management local; ?

?

/*第2步:创建数据表空间 ?*/

create tablespace user_data ?

logging ?

datafile 'D:\oracle\oradata\Oracle9i\user_data.dbf'?

size 50m ?

autoextend on ?

next 50m maxsize 20480m ?

extent management local; ?

?

/*第3步:创建用户并指定表空间 ?*/

create user username identified by password ?

default tablespace user_data ?

temporary tablespace user_temp; ?

?

/*第4步:给用户授予权限 ?*/

grant connect,resource,dba to username;

?

--------------------------------------------------------

1.查看oracle数据有多少表空间

SELECT COUNT(*) FROM DBA_DATA_FILES;
SELECT FILE_NAME,TABLESPACE_NAME,BYTES,USER_BLOCKS FROM DBA_DATA_FILES;
SELECT TABLESPACE_NAME FROM DBA_DATA_FILES;


2.删除表空间

drop tablespace?opencmstest?including contents;

3.创建表空间

#------------------------------------------------
创建临时表空间
create temporary tablespace?tmp_jportal
tempfile '/u01/app/oracle/database/tmp_jportal.dbf'
Size 32m
autoextend on
extent management local;

#------------------------------------------------
创建表空间
create tablespace?jportal
logging
datafile '/u01/app/oracle/database/jportal.dbf'
Size 32m
autoextend on
extent management local;

#------------------------------------------------
创建用户
create user jboss identified by?jboss
default tablespace?jportal
temporary tablespace?tmp_jportal;?

#------------------------------------------------
授权给用户
GRANT CREATE USER,DROP USER,ALTER USER ,CREATE ANY VIEW ,DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE,DBA,CONNECT,RESOURCE,CREATE SESSION TOjboss