关于表空间offline小知识点

本文涉及的产品
全球加速 GA,每月750个小时 15CU
简介:
1、表空间offline的原因
Taking Tablespaces Offline
Taking a tablespace offline makes it unavailable for normal access.

You may want to take a tablespace offline for any of the following reasons:

To make a portion of the database unavailable while allowing normal access to the remainder of the database

To perform an offline tablespace backup (even though a tablespace can be backed up while online and in use)

To make an application and its group of tables temporarily unavailable while updating or maintaining the application

To rename or relocate tablespace data files  ##上次文档就是因为要重命名数据文件offline了表空间
实验1
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +DATADG/arch
Oldest online log sequence     266
Next log sequence to archive   268
Current log sequence           268
SQL> 

SQL> alter tablespace users offline ;  ##默认使用normal参数
Tablespace altered.

SQL> alter system switch logfile;
System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> 
SQL> startup
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1006636072 bytes
Database Buffers          637534208 bytes
Redo Buffers                7094272 bytes
Database mounted.
Database opened.
SQL> 
SQL> alter tablespace users online;
Tablespace altered.

SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
UNDOTBS2                       ONLINE
6 rows selected.

SQL> 
实验2
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +DATADG/arch
Oldest online log sequence     267
Next log sequence to archive   269
Current log sequence           269
SQL> alter tablespace users offline immediate;  ##参数immediate

Tablespace altered.

SQL> alter system switch logfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1006636072 bytes
Database Buffers          637534208 bytes
Redo Buffers                7094272 bytes
Database mounted.
Database opened.
SQL> alter tablespace users online;
alter tablespace users online
*
ERROR at line 1:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '+DATADG/orcl/datafile/users.259.954803993'

SQL> recover tablespace users;
Media recovery complete.
SQL> alter tablespace users online;

Tablespace altered.

SQL> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
UNDOTBS2                       ONLINE

6 rows selected.

SQL> 

小结:
默认offline表空间执行一致性检查点,使用normal参数来offline表空间。
如果使用immediate参数offline表空间需要进行recover操作。大家可以看实验过程了解。










本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/2072962,如需转载请自行联系原作者
目录
相关文章
|
SQL 监控 Oracle
关于undo表空间配置错误的ORA-30012
      undo表空间是Oracle体系结构的重要组成部分,为什么我们可以回滚,就是因为有它。数据库任意数据的修改都会在undo表空间里生成前镜像,一是可以回滚,二是可以实现并发,以及一致性查询。
1169 0
|
SQL 存储 监控
Oracle-UNDO表空间解读
Oracle-UNDO表空间解读
643 0
|
Oracle 关系型数据库 数据库
一文搞懂Oracle表空间
一文搞懂Oracle表空间
|
SQL 存储 Oracle
oracle学习5-表空间的作用
oracle学习5-表空间的作用
145 0
|
Oracle 关系型数据库 数据库
Oracle 快速创建 N 个表空间数据文件
Oracle 数据库是由无数个表空间组成,表空间是由无数个数据文件组成,数据文件存放在磁盘中。
|
SQL Oracle 关系型数据库
|
Oracle 关系型数据库 数据库