Home Database Mysql Tutorial Oracle 表空间联机(online)与脱机(offline)

Oracle 表空间联机(online)与脱机(offline)

Jun 07, 2016 pm 05:11 PM

数据库管理员可以在数据库处于开启(open)状态时令除 SYSTEM 表空间(tablespace)之外的任何表空间联机(online)(可访问)或脱

数据库管理员可以在数据库处于开启(open)状态时令除 SYSTEM 表空间(tablespace)之外的任何表空间联机(online)(可访问)或脱机(offline)(不可访问)。SYSTEM 表空间在数据库处于开启(open)状态时总是处于联机状态,因为Oracle需要使用其中的数据字典(data dictionary)。

表空间(tablespace)通常处于联机(online)状态,以便数据库用户访问其中的数据。但是数据库管理员可以在对表空间进行维护,备份或恢复操作时,令表空间脱机(offline)。

令表空间脱机

当一个表空间(tablespace)脱机(offline)后,Oracle不允许任何SQL语句继续引用此表空间内的对象(schema object)。如果一个活动事务(activetransaction)中的 SQL 语句正好在使用被置为脱机状态的表空间内的对象,其事务性也不会被破坏。Oracle使用 SYSTEM 表空间内的延迟回滚段(deferred rollback segment)为此事务中已完成的 SQL 语句保存回滚信息(rollback data)。当脱机表空间被重新置位联机(online)状态后,Oracle会在需要时应用这些回滚信息。

表空间(tablespace)联机(online)或脱机(offline)时,SYSTEM 表空间内的数据字典(data dictionary)会进行记录。如果用户关闭(shut down)一个数据库时某个表空间处于脱机状态,那么这个表空间在数据库下次被装载(mount)、打开(open)后依旧保持脱机状态。

用户只能将一个表空间(tablespace)联机(online)到创建她的数据库中,因为只有这个数据库的 SYSTEM 表空间中才保存着与此表空间相关的必要的数据字典(data dictionary)信息。一个脱机(offline)的表空间不能被Oracle之外的工具打开或编辑。因此脱机表空间不能被移动到其他数据库中。

当某些错误发生时,Oracle会自动地将相关的联机表空间(online tablespace)切换到脱机(offline)状态。例如,当数据库写入进程(database writerprocess,DBWn)多次尝试向表空间的数据文件(datafile)写入失败后,Oracle就会将此表空间切换到脱机状态。此时尝试访问脱机表空间内数据表的用户将会得到错误信息。如果是介质故障(media failure)导致此次磁盘 I/O 失败,用户必须在处理故障后恢复(recover)受影响的表空间。

特殊情况下的表空间使用

用户可以将不同类型的数据分开存储在不同的表空间(tablespace)中。当用户因为某些任务而令某个表空间脱机(offline)后,其余表空间仍保持联机(online)状态,其中的数据对用户依然可用。但是表空间脱机后也会导致特殊情况发生。例如,有两个表空间分别用于存储表及此表对应的索引,将出现以下问题:● 如果包含索引的表空间脱机,那么查询依旧可以访问表数据,因为对表数据的访问并不一定需要索引数据。

● 如果包含表的表空间脱机,那么查询将无法访问表数据,因为脱机表空间内的对象无法被引用。

如果Oracle能够从联机(online)表空间(tablespace)中获得执行一个SQL语句的足够的信息,那么语句就将被执行。如果相关信息必须从脱机(offline)的表空间中获得,那么语句将失败。

只读表空间 

使用只读表空间(read-only tablespace)的主要目的是为了避免对静态、且容量大的数据库内容进行备份和恢复操作。Oracle不会更新只读表空间内的数据,因此这类表空间的数据文件(datafile)可以放置在 CD-ROM 或 WORM之类的只读介质(read-only media)上。

提示:用户只能将一个表空间(tablespace)联机(online)到创建她的数据库,因此只读表空间(read-only tablespace)技术不适用于存档工作(archiving)。

只读表空间(read-only tablespace)不能被修改。如需更新一个只读表空间,首先要使表空间可读写。在更新后,还可以将表空间恢复到只读状态。

因为只读表空间(read-only tablespace)不能被修改,只要没有将只读表空间置于可读写状态,就无需对其进行重复的备份操作。当用户需要恢复数据库时,也没必要恢复只读表空间,原因同前所述。

 

进行此操作必须具有ALTER TABLESPACE 或 MANAGE TABLESPACE 系统权限,GRANT ALTER TABLESPACE TO "USER";

GRANT MANAGE TABLESPACE TO "USER";(双引号内必须大写)

也可以使表空间中所有的数据文件或临时文件脱机,然后还能联机,而不影响表空间自己的脱机或联机状态。

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1252
24
MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Explain the role of InnoDB redo logs and undo logs. Explain the role of InnoDB redo logs and undo logs. Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL's Place: Databases and Programming MySQL's Place: Databases and Programming Apr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL: From Small Businesses to Large Enterprises MySQL: From Small Businesses to Large Enterprises Apr 13, 2025 am 12:17 AM

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

How does MySQL index cardinality affect query performance? How does MySQL index cardinality affect query performance? Apr 14, 2025 am 12:18 AM

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

See all articles