狠狠撸

狠狠撸Share a Scribd company logo
Part 1 ORACLE │95
??? DML ??? ?? ??????
??? ?????/DB???? ? ??
??
??? ???? ???? ?? ??? ? ?????? ? ???? ????. ??? ???
? ???? ???? ?? ??? ???? ? ???? ?? ?? ???? ?? ???? ?
? ?? ??????? ??? ???? ?? ????? ?? ? ??? ???.
? ??? ??? ???? ???? ?? ??? ??? SQL Tuning ??? ??? ??? ?
?? ?? ????? ??? ?? ???? ??? ??? ????? ???. ??? ???
?? ???? redo ? undo ???? ?? ???? ??? ??? ???? ?? ?????
???? ???? ??? ?? ????? ??? ????? ??? ?? ??.
???, ?? ??? ??? DML ? ??? ?, ??? ???? ?? ? ???? Direct Path
Insert ? ???? ?? ?? ??? DML ????? ?? ??? ????, ???? Down
Time ????? ??? ? ?? ??? ?? ???? ??? ??.
??? Delete
? ?? ?? ?? ?? ??? ???? ????? ???? ??? ?? ?????? ??
? ? ?? ?? ? ????. ??? ???? ?? ? ??? ??? ????? ?? ??.
??? Delete ??? Table Full Scan ?? Index Scan ?? ?? ?? ???? Access ??
??? ?? ?????? ????? ??? ? ?? ?? redo, undo ??? ??? ???
?? ???? ???? ????? ???? ??? ?? ???? Overhead ? ???? ?
? ????? ?? ??? ?? ????.
????? ???? ???? Overhead ?, ?? ??? ?? ???? ?????? ???
? ?? ?? ???, ? ?? ?? redo ? undo ???? ???? ????.
96│2013 ???? White Paper
?? ?? ??? ????? ??? Delete ??? ????? ????? ?? ??? ????
?? Partition Table ??? ??.
????? ???? ?? ??? ??? ???, ?? ??? Key ? ?? Range Partition ?
????, ?? ??? ?? ??? ???? Partition Table ? Alter Table [Partition_Name]
Drop Partition [Partition_Name]??? ?? DML ? ?? DDL ? ??? ??? ? ??.
DDL ?? Delete ??? ???, redo ???? ???? ?? ??? ?? Partition ? Drop
?? ??? ????? ??? ??? ??? ? ?? ?? ??, ?? ?? redo / undo ??
?? ???? ???? Down Time ????? ? ??? ? ? ??.
?? ???? ?? ? ??? ??? ??? ????.
??? ?? DDL (Partition_test)
CREATE TABLE partition_test (TIME_ID DATE ,
DAY_NAME VARCHAR2(9),
DAY_NUMBER_IN_WEEK NUMBER(1,0) ,
DAY_NUMBER_IN_MONTH NUMBER(2,0) ,
CALENDAR_WEEK_NUMBER NUMBER(2,0) ,
FISCAL_WEEK_NUMBER NUMBER(2,0) ,
WEEK_ENDING_DAY DATE ,
WEEK_ENDING_DAY_ID NUMBER ,
CALENDAR_MONTH_NUMBER NUMBER(2,0) ,
FISCAL_MONTH_NUMBER NUMBER(2,0) ,
CALENDAR_MONTH_DESC VARCHAR2(8) ,
CALENDAR_MONTH_ID NUMBER ,
FISCAL_MONTH_DESC VARCHAR2(8) ,
FISCAL_MONTH_ID NUMBER,
DAYS_IN_CAL_MONTH NUMBER ,
DAYS_IN_FIS_MONTH NUMBER ,
END_OF_CAL_MONTH DATE ,
END_OF_FIS_MONTH DATE ,
CALENDAR_MONTH_NAME VARCHAR2(9) ,
FISCAL_MONTH_NAME VARCHAR2(9) ,
CALENDAR_QUARTER_DESC CHAR(7) ,
CALENDAR_QUARTER_ID NUMBER ,
FISCAL_QUARTER_DESC CHAR(7) ,
Part 1 ORACLE │97
FISCAL_QUARTER_ID NUMBER ,
DAYS_IN_CAL_QUARTER NUMBER ,
DAYS_IN_FIS_QUARTER NUMBER ,
END_OF_CAL_QUARTER DATE ,
END_OF_FIS_QUARTER DATE ,
CALENDAR_QUARTER_NUMBER NUMBER(1,0) ,
FISCAL_QUARTER_NUMBER NUMBER(1,0) ,
CALENDAR_YEAR NUMBER(4,0) ,
CALENDAR_YEAR_ID NUMBER ,
FISCAL_YEAR NUMBER(4,0) ,
FISCAL_YEAR_ID NUMBER ,
DAYS_IN_CAL_YEAR NUMBER ,
DAYS_IN_FIS_YEAR NUMBER ,
END_OF_CAL_YEAR DATE ,
END_OF_FIS_YEAR DATE )
PARTITION BY RANGE( time_id )(
PARTITION partition_test1 VALUES less than (to_date('1998-12-31','YYYY-MM-DD')) ,
PARTITION partition_test2 VALUES less than (to_date('1999-12-31','YYYY-MM-DD')) ,
PARTITION partition_test3 VALUES less than (to_date('2000-12-31','YYYY-MM-DD')) ,
PARTITION partition_test4 VALUES less than (to_date('2001-12-31','YYYY-MM-DD')) ,
PARTITION partition_test5 VALUES less than (to_date('2003-12-31','YYYY-MM-DD')) );
??? ?? DDL (Partition_test2)
CREATE TABLE partition_test2 (TIME_ID DATE ,
DAY_NAME VARCHAR2(9),
DAY_NUMBER_IN_WEEK NUMBER(1,0) ,
DAY_NUMBER_IN_MONTH NUMBER(2,0) ,
CALENDAR_WEEK_NUMBER NUMBER(2,0) ,
FISCAL_WEEK_NUMBER NUMBER(2,0) ,
WEEK_ENDING_DAY DATE ,
WEEK_ENDING_DAY_ID NUMBER ,
CALENDAR_MONTH_NUMBER NUMBER(2,0) ,
FISCAL_MONTH_NUMBER NUMBER(2,0) ,
CALENDAR_MONTH_DESC VARCHAR2(8) ,
CALENDAR_MONTH_ID NUMBER ,
FISCAL_MONTH_DESC VARCHAR2(8) ,
FISCAL_MONTH_ID NUMBER,
DAYS_IN_CAL_MONTH NUMBER ,
DAYS_IN_FIS_MONTH NUMBER ,
END_OF_CAL_MONTH DATE ,
98│2013 ???? White Paper
END_OF_FIS_MONTH DATE ,
CALENDAR_MONTH_NAME VARCHAR2(9) ,
FISCAL_MONTH_NAME VARCHAR2(9) ,
CALENDAR_QUARTER_DESC CHAR(7) ,
CALENDAR_QUARTER_ID NUMBER ,
FISCAL_QUARTER_DESC CHAR(7) ,
FISCAL_QUARTER_ID NUMBER ,
DAYS_IN_CAL_QUARTER NUMBER ,
DAYS_IN_FIS_QUARTER NUMBER ,
END_OF_CAL_QUARTER DATE ,
END_OF_FIS_QUARTER DATE ,
CALENDAR_QUARTER_NUMBER NUMBER(1,0) ,
FISCAL_QUARTER_NUMBER NUMBER(1,0) ,
CALENDAR_YEAR NUMBER(4,0) ,
CALENDAR_YEAR_ID NUMBER ,
FISCAL_YEAR NUMBER(4,0) ,
FISCAL_YEAR_ID NUMBER ,
DAYS_IN_CAL_YEAR NUMBER ,
DAYS_IN_FIS_YEAR NUMBER ,
END_OF_CAL_YEAR DATE ,
END_OF_FIS_YEAR DATE );
??? ??(? ??? ??)
INSERT /*+ append */
INTO partition_test
SELECT a.*
FROM sh.times a ,
(
SELECT LEVEL
FROM dual
CONNECT BY LEVEL <= 10000
) b;
?? ???(Partition_test2) ? ??? ??
SQL> delete partition_test2
2 where time_id<= (to_date('2000-12-31','YYYY-MM-DD'));
10960000 ?? ???????.
Execution Plan
Part 1 ORACLE │99
----------------------------------------------------------
Plan hash value: 3385385008
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | DELETE STATEMENT | | 5718 | 51462 | 141K (1)| 00:28:15 |
| 1 | DELETE | PARTITION_TEST2 | | | | |
|* 2 | TABLE ACCESS FULL| PARTITION_TEST2 | 5718 | 51462 | 141K (1)| 00:28:15 |
--------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("TIME_ID"<=TO_DATE(' 2000-12-31 00:00:00', 'syyyy-mm-ddhh24:mi:ss'))
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
5516 recursive calls
13289330 db block gets
521869 consistent gets
520081 physical reads
5831072716 redo size
565 bytes sent via SQL*Net to client
544 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
7 sorts (memory)
0 sorts (disk)
10960000 rows processed
??? ???(Partition_test)? ??? ??
SQL> alter table partition_test drop partition partition_test1;
???? ???????.
SQL> alter table partition_test drop partition partition_test2;
???? ???????.
SQL> alter table partition_test drop partition partition_test3;
100│2013 ???? White Paper
???? ???????.
??? INSERT
??? ???? Insert ?? ??? ??? ??? Delete ??? ?? ?? ??? ??? ?
? ???. ?? ??? ???? ???? ????(Nologging)? ??(/*+ append */)??
? Direct Path Insert ? ???? redo ??? ???? ??? ?? ????.
??? ??? ? ?? ??? ?????, ?? ???? ???.
?? ??? Insert ?? ? ???? ???? ???? ????? ???? ??? ????
??? ?? ??? ????? ?? ??? ??? ????.
Direct Path Insert ? ??? ???? ? ?? ??? ?? ??? Insert ??? ?????
?? ???? ??? ??? ????? ??.
???? ??? ?? Direct Path Insert ????
Insert ??? ?????? ???? ?? ???? ??? ? ??? redo ???? ???
???? ???? Insert ??? ??? ???.
?? ???? ?? ??? ??? ?? Direct Path Insert ??? ??? ?? ?? ??? ?
??? ????.
??? ?? DDL ?? (? ??? Delete ? Partition_test ??? DDL ??)
? ?? ???? ???? ??? ??? Insert
SQL> alter table partition_testnologging;
???? ???????.
SQL> INSERT /*+ append */
Part 1 ORACLE │101
2 INTO partition_test
3 SELECT a.*
4 FROM sh.times a ,
5 (
6 SELECT LEVEL
7 FROM dual
8 CONNECT BY LEVEL <= 10000
9 ) b;
18260000 ?? ?? ???????.
? ?: 00:08:50.77
Statistics
----------------------------------------------------------
37399 recursive calls
4600992 db block gets
323059 consistent gets
493284 physical reads
5177833936 redo size
564 bytes sent via SQL*Net to client
636 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
3 sorts (memory)
3 sorts (disk)
18260000 rows processed
??? ???? ???? Insert ?? ??? ??
SQL> truncate table partition_test;
???? ?????.
? ?: 00:00:00.74
SQL> drop index idx_test1;
???? ???????.
? ?: 00:00:00.09
SQL> drop index idx_test2;
???? ???????.
? ?: 00:00:00.03
102│2013 ???? White Paper
SQL> drop index idx_test3;
???? ???????.
? ?: 00:00:00.03
SQL> INSERT /*+ append */
2 INTO partition_test
3 SELECT a.*
4 FROM sh.times a ,
5 (
6 SELECT LEVEL
7 FROM dual
8 CONNECT BY LEVEL <= 10000
9 ) b;
18260000 ?? ?? ???????.
? ?: 00:00:24.49
Statistics
----------------------------------------------------------
13820 recursive calls
532991 db block gets
4210 consistent gets
7 physical reads
1975520 redo size
566 bytes sent via SQL*Net to client
636 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
20 sorts (memory)
0 sorts (disk)
18260000 rows processed
SQL> create index idx_test1 on partition_test(time_id, day_name) local;
???? ???????.
? ?: 00:00:26.87
SQL> create index idx_test2 on
partition_test(DAY_NUMBER_IN_WEEK,DAY_NUMBER_IN_MONTH) local;
???? ???????.
? ?: 00:00:27.42
SQL> create index idx_test3 on partition_test(WEEK_ENDING_DAY,WEEK_ENDING_DAY_ID)
Part 1 ORACLE │103
local;
???? ???????.
? ?: 00:00:26.72
? ??? ??? ?? ??? ???? ??? ?, ?? ???? ???? ??? ?? ???
??? ?? ??? ? ??? ?? ??? ????. ?? ??? ??? ??? ???? ??
?? ??? ?? ????? ???? ?????? ??? ???? ???? ?? ??? ?
??? Drop ??? Unusable ??? ???? ????? ??? ???.
??, ??? ???? ?? ???? ?? ????? ??? ??? ? ?? ???????
??. ????? ?????? redo ??? ????? ? ??? ? ? ?? ????? ??
??.
??? Index Split? ?? Direct Path Insert ????
?? ???? ?? Insert ?? ?? ??? ??? ??? ? ??. ???? ?? ?????
SYSDATE ? ???? ??? ???. ??, ? ??? Index ? ???? ??? ????, ?
?? Insert ??? ????? 9:1 Index Split ? ???? ???? ??? ???? ???
???. ?? ?????, Index Split ? ?? ????? ??. ? ??? ??? ? ??? ?
???.
??, 9:1 Split ?? Max ?? ???? ???? ?? ??? Index Leaf Block ? ? ?? ?
?? ??? ?? ?? Free List ? Free Block ? ??? ?? ?? ??? Index Leaf Block
? ???? ???? ??? Free Block ? ???? ?? ???? ?????? Block ? ?
??? ??? ???.
?? ???? ???? ???? ????? Index Size ? ????, Index Split ? ???
?? ???? ????? ????.
???, Index Split ??? ??? ???.
104│2013 ???? White Paper
Index Split ? ? ??? redo ? ???? Split ? ???? ???? ???? Locking ? ?
? ? ??? ????. ? Locking ?, Enq : TX – Index Contention ??? Wait Event ?
Split ? ???? ???? Split ??? ???? ??.
???, ?? ???? ??? ??? ???? ???? ?? ?? ???? ??? ????
???? ??, Index Split ? ?? Wait Time ??? ??? redo ?? ??? Insert ???
??? ????? ????.
???? ?? ??? ? ?? ??? ???? ???? ????? ??? ?? Index ???
??? ???? ? ???? ??? ????.
? ??? ??? ??? ???? ??? ?, ?? ?? ??? Index Leaf Block ? ??? ?
??? ?? ?? ???? ??? ? ??? ???? ??? ??? ????. ?????
Index ?? ?? ??? NDV(Number of Distinct Value) ?? ? ?? Index Split ??? ?
?? ?? ?? ???.
??, ? ???? ??? ?? Index Clustering Factor ? ?? ??? ? ???? NDV ??
? ??? ????? ??? ??? ??.
Array Processing
??? DML ??? ???? Load ??? Update(Delete) ? ? ????? LOOP ????
?? ??? ???? ??? ??. ? ??? ? Loop ?? 1 ?? DML ??? ???? ? ?
?? DBMS CALL ? ???? ??? ??? ????.
??? Array Processing ? ??? Bulk SQL ? ???? Loop ?? ? ??? SQL ????
? ??? ????. ?, ??? DML ? ? ??(Limit ???? ???? ??? ??? ? ?
? ??? ???? ?? ??)? ??? ? ???? DBMS CALL ? ???? Loop ? ??
?? ??? ?? ? ???? ??? ? ? ??.
?? ???? ?? ? ????? ??? ??.
Part 1 ORACLE │105
Array Processing ? ???? Insert ?? Procedure Source - P_BULK_INSERT_TEST1
CREATE OR REPLACE PROCEDURE P_BULK_INSERT_TEST1 IS
CURSOR sales_cur IS
SELECT PROD_ID,
CUST_ID,
TIME_ID,
CHANNEL_ID,
PROMO_ID,
QUANTITY_SOLD,
AMOUNT_SOLD
FROM SH.SALES;
TYPE SALES_TBL_TYPE IS TABLE OF sales_cur%ROWTYPE INDEX BY BINARY_INTEGER;
SALES_TBL SALES_TBL_TYPE;
BEGIN
OPEN sales_cur;
LOOP
FETCH sales_cur BULK COLLECT INTO sales_tbl LIMIT 1000; -- PGA ??? ?? ????
?? 1000 ??? ??
FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP --?? ??? ????
sales_tbl(i).AMOUNT_SOLD := sales_tbl(i).AMOUNT_SOLD * 1.5;
END LOOP;
-- FETCH ? 1000 ?? SQL 1 ? ???? ??
FORALL i IN sales_tbl.FIRST..sales_tbl.LAST
INSERT INTO SALES2 VALUES (sales_tbl(i).PROD_ID,
sales_tbl(i).CUST_ID,
sales_tbl(i).TIME_ID,
sales_tbl(i).CHANNEL_ID,
sales_tbl(i).PROMO_ID,
sales_tbl(i).QUANTITY_SOLD,
sales_tbl(i).AMOUNT_SOLD
);
EXIT WHEN sales_cur%NOTFOUND;
END LOOP;
CLOSE sales_cur;
COMMIT;
EXCEPTION
106│2013 ???? White Paper
WHEN OTHERS THEN
ROLLBACK;
RAISE_APPLICATION_ERROR(-20001,'RAISE_APPLICATION_ERROR : '
||SQLCODE||':'|| SUBSTR(SQLERRM,1,200));
END;
/
??? Loop ? ?? Insert ?? Procedure Source - P_BULK_INSERT_TEST2
CREATE OR REPLACE PROCEDURE P_BULK_INSERT_TEST2 IS
CURSOR sales_cur IS
SELECT PROD_ID,
CUST_ID,
TIME_ID,
CHANNEL_ID,
PROMO_ID,
QUANTITY_SOLD,
AMOUNT_SOLD
FROM SH.SALES;
TYPE SALES_TBL_TYPE IS TABLE OF sales_cur%ROWTYPE INDEX BY BINARY_INTEGER;
SALES_TBL SALES_TBL_TYPE;
BEGIN
OPEN sales_cur;
LOOP
FETCH sales_cur BULK COLLECT INTO sales_tbl LIMIT 1000; -- PGA ??? ?? ????
?? 1000 ??? ??
FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP --?? ??? ????
sales_tbl(i).AMOUNT_SOLD := sales_tbl(i).AMOUNT_SOLD * 1.5;
END LOOP;
-- LOOP ? ???? ??; INSERT SQL 1000 ? ??
FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP -- FORALL ??? ??
INSERT INTO SALES2 VALUES (sales_tbl(i).PROD_ID,
sales_tbl(i).CUST_ID,
sales_tbl(i).TIME_ID,
sales_tbl(i).CHANNEL_ID,
sales_tbl(i).PROMO_ID,
sales_tbl(i).QUANTITY_SOLD,
sales_tbl(i).AMOUNT_SOLD
);
Part 1 ORACLE │107
END LOOP;
EXIT WHEN sales_cur%NOTFOUND;
END LOOP;
CLOSE sales_cur;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RAISE_APPLICATION_ERROR(-20001,'RAISE_APPLICATION_ERROR : '
||SQLCODE||':'|| SUBSTR(SQLERRM,1,200));
END;
/
P_BULK_INSERT_TEST2 Vs. P_BULK_INSERT_TEST2
SQL> exec P_BULK_INSERT_TEST1;
PL/SQL ??? ????? ???????.
? ?: 00:00:02.20
SQL>
SQL>
SQL> exec P_BULK_INSERT_TEST2;
PL/SQL ??? ????? ???????.
? ?: 00:00:35.08
?? : Array Processing ? ??? Update Procedure Source
CREATE OR REPLACE PROCEDURE P_BULK_INSERT_TEST2 IS
CURSOR sales_cur IS
SELECT PROD_ID,
CUST_ID,
TIME_ID,
CHANNEL_ID,
PROMO_ID,
QUANTITY_SOLD,
AMOUNT_SOLD
FROM SH.SALES;
108│2013 ???? White Paper
TYPE SALES_TBL_TYPE IS TABLE OF sales_cur%ROWTYPE INDEX BY BINARY_INTEGER;
SALES_TBL SALES_TBL_TYPE;
BEGIN
OPEN sales_cur;
LOOP
FETCH sales_cur BULK COLLECT INTO sales_tbl LIMIT 1000; -- PGA ??? ?? ????
?? 1000 ??? ??
FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP --?? ??? ????
sales_tbl(i).AMOUNT_SOLD := sales_tbl(i).AMOUNT_SOLD * 1.5;
END LOOP;
-- UPDATE / DELETE ? ??
FORALL i IN sales_tbl.FIRST..sales_tbl.LAST
UPDATE SALES SET AMOUNT_SOLD = sales_tbl(i).AMOUNT_SOLD
WHERE PROD_ID = sales_tbl(i).PROD_ID
AND CUST_ID = sales_tbl(i).CUST_ID
AND TIME_ID = sales_tbl(i).TIME_ID
AND CHANNEL_ID = sales_tbl(i).CHANNEL_ID
AND PROMO_ID = sales_tbl(i).PROMO_ID;
EXIT WHEN sales_cur%NOTFOUND;
END LOOP;
CLOSE sales_cur;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RAISE_APPLICATION_ERROR(-20001,'RAISE_APPLICATION_ERROR : '
||SQLCODE||':'|| SUBSTR(SQLERRM,1,200));
END;
/
Part 1 ORACLE │109
? ?? ??
?? ??? ???? ??? ????? ??? DML ??? ?? ???? Process ? ???
? ?? ???. ??? ? ??? ???? ? ??? ?? ???? ??.
?? Partition Table ?? ??? ??? ??? ???? ??? ??? ?? ???? ???
? ???? ???? Partition Table ? ???? ??? ??? ??? ???.
???? Offline ? ????? ?? ????? ??? ? ?? ????, ?? ??????
? ?? ???? Partition Table ? ???? ??? ?????, ?????? ??? ? ?
????? ??? ???? ?? DBA ??? ? ????? ???? ??? ?? ? ??.
??? ? ?????? ??? ??? ? ?? ?????. ?? ?? Partition Exchange(?
? PE) ??? ???? ???. PE ??? ? ??? ?? ???? Partition Table ?? ??
? ???? ????. ??, ???? ??? ?? ?? ??????? ???? Partition
Table ?? ??? ?? ? ??.
?? ???? PE ??? ???? ?? ???? Partition Table ?? ? ?? ??? ???
? ??? ??.
??? ???? ?? ??? : Partition_test2
: Delete ???? ??? ?? ????? ??? ?? ???? ??
Partition Table ? ??? Partition Table ??
CREATE TABLE partition_test (TIME_ID DATE ,
DAY_NAME VARCHAR2(9),
DAY_NUMBER_IN_WEEK NUMBER(1,0) ,
DAY_NUMBER_IN_MONTH NUMBER(2,0) ,
CALENDAR_WEEK_NUMBER NUMBER(2,0) ,
FISCAL_WEEK_NUMBER NUMBER(2,0) ,
WEEK_ENDING_DAY DATE ,
WEEK_ENDING_DAY_ID NUMBER ,
CALENDAR_MONTH_NUMBER NUMBER(2,0) ,
FISCAL_MONTH_NUMBER NUMBER(2,0) ,
CALENDAR_MONTH_DESC VARCHAR2(8) ,
110│2013 ???? White Paper
CALENDAR_MONTH_ID NUMBER ,
FISCAL_MONTH_DESC VARCHAR2(8) ,
FISCAL_MONTH_ID NUMBER,
DAYS_IN_CAL_MONTH NUMBER ,
DAYS_IN_FIS_MONTH NUMBER ,
END_OF_CAL_MONTH DATE ,
END_OF_FIS_MONTH DATE ,
CALENDAR_MONTH_NAME VARCHAR2(9) ,
FISCAL_MONTH_NAME VARCHAR2(9) ,
CALENDAR_QUARTER_DESC CHAR(7) ,
CALENDAR_QUARTER_ID NUMBER ,
FISCAL_QUARTER_DESC CHAR(7) ,
FISCAL_QUARTER_ID NUMBER ,
DAYS_IN_CAL_QUARTER NUMBER ,
DAYS_IN_FIS_QUARTER NUMBER ,
END_OF_CAL_QUARTER DATE ,
END_OF_FIS_QUARTER DATE ,
CALENDAR_QUARTER_NUMBER NUMBER(1,0) ,
FISCAL_QUARTER_NUMBER NUMBER(1,0) ,
CALENDAR_YEAR NUMBER(4,0) ,
CALENDAR_YEAR_ID NUMBER ,
FISCAL_YEAR NUMBER(4,0) ,
FISCAL_YEAR_ID NUMBER ,
DAYS_IN_CAL_YEAR NUMBER ,
DAYS_IN_FIS_YEAR NUMBER ,
END_OF_CAL_YEAR DATE ,
END_OF_FIS_YEAR DATE )
PARTITION BY RANGE( time_id )(
PARTITION part1 VALUES less than (to_date('2002-12-31','YYYY-MM-DD')) ); --
Partiton Table ? ??? ???? Max ?? ??
Partition Exchange ??
SQL> ALTER TABLE partition_test exchange partition part1 WITH TABLE
partition_test2 without validation ;
???? ???????.
? ?: 00:00:00.03
?? ??? ?? ? Rename
Part 1 ORACLE │111
SQL> DROP TABLE partition_test2;
???? ???????.
? ?: 00:00:00.06
SQL> RENAME partition_test to partition_test2;
??? ??? ???????.
? ?: 00:00:00.03
?? ?? ???? ??? ???? ??? Partition Table ? ??? ? ??? ? ???. ?
? ??? ???? ?? ????? ??? ?? ????(Primary Key)?? Index ???
?? ???? ????? ???? PE ??? ????.
??
?? ??? ??? DML ??? ??? ???? ??? ???? ?? ??? ????? ?
???? redo ? ?? ??? ????? ?? ??? Index ? ????? Drop ??? ??
? ? ??. ??? ??? ??? ?? ??? ???? DBA ??? ?? ? ???? ???
? ??? ? ??. ???? ??? ???? ??? ? ?? ?? ??? ????? ????
??? ??? ? ??? ? ???? ? ???? ??? ???.
??? ?? ??? ???? ????? ??? ? ?? ?? ??? ??? ??. ?? ???
??? ?? ?? ???? ?? ?? ???? ???? ??? ? ?? ?? ????, ? ?
?? ?? ???? ?? ????? ???.
??????? ?????? ?? ????? ??? ?????. ?? ???? ???? ?
??? ??? ???? ??? ?? ???? ???? ????? ??? ? ??, ? ? ??
??? ??? ? ?? ??? ??? ?? ?? ? ?? ???.
??? DML ?? ????? ???? Down Time ????? ? ?? ??? ?? ?? ??
????? ??.

More Related Content

What's hot (20)

Delta lakesummary
Delta lakesummaryDelta lakesummary
Delta lakesummary
Ryoma Nagata
?
Oracle Database Applianceのご紹介(詳細)
Oracle Database Applianceのご紹介(詳細)Oracle Database Applianceのご紹介(詳細)
Oracle Database Applianceのご紹介(詳細)
オラクルエンジニア通信
?
Oracle GoldenGate導入Tips
Oracle GoldenGate導入TipsOracle GoldenGate導入Tips
Oracle GoldenGate導入Tips
オラクルエンジニア通信
?
翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法
翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法
翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法
株式会社クライム
?
Oracle Cloud Infrastructure:2022年8月度サービス?アップデート
Oracle Cloud Infrastructure:2022年8月度サービス?アップデートOracle Cloud Infrastructure:2022年8月度サービス?アップデート
Oracle Cloud Infrastructure:2022年8月度サービス?アップデート
オラクルエンジニア通信
?
【2017年4月時点】Oracle Essbase 概要
【2017年4月時点】Oracle Essbase 概要【2017年4月時点】Oracle Essbase 概要
【2017年4月時点】Oracle Essbase 概要
オラクルエンジニア通信
?
【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]
【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]
【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]
オラクルエンジニア通信
?
Oracle 索引介紹
Oracle 索引介紹Oracle 索引介紹
Oracle 索引介紹
Chien Chung Shen
?
しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2
しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2
しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2
オラクルエンジニア通信
?
【ことはじめ】 はじめてのコンテナ活用をクラウドで
【ことはじめ】 はじめてのコンテナ活用をクラウドで【ことはじめ】 はじめてのコンテナ活用をクラウドで
【ことはじめ】 はじめてのコンテナ活用をクラウドで
オラクルエンジニア通信
?
OCI GoldenGate Overview 2021年4月版
OCI GoldenGate Overview 2021年4月版OCI GoldenGate Overview 2021年4月版
OCI GoldenGate Overview 2021年4月版
オラクルエンジニア通信
?
Oracle GoldenGate Cloud Serviceユーザーズガイド
Oracle GoldenGate Cloud ServiceユーザーズガイドOracle GoldenGate Cloud Serviceユーザーズガイド
Oracle GoldenGate Cloud Serviceユーザーズガイド
オラクルエンジニア通信
?
とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...
とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...
とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...
オラクルエンジニア通信
?
Oracle Data Guard による高可用性
Oracle Data Guard による高可用性Oracle Data Guard による高可用性
Oracle Data Guard による高可用性
驰补丑辞辞!デベロッパーネットワーク
?
Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]
Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]
Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]
オラクルエンジニア通信
?
蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果
蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果
蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果
kawarasho
?
Oracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理について
Oracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理についてOracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理について
Oracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理について
オラクルエンジニア通信
?
Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)
Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)
Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)
オラクルエンジニア通信
?
OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)
OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)
OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)
オラクルエンジニア通信
?
翱谤补肠濒别のトランケートについて知っておくべきこと
翱谤补肠濒别のトランケートについて知っておくべきこと翱谤补肠濒别のトランケートについて知っておくべきこと
翱谤补肠濒别のトランケートについて知っておくべきこと
Kazuhiro Takahashi
?
翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法
翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法
翱厂厂系データベース、クラウド?データベースへ脱翱谤补肠濒别への実现方法
株式会社クライム
?
Oracle Cloud Infrastructure:2022年8月度サービス?アップデート
Oracle Cloud Infrastructure:2022年8月度サービス?アップデートOracle Cloud Infrastructure:2022年8月度サービス?アップデート
Oracle Cloud Infrastructure:2022年8月度サービス?アップデート
オラクルエンジニア通信
?
【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]
【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]
【旧版】Oracle Database Cloud Service:サービス概要のご紹介 [2021年7月版]
オラクルエンジニア通信
?
しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2
しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2
しばちょう先生が语る!オラクルデータベースの进化の歴史と最新技术动向#2
オラクルエンジニア通信
?
【ことはじめ】 はじめてのコンテナ活用をクラウドで
【ことはじめ】 はじめてのコンテナ活用をクラウドで【ことはじめ】 はじめてのコンテナ活用をクラウドで
【ことはじめ】 はじめてのコンテナ活用をクラウドで
オラクルエンジニア通信
?
とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...
とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...
とっておきの方法! Oracle Databaseの自動アップグレードのお勧め手法 省力?最新化 概要編?(Oracle Cloudウェビナーシリーズ: ...
オラクルエンジニア通信
?
Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]
Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]
Oracle Container Engine for Kubernetes (OKE) ご紹介 [2021年5月版]
オラクルエンジニア通信
?
蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果
蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果
蝉蝉濒肠辞尘辫谤别蝉蝉颈辞苍の设定方法および性能测定结果
kawarasho
?
Oracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理について
Oracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理についてOracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理について
Oracle Database Appliance 12.1.2.3.0 アップデート及びパッチ管理について
オラクルエンジニア通信
?
Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)
Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)
Oracle GoldenGateでの資料採取(トラブル時に採取すべき資料)
オラクルエンジニア通信
?
OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)
OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)
OCI 購入モデルの整理と Universal Credit 最新情報(2021年2月17日版)
オラクルエンジニア通信
?
翱谤补肠濒别のトランケートについて知っておくべきこと
翱谤补肠濒别のトランケートについて知っておくべきこと翱谤补肠濒别のトランケートについて知っておくべきこと
翱谤补肠濒别のトランケートについて知っておくべきこと
Kazuhiro Takahashi
?

Similar to ??? DML ??? ?? ??????_Wh oracle (20)

NLJ BATCH? ???? ??_Wh oracle
NLJ BATCH? ???? ??_Wh oracleNLJ BATCH? ???? ??_Wh oracle
NLJ BATCH? ???? ??_Wh oracle
??
?
[2015-06-26] Oracle ?? ??? ? ?? ??? 3
[2015-06-26] Oracle ?? ??? ? ?? ??? 3[2015-06-26] Oracle ?? ??? ? ?? ??? 3
[2015-06-26] Oracle ?? ??? ? ?? ??? 3
Seok-joon Yun
?
?1? Tech Net Sql Server 2005 T Sql Enhancements
?1? Tech Net Sql Server 2005 T Sql Enhancements?1? Tech Net Sql Server 2005 T Sql Enhancements
?1? Tech Net Sql Server 2005 T Sql Enhancements
beamofhope
?
SQL ??? Dictionary View ???? Part2_Wh oracle
SQL ??? Dictionary View ???? Part2_Wh oracleSQL ??? Dictionary View ???? Part2_Wh oracle
SQL ??? Dictionary View ???? Part2_Wh oracle
??
?
From MSSQL to MySQL
From MSSQL to MySQLFrom MSSQL to MySQL
From MSSQL to MySQL
I Goo Lee
?
?? DataSnap!
?? DataSnap!?? DataSnap!
?? DataSnap!
Devgear
?
MariaDB ?????? - ?????
MariaDB ?????? - ?????MariaDB ?????? - ?????
MariaDB ?????? - ?????
NeoClova
?
?? ?????? ???? SQL ????_Wh oracle
?? ?????? ???? SQL ????_Wh oracle?? ?????? ???? SQL ????_Wh oracle
?? ?????? ???? SQL ????_Wh oracle
??
?
Database ?? ?? 110124
Database ?? ?? 110124Database ?? ?? 110124
Database ?? ?? 110124
? ??
?
[Pgday.Seoul 2020] SQL Tuning
[Pgday.Seoul 2020] SQL Tuning[Pgday.Seoul 2020] SQL Tuning
[Pgday.Seoul 2020] SQL Tuning
PgDay.Seoul
?
Fundamentals of Oracle SQL
Fundamentals of Oracle SQLFundamentals of Oracle SQL
Fundamentals of Oracle SQL
JAEGEUN YU
?
Intranet query tuning (example)
Intranet query tuning (example)Intranet query tuning (example)
Intranet query tuning (example)
?? ?
?
SQL Profile? ??? SQL Plan ??_Wh oracle
SQL Profile? ??? SQL Plan ??_Wh oracleSQL Profile? ??? SQL Plan ??_Wh oracle
SQL Profile? ??? SQL Plan ??_Wh oracle
??
?
?? ?? SQL??? ??? ?? ??? ?
?? ?? SQL??? ??? ?? ??? ??? ?? SQL??? ??? ?? ??? ?
?? ?? SQL??? ??? ?? ??? ?
Devgear
?
NO PARALLEL DML
NO PARALLEL DMLNO PARALLEL DML
NO PARALLEL DML
Kyung Sang Jang
?
1.7 ????? sql autorace
1.7 ????? sql autorace1.7 ????? sql autorace
1.7 ????? sql autorace
?????(????????3??? 2???)
?
1.3 dbms stats ???????
1.3 dbms stats ???????1.3 dbms stats ???????
1.3 dbms stats ???????
?????(????????3??? 2???)
?
MySQL ?? ??? ?? ? ??
MySQL ?? ??? ?? ? ??MySQL ?? ??? ?? ? ??
MySQL ?? ??? ?? ? ??
I Goo Lee
?
[2015-06-12] Oracle ?? ??? ? ?? ??? 1
[2015-06-12] Oracle ?? ??? ? ?? ??? 1[2015-06-12] Oracle ?? ??? ? ?? ??? 1
[2015-06-12] Oracle ?? ??? ? ?? ??? 1
Seok-joon Yun
?
??? ??? ?? ??(?????? ??)
??? ??? ?? ??(?????? ??)??? ??? ?? ??(?????? ??)
??? ??? ?? ??(?????? ??)
Devgear
?
NLJ BATCH? ???? ??_Wh oracle
NLJ BATCH? ???? ??_Wh oracleNLJ BATCH? ???? ??_Wh oracle
NLJ BATCH? ???? ??_Wh oracle
??
?
[2015-06-26] Oracle ?? ??? ? ?? ??? 3
[2015-06-26] Oracle ?? ??? ? ?? ??? 3[2015-06-26] Oracle ?? ??? ? ?? ??? 3
[2015-06-26] Oracle ?? ??? ? ?? ??? 3
Seok-joon Yun
?
?1? Tech Net Sql Server 2005 T Sql Enhancements
?1? Tech Net Sql Server 2005 T Sql Enhancements?1? Tech Net Sql Server 2005 T Sql Enhancements
?1? Tech Net Sql Server 2005 T Sql Enhancements
beamofhope
?
SQL ??? Dictionary View ???? Part2_Wh oracle
SQL ??? Dictionary View ???? Part2_Wh oracleSQL ??? Dictionary View ???? Part2_Wh oracle
SQL ??? Dictionary View ???? Part2_Wh oracle
??
?
From MSSQL to MySQL
From MSSQL to MySQLFrom MSSQL to MySQL
From MSSQL to MySQL
I Goo Lee
?
?? DataSnap!
?? DataSnap!?? DataSnap!
?? DataSnap!
Devgear
?
MariaDB ?????? - ?????
MariaDB ?????? - ?????MariaDB ?????? - ?????
MariaDB ?????? - ?????
NeoClova
?
?? ?????? ???? SQL ????_Wh oracle
?? ?????? ???? SQL ????_Wh oracle?? ?????? ???? SQL ????_Wh oracle
?? ?????? ???? SQL ????_Wh oracle
??
?
Database ?? ?? 110124
Database ?? ?? 110124Database ?? ?? 110124
Database ?? ?? 110124
? ??
?
[Pgday.Seoul 2020] SQL Tuning
[Pgday.Seoul 2020] SQL Tuning[Pgday.Seoul 2020] SQL Tuning
[Pgday.Seoul 2020] SQL Tuning
PgDay.Seoul
?
Fundamentals of Oracle SQL
Fundamentals of Oracle SQLFundamentals of Oracle SQL
Fundamentals of Oracle SQL
JAEGEUN YU
?
Intranet query tuning (example)
Intranet query tuning (example)Intranet query tuning (example)
Intranet query tuning (example)
?? ?
?
SQL Profile? ??? SQL Plan ??_Wh oracle
SQL Profile? ??? SQL Plan ??_Wh oracleSQL Profile? ??? SQL Plan ??_Wh oracle
SQL Profile? ??? SQL Plan ??_Wh oracle
??
?
?? ?? SQL??? ??? ?? ??? ?
?? ?? SQL??? ??? ?? ??? ??? ?? SQL??? ??? ?? ??? ?
?? ?? SQL??? ??? ?? ??? ?
Devgear
?
MySQL ?? ??? ?? ? ??
MySQL ?? ??? ?? ? ??MySQL ?? ??? ?? ? ??
MySQL ?? ??? ?? ? ??
I Goo Lee
?
[2015-06-12] Oracle ?? ??? ? ?? ??? 1
[2015-06-12] Oracle ?? ??? ? ?? ??? 1[2015-06-12] Oracle ?? ??? ? ?? ??? 1
[2015-06-12] Oracle ?? ??? ? ?? ??? 1
Seok-joon Yun
?
??? ??? ?? ??(?????? ??)
??? ??? ?? ??(?????? ??)??? ??? ?? ??(?????? ??)
??? ??? ?? ??(?????? ??)
Devgear
?

More from ?? (20)

WAS? ??? WEB, Servlet, JSP_Wh apm
WAS? ??? WEB, Servlet, JSP_Wh apmWAS? ??? WEB, Servlet, JSP_Wh apm
WAS? ??? WEB, Servlet, JSP_Wh apm
??
?
? ??? ?? ? ??_Wh apm
? ??? ?? ? ??_Wh apm? ??? ?? ? ??_Wh apm
? ??? ?? ? ??_Wh apm
??
?
TP-Monitor_Wh apm
TP-Monitor_Wh apmTP-Monitor_Wh apm
TP-Monitor_Wh apm
??
?
TCP ?? ??_Wh apm
TCP ?? ??_Wh apmTCP ?? ??_Wh apm
TCP ?? ??_Wh apm
??
?
???? ?? ? ??_Wh apm
???? ?? ? ??_Wh apm???? ?? ? ??_Wh apm
???? ?? ? ??_Wh apm
??
?
Runtime Data Areas_Wh apm
Runtime Data Areas_Wh apmRuntime Data Areas_Wh apm
Runtime Data Areas_Wh apm
??
?
???? ?? ?? ? ?? ??_Wh apm
???? ?? ?? ? ?? ??_Wh apm???? ?? ?? ? ?? ??_Wh apm
???? ?? ?? ? ?? ??_Wh apm
??
?
JVM Synchronization_Wh apm
JVM Synchronization_Wh apmJVM Synchronization_Wh apm
JVM Synchronization_Wh apm
??
?
IBM JVM GC_Wh apm
IBM JVM GC_Wh apmIBM JVM GC_Wh apm
IBM JVM GC_Wh apm
??
?
Hotspot JVM GC_Wh apm
Hotspot JVM GC_Wh apmHotspot JVM GC_Wh apm
Hotspot JVM GC_Wh apm
??
?
Class Loader_Wh apm
Class Loader_Wh apmClass Loader_Wh apm
Class Loader_Wh apm
??
?
All about JDBC Performance Tuning_Wh apm
All about JDBC Performance Tuning_Wh apmAll about JDBC Performance Tuning_Wh apm
All about JDBC Performance Tuning_Wh apm
??
?
WINDOW FUNCTION? ??? ????_Wh oracle
WINDOW FUNCTION? ??? ????_Wh oracleWINDOW FUNCTION? ??? ????_Wh oracle
WINDOW FUNCTION? ??? ????_Wh oracle
??
?
TABLE ACCESS ??? ??? SQL ??_Wh oracle
TABLE ACCESS ??? ??? SQL ??_Wh oracleTABLE ACCESS ??? ??? SQL ??_Wh oracle
TABLE ACCESS ??? ??? SQL ??_Wh oracle
??
?
SSD ?? ? ??_Wh oracle
SSD ?? ? ??_Wh oracleSSD ?? ? ??_Wh oracle
SSD ?? ? ??_Wh oracle
??
?
SQL PlAN MANAGEMENT ??_Wh oracle
SQL PlAN MANAGEMENT ??_Wh oracleSQL PlAN MANAGEMENT ??_Wh oracle
SQL PlAN MANAGEMENT ??_Wh oracle
??
?
SPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracle
SPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracleSPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracle
SPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracle
??
?
Result Cache ???? ? ????_Wh oracle
Result Cache ???? ? ????_Wh oracleResult Cache ???? ? ????_Wh oracle
Result Cache ???? ? ????_Wh oracle
??
?
ORACLE EXADATA HCC ???? ????_Wh oracle
ORACLE EXADATA HCC ???? ????_Wh oracleORACLE EXADATA HCC ???? ????_Wh oracle
ORACLE EXADATA HCC ???? ????_Wh oracle
??
?
KEEP BUFFER ?? ??_Wh oracle
KEEP BUFFER ?? ??_Wh oracleKEEP BUFFER ?? ??_Wh oracle
KEEP BUFFER ?? ??_Wh oracle
??
?
WAS? ??? WEB, Servlet, JSP_Wh apm
WAS? ??? WEB, Servlet, JSP_Wh apmWAS? ??? WEB, Servlet, JSP_Wh apm
WAS? ??? WEB, Servlet, JSP_Wh apm
??
?
? ??? ?? ? ??_Wh apm
? ??? ?? ? ??_Wh apm? ??? ?? ? ??_Wh apm
? ??? ?? ? ??_Wh apm
??
?
TP-Monitor_Wh apm
TP-Monitor_Wh apmTP-Monitor_Wh apm
TP-Monitor_Wh apm
??
?
TCP ?? ??_Wh apm
TCP ?? ??_Wh apmTCP ?? ??_Wh apm
TCP ?? ??_Wh apm
??
?
???? ?? ? ??_Wh apm
???? ?? ? ??_Wh apm???? ?? ? ??_Wh apm
???? ?? ? ??_Wh apm
??
?
Runtime Data Areas_Wh apm
Runtime Data Areas_Wh apmRuntime Data Areas_Wh apm
Runtime Data Areas_Wh apm
??
?
???? ?? ?? ? ?? ??_Wh apm
???? ?? ?? ? ?? ??_Wh apm???? ?? ?? ? ?? ??_Wh apm
???? ?? ?? ? ?? ??_Wh apm
??
?
JVM Synchronization_Wh apm
JVM Synchronization_Wh apmJVM Synchronization_Wh apm
JVM Synchronization_Wh apm
??
?
IBM JVM GC_Wh apm
IBM JVM GC_Wh apmIBM JVM GC_Wh apm
IBM JVM GC_Wh apm
??
?
Hotspot JVM GC_Wh apm
Hotspot JVM GC_Wh apmHotspot JVM GC_Wh apm
Hotspot JVM GC_Wh apm
??
?
Class Loader_Wh apm
Class Loader_Wh apmClass Loader_Wh apm
Class Loader_Wh apm
??
?
All about JDBC Performance Tuning_Wh apm
All about JDBC Performance Tuning_Wh apmAll about JDBC Performance Tuning_Wh apm
All about JDBC Performance Tuning_Wh apm
??
?
WINDOW FUNCTION? ??? ????_Wh oracle
WINDOW FUNCTION? ??? ????_Wh oracleWINDOW FUNCTION? ??? ????_Wh oracle
WINDOW FUNCTION? ??? ????_Wh oracle
??
?
TABLE ACCESS ??? ??? SQL ??_Wh oracle
TABLE ACCESS ??? ??? SQL ??_Wh oracleTABLE ACCESS ??? ??? SQL ??_Wh oracle
TABLE ACCESS ??? ??? SQL ??_Wh oracle
??
?
SSD ?? ? ??_Wh oracle
SSD ?? ? ??_Wh oracleSSD ?? ? ??_Wh oracle
SSD ?? ? ??_Wh oracle
??
?
SQL PlAN MANAGEMENT ??_Wh oracle
SQL PlAN MANAGEMENT ??_Wh oracleSQL PlAN MANAGEMENT ??_Wh oracle
SQL PlAN MANAGEMENT ??_Wh oracle
??
?
SPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracle
SPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracleSPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracle
SPA(SQL Performance Analyze)? ??? ?? ?? ??_Wh oracle
??
?
Result Cache ???? ? ????_Wh oracle
Result Cache ???? ? ????_Wh oracleResult Cache ???? ? ????_Wh oracle
Result Cache ???? ? ????_Wh oracle
??
?
ORACLE EXADATA HCC ???? ????_Wh oracle
ORACLE EXADATA HCC ???? ????_Wh oracleORACLE EXADATA HCC ???? ????_Wh oracle
ORACLE EXADATA HCC ???? ????_Wh oracle
??
?
KEEP BUFFER ?? ??_Wh oracle
KEEP BUFFER ?? ??_Wh oracleKEEP BUFFER ?? ??_Wh oracle
KEEP BUFFER ?? ??_Wh oracle
??
?

??? DML ??? ?? ??????_Wh oracle

  • 1. Part 1 ORACLE │95 ??? DML ??? ?? ?????? ??? ?????/DB???? ? ?? ?? ??? ???? ???? ?? ??? ? ?????? ? ???? ????. ??? ??? ? ???? ???? ?? ??? ???? ? ???? ?? ?? ???? ?? ???? ? ? ?? ??????? ??? ???? ?? ????? ?? ? ??? ???. ? ??? ??? ???? ???? ?? ??? ??? SQL Tuning ??? ??? ??? ? ?? ?? ????? ??? ?? ???? ??? ??? ????? ???. ??? ??? ?? ???? redo ? undo ???? ?? ???? ??? ??? ???? ?? ????? ???? ???? ??? ?? ????? ??? ????? ??? ?? ??. ???, ?? ??? ??? DML ? ??? ?, ??? ???? ?? ? ???? Direct Path Insert ? ???? ?? ?? ??? DML ????? ?? ??? ????, ???? Down Time ????? ??? ? ?? ??? ?? ???? ??? ??. ??? Delete ? ?? ?? ?? ?? ??? ???? ????? ???? ??? ?? ?????? ?? ? ? ?? ?? ? ????. ??? ???? ?? ? ??? ??? ????? ?? ??. ??? Delete ??? Table Full Scan ?? Index Scan ?? ?? ?? ???? Access ?? ??? ?? ?????? ????? ??? ? ?? ?? redo, undo ??? ??? ??? ?? ???? ???? ????? ???? ??? ?? ???? Overhead ? ???? ? ? ????? ?? ??? ?? ????. ????? ???? ???? Overhead ?, ?? ??? ?? ???? ?????? ??? ? ?? ?? ???, ? ?? ?? redo ? undo ???? ???? ????.
  • 2. 96│2013 ???? White Paper ?? ?? ??? ????? ??? Delete ??? ????? ????? ?? ??? ???? ?? Partition Table ??? ??. ????? ???? ?? ??? ??? ???, ?? ??? Key ? ?? Range Partition ? ????, ?? ??? ?? ??? ???? Partition Table ? Alter Table [Partition_Name] Drop Partition [Partition_Name]??? ?? DML ? ?? DDL ? ??? ??? ? ??. DDL ?? Delete ??? ???, redo ???? ???? ?? ??? ?? Partition ? Drop ?? ??? ????? ??? ??? ??? ? ?? ?? ??, ?? ?? redo / undo ?? ?? ???? ???? Down Time ????? ? ??? ? ? ??. ?? ???? ?? ? ??? ??? ??? ????. ??? ?? DDL (Partition_test) CREATE TABLE partition_test (TIME_ID DATE , DAY_NAME VARCHAR2(9), DAY_NUMBER_IN_WEEK NUMBER(1,0) , DAY_NUMBER_IN_MONTH NUMBER(2,0) , CALENDAR_WEEK_NUMBER NUMBER(2,0) , FISCAL_WEEK_NUMBER NUMBER(2,0) , WEEK_ENDING_DAY DATE , WEEK_ENDING_DAY_ID NUMBER , CALENDAR_MONTH_NUMBER NUMBER(2,0) , FISCAL_MONTH_NUMBER NUMBER(2,0) , CALENDAR_MONTH_DESC VARCHAR2(8) , CALENDAR_MONTH_ID NUMBER , FISCAL_MONTH_DESC VARCHAR2(8) , FISCAL_MONTH_ID NUMBER, DAYS_IN_CAL_MONTH NUMBER , DAYS_IN_FIS_MONTH NUMBER , END_OF_CAL_MONTH DATE , END_OF_FIS_MONTH DATE , CALENDAR_MONTH_NAME VARCHAR2(9) , FISCAL_MONTH_NAME VARCHAR2(9) , CALENDAR_QUARTER_DESC CHAR(7) , CALENDAR_QUARTER_ID NUMBER , FISCAL_QUARTER_DESC CHAR(7) ,
  • 3. Part 1 ORACLE │97 FISCAL_QUARTER_ID NUMBER , DAYS_IN_CAL_QUARTER NUMBER , DAYS_IN_FIS_QUARTER NUMBER , END_OF_CAL_QUARTER DATE , END_OF_FIS_QUARTER DATE , CALENDAR_QUARTER_NUMBER NUMBER(1,0) , FISCAL_QUARTER_NUMBER NUMBER(1,0) , CALENDAR_YEAR NUMBER(4,0) , CALENDAR_YEAR_ID NUMBER , FISCAL_YEAR NUMBER(4,0) , FISCAL_YEAR_ID NUMBER , DAYS_IN_CAL_YEAR NUMBER , DAYS_IN_FIS_YEAR NUMBER , END_OF_CAL_YEAR DATE , END_OF_FIS_YEAR DATE ) PARTITION BY RANGE( time_id )( PARTITION partition_test1 VALUES less than (to_date('1998-12-31','YYYY-MM-DD')) , PARTITION partition_test2 VALUES less than (to_date('1999-12-31','YYYY-MM-DD')) , PARTITION partition_test3 VALUES less than (to_date('2000-12-31','YYYY-MM-DD')) , PARTITION partition_test4 VALUES less than (to_date('2001-12-31','YYYY-MM-DD')) , PARTITION partition_test5 VALUES less than (to_date('2003-12-31','YYYY-MM-DD')) ); ??? ?? DDL (Partition_test2) CREATE TABLE partition_test2 (TIME_ID DATE , DAY_NAME VARCHAR2(9), DAY_NUMBER_IN_WEEK NUMBER(1,0) , DAY_NUMBER_IN_MONTH NUMBER(2,0) , CALENDAR_WEEK_NUMBER NUMBER(2,0) , FISCAL_WEEK_NUMBER NUMBER(2,0) , WEEK_ENDING_DAY DATE , WEEK_ENDING_DAY_ID NUMBER , CALENDAR_MONTH_NUMBER NUMBER(2,0) , FISCAL_MONTH_NUMBER NUMBER(2,0) , CALENDAR_MONTH_DESC VARCHAR2(8) , CALENDAR_MONTH_ID NUMBER , FISCAL_MONTH_DESC VARCHAR2(8) , FISCAL_MONTH_ID NUMBER, DAYS_IN_CAL_MONTH NUMBER , DAYS_IN_FIS_MONTH NUMBER , END_OF_CAL_MONTH DATE ,
  • 4. 98│2013 ???? White Paper END_OF_FIS_MONTH DATE , CALENDAR_MONTH_NAME VARCHAR2(9) , FISCAL_MONTH_NAME VARCHAR2(9) , CALENDAR_QUARTER_DESC CHAR(7) , CALENDAR_QUARTER_ID NUMBER , FISCAL_QUARTER_DESC CHAR(7) , FISCAL_QUARTER_ID NUMBER , DAYS_IN_CAL_QUARTER NUMBER , DAYS_IN_FIS_QUARTER NUMBER , END_OF_CAL_QUARTER DATE , END_OF_FIS_QUARTER DATE , CALENDAR_QUARTER_NUMBER NUMBER(1,0) , FISCAL_QUARTER_NUMBER NUMBER(1,0) , CALENDAR_YEAR NUMBER(4,0) , CALENDAR_YEAR_ID NUMBER , FISCAL_YEAR NUMBER(4,0) , FISCAL_YEAR_ID NUMBER , DAYS_IN_CAL_YEAR NUMBER , DAYS_IN_FIS_YEAR NUMBER , END_OF_CAL_YEAR DATE , END_OF_FIS_YEAR DATE ); ??? ??(? ??? ??) INSERT /*+ append */ INTO partition_test SELECT a.* FROM sh.times a , ( SELECT LEVEL FROM dual CONNECT BY LEVEL <= 10000 ) b; ?? ???(Partition_test2) ? ??? ?? SQL> delete partition_test2 2 where time_id<= (to_date('2000-12-31','YYYY-MM-DD')); 10960000 ?? ???????. Execution Plan
  • 5. Part 1 ORACLE │99 ---------------------------------------------------------- Plan hash value: 3385385008 -------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------- | 0 | DELETE STATEMENT | | 5718 | 51462 | 141K (1)| 00:28:15 | | 1 | DELETE | PARTITION_TEST2 | | | | | |* 2 | TABLE ACCESS FULL| PARTITION_TEST2 | 5718 | 51462 | 141K (1)| 00:28:15 | -------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("TIME_ID"<=TO_DATE(' 2000-12-31 00:00:00', 'syyyy-mm-ddhh24:mi:ss')) Note ----- - dynamic sampling used for this statement (level=2) Statistics ---------------------------------------------------------- 5516 recursive calls 13289330 db block gets 521869 consistent gets 520081 physical reads 5831072716 redo size 565 bytes sent via SQL*Net to client 544 bytes received via SQL*Net from client 3 SQL*Net roundtrips to/from client 7 sorts (memory) 0 sorts (disk) 10960000 rows processed ??? ???(Partition_test)? ??? ?? SQL> alter table partition_test drop partition partition_test1; ???? ???????. SQL> alter table partition_test drop partition partition_test2; ???? ???????. SQL> alter table partition_test drop partition partition_test3;
  • 6. 100│2013 ???? White Paper ???? ???????. ??? INSERT ??? ???? Insert ?? ??? ??? ??? Delete ??? ?? ?? ??? ??? ? ? ???. ?? ??? ???? ???? ????(Nologging)? ??(/*+ append */)?? ? Direct Path Insert ? ???? redo ??? ???? ??? ?? ????. ??? ??? ? ?? ??? ?????, ?? ???? ???. ?? ??? Insert ?? ? ???? ???? ???? ????? ???? ??? ???? ??? ?? ??? ????? ?? ??? ??? ????. Direct Path Insert ? ??? ???? ? ?? ??? ?? ??? Insert ??? ????? ?? ???? ??? ??? ????? ??. ???? ??? ?? Direct Path Insert ???? Insert ??? ?????? ???? ?? ???? ??? ? ??? redo ???? ??? ???? ???? Insert ??? ??? ???. ?? ???? ?? ??? ??? ?? Direct Path Insert ??? ??? ?? ?? ??? ? ??? ????. ??? ?? DDL ?? (? ??? Delete ? Partition_test ??? DDL ??) ? ?? ???? ???? ??? ??? Insert SQL> alter table partition_testnologging; ???? ???????. SQL> INSERT /*+ append */
  • 7. Part 1 ORACLE │101 2 INTO partition_test 3 SELECT a.* 4 FROM sh.times a , 5 ( 6 SELECT LEVEL 7 FROM dual 8 CONNECT BY LEVEL <= 10000 9 ) b; 18260000 ?? ?? ???????. ? ?: 00:08:50.77 Statistics ---------------------------------------------------------- 37399 recursive calls 4600992 db block gets 323059 consistent gets 493284 physical reads 5177833936 redo size 564 bytes sent via SQL*Net to client 636 bytes received via SQL*Net from client 3 SQL*Net roundtrips to/from client 3 sorts (memory) 3 sorts (disk) 18260000 rows processed ??? ???? ???? Insert ?? ??? ?? SQL> truncate table partition_test; ???? ?????. ? ?: 00:00:00.74 SQL> drop index idx_test1; ???? ???????. ? ?: 00:00:00.09 SQL> drop index idx_test2; ???? ???????. ? ?: 00:00:00.03
  • 8. 102│2013 ???? White Paper SQL> drop index idx_test3; ???? ???????. ? ?: 00:00:00.03 SQL> INSERT /*+ append */ 2 INTO partition_test 3 SELECT a.* 4 FROM sh.times a , 5 ( 6 SELECT LEVEL 7 FROM dual 8 CONNECT BY LEVEL <= 10000 9 ) b; 18260000 ?? ?? ???????. ? ?: 00:00:24.49 Statistics ---------------------------------------------------------- 13820 recursive calls 532991 db block gets 4210 consistent gets 7 physical reads 1975520 redo size 566 bytes sent via SQL*Net to client 636 bytes received via SQL*Net from client 3 SQL*Net roundtrips to/from client 20 sorts (memory) 0 sorts (disk) 18260000 rows processed SQL> create index idx_test1 on partition_test(time_id, day_name) local; ???? ???????. ? ?: 00:00:26.87 SQL> create index idx_test2 on partition_test(DAY_NUMBER_IN_WEEK,DAY_NUMBER_IN_MONTH) local; ???? ???????. ? ?: 00:00:27.42 SQL> create index idx_test3 on partition_test(WEEK_ENDING_DAY,WEEK_ENDING_DAY_ID)
  • 9. Part 1 ORACLE │103 local; ???? ???????. ? ?: 00:00:26.72 ? ??? ??? ?? ??? ???? ??? ?, ?? ???? ???? ??? ?? ??? ??? ?? ??? ? ??? ?? ??? ????. ?? ??? ??? ??? ???? ?? ?? ??? ?? ????? ???? ?????? ??? ???? ???? ?? ??? ? ??? Drop ??? Unusable ??? ???? ????? ??? ???. ??, ??? ???? ?? ???? ?? ????? ??? ??? ? ?? ??????? ??. ????? ?????? redo ??? ????? ? ??? ? ? ?? ????? ?? ??. ??? Index Split? ?? Direct Path Insert ???? ?? ???? ?? Insert ?? ?? ??? ??? ??? ? ??. ???? ?? ????? SYSDATE ? ???? ??? ???. ??, ? ??? Index ? ???? ??? ????, ? ?? Insert ??? ????? 9:1 Index Split ? ???? ???? ??? ???? ??? ???. ?? ?????, Index Split ? ?? ????? ??. ? ??? ??? ? ??? ? ???. ??, 9:1 Split ?? Max ?? ???? ???? ?? ??? Index Leaf Block ? ? ?? ? ?? ??? ?? ?? Free List ? Free Block ? ??? ?? ?? ??? Index Leaf Block ? ???? ???? ??? Free Block ? ???? ?? ???? ?????? Block ? ? ??? ??? ???. ?? ???? ???? ???? ????? Index Size ? ????, Index Split ? ??? ?? ???? ????? ????. ???, Index Split ??? ??? ???.
  • 10. 104│2013 ???? White Paper Index Split ? ? ??? redo ? ???? Split ? ???? ???? ???? Locking ? ? ? ? ??? ????. ? Locking ?, Enq : TX – Index Contention ??? Wait Event ? Split ? ???? ???? Split ??? ???? ??. ???, ?? ???? ??? ??? ???? ???? ?? ?? ???? ??? ???? ???? ??, Index Split ? ?? Wait Time ??? ??? redo ?? ??? Insert ??? ??? ????? ????. ???? ?? ??? ? ?? ??? ???? ???? ????? ??? ?? Index ??? ??? ???? ? ???? ??? ????. ? ??? ??? ??? ???? ??? ?, ?? ?? ??? Index Leaf Block ? ??? ? ??? ?? ?? ???? ??? ? ??? ???? ??? ??? ????. ????? Index ?? ?? ??? NDV(Number of Distinct Value) ?? ? ?? Index Split ??? ? ?? ?? ?? ???. ??, ? ???? ??? ?? Index Clustering Factor ? ?? ??? ? ???? NDV ?? ? ??? ????? ??? ??? ??. Array Processing ??? DML ??? ???? Load ??? Update(Delete) ? ? ????? LOOP ???? ?? ??? ???? ??? ??. ? ??? ? Loop ?? 1 ?? DML ??? ???? ? ? ?? DBMS CALL ? ???? ??? ??? ????. ??? Array Processing ? ??? Bulk SQL ? ???? Loop ?? ? ??? SQL ???? ? ??? ????. ?, ??? DML ? ? ??(Limit ???? ???? ??? ??? ? ? ? ??? ???? ?? ??)? ??? ? ???? DBMS CALL ? ???? Loop ? ?? ?? ??? ?? ? ???? ??? ? ? ??. ?? ???? ?? ? ????? ??? ??.
  • 11. Part 1 ORACLE │105 Array Processing ? ???? Insert ?? Procedure Source - P_BULK_INSERT_TEST1 CREATE OR REPLACE PROCEDURE P_BULK_INSERT_TEST1 IS CURSOR sales_cur IS SELECT PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD FROM SH.SALES; TYPE SALES_TBL_TYPE IS TABLE OF sales_cur%ROWTYPE INDEX BY BINARY_INTEGER; SALES_TBL SALES_TBL_TYPE; BEGIN OPEN sales_cur; LOOP FETCH sales_cur BULK COLLECT INTO sales_tbl LIMIT 1000; -- PGA ??? ?? ???? ?? 1000 ??? ?? FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP --?? ??? ???? sales_tbl(i).AMOUNT_SOLD := sales_tbl(i).AMOUNT_SOLD * 1.5; END LOOP; -- FETCH ? 1000 ?? SQL 1 ? ???? ?? FORALL i IN sales_tbl.FIRST..sales_tbl.LAST INSERT INTO SALES2 VALUES (sales_tbl(i).PROD_ID, sales_tbl(i).CUST_ID, sales_tbl(i).TIME_ID, sales_tbl(i).CHANNEL_ID, sales_tbl(i).PROMO_ID, sales_tbl(i).QUANTITY_SOLD, sales_tbl(i).AMOUNT_SOLD ); EXIT WHEN sales_cur%NOTFOUND; END LOOP; CLOSE sales_cur; COMMIT; EXCEPTION
  • 12. 106│2013 ???? White Paper WHEN OTHERS THEN ROLLBACK; RAISE_APPLICATION_ERROR(-20001,'RAISE_APPLICATION_ERROR : ' ||SQLCODE||':'|| SUBSTR(SQLERRM,1,200)); END; / ??? Loop ? ?? Insert ?? Procedure Source - P_BULK_INSERT_TEST2 CREATE OR REPLACE PROCEDURE P_BULK_INSERT_TEST2 IS CURSOR sales_cur IS SELECT PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD FROM SH.SALES; TYPE SALES_TBL_TYPE IS TABLE OF sales_cur%ROWTYPE INDEX BY BINARY_INTEGER; SALES_TBL SALES_TBL_TYPE; BEGIN OPEN sales_cur; LOOP FETCH sales_cur BULK COLLECT INTO sales_tbl LIMIT 1000; -- PGA ??? ?? ???? ?? 1000 ??? ?? FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP --?? ??? ???? sales_tbl(i).AMOUNT_SOLD := sales_tbl(i).AMOUNT_SOLD * 1.5; END LOOP; -- LOOP ? ???? ??; INSERT SQL 1000 ? ?? FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP -- FORALL ??? ?? INSERT INTO SALES2 VALUES (sales_tbl(i).PROD_ID, sales_tbl(i).CUST_ID, sales_tbl(i).TIME_ID, sales_tbl(i).CHANNEL_ID, sales_tbl(i).PROMO_ID, sales_tbl(i).QUANTITY_SOLD, sales_tbl(i).AMOUNT_SOLD );
  • 13. Part 1 ORACLE │107 END LOOP; EXIT WHEN sales_cur%NOTFOUND; END LOOP; CLOSE sales_cur; COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; RAISE_APPLICATION_ERROR(-20001,'RAISE_APPLICATION_ERROR : ' ||SQLCODE||':'|| SUBSTR(SQLERRM,1,200)); END; / P_BULK_INSERT_TEST2 Vs. P_BULK_INSERT_TEST2 SQL> exec P_BULK_INSERT_TEST1; PL/SQL ??? ????? ???????. ? ?: 00:00:02.20 SQL> SQL> SQL> exec P_BULK_INSERT_TEST2; PL/SQL ??? ????? ???????. ? ?: 00:00:35.08 ?? : Array Processing ? ??? Update Procedure Source CREATE OR REPLACE PROCEDURE P_BULK_INSERT_TEST2 IS CURSOR sales_cur IS SELECT PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD FROM SH.SALES;
  • 14. 108│2013 ???? White Paper TYPE SALES_TBL_TYPE IS TABLE OF sales_cur%ROWTYPE INDEX BY BINARY_INTEGER; SALES_TBL SALES_TBL_TYPE; BEGIN OPEN sales_cur; LOOP FETCH sales_cur BULK COLLECT INTO sales_tbl LIMIT 1000; -- PGA ??? ?? ???? ?? 1000 ??? ?? FOR i IN sales_tbl.FIRST..sales_tbl.LAST LOOP --?? ??? ???? sales_tbl(i).AMOUNT_SOLD := sales_tbl(i).AMOUNT_SOLD * 1.5; END LOOP; -- UPDATE / DELETE ? ?? FORALL i IN sales_tbl.FIRST..sales_tbl.LAST UPDATE SALES SET AMOUNT_SOLD = sales_tbl(i).AMOUNT_SOLD WHERE PROD_ID = sales_tbl(i).PROD_ID AND CUST_ID = sales_tbl(i).CUST_ID AND TIME_ID = sales_tbl(i).TIME_ID AND CHANNEL_ID = sales_tbl(i).CHANNEL_ID AND PROMO_ID = sales_tbl(i).PROMO_ID; EXIT WHEN sales_cur%NOTFOUND; END LOOP; CLOSE sales_cur; COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; RAISE_APPLICATION_ERROR(-20001,'RAISE_APPLICATION_ERROR : ' ||SQLCODE||':'|| SUBSTR(SQLERRM,1,200)); END; /
  • 15. Part 1 ORACLE │109 ? ?? ?? ?? ??? ???? ??? ????? ??? DML ??? ?? ???? Process ? ??? ? ?? ???. ??? ? ??? ???? ? ??? ?? ???? ??. ?? Partition Table ?? ??? ??? ??? ???? ??? ??? ?? ???? ??? ? ???? ???? Partition Table ? ???? ??? ??? ??? ???. ???? Offline ? ????? ?? ????? ??? ? ?? ????, ?? ?????? ? ?? ???? Partition Table ? ???? ??? ?????, ?????? ??? ? ? ????? ??? ???? ?? DBA ??? ? ????? ???? ??? ?? ? ??. ??? ? ?????? ??? ??? ? ?? ?????. ?? ?? Partition Exchange(? ? PE) ??? ???? ???. PE ??? ? ??? ?? ???? Partition Table ?? ?? ? ???? ????. ??, ???? ??? ?? ?? ??????? ???? Partition Table ?? ??? ?? ? ??. ?? ???? PE ??? ???? ?? ???? Partition Table ?? ? ?? ??? ??? ? ??? ??. ??? ???? ?? ??? : Partition_test2 : Delete ???? ??? ?? ????? ??? ?? ???? ?? Partition Table ? ??? Partition Table ?? CREATE TABLE partition_test (TIME_ID DATE , DAY_NAME VARCHAR2(9), DAY_NUMBER_IN_WEEK NUMBER(1,0) , DAY_NUMBER_IN_MONTH NUMBER(2,0) , CALENDAR_WEEK_NUMBER NUMBER(2,0) , FISCAL_WEEK_NUMBER NUMBER(2,0) , WEEK_ENDING_DAY DATE , WEEK_ENDING_DAY_ID NUMBER , CALENDAR_MONTH_NUMBER NUMBER(2,0) , FISCAL_MONTH_NUMBER NUMBER(2,0) , CALENDAR_MONTH_DESC VARCHAR2(8) ,
  • 16. 110│2013 ???? White Paper CALENDAR_MONTH_ID NUMBER , FISCAL_MONTH_DESC VARCHAR2(8) , FISCAL_MONTH_ID NUMBER, DAYS_IN_CAL_MONTH NUMBER , DAYS_IN_FIS_MONTH NUMBER , END_OF_CAL_MONTH DATE , END_OF_FIS_MONTH DATE , CALENDAR_MONTH_NAME VARCHAR2(9) , FISCAL_MONTH_NAME VARCHAR2(9) , CALENDAR_QUARTER_DESC CHAR(7) , CALENDAR_QUARTER_ID NUMBER , FISCAL_QUARTER_DESC CHAR(7) , FISCAL_QUARTER_ID NUMBER , DAYS_IN_CAL_QUARTER NUMBER , DAYS_IN_FIS_QUARTER NUMBER , END_OF_CAL_QUARTER DATE , END_OF_FIS_QUARTER DATE , CALENDAR_QUARTER_NUMBER NUMBER(1,0) , FISCAL_QUARTER_NUMBER NUMBER(1,0) , CALENDAR_YEAR NUMBER(4,0) , CALENDAR_YEAR_ID NUMBER , FISCAL_YEAR NUMBER(4,0) , FISCAL_YEAR_ID NUMBER , DAYS_IN_CAL_YEAR NUMBER , DAYS_IN_FIS_YEAR NUMBER , END_OF_CAL_YEAR DATE , END_OF_FIS_YEAR DATE ) PARTITION BY RANGE( time_id )( PARTITION part1 VALUES less than (to_date('2002-12-31','YYYY-MM-DD')) ); -- Partiton Table ? ??? ???? Max ?? ?? Partition Exchange ?? SQL> ALTER TABLE partition_test exchange partition part1 WITH TABLE partition_test2 without validation ; ???? ???????. ? ?: 00:00:00.03 ?? ??? ?? ? Rename
  • 17. Part 1 ORACLE │111 SQL> DROP TABLE partition_test2; ???? ???????. ? ?: 00:00:00.06 SQL> RENAME partition_test to partition_test2; ??? ??? ???????. ? ?: 00:00:00.03 ?? ?? ???? ??? ???? ??? Partition Table ? ??? ? ??? ? ???. ? ? ??? ???? ?? ????? ??? ?? ????(Primary Key)?? Index ??? ?? ???? ????? ???? PE ??? ????. ?? ?? ??? ??? DML ??? ??? ???? ??? ???? ?? ??? ????? ? ???? redo ? ?? ??? ????? ?? ??? Index ? ????? Drop ??? ?? ? ? ??. ??? ??? ??? ?? ??? ???? DBA ??? ?? ? ???? ??? ? ??? ? ??. ???? ??? ???? ??? ? ?? ?? ??? ????? ???? ??? ??? ? ??? ? ???? ? ???? ??? ???. ??? ?? ??? ???? ????? ??? ? ?? ?? ??? ??? ??. ?? ??? ??? ?? ?? ???? ?? ?? ???? ???? ??? ? ?? ?? ????, ? ? ?? ?? ???? ?? ????? ???. ??????? ?????? ?? ????? ??? ?????. ?? ???? ???? ? ??? ??? ???? ??? ?? ???? ???? ????? ??? ? ??, ? ? ?? ??? ??? ? ?? ??? ??? ?? ?? ? ?? ???. ??? DML ?? ????? ???? Down Time ????? ? ?? ??? ?? ?? ?? ????? ??.