Oracle 普通Table進行Reorg
建立pp1例項表.
SQL> create table pp1 as select * from pp;
Table created.
SQL> create index pp1_index on pp1(id);
Index created.
SQL> execute dbms_stats.gather_table_stats('scott','pp1');
PL/SQL procedure successfully completed.
SQL> select count(*) from pp1;
COUNT(*)
----------
10000000
現在開始重建table。
1.將原來pp1 table的statistics export出來
SQL> exec dbms_stats.create_stat_table('scott','stat_table');
PL/SQL procedure successfully completed.
SQL> exec dbms_stats.export_table_stats('scott','pp1',null,'stat_table');
PL/SQL procedure successfully completed.
2.將pp1 table的資料insert到pp1_copy上
SQL> edit
Wrote file afiedt.buf
1 create table pp1_copy
2 tablespace users
3 nologging
4 parallel 2
5 as
6* select /*+parallel(a,2)*/ * from pp1 a where dt>to_date('2014/01/01','yyyy/mm/dd')
SQL>
SQL> /
Table created.
3.在pp1_copy上建立 和在pp1上相同的index
SQL> create index pp1_copy_index on pp1_copy(id) nologging parallel 2;
Index created.
4.更改table,index為logging,noparallel模式
SQL> alter table pp1_copy logging noparallel;
Table altered.
SQL> alter index pp1_copy_index logging noparallel;
Index altered.
5.刪除原來的pp1 table
SQL> drop table pp1 purge;
Table dropped.
6.將pp1_copy table和index rename為pp1以及相應的index
SQL> alter table pp1_copy rename to pp1;
Table altered.
SQL> alter index pp1_copy_index rename to pp1_index;
Index altered.
7.將export的statistics import到pp1中
SQL> exec dbms_stats.import_table_stats(ownname=>'scott',tabname=>'pp1',stattab=>'stat_table');
PL/SQL procedure successfully completed.
8.編譯原來存在package,view,procedure
alter package package_name compile;
alter procedure procedure_name compile;
alter view view_name compile;
=========================================================================================
*其中可以將pp1先rename為其他table明,然後再做操作。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1852372/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle:TABLE MONITORINGOracle
- Oracle table selectOracle
- JavaScript table表格行進行刪除和新增JavaScript
- db2 reorg,runstatsDB2
- oracle cache table(轉)Oracle
- Oracle Pipelined Table(轉)Oracle
- Oracle Pipelined Table Functions(轉)OracleFunction
- Oracle Table建立引數說明Oracle
- Analyze table對Oracle效能的提升Oracle
- Oracle cluster table(1)_概念介紹Oracle
- ORACLE _small_table_threshold與eventOracle
- oracle 普通表-分割槽表改造流程Oracle
- oracle truncate table recover(oracle 如何拯救誤操作truncate的表)Oracle
- use azure data studio to create external table for oracleOracle
- 【TABLE】Oracle表資訊收集指令碼Oracle指令碼
- 深入解析 oracle drop table內部原理Oracle
- DB2 offline reorg的一點筆記DB2筆記
- Rasa中使用lookup table時針對中文對RegexEntityExtractor進行修改
- Oracle 19c Concepts(02):Tables and Table ClustersOracle
- 14_深入解析Oracle table cluster結構Oracle
- iview table tooltip 折行View
- vue對table的某一行的資料進行編輯,刪除操作Vue
- oracle是如何進行全表掃描的Oracle
- SAP UI5 Table 控制元件資料進行 Excel 匯出時如何進行格式控制試讀版UI控制元件Excel
- 有關oracle external table的一點測試。Oracle
- 【TABLE】Oracle監控異常的表設計Oracle
- oracle 19c 無法create table解決Oracle
- 使用python對oracle進行簡單效能測試PythonOracle
- 【SWINGBENCH】使用SwingBench對Oracle進行壓力測試Oracle
- Oracle普通檢視和物化檢視的區別Oracle
- oracle 普通表空間資料檔案壞塊Oracle
- oracle表空間不足:ORA-01653: unable to extend tableOracle
- Oracle中獲取TABLE的DDL語句的方法Oracle
- iview Table元件使用render新增Select下拉框並進行雙向繫結View元件
- mybatis進行資料庫建表 CREATE command denied to user 'root'@'127.0.0.1' for table 問題MyBatis資料庫127.0.0.1
- Fiori Elements List Report table 裡的普通按鈕,Global 按鈕 和 Determining 按鈕
- table表格tr行點選高亮
- 使用python進行Oracle資料庫效能趨勢分析PythonOracle資料庫
- 如何抽取Oracle資料到文字文件進行查詢NAOracle