暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
Oracle表空间OFFLINE的三种参数.pdf
119
20页
3次
2023-12-20
5墨值下载
OracleOFFLINE
Oracle表空间Offline的三种参数--1-CSDN博客
引言
Oracle 数据库基础管理中,表空间管理尤为重要。而表空间 OFFLINE 是我们经常会用到的知识点,在进行
数据库管理的时候,留足备份、慎删数据是非常重要的原则。没有绝对把握的时候,绝对不要动手删除数据。
这里谈到的offline tablespace lock user都是非常好的屏蔽数据访问的手段。
1空间 OFFLINE
当数据库处于 OPNE 状态时,表空间处于联机状态(可访问)或脱机状态(不可访问)。表空间通常是联机的以便
用户可以使用。SYSTEM 和临时表空间不可以脱机。表空间可以手动脱机或者自动脱机,例如可以手动将表空间脱
机以便进行维护,备份和恢复。数据库在遇到某些问题时会自动将一个表空间脱机,比如数据库写进程(DBWn
多次试图写入数据文件但遇到失败时。当用户试图访问一个脱机表空间中的表时会收到错误。
当一个表空间进入脱机状态时,数据库执行以下任务:
数据库不允许后续 DML 语句引用脱机表空间中的对象。脱机的表空间无法被除 Oracle 数据库之外的任务其它
使用程序读取或编辑。
活动事务中的某些已完成的语句,曾引用了脱机表空间中的数据,这些事务在事务级别不受影响。
数据库将那些已完成语句相应的撤销数据,保存在 SYSTEM 表空间中的延迟撤销段中。当表空间被联机时,
数据库在必要时将撤销数据应用到该表空间中。
Oracle 表空间在正常 ONLINE 的情况下,一个表空间中若干个数据文件是维持在动态一致状态中,文件头上的
SCN 根据 DBWR CKPT 维持一致或者不一致的状态。
官方文档说明
Online and Offline Tablespaces
A tablespace can be online (accessible) or offline (not accessible), whenever the database is open. A
tablespace is usually online so that its data is available to users. The SYSTEM tablespace and temporary
tablespaces cannot be taken offline. A tablespace can go offline automatically or manually. For example,
you can take a tablespace offline for maintenance or backup and recovery. The database automatically
takes a tablespace offline when certain errors are encountered, as when the database writer (DBWn)
process fails in several attempts to write to a data file. Users trying to access tables in an offline tablespace
receive an error.
When a tablespace goes offline, the database does the following:
The database does not permit subsequent DML statements to reference objects in the offline
tablespace. An offline tablespace cannot be read or edited by any utility other than Oracle Database.
Active transactions with completed statements that refer to data in that tablespace are not affected at
the transaction level.
The database saves undo data corresponding to those completed statements in a deferred undo
segment in the SYSTEM tablespace. When the tablespace is brought online, the database applies the
undo data to the tablespace, if needed.
将表空间进行 Offline 的命令很简单,就是 alter tablespace xxx offline;根据不同的情况,我们是可以使用三种参
数进行命令修饰,分别为normaltemporary immediate。三个命令分别对应了 Offline 过程的不同行为。
2
环境说明:
主机版本
数据库版本
是否归档
CentOS Linux release 7.9.2009
11.2.0.4
Enable
注意:是否启用归档模式对于数据库表空间 OFFLINE 影响巨大。
检查:
Warning
一个表空间可以有一个或者多个数据文件。如果一个表空间被 offline,那么对应的数据文件也就被 offline
并不是所有表空间都可以被offlineSystemUndoTemporary表空间是不允许进行Offline操作的。一般只
有非系统表空间,也就是业务数据表空间才会进行Offline操作。
另一个重要点是如果要进行 offline 操作的表空间是一个用户的 Default 表空间,那么最好要将其默认表空间
修改一下,防止操作错误出现。
Sql
1
2
3
4
of 20
5墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文档被以下合辑收录

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜