offline datafile and offline tablespace

1)offline datafile
OFFLINE
Specify OFFLINE to take the datafile offline. If the database is open, you must perform media recovery on the datafile before bringing it back online, because a checkpoint is not performed on the datafile before it is taken offline.

[quote]DATA FILE #5:
(name #4) /u01/oracle/oradata/PROD/example01.dbf
creation size=0 block size=8192 status=0x1c head=4 tail=4 dup=1
tablespace 6, index=5 krfil=5 prev_file=0
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:75 scn: 0x0000.000e2959 05/04/2011 10:45:17
Stop scn: 0x0000.000e296f 05/04/2011 10:45:30
Creation Checkpointed at scn: 0x0000.00072202 03/12/2011 23:05:50
thread:0 rba:(0x0.0.0)[/quote]

2)offline tablespace

[quote]DATA FILE #4:
(name #5) /u01/oracle/oradata/PROD/users01.dbf
creation size=0 block size=8192 status=0x80 head=5 tail=5 dup=1
tablespace 4, index=4 krfil=4 prev_file=0
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:114 scn: 0x0000.000e268b 05/04/2011 10:28:24
Stop scn: 0x0000.000e268b 05/04/2011 10:28:24
Creation Checkpointed at scn: 0x0000.00002946 06/30/2005 19:10:40
thread:0 rba:(0x0.0.0)[/quote]

Specify ONLINE to bring the tablespace online. Specify OFFLINE to take the tablespace offline and prevent further access to its segments. When you take a tablespace offline, all of its datafiles are also offline.

Restriction on Taking Tablespaces Offline
You cannot take a temporary tablespace offline.

OFFLINE NORMAL
Specify NORMAL to flush all blocks in all datafiles in the tablespace out of the system global area (SGA). You need not perform media recovery on this tablespace before bringing it back online. This is the default.

OFFLINE TEMPORARY
If you specify TEMPORARY, then Oracle Database performs a checkpoint for all online datafiles in the tablespace but does not ensure that all files can be written. Files that are offline when you issue this statement may require media recovery before you bring the tablespace back online.

OFFLINE IMMEDIATE
If you specify IMMEDIATE, then Oracle Database does not ensure that tablespace files are available and does not perform a checkpoint. You must perform media recovery on the tablespace before bringing it back online.


SQL> alter tablespace users offline;

Tablespace altered.

SQL> alter tablespace users online;

Tablespace altered.

SQL> alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' offline;

Database altered.

SQL> alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' online;
alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/u01/oracle/oradata/PROD/users02.dbf'


SQL> recover datafile 6;
Media recovery complete.
SQL> alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' online;

Database altered.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值