OCM备考 一、Server config 之管理表空间

OCM考试大纲针对表空间的要求:

    * Create and manage temporary, permanent, and undo tablespaces

       *  Create and manage bigfile tablespaces

 

       这个环节的考点是要求熟练掌握表空间管理的语句,最好是记熟,到时查联机文档,时间可能会很紧张。

 

1、创建普通表空间

sql> create tablespace ts1 datafile ‘$ORACLE_BASE/oradata/orcl/datafile/ts1.dbf’ size 100m

autoextend on next 10m maxsize 200m extent management local uniform size 128k

space segment space management auto;

-- extent management local、space segment space management auto是默认的。

 

2、创建undo表空间

sql> create undo tablespace undo_ts2 datafile 'u01/app/oracle/oradata/orcl/datafile/undo_ts2.dbf' size 100m autoextend on next 10m maxsize 200m;

 

3、创建临时表空间

sql> CREATE TEMPORARY TABLESPACE temp2 TEMPFILE'u01/app/oracle/oradata/orcl/datafile/temp02.dbf'

SIZE 50M autoextend on next 10m maxsize 200m;

 

4、创建临时表空间组

alter tablespace temp1 tablespace group temp_grp;

alter tablespace temp2 tablespace group temp_grp;

查看数据库当前默认临时表空间:

select property_name,property_value from database_properties where property_name like '%TEMP%'

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

DEFAULT_TEMP_TABLESPACE   TEMP

修改数据库默认临时表空间:

alter database default temporary tablespace temp2;

只修改某用户的默认临时表空间:

alter user u1 temporary tablespace temp;

 

5、创建bigfile表空间

create bigfile tablespace bigts datafile '/u01/app/oracle/oradata/orcl/datafile/bigts.dbf' size 50G;

 

6、修改datafile大小

sql> alter database datafile ''u01/app/oracle/oradata/orcl/datafile/ts1.dbf' resize 500m;

 

7、重命名datafile

sql> alter tablespace datafile '''u01/app/oracle/oradata/orcl/datafile/ts1.dbf' to '''u01/app/oracle/oradata/orcl/datafile/ts1_new.dbf' ;  或

sql>  alter database file '''u01/app/oracle/oradata/orcl/datafile/ts1.dbf' to '''u01/app/oracle/oradata/orcl/datafile/ts1_new.dbf' ;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值