数据库管理员可以在数据库处于开启(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";(双引号内必须大写)
也可以使表空间中所有的数据文件或临时文件脱机,然后还能联机,而不影响表空间自己的脱机或联机状态。

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6
Visual web development tools

Atom editor mac version download
The most popular open source editor
