表A从表空间USER转到表空间TEST ALTER TABLE A MOVE TABLESPACE TEST;10G的文档是这么说的: Moving a table changes the rowids of the rows in the table. This causes indexes on the table to be ed UNUSABLE, and DML accessing the table using these indexes will receive an ORA-01502 error. The indexes on the table must be dropped or rebuilt. Likewise, any statistics for the table become invalid and new statistics should be collected after moving the table.
declare CURSOR get_t IS SSelect t.table_name From User_Tables t; begin -- Test statements here FOR rec_ IN get_t LOOP Begin Alter Table rec_.table_name Move Tablespace New_Tablespace; EXCEPTION WHEN OTHERS THEN dbms_output.put_line('error:'||Sqlerrm); END; END LOOP; end;
alter table move tablespace
ALTER TABLE A MOVE TABLESPACE TEST;10G的文档是这么说的:
Moving a table changes the rowids of the rows in the table. This causes indexes on the table to be ed UNUSABLE, and DML accessing the table using these indexes will receive an ORA-01502 error. The indexes on the table must be dropped or rebuilt. Likewise, any statistics for the table become invalid and new statistics should be collected after moving the table.
CURSOR get_t IS
SSelect t.table_name
From User_Tables t;
begin
-- Test statements here
FOR rec_ IN get_t LOOP
Begin
Alter Table rec_.table_name Move Tablespace New_Tablespace;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('error:'||Sqlerrm);
END;
END LOOP;
end;
如果在执行EXP/EXPDP命令时,导出了索引的话,在IMP/IMPDP时,也会导入索引,而无需重建索引。
并且该命令支持并行操作。
现在是这样的,用imp导入的话,如果导入的新库中的表空间与dmp文件中含有的表空间信息一致的话,就是你指定自己的表空间也是没有用的。
比如,导出的dmp文件中有从users表空间导出的数据,那么你再倒入新库的时候,数据仍然会写到新库的users表空间,是没有办法更改的,入过新库没有users表空间,那么会报错吧。
alter user 用户名 quota 0 on user;
ALTER USER 用户名 QUOTA UNLIMITED ON 目的表空间;
imp/impdp在导入数据时,肯定可以将表导入指定的表空间中,方法是:
1、将目标用户的默认表空间改为要导入的表空间名称,并保证该用户在表空间上有足够的配额。
2、用户目标用户执行Imp/impdp操作。