Master Note: Overview of Oracle Tablespace Management (Doc ID 1493350.1)
Master Note: Overview of Oracle Tablespace Management (Doc ID 1493350.1)
In this Document
Applies to:Oracle Database - Enterprise Edition - Version 8.1.7.0 and laterInformation in this document applies to any platform. PurposeThis Notes describes the various aspects of tablespace management and is to instruct engineers and customers how to better diagnose Tablespace related issues / questions. DetailsOverview of TablespacesA database is divided into one or more logical storage units called tablespaces. Tablespaces are divided into logical units of storage called segments, which are further divided into extents. Extents are a collection of contiguous blocks. Before working with tablespaces of an Oracle Database, familiarize yourself with the guidelines provided in the following sections: Using Multiple TablespacesUsing multiple tablespaces allows you more flexibility in performing database operations. When a database has multiple tablespaces, you can:
Some operating systems set a limit on the number of files that can be open simultaneously. Such limits can affect the number of tablespaces that can be simultaneously online. To avoid exceeding your operating system limit, plan your tablespaces efficiently. Create only enough tablespaces to fulfill your needs, and create these tablespaces with as few files as possible. If you need to increase the size of a tablespace, add one or two large datafiles, or create datafiles with autoextension enabled, rather than creating many small datafiles. Assigning Tablespace Quotas to UsersGrant to users who will be creating tables, clusters, materialized views, indexes, and other objects the privilege to create the object and a quota (space allowance or limit) in the tablespace intended to hold the object segment.
The UNLIMITED TABLESPACE privilege is no longer the default RESOURCE role starting in Oracle Database 12c. This change increases the default security of the database by eliminating the potential for database users and applications that have been granted the RESOURCE role to exceed their intended resource quotas for tablespaces.
Creating Tablespaces
Before you can create a tablespace, you must create a database to contain it. The primary tablespace in any database is the SYSTEM tablespace, which contains information basic to the functioning of the database server, such as the data dictionary and the system rollback segment. The SYSTEM tablespace is the first tablespace created at database creation. It is managed as any other tablespace, but requires a higher level of privilege and is restricted in some ways. For example, you cannot rename or drop the SYSTEM tablespace or take it offline. The only mandatory parameter to create a tablespace in the CREATE TABLESPACE statement is its name. CREATE TABLESPACE Created tablespace will then be:
Complete Syntax
CREATE [TEMPORARY / UNDO] TABLESPACE DATAFILE / TEMPFILE ' ' ' BLOCKSIZE AUTOEXTEND { [OFF/ON (NEXT LOGGING/NOLOGGING (Logging default) ONLINE/OFFLINE (Online default) EXTENT MANAGEMENT { [DICTIONARY] / [LOCAL Default (AUTOALLOCATE / UNIFORM PERMANENT / TEMPORARY (Permanent default) MINIMUM EXTENT DEFAULT STORAGE { [INITIAL [NEXT [PCTINCREASE [MINEXTENTS [MAXEXTENTS [FREELISTS [FREELIST GROUPS [OPTIMAL [BUFFER_POOL < DEFAULT/KEEP/RECYCLE >] } CHUNK NOCACHE;
BLOCKSIZE – By default blocksize defined in the parameter DB_BLOCK_SIZE. In Oracle9i, multiple blocksizes that are a different block size for different tablespaces, can be defined; all datafiles of a same tablespace have the same block size.
DEFAULT STORAGE : INITIAL – Specifies the size of the object's first extent. 3 k minimum for Locally and 2 k minimum for Dictionary managed tablespaces NEXT – Specifies the size of the object's successive extent. PCTINCREASE – Specifies the ratio of the third or the preceding extent of the object. The default value for PCTINCREASE is 50 % and the minimum value is 0%. MINEXTENTS – The total number of extents allocated to the segment at the time of creation MAXEXTENTS – The maximum number of extents that can be allocated to the segment MININUM EXTENT – The size is specified in this clause. The extent are a multiple of the size specified in this clause. NEXT and INITIAL extent size specified should be multiple of the minimum extent. PERMANENT / TEMPORARY – Permanent is default, used to store table, index etc. Temporary is for temporay segments (e.g. for sorts in sql) and can not store table, index. LOGGING / NOLOGGING – Logging is default, the DDL operation & direct insert load are recorded in the redo log file. ONLINE / OFFLINE - Online is default, tablespace is available as soon as created. Tablespace typesDifferent tablespace types can be created for different purposes: Permanent tablespaces Permanent tablespaces are used to store user data and user created objects like tables, indexes and materialized views. Sample create statements:
CREATE TABLESPACE tools DATAFILE '/u01/oradata/orcl/tools/file_1.dbf' SIZE 100M;
CREATE TABLESPACE tools DATAFILE 'C:\ORA\tools01.dbf' SIZE 100M AUTOEXTEND ON MAXSIZE 500M; Temp tablespaces Temp or temporary tablespaces are used to store data with short lifespan (transient data), for example: global temporary tables or sort results.
CREATE TEMPORARY TABLESPACE temp TEMPFILE '/u01/oradata/orcl/temp/file_1.dbf' SIZE 100M;
With a single temp tablespace, the database will only write to one temp file at a time. However, temporary tablespace groups, an Oracle 10g feature, can be created to allow Oracle to write to multiple temp files simultaneously. Undo tablespaces Undo tablespaces are used to store "before image" data that can be used to undo transactions. See ROLLBACK.
CREATE UNDO TABLESPACE undots DATAFILE '/u01/oradata/orcl/undo/file_1.dbf' SIZE 20M;
Best practices
Locally Managed Tablespaces
Locally managed tablespaces track all extent information in the tablespace itself by using bitmaps, resulting in the following benefits:
When you do not explicitly specify the type of extent management, Oracle Database determines extent management as follows: If the CREATE TABLESPACE statement omits the DEFAULT storage clause, then the database creates a locally managed autoallocated tablespace. When you allocate a datafile for a locally managed tablespace, you should allow space for metadata used for space management (the extent bitmap or space header segment) which are part of user space. For example, if you specify the UNIFORM clause in the extent management clause but you omit the SIZE parameter, then the default extent size is 1MB. In that case, the size specified for the datafile must be larger (at least one block plus space for the bitmap) than 1MB. The DBMS_SPACE_ADMIN package provides maintenance procedures for locally managed tablespaces. The following statement creates a locally managed tablespace named lmtbsb and specifies AUTOALLOCATE: CREATE TABLESPACE lmtbsb DATAFILE '/u02/oracle/data/lmtbsb01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL AUTOALLOCATE; The following statement creates tablespace lmtbsb with automatic segment space management: CREATE TABLESPACE lmtbsb DATAFILE '/u02/oracle/data/lmtbsb01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; The SEGMENT SPACE MANAGEMENT MANUAL clause disables automatic segment space management. For more information
Note 735978.1 - How To Change A Dictionary Managed Tablespace To A Locally Managed Tablespace? Bigfile TablespacesOracle lets you create bigfile tablespaces. This allows Oracle Database to contain tablespaces made up of single large files rather than numerous smaller ones. This lets Oracle Database utilize the ability of 64-bit systems to create and manage ultralarge files. The consequence of this is that Oracle Database can now scale up to 8 exabytes in size. A bigfile tablespace is a tablespace with a single, but very large (up to 4G blocks) datafile. Traditional smallfile tablespaces, in contrast, can contain multiple datafiles, but the files cannot be as large. Benefits of Bigfile Tablespaces
Considerations with Bigfile Tablespaces
Creating a Bigfile Tablespace
CREATE BIGFILE TABLESPACE bigtbs DATAFILE '/u02/oracle/data/bigtbs01.dbf' SIZE 50G ...
Identifying a Bigfile Tablespace For more information
Note 1287314.1 - Unable To Edit Bigfile System Tablespace In DBConsole Compressed Tablespaces
You can specify that all tables created in a tablespace are compressed by default. You specify the type of table compression using the DEFAULT keyword, followed by one of the compression type clauses used when creating a table.
CREATE TABLESPACE ... DEFAULT COMPRESS FOR OLTP ... ;
You can override the default tablespace compression specification when you create a table in that tablespace. Encrypted Tablespaces
You can encrypt any permanent tablespace to protect sensitive data. Tablespace encryption is completely transparent to your applications, so no application modification is necessary. Encrypted tablespaces primarily protect your data from unauthorized access by means other than through the database. For example, when encrypted tablespaces are written to backup media for travel from one Oracle database to another or for travel to an off-site facility for storage, they remain encrypted. Also, encrypted tablespaces protect data from users who try to circumvent the security features of the database and access database files directly through the operating system file system.
To encrypt a tablespace, you must open the database with the COMPATIBLE initialization parameter set to 11.1.0 or higher. The default setting for COMPATIBLE for a new Oracle Database 11g Release 2 installation is 11.2.0. Any user who can create a tablespace can create an encrypted tablespace.
Transparent data encryption supports industry-standard encryption algorithms, including the following Advanced Encryption Standard (AES) and Triple Data Encryption Standard (3DES) algorithms: AES256 AES192 AES128 3DES168 The following statement creates an encrypted tablespace with the default encryption algorithm: CREATE TABLESPACE securespace DATAFILE '/u01/app/oracle/oradata/orcl/secure01.dbf' SIZE 100M ENCRYPTION DEFAULT STORAGE(ENCRYPT); The following statement creates the same tablespace with the AES256 algorithm: CREATE TABLESPACE securespace DATAFILE '/u01/app/oracle/oradata/orcl/secure01.dbf' SIZE 100M ENCRYPTION USING 'AES256' DEFAULT STORAGE(ENCRYPT); Restrictions
The following are restrictions for encrypted tablespaces:
Querying Tablespace Encryption Information
The DBA_TABLESPACES and USER_TABLESPACES data dictionary views include a column named ENCRYPTED. This column contains YES for encrypted tablespaces.
SELECT t.name, e.encryptionalg algorithm
FROM v$tablespace t, v$encrypted_tablespaces e WHERE t.ts# = e.ts#; NAME ALGORITHM ------------------------------ --------- SECURESPACE AES256 For more Information
Note 1228046.1 - Master Note For Transparent Data Encryption ( TDE ) Temporary Tablespaces
A temporary tablespace contains transient data that persists only for the duration of the session. Temporary tablespaces can improve the concurrency of multiple sort operations that do not fit in memory and can improve the efficiency of space management operations during sorts.
Within a temporary tablespace, all sort operations for a particular instance share a single sort segment, and sort segments exist for every instance that performs sort operations that require temporary space. A sort segment is created by the first statement after startup that uses the temporary tablespace for sorting, and is released only at shutdown. Default Temporary Tablespace Users who are not explicitly assigned a temporary tablespace use the database default temporary tablespace, which for new installations is TEMP. You can change the default temporary tablespace for the database with the following command:
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE tablespace_name;
To determine the current default temporary tablespace for the database, run the following query:
SELECT PROPERTY_NAME, PROPERTY_VALUE FROM DATABASE_PROPERTIES WHERE
PROPERTY_NAME='DEFAULT_TEMP_TABLESPACE'; PROPERTY_NAME PROPERTY_VALUE -------------------------- ------------------------------ DEFAULT_TEMP_TABLESPACE TEMP
Creating a Locally Managed Temporary Tablespace
You also use different views for viewing information about tempfiles than you would for datafiles. The V$TEMPFILE and DBA_TEMP_FILES views are analogous to the V$DATAFILE and DBA_DATA_FILES views.
CREATE TEMPORARY TABLESPACE lmtemp TEMPFILE '/u02/oracle/data/lmtemp01.dbf'
SIZE 20M REUSE EXTENT MANAGEMENT LOCAL UNIFORM SIZE 16M; Viewing Space Usage for Temporary Tablespaces The DBA_TEMP_FREE_SPACE dictionary view contains information about space usage for each temporary tablespace. The information includes the space allocated and the free space. You can query this view for these statistics using the following command.
SELECT * from DBA_TEMP_FREE_SPACE;
TABLESPACE_NAME TABLESPACE_SIZE ALLOCATED_SPACE FREE_SPACE ----------------------------------- --------------- --------------- ---------- TEMP 250609664 250609664 249561088 Multiple Temporary Tablespaces: Using Tablespace Groups
A tablespace group enables a user to consume temporary space from multiple tablespaces. Using a tablespace group, rather than a single temporary tablespace, can alleviate problems caused where one tablespace is inadequate to hold the results of a sort, particularly on a table that has many partitions. A tablespace group enables parallel execution servers in a single parallel operation to use multiple temporary tablespaces.
Creating a Tablespace Group You create a tablespace group implicitly when you include the TABLESPACE GROUP clause in the CREATE TEMPORARY TABLESPACE or ALTER TABLESPACE statement and the specified tablespace group does not currently exist.
CREATE TEMPORARY TABLESPACE lmtemp2 TEMPFILE '/u02/oracle/data/lmtemp201.dbf' SIZE 50M TABLESPACE GROUP group1;
ALTER TABLESPACE lmtemp TABLESPACE GROUP group2; Assigning a Tablespace Group as the Default Temporary Tablespace
ALTER DATABASE sample DEFAULT TEMPORARY TABLESPACE group2;
For more information
Note 1099324.1 - DB 11.1: Temporary Tablespaces [Video] Note 1498442.1 - Master Note: Overview of Oracle Temporary Tablespaces Specifying Nonstandard Block Sizes for Tablespaces
You can create tablespaces with block sizes different from the standard database block size, which is specified by the DB_BLOCK_SIZE initialization parameter. This feature lets you transport tablespaces with different block sizes between databases.
The following statement creates tablespace lmtbsb, but specifies a block size that differs from the standard database block size (as specified by the DB_BLOCK_SIZE initialization parameter):
CREATE TABLESPACE lmtbsb DATAFILE '/u02/oracle/data/lmtbsb01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K BLOCKSIZE 8K; Controlling the Writing of Redo Records
For some database operations, you can control whether the database generates redo records. Without redo, no media recovery is possible. However, suppressing redo generation can improve performance, and may be appropriate for easily recoverable operations. An example of such an operation is a CREATE TABLE...AS SELECT statement, which can be repeated in case of database or instance failure. Altering Tablespace Availability
You can take an online tablespace offline so that it is temporarily unavailable for general use. The rest of the database remains open and available for users to access data. Conversely, you can bring an offline tablespace online to make the schema objects within the tablespace available to database users. The database must be open to alter the availability of a tablespace. Taking Tablespaces Offline
You may want to take a tablespace offline for any of the following reasons:
The following example takes the users tablespace offline normally:
ALTER TABLESPACE users OFFLINE NORMAL; Bringing Tablespaces Online
You can bring any tablespace in an Oracle Database online whenever the database is open. A tablespace is normally online so that the data contained within it is available to database users.
The following statement brings the users tablespace online:
ALTER TABLESPACE users ONLINE; Using Read-Only Tablespaces
Making a tablespace read-only prevents write operations on the datafiles in the tablespace. The primary purpose of read-only tablespaces is to eliminate the need to perform backup and recovery of large, static portions of a database. Read-only tablespaces also provide a way to protect historical data so that users cannot modify it. Making a tablespace read-only prevents updates on all tables in the tablespace, regardless of a user's update privilege level. Making a Tablespace Read-Only All tablespaces are initially created as read/write. Use the READ ONLY clause in the ALTER TABLESPACE statement to change a tablespace to read-only. You must have the ALTER TABLESPACE or MANAGE TABLESPACE system privilege. Before you can make a tablespace read-only, the following conditions must be met.
For better performance while accessing data in a read-only tablespace, you can issue a query that accesses all of the blocks of the tables in the tablespace just before making it read-only. A simple query, such as SELECT COUNT (*), executed against each table ensures that the data blocks in the tablespace can be subsequently accessed most efficiently. This eliminates the need for the database to check the status of the transactions that most recently modified the blocks.
The following statement makes the flights tablespace read-only:
ALTER TABLESPACE flights READ ONLY; Making a Tablespace Read/Write
Making a Read-Only Tablespace Writable
The following statement makes the flights tablespace writable:
ALTER TABLESPACE flights READ WRITE; Making a read-only tablespace writable updates the control file entry for the datafiles, so that you can use the read-only version of the datafiles as a starting point for recovery. Creating a Read-Only Tablespace on a WORM DeviceFollow these steps to create a read-only tablespace on a CD-ROM or WORM (Write Once-Read Many) device.
Delaying the Opening of Datafiles in Read-Only TablespacesWhen substantial portions of a very large database are stored in read-only tablespaces that are located on slow-access devices or hierarchical storage, you should consider setting the READ_ONLY_OPEN_DELAYED initialization parameter to TRUE. This speeds certain operations, primarily opening the database, by causing datafiles in read-only tablespaces to be accessed for the first time only when an attempt is made to read data stored within them.
Setting READ_ONLY_OPEN_DELAYED=TRUE has the following side-effects:
Note:
Altering and Maintaining TablespacesIncreasing the Size of a TablespaceYou can increase the size of a tablespace by either increasing the size of a datafile in the tablespace or adding one. Additionally, you can enable automatic file extension (AUTOEXTEND) to datafiles and bigfile tablespaces. For more information
http://docs.oracle.com/cd/E11882_01/server.112/e25494/dfiles.htm#ADMIN11424 Altering a Locally Managed TablespaceYou can use the ALTER TABLESPACE statement on locally managed tablespaces for some operations, including the following:
For more information
http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces.htm#ADMIN11375 Altering a Bigfile TablespaceTwo clauses of the ALTER TABLESPACE statement support datafile transparency when you are using bigfile tablespaces:
RESIZE: The RESIZE clause lets you resize the single datafile in a bigfile tablespace to an absolute size, without referring to the datafile.
For example: ALTER TABLESPACE bigtbs RESIZE 80G; AUTOEXTEND (used outside of the ADD DATAFILE clause): With a bigfile tablespace, you can use the AUTOEXTEND clause outside of the ADD DATAFILE clause. For example: ALTER TABLESPACE bigtbs AUTOEXTEND ON NEXT 20G; An error is raised if you specify an ADD DATAFILE clause for a bigfile tablespace. Altering a Locally Managed Temporary TablespaceYou can use ALTER TABLESPACE to add a tempfile, take a tempfile offline, or bring a tempfile online, as illustrated in the following examples:
ALTER TABLESPACE lmtemp
ADD TEMPFILE '/u02/oracle/data/lmtemp02.dbf' SIZE 18M REUSE; ALTER TABLESPACE lmtemp TEMPFILE OFFLINE; ALTER TABLESPACE lmtemp TEMPFILE ONLINE; You cannot use the ALTER TABLESPACE statement, with the TEMPORARY keyword, to change a locally managed permanent tablespace into a locally managed temporary tablespace. You must use the CREATE TEMPORARY TABLESPACE statement to create a locally managed temporary tablespace. You cannot take a temporary tablespace offline. Instead, you take its tempfile offline. The view V$TEMPFILE displays online status for a tempfile.
The ALTER DATABASE statement can be used to alter tempfiles. ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' OFFLINE; ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' ONLINE; The following statement resizes a tempfile: ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' RESIZE 18M; The following statement drops a tempfile and deletes its operating system file: ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' DROP INCLUDING DATAFILES; To rename a tempfile, you take the tempfile offline, use operating system commands to rename or relocate the tempfile, and then use the ALTER DATABASE RENAME FILE command to update the database controlfiles. Shrinking a Locally Managed Temporary Tablespace
Large sort operations performed by the database may result in a temporary tablespace growing and occupying a considerable amount of disk space. After the sort operation completes, the extra space is not released; it is just marked as free and available for reuse. Therefore, a single large sort operation might result in a large amount of allocated temporary space that remains unused after the sort operation is complete. For this reason, the database enables you to shrink locally managed temporary tablespaces and release unused space.
ALTER TABLESPACE lmtemp1 SHRINK SPACE KEEP 20M;
The following example shrinks the tempfile lmtemp02.dbf of the locally managed temporary tablespace lmtmp2. Because the KEEP clause is omitted, the database attempts to shrink the tempfile to the minimum possible size.
ALTER TABLESPACE lmtemp2 SHRINK TEMPFILE '/u02/oracle/data/lmtemp02.dbf';
For more information
Note 452697.1 - How To Shrink A Temporary Tablespace in 11G ? Renaming TablespacesUsing the RENAME TO clause of the ALTER TABLESPACE, you can rename a permanent or temporary tablespace. For example, the following statement renames the users tablespace:
ALTER TABLESPACE users RENAME TO usersts;
When you rename a tablespace the database updates all references to the tablespace name in the data dictionary, control file, and (online) datafile headers. The database does not change the tablespace ID so if this tablespace were, for example, the default tablespace for a user, then the renamed tablespace would show as the default tablespace for the user in the DBA_USERS view. The following affect the operation of this statement:
If a traditional initialization parameter file (PFILE) is being used then a message is written to the alert log stating that the initialization parameter file must be manually changed. For more information
Note 270061.1 - How To Rename a Tablespace and Avoid Certain Errors Dropping TablespacesYou can drop a tablespace and its contents (the segments contained in the tablespace) from the database if the tablespace and its contents are no longer required. You must have the DROP TABLESPACE system privilege to drop a tablespace.
Caution:
Once a tablespace has been dropped, the data in the tablespace is not recoverable. Therefore, ensure that all data contained in a tablespace to be dropped will not be required in the future. Also, immediately before and after dropping a tablespace from a database, back up the database completely. This is strongly recommended so that you can recover the database if you mistakenly drop a tablespace, or if the database experiences a problem in the future after the tablespace has been dropped.
When you drop a tablespace, the file pointers in the control file of the associated database are removed. You can optionally direct Oracle Database to delete the operating system files (datafiles) that constituted the dropped tablespace. If you do not direct the database to delete the datafiles at the same time that it deletes the tablespace, you must later use the appropriate commands of your operating system to delete them.
The following statement drops the users tablespace, including the segments in the tablespace:
DROP TABLESPACE users INCLUDING CONTENTS; The following statement drops the users tablespace and its associated datafiles: DROP TABLESPACE users INCLUDING CONTENTS AND DATAFILES; A message is written to the alert log for each datafile that is deleted. If an operating system error prevents the deletion of a file, the DROP TABLESPACE statement still succeeds, but a message describing the error is written to the alert log.
Note 111316.1 - How to 'DROP' a Datafile from a Tablespace
http://docs.oracle.com/cd/E11882_01/server.112/e25494/dfiles.htm#ADMIN11435 Managing the SYSAUX Tablespace
The SYSAUX tablespace was installed as an auxiliary tablespace to the SYSTEM tablespace when you created your database. Some database components that formerly created and used separate tablespaces now occupy the SYSAUX tablespace. For more information http://docs.oracle.com/cd/E11882_01/server.112/e25494/create.htm#ADMIN00203 Monitoring Occupants of the SYSAUX Tablespace
You can monitor the occupants of the SYSAUX tablespace using the V$SYSAUX_OCCUPANTS view. This view lists the following information about the occupants of the SYSAUX tablespace:
Name of the occupant Occupant description Schema name Move procedure Current space usage View information is maintained by the occupants. Moving Occupants Out Of or Into the SYSAUX Tablespace
You will have an option at component install time to specify that you do not want the component to reside in SYSAUX. Also, if you later decide that the component should be relocated to a designated tablespace, you can use the move procedure for that component, as specified in the V$SYSAUX_OCCUPANTS view, to perform the move. The following table provides guidelines on sizing the SYSAUX tablespace based on the system configuration and expected load.
Diagnosing and Repairing Locally Managed Tablespace ProblemsOracle Database includes the DBMS_SPACE_ADMIN package, which is a collection of aids for diagnosing and repairing problems in locally managed tablespaces. For more information
Note 243246.1 - SYSAUX New Mandatory Tablespace in Oracle 10g and higher http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces.htm#ADMIN011 Migrating from a Dictionary Managed to a Locally Managed Tablespace
Use the TABLESPACE_MIGRATE_TO_LOCAL procedure to migrate a dictionary-managed tablespace to a locally managed tablespace. This operation is done online, but space management operations are blocked until the migration has been completed. Therefore, you can read or modify data while the migration is in progress, but if you are loading a large amount of data that requires the allocation of additional extents, then the operation may be blocked.
EXEC DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL ('tbs_1');
Migrating the SYSTEM Tablespace to a Locally Managed TablespaceUse the DBMS_SPACE_ADMIN package to migrate the SYSTEM tablespace from dictionary-managed to locally managed. The following statement performs the migration:
SQL> EXECUTE DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL('SYSTEM');
Before performing the migration the following conditions must be met:
All of these conditions, except for the cold backup, are enforced by the TABLESPACE_MIGRATE_TO_LOCAL procedure. For more infor mation
Note 735978.1 - How To Change A Dictionary Managed Tablespace To A Locally Managed Tablespace? Transporting Tablespaces Between Databases
You can use the Transportable Tablespaces feature to copy a set of tablespaces from one Oracle Database to another. For more information
http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces.htm#ADMIN011 Tablespace Data Dictionary ViewsThere are many data dictionary and dynamic performance views that provide useful information about the tablespaces of a database like in the examples below Example 1: Listing Tablespaces and Default Storage Parameters To list the names and default storage parameters of all tablespaces in a database, use the following query on the DBA_TABLESPACES view: SELECT TABLESPACE_NAME "TABLESPACE", INITIAL_EXTENT "INITIAL_EXT", NEXT_EXTENT "NEXT_EXT", MIN_EXTENTS "MIN_EXT", MAX_EXTENTS "MAX_EXT", PCT_INCREASE FROM DBA_TABLESPACES; TABLESPACE INITIAL_EXT NEXT_EXT MIN_EXT MAX_EXT PCT_INCREASE ---------- ----------- -------- ------- ------- ------------ RBS 1048576 1048576 2 40 0 SYSTEM 106496 106496 1 99 1 TEMP 106496 106496 1 99 0 TESTTBS 57344 16384 2 10 1 USERS 57344 57344 1 99 1 Example 2: Listing the Datafiles and Associated Tablespaces of a Database To list the names, sizes, and associated tablespaces of a database, enter the following query on the DBA_DATA_FILES view: SELECT FILE_NAME, BLOCKS, TABLESPACE_NAME FROM DBA_DATA_FILES; FILE_NAME BLOCKS TABLESPACE_NAME ------------ ---------- ------------------- /U02/ORACLE/IDDB3/DBF/RBS01.DBF 1536 RBS /U02/ORACLE/IDDB3/DBF/SYSTEM01.DBF 6586 SYSTEM /U02/ORACLE/IDDB3/DBF/TEMP01.DBF 6400 TEMP /U02/ORACLE/IDDB3/DBF/TESTTBS01.DBF 6400 TESTTBS /U02/ORACLE/IDDB3/DBF/USERS01.DBF 384 USERS Example 3: Displaying Statistics for Free Space (Extents) of Each Tablespace To produce statistics about free extents and coalescing activity for each tablespace in the database, enter the following query: SELECT TABLESPACE_NAME "TABLESPACE", FILE_ID, COUNT(*) "PIECES", MAX(blocks) "MAXIMUM", MIN(blocks) "MINIMUM", AVG(blocks) "AVERAGE", SUM(blocks) "TOTAL" FROM DBA_FREE_SPACE GROUP BY TABLESPACE_NAME, FILE_ID; TABLESPACE FILE_ID PIECES MAXIMUM MINIMUM AVERAGE TOTAL ---------- ------- ------ ------- ------- ------- ------ RBS 2 1 955 955 955 955 SYSTEM 1 1 119 119 119 119 TEMP 4 1 6399 6399 6399 6399 TESTTBS 5 5 6364 3 1278 6390 USERS 3 1 363 363 363 363 For more information http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces.htm#ADMIN011 Troubleshooting
Note 1270839.1 - Master Note for Tablespace Issues References
Knowledge base:
Note 1270839.1 - Master Note for Tablespace Issues Note 93771.1 - Introduction to Locally-Managed Tablespaces Note 243245.1 - 10G New Storage Features and Enhancements Documentation: http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces.htm#ADMIN011 References |
|
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1411354/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Master Note: Oracle Transaction Management (Local) Overview (Doc ID 1506115.1)ASTOracleView
- * Master Note: Database Performance Overview (Doc ID 402983.1)ASTDatabaseORMView
- Master Note: Troubleshooting Oracle Tablespace Management (文件 ID 1522807.1)ASTOracle
- Master Note - Oracle GoldenGate (Doc ID 1298817.1)ASTOracleGo
- Overview of Parameter Reference Notes (Doc ID 68462.1)View
- Master Note for Tablespace IssuesAST
- Master Note for Oracle Disk Manager (Doc ID 1226653.1)ASTOracle
- Master Note Oracle GoldenGate Management Pack - Director [ID 1307305.1]ASTOracleGo
- Master Note: Overview of Database ControlFiles (文件 ID 1493674.1)ASTViewDatabase
- Master Note of Linux OS Requirements for Database Server (Doc ID 851598.1)ASTLinuxUIREMDatabaseServer
- Master Note for Automatic Storage Management (ASM) [ID 1187723.1]ASTASM
- Oracle Memory Structure 1. Overview And ManagementOracleStructView
- Master Note For PL/SQL UTL_FILE Package (Doc ID 1155024.1)ASTSQLPackage
- Tablespace Management Enhancements in Oracle Database 10gOracleDatabase
- Master Note: Overview of Redo Logs and Archiving_1503091.1ASTView
- Overview of Transaction Management (142)View
- Master Note for RAC Oracle Clusterware and Oracle Grid Infrastructure 1096952.ASTOracleStruct
- Master Data Management UpdateAST
- Oracle10g New Feature -- 8. Tablespace ManagementOracle
- 【Oracle】Master Note for Parallel Execution Wait EventsOracleASTParallelAI
- Master Note For ASM For OS Administrators [ID 1345562.1]ASTASM
- 6-Overview-Kubernetes Object ManagementViewObject
- Master Note for Handling Oracle Database Corruption Issues [ID 1088018.1]ASTOracleDatabase
- 【DOC】VIEW: "V$LOCK" Reference NoteView
- Master Note - Troubleshooting DBCA Issues (文件 ID 1269459.1)AST
- Master Note of Linux OS Requirements for Database Server [ID 851598.1]ASTLinuxUIREMDatabaseServer
- Master Note: Locks, Enqueues and Deadlocks [ID 1392319.1]ASTENQ
- Master Note: Troubleshooting Oracle Background Processes_1509616.1ASTOracle
- Master Note for Streams Recommended Configuration [ID 418755.1]AST
- Master Note Parallel Execution Wait Events [ID 1097154.1]ASTParallelAI
- oracle function overviewOracleFunctionView
- WAITEVENT: "latch: row cache objects" Reference Note (Doc ID 1550722.1)AIObject
- Oracle Text Health Check (Doc ID 823649.1)Oracle
- Oracle 最新PSU (Doc ID 2118136.2)Oracle
- oracle segment space management and extent management幾則Oracle
- How to move Oracle Spatial objects from SYSAUX tablespace to a user defined tablespace [ID 1119758.1OracleObjectUX
- Master Note: Troubleshooting Redo Logs and Archiving (文件 ID 1507157.1)AST
- Oracle Grid/RAC 11.2.0.4 on Oracle Linux 7 (Doc ID 1951613.1)OracleLinux