0% found this document useful (0 votes)
4 views3 pages

1.TBS Management

The document provides an overview of Oracle Tablespace Management, detailing the default tablespaces in Oracle 10g and commands for creating, modifying, and managing tablespaces and datafiles. It includes instructions for tasks such as renaming, relocating, and moving tables and indexes, as well as checking database size and free space. Additionally, it lists relevant views for monitoring tablespace and datafile information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

1.TBS Management

The document provides an overview of Oracle Tablespace Management, detailing the default tablespaces in Oracle 10g and commands for creating, modifying, and managing tablespaces and datafiles. It includes instructions for tasks such as renaming, relocating, and moving tables and indexes, as well as checking database size and free space. Additionally, it lists relevant views for monitoring tablespace and datafile information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Futurematics.Pvt.

Ltd
Oracle Tables Management

Tablespace Management - I

By default each database will have five tablespaces in oracle 10g.


1. System : Tablespace-contains data dictionary of database
2. Sysaux : Contains database statistics,OEM utility and rman uttilitys.
3. Undo : Contains Pre Image data
4. Temporary : Temporary oprations are performed in this fm if pga is not enough
5. Users : Default tablespace for all DB users / Application schemas

Creating tablespace :
Sql> create tablespace tbs1 datafile '/u01/prod/tsb.dbf' size 10m autoextend on
maxsize 100m default storage (next 10m);

To check tablespace information


Sql> select tablespace_name from dba_tablespaces;

Adding a datafile to a tablespace


Sql> alter tablespace fm add datafile ‘/u02/prod/fm02.dbf’ size 100m autoextend on;

Deleting a datafile from a tablespace


Sql> alter tablespace fm drop datafile ‘/u02/prod/fm02.dbf’;

Droping a tablespace
Sql> drop tablespace fm;  it will drop tablespace and datafile at database level.
Sql> drop tablespace fm including contents and datafiles;  it will drop tablespace
logically(database level) and physically(o/s level)

Reusing orphan datafile


Sql> create tablespace fm2 datafile ‘/u01/prod/fm01.dbf reuse;

Making a tablespace as read only


Sql> alter tablespace fm read only;
Sql> select tablespace_name,status from dba_tablespaces;
Sql> alter tablespace fm read write;

Making a tablespace offline


Sql> alter tablespace fm offline;  Users can not access this tablespace in this state.
Sql> alter tablespace fm online;

Renaming of tablespace
Sql> alter tablespace fm rename to fm1;

[email protected]
Futurematics.Pvt.Ltd
Oracle Tables Management

Renaming a datafile in tablespace


Steps:-
1.make tablespace offline
Sql> alter tablespace fm offline;
2. at os level rename the datafile
$cd /u01/prod/
$mv fm01.dbf fm03.dbf
3. Update the controlfile for this datafile.
Sql> alter database rename file ‘/u01/prod/fm01.dbf’ to
‘/u01/prod/fm03.dbf’;
4. Online the tablespace
Sql> alter tablespace fm online;
Select tablespace_name, file_name from dba_data_files;

Relocating (MOVE DATAFILE) a datafile in tablespace


1.make tablespace offline
Sql> alter tablespace fm offline;
2. at os level rename the datafile
$cd /u01/prod/
$mv fm01.dbf /u02/data/fm03.dbf
3. Update the controlfile for this datafile.
Sql> alter database rename file ‘/u01/prod/fm01.dbf’ to
‘/u02/data/fm03.dbf’;
4. Online the tablespace
sql>recover datatfile '/u02/data/fm03.dbf'
Sql> alter tablespace fm online;
Select tablespace_name, file_name from dba_data_files;

Moving table from one tablespace to another tablespace


Sql> alter table emp move tablespace fm;

Grant tablespaces
SQL>grant alter tablespace to FM

Moving index from on tablespace to another tablespace


Sql> alter index emp_indx rebuild tablespace fm;

To check database size


Select sum(bytes)/1024/1024 “size in MB” from dba_data_files

To check free space in database


Select sum(bytes)/1024/1024 from dba_free_space;

[email protected]
Futurematics.Pvt.Ltd
Oracle Tables Management

Views:-
V$tablespace V$datafile
Dba_tablespaces User_tablespaces
Dba_data_files Dba_segments
Dba_extents sm$ts_free
Sm$ts_used sm$ts_avail

[email protected]

You might also like