为了规范数据库用户的操作,特制订如下规范:
一、每个系统建立自己的数据库文件和索引文件,每个文件不允许超过2G,不支持自动扩展,系统根据自己的情况申请相应大小的数据文件;
创建文件系统的命令为:
(1)创建表空间
Create tablespace coredb_data logging datafile
'/home/oracle/oracle/product/10.2.0/oradata/orcl/coredb_data01.dbf'
size 2G autoextend off
(2)创建索引空间
Create tablespace coredb_idx logging datafile
'/home/oracle/oracle/product/10.2.0/oradata/orcl/coredb_idx01.dbf'
size 1G autoextend off
(3)增扩表空间
alter tablespace coredb_idx add datafile
'/home/oracle/oracle/product/10.2.0/oradata/orcl/coredb_idx02.dbf' size 2G
autoextend off
(4)查看表空间
select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as 总块数,
dfs.freespace "剩余总量(M)",
dfs.freeblocks "剩余块数",
(dfs.freespace / dbf.totalspace) * 100 "空闲比例"
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)
二、创建用户的命令
使用ORACLE用户执行如下命令(无DBA权限):
sqlplus '/as sysdba' <
drop user cascade;
create user identified by default tablespace coredb_data temporary tablespace temp;