
- create tablespace dasong datafile '/oradata/oracle/dasong.dbf' size 100m; create tablespace dasong_idx2 datafile '/oradata/oracle/dasong_idx2.dbf' size 100m; create tablespace dasong_idx3 datafile '/oradata/oracle/dasong_idx3.dbf' size 100m; create user dasong identified by dasong default tablespace dasong temporary tablespace temp; grant dba to dasong; grant create session to dasong; grant resource to dasong; grant debug connect session to dasong; grant debug any procedure to dasong; grant select_catalog_role to dasong;
- create table t_idx_offline_test ( c1 number, c2 number, c3 number ) partition by range(c1) interval(1000) ( partition part_0 values less than(0) ) tablespace dasong; create index idx_test_c2 on t_idx_offline_test(c2) tablespace dasong_idx2 local; create index idx_test_c3 on t_idx_offline_test(c3) tablespace dasong_idx3 local; insert into t_idx_offline_test select rownum, rownum+1, rownum+2 from dual connect by rownum<10000; commit;
- alter database datafile '/oradata/oracle/dasong_idx2.dbf' offline for drop;
- select * from user_ind_partitions;

- select * from user_segments;

- alter index idx_test_c2 rebuild partition sys_p872 tablespace dasong_idx3;
- SQL Error: ORA-00376: file 10 cannot be read at this time ORA-01110: data file 10: '/oradata/oracle/dasong_idx2.dbf' 00376. 00000 - "file %s cannot be read at this time" *Cause: attempting to read from a file that is not readable. Most likely the file is offline. *Action: Check the state of the file. Bring it online
- alter index idx_test_c2 modify partition sys_p872 unusable;


- alter index idx_test_c2 rebuild partition sys_p872 tablespace dasong_idx3;


- alter index idx_test_c2 unusable;
- alter index idx_test_c2 modify default attributes tablespace dasong_idx3;


- drop tablespace dasong_idx2 including contents and datafiles;
- SQL Error: ORA-14405: partitioned index contains partitions in a different tablespace 14405. 00000 - "partitioned index contains partitions in a different tablespace" *Cause: An attempt was made to drop a tablespace which contains indexes whose partitions are not completely contained in this tablespace, and which are defined on the tables which are completely contained in this tablespace. *Action: find indexes with partitions which span the tablespace being dropped and some other tablespace(s). Drop these indexes, or move the index partitions to a different tablespace, or find the tables on which the indexes are defined, and drop (or move) them.
- delete from seg$ where file#=10 and type#=3; commit;

- drop index idx_test_c2; drop tablespace dasong_idx2 including contents and datafiles;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26736162/viewspace-2122112/,如需转载,请注明出处,否则将追究法律责任。