Oracle批次修改使用者表table的表空間
由於開發人員把ess 專案下的大部分物件放到user 表空間中,用imp/exp 匯入正式庫後,ess使用者的物件還是在users 表空間中.為了把ESS 的物件放到ess 預設的表空間ess中,我按如下幾
步操作:
1 找出要修改表空間的物件:
select * from dba_tables where owner='ESS' and tablespace_name = 'USERS';
select * from dba_INDEXES where table_owner='ESS' and tablespace_name = 'USERS';
2 . 生成批次修改的sql 語句
select 'alter table ess.' || table_name || ' move tablespace ess;'
from dba_tables where wner='ESS' and tablespace_name = 'USERS';
select 'alter index ess.'||index_name||' rebuild online nologging tablespace ess;'
from DBA_indexes
WHERE table_owner='ESS' and tablespace_name = 'USERS'
把生成sql 語句導到 到ess_table.txt和ess_index.txt 檔案中
3.因為我們這裡欄位有clob型別,clob預設會建立索引,所以移動的時候要先移動clob欄位所產生的索引。
SELECT 'alter table ' ||t.table_name ||
' move tablespace ess lob (' || t.column_name ||
') store as(tablespace ess);' v_sql
FROM user_lobs t
4 檢查users 表空間,看看ess 使用者的物件是不是少了
步操作:
1 找出要修改表空間的物件:
select * from dba_tables where owner='ESS' and tablespace_name = 'USERS';
select * from dba_INDEXES where table_owner='ESS' and tablespace_name = 'USERS';
2 . 生成批次修改的sql 語句
select 'alter table ess.' || table_name || ' move tablespace ess;'
from dba_tables where wner='ESS' and tablespace_name = 'USERS';
select 'alter index ess.'||index_name||' rebuild online nologging tablespace ess;'
from DBA_indexes
WHERE table_owner='ESS' and tablespace_name = 'USERS'
把生成sql 語句導到 到ess_table.txt和ess_index.txt 檔案中
3.因為我們這裡欄位有clob型別,clob預設會建立索引,所以移動的時候要先移動clob欄位所產生的索引。
SELECT 'alter table ' ||t.table_name ||
' move tablespace ess lob (' || t.column_name ||
') store as(tablespace ess);' v_sql
FROM user_lobs t
4 檢查users 表空間,看看ess 使用者的物件是不是少了
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27036311/viewspace-1766789/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle表、索引修改表空間語句Oracle索引
- 修改oracle使用者名稱,表空間名字,Oracle
- Oracle新建使用者、表空間、表Oracle
- ORACLE表空間的建立修改刪除Oracle
- Oracle修改預設表空間和預設臨時表空間Oracle
- oracle 修改表空間儲存路徑Oracle
- 2 Day DBA-管理Oracle例項-修改表空間-刪除表空間Oracle
- 表、索引遷移表空間alter table move索引
- 2 Day DBA-管理Oracle例項-修改表空間-使表空間離線Oracle
- Oracle建立表空間和使用者Oracle
- oracle 建立表空間和使用者Oracle
- Oracle中新建表空間、使用者Oracle
- Oracle表空間Oracle
- 如何更改table及index的表空間Index
- 表空間的建立修改等操作
- 修改表空間的SQL程式碼SQL
- Oracle臨時表空間檢視、新增臨時表空間資料檔案、修改預設臨時表空間 方法!Oracle
- Oracle表移動表空間Oracle
- oracle 表移動表空間Oracle
- oracle 檢視使用者所在的表空間Oracle
- table/index/LOBINDEX遷移表空間Index
- oracle表空間的整理Oracle
- Oracle 表空間的管理Oracle
- Oracle 表空間 的操作Oracle
- ORACLE的SYSAUX 表空間OracleUX
- ORACLE的SYSTEM 表空間Oracle
- Oracle的表空間管理Oracle
- Oracle RAC建立表空間和使用者Oracle
- oracle RAC 建立使用者和表空間Oracle
- oracle temp 表空間Oracle
- 增加oracle表空間Oracle
- oracle undo 表空間Oracle
- oracle users 表空間Oracle
- Oracle表空間管理Oracle
- oracle建立表空間Oracle
- Oracle 表空間管理Oracle
- oracle表空間操作Oracle
- ORACLE MOVE表空間Oracle