JBOSS 點滴

          豐豐的博客

          ORACLE,更換表空間

          創建表空間
          CREATE SMALLFILE TABLESPACE "TABLESPACE "
            DATAFILE 'e:\ORACLE\PRODUCT\10.2.0\ORADATA\TABLESPACE _user\TABLESPACE '
            SIZE 50M LOGGING EXTENT MANAGEMENT
            LOCAL SEGMENT SPACE MANAGEMENT AUTO

          更換表空間:
          select 'alter   table '||table_name|| ' move tablespace   new_tablespace_name;'   from all_tables where tablespace_name='old_tablespace_name';

          更換索引表空間:
          BLOB字段
          select 'alter table ' || table_name ||
                 ' MOVE tablespace tablespace _name LOB (' ||
                  (select column_name
                    from cols
                   where table_name = dba_indexes.table_name
                     and DATA_TYPE
                         like '%LOB' and rownum = 1 )|| ') STORE AS (TABLESPACE tablespace _name );' from
                   dba_indexes
                   where tablespace_name = 'old_tablespace _name '
                     and index_type = 'LOB'
                說明:用了 rownum = 1 可能有些字段無法更新,需要查看如:
                   select *
                    from cols   where table_name='' and data_type like '%LOB'
          普通字段:
          select 'alter index '||index_name||' rebuild tablespace tablespace _name;'
          from dba_indexes
          where  tablespace_name=''
          查詢在舊空間是否還存在索引
          select * from dba_indexes where  tablespace_name=''  and table_owner=''

          posted on 2010-11-29 18:09 半導體 閱讀(763) 評論(0)  編輯  收藏 所屬分類: oracle

          主站蜘蛛池模板: 桃源县| 长治县| 固阳县| 茶陵县| 丰都县| 安远县| 陆丰市| 舟山市| 三原县| 迭部县| 厦门市| 天水市| 德江县| 汾西县| 济源市| 密云县| 弥勒县| 曲水县| 辉南县| 宜阳县| 巫溪县| 淮南市| 博兴县| 梅河口市| 柘荣县| 霍山县| 永济市| 乌兰察布市| 平泉县| 加查县| 兖州市| 湖州市| 科技| 廉江市| 宁都县| 广水市| 长子县| 义乌市| 班玛县| 化隆| 新郑市|