关于表空间offline小知识点
admin
2023-04-21 15:04:34
0
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操作。大家可以看实验过程了解。

相关内容

热门资讯

重磅消息“闲逸斗地主到底有挂吗... 家人们!今天小编来为大家解答闲逸斗地主透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里买...
【第一财经】“新圣游牛牛真的有... 网上科普关于“新圣游牛牛有没有挂”话题很是火热,小编也是针对新圣游牛牛作*弊开挂的方法以及开挂对应的...
我来教教您“新起点怎么装挂?”... 我来教教您“新起点怎么装挂?”(必胜开挂神器)您好,新起点这个游戏其实有挂的,确实是有挂的,需要了解...
今日重大发现“三鑫联盟到底有挂... 有 亲,根据资深记者爆料三鑫联盟是可以开挂的,确实有挂(咨询软件无需打开...
重磅消息“闽乐乐五十K有挂吗?... 您好:闽乐乐五十K这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9784099】很多玩家在这款...
终于懂了“牛魔王牛牛辅助器?”... 您好:牛魔王牛牛这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款游...
今日重大消息“道游联盟开挂神器... 网上科普关于“道游联盟有没有挂”话题很是火热,小编也是针对道游联盟作*弊开挂的方法以及开挂对应的知识...
今日重大通报“小南娱乐辅助器?... 家人们!今天小编来为大家解答小南娱乐透视挂怎么安装这个问题咨询软件客服徽4282891的挂在哪里买很...
【第一财经】“新毛豆牛牛真的有... 【第一财经】“新毛豆牛牛真的有挂吗?”(外卦神器下载)您好,新毛豆牛牛这个游戏其实有挂的,确实是有挂...
终于懂了“越记乡游是不是有挂?... 有 亲,根据资深记者爆料越记乡游是可以开挂的,确实有挂(咨询软件无需打开...