N
The Daily Insight

How do I move a table from one tablespace to another in Oracle 11g?

Author

Emma Newman

Updated on April 25, 2026

First run: SELECT 'ALTER TABLE <schema_name>. '||LOWER(TABLE_NAME)||' MOVE LOB('||LOWER(COLUMN_NAME)||') STORE AS (TABLESPACE <table_space>);' FROM DBA_TAB_COLS WHERE OWNER = '<schema_name>' AND DATA_TYPE like '%LOB%'; This moves the LOB objects to the other tablespace.

Accordingly, how do I move a table from one tablespace to another tablespace in Oracle 11g?

  1. SELECT 'ALTER TABLE <SCHEMA>.' || TABLE_NAME ||' MOVE TABLESPACE '||' <TABLESPACE_NAME> ' FROM dba_tables WHERE OWNER = '<SCHEMA>' AND TABLESPACE_NAME <> '<TABLESPACE_NAME>'; filter's tables already in desired tablespace – Barun Feb 22 '16 at 4:45.
  2. First query in the answer should be replaced with Barun`s query. –

Furthermore, how do I move a partition to another tablespace in Oracle? Use the ALTER TABLE… MOVE PARTITION command to move a partition or subpartition to a different tablespace. The command takes two forms. You can move a partition with the MOVE PARTITION or MOVE SUBPARTITION clause.

Accordingly, how do I move data from one tablespace to another?

Steps to Move objects into different tablespace using EXPDP:

  1. STEP1: Create directory for export dumpfile: SQL> create or replace directory test_dir as '/data/oracle';
  2. STEP2: Grant read, write on the newly created directory.
  3. STEP 4: Import objects to the newly created tablespace using remap_tablespace.

How do I move LOB data to another tablespace?

You can move any lob segment to another tablespace as follows. ALTER TABLE OWNER. TABLE_NAME MOVE LOB(LOB_COLUMN) STORE AS (TABLESPACE NEW_TABLESPACE_NAME); You can generate the moving scripts for lob segments as follows.

Related Question Answers

What is Alter table move in Oracle?

Alter table move - The alter table xxx move command moves rows down into un-used space and adjusts the HWM but does not adjust the segments extents, and the table size remains the same. The alter table move syntax also preserves the index and constraint definitions.

How do you create space in a table?

The space between two rows in a table can be done using CSS border-spacing and border-collapse property. The border-spacing property is used to set the spaces between cells of a table and border-collapse property is used to specify whether the border of table is collapse or not.

How do I move Datafile from one directory to another in Oracle 12c?

Below are examples of how the ALTER DATABASE MOVE DATAFILE command can be used to Rename, Relocate, Copy or Move data files to to ASM.
  1. Rename: ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/PSTG/datafile/test.dbf' TO '/u01/app/oracle/oradata/PSTG/datafile/tester.dbf';
  2. Relocate:
  3. Copy:
  4. Move to ASM:

How do you change the schema of a table in Oracle?

Following is the process to move a table from one schema to another:
  1. Create a partitioned copy of the table – you do this by using. SELECT dbms_metadata.
  2. Exchange the partition between the source and the target table. ALTER TABLE NEW_SCHEMA.
  3. That's it! verify it by selecting from the source and target tables.

What is a tablespace in Oracle?

An Oracle database consists of one or more logical storage units called tablespaces, which collectively store all of the database's data. Each tablespace in an Oracle database consists of one or more files called datafiles, which are physical structures that conform to the operating system in which Oracle is running.

How do I move IOT index to another tablespace?

If you want to move the IOT to a different tablespace, simply specify the tablespace within the ALTER TABLE clause, as shown in the following examples: SQL> ALTER TABLE employees_iot MOVE TABLESPACE emp_s; Table

How do I change tablespace in Toad?

I went into Toad, went to Database => Administer => Tablespaces.
  1. select the row of the tablespace you are interested in.
  2. Click 'Alter Tablespace' (2nd button) on the toolbar.
  3. The 'Alter tablespace' dialog will appear. Click the datafile tab, then Add.
  4. Fill in the info and 'OK' your way out.

How do I grant privileges to a tablespace in Oracle?

Once connected as SYSTEM , simply issue the CREATE USER command to generate a new account.
  1. CREATE USER books_admin IDENTIFIED BY MyPassword;
  2. GRANT CONNECT TO books_admin;
  3. GRANT CONNECT, RESOURCE, DBA TO books_admin;
  4. GRANT CREATE SESSION GRANT ANY PRIVILEGE TO books_admin;
  5. GRANT UNLIMITED TABLESPACE TO books_admin;

How do I change the default tablespace in Oracle?

Check and Change Default Tablespace for User in Oracle
  1. Check the User default tablespace. select username,default_tablespace from dba_users where username = 'MDSYS';
  2. In this user MDSYS has the tablespace SYSAUS as default.
  3. Change the user Default tablespace.
  4. Verify the result.

How can I change the tablespace of a table in Oracle 12c?

You can move any table to new tablespace in Oracle with following command. ALTER TABLE MEHMET. SALIH MOVE TABLESPACE NEW_TABLESPACE_NAME; You can move lots of tables to the new tablespace with using generate move scripts.

How do I remap tablespaces in Impdp?

impdp remap_tablespace parameter
  1. test@orcl112> create table t as select * from dba_objects;
  2. test@orcl112> select table_name, tablespace_name from dba_tables where table_name='t' and owner='test';
  3. SQL>
  4. SQL>
  5. impdp usr1/usr1 directory=dp_dir dumpfile=test.dmp table_exists_action=skip.

How do I drop a tablespace?

Use the DROP TABLESPACE statement to remove a tablespace from the database. When you drop a tablespace, Oracle Database does not place it in the recycle bin. Therefore, you cannot subsequently either purge or undrop the tablespace. You must have the DROP TABLESPACE system privilege.

How do I create a Subpartition to a partitioned table in Oracle?

To create a composite partitioned table, you start by using the PARTITION BY [ RANGE | LIST ] clause of a CREATE TABLE statement. Next, you specify a SUBPARTITION BY [RANGE | LIST | HASH] clause that follows similar syntax and rules as the PARTITION BY [RANGE | LIST | HASH] clause.

How do you move the LOB index?

How to move lob segment to another tablespace
  1. Follow below steps from moving lob segment from one tablespace to another.
  2. SQL> alter table DBACLASS.
  3. SQL> select table_name,COLUMN_NAME,SEGMENT_NAME,TABLESPACE_NAME from dba_lobs where OWNER='DBACLASS';

How do you reclaim a space LOB segment?

Otherwise they go in the LOB segment. If the lobs for all your rows are inline, after you null them you can reclaim the space they used by moving or shrinking the table. But once a lob is out-of-line, it remains out-of-line. So to reclaim the space you need to move/shrink the lob, not the table!

How do you shrink a LOB segment in Oracle?

-- Shrink a LOB segment (basicfile only). ALTER TABLE table_name MODIFY LOB(lob_column) (SHRINK SPACE); ALTER TABLE table_name MODIFY LOB(lob_column) (SHRINK SPACE CASCADE); -- Shrink an IOT overflow segment. ALTER TABLE iot_name OVERFLOW SHRINK SPACE; There is more detail about this functionality below.