日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Oracle cursor_sharing 参数 详解

發(fā)布時間:2025/4/5 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle cursor_sharing 参数 详解 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?

. 官網(wǎng)的說明

http://download.oracle.com/docs/cd/E11882_01/server.112/e17110/initparams042.htm#REFRN10025

?

1.1 CURSOR_SHARING

Property

Description

Parameter type

String

Syntax

CURSOR_SHARING = { SIMILAR | EXACT | FORCE }

Default value

EXACT

Modifiable

ALTER SESSION, ALTER SYSTEM

Basic

No

?

?????? CURSOR_SHARING determines what kind of SQL statements can share the same cursors.

?

Values:

1FORCE

?????? Allows the creation of a new cursor if sharing an existing cursor, or if the cursor plan is not optimal.

?

2SIMILAR

?????? Causes statements that may differ in some literals, but are otherwise identical, to share a cursor, unless the literals affect either the meaning of the statement or the degree to which the plan is optimized.

?

3EXACT

?????? Only allows statements with identical text to share the same cursor.

?????? --只有SQL 語句完全相同的情況下,才會使用相同的cursor,即執(zhí)行計劃。

?

Notes:

?????? 1If you set CURSOR_SHARING, then Oracle recommends the FORCE setting unless you are in a DSS environment. FORCE limits the growth of child cursors that can occur when the setting is SIMILAR.

?????? 2The value of the CURSOR_SHARING parameter has performance implications. Refer to Oracle Database Performance Tuning Guide before setting this parameter.

?

?

?

1.2 When to Set CURSOR_SHARING to a Nondefault Value

?????? The best practice is to write sharable SQL and use the default of EXACT for CURSOR_SHARING. However, for applications with many similar statements, setting CURSOR_SHARING can significantly improve cursor sharing, resulting in reduced memory usage, faster parses, and reduced latch contention. Consider this approach when statements in the shared pool differ only in the values of literals, and when response time is poor because of a very high number of library cache misses.

?

Setting CURSOR_SHARING to FORCE or SIMILAR has the following drawbacks:

?????? 1The database must perform extra work during the soft parse to find a similar statement in the shared pool.

?????? 2There is an increase in the maximum lengths (as returned by DESCRIBE) of any selected expressions that contain literals in a SELECT statement. However, the actual length of the data returned does not change.

?????? 3Star transformation is not supported.

?????? 4If stored outlines were generated with CURSOR_SHARING set to EXACT, then the database does not use stored outlines generated with literals. To avoid this problem, generate outlines with CURSOR_SHARING set to FORCE or SIMILAR and use the CREATE_STORED_OUTLINES parameter.

?

?

?????? When deciding whether to set CURSOR_SHARING to FORCE or SIMILAR, consider the performance implications of each setting.

?????? When CURSOR_SHARING is set to FORCE, the database uses one parent cursor and one child cursor for each distinct SQL statement. The database uses the same plan for each execution of the same statement.

?

?

?????? When set to SIMILAR, database behavior depends on the presence of histograms:

?????? 1Histogram absent for column with system-generated bind value

????????????? Only one parent cursor and one child cursor exists for each distinct SQL statement. In this case, all executions of a SQL statement use the same plan.

?????? 2Histogram present for column with system-generated bind value

????????????? If the same SQL statement is executed multiple times, each execution has its own child cursor. In this case, the database peeks at bind variable values and create a new child cursor for each distinct value. Thus, each statement execution uses a plan based on the specific literals in the statement.

?

For example, consider the following statement:

?????? SELECT * FROM hr.employees WHERE employee_id = 101

?

?????? If FORCE is used, or if SIMILAR is used when no histogram exists, then the database optimizes this statement as if it contained a bind variable and uses bind peeking to estimate cardinality. Statements that differ only in the bind variable share the same execution plan.

?????? If SIMILAR is used, and if a histogram does exist, then the database does not treat the statement as if a bind variable were used. The same query for a different employee may not use the same plan.

?

?????? If you set CURSOR_SHARING, then Oracle recommends the FORCE setting unless you are in a DSS environment. FORCE limits the growth of child cursors that can occur when the setting is SIMILAR.

?????? Also, function-based indexes may not work when using SIMILAR because the database converts index parameters to bind variables.

?????? For example, if the index is SUBSTR(id,1,3), then the database converts it to SUBSTR("ID",:SYS_B_0,:SYS_B_1)=:id, rendering the index invalid.

?

Oracle 綁定變量 詳解

http://blog.csdn.net/tianlesoftware/archive/2010/09/01/5856430.aspx

?

. 測試

2.1 cursor_sharing=exact,這cursor_sharing的默認值

?

2.1.1 查看cursor_sharing

SYS@anqing2(rac2)> show parameter cursor_sharing

?

NAME?????????? TYPE????????? VALUE

------------------------- -------------------- ---------------------

cursor_sharing???? ??string???????? EXACT

?

2.1.2 查看當(dāng)前硬解析值

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882056

parse time elapsed??????????????? 2648194

parse count (total)????????????? 12780229

parse count (hard)??????????????? 9890010(硬解析次數(shù))

parse count (failures)???????????????? 71

?

2.1.3 執(zhí)行一條select 語句,然后查看硬解析次數(shù)

SYS@anqing2(rac2)> select * from ta where id=168;

??????? ID NAME

---------- ------------------------------

?????? 168 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882061

parse time elapsed??????????????? 2648196

parse count (total)????????????? 12780360

parse count (hard)??????????????? 9890021

parse count (failures)???????????????? 71

-- 這里硬解析的次數(shù)加一,因為之前SQL 沒有解析過,所以需要進行硬解析之后才能執(zhí)行。

?

2.1.4 執(zhí)行與之前類似的SQL,謂詞值不一樣

SYS@anqing2(rac2)> select * from ta where id=198;

?

??????? ID NAME

---------- ------------------------------

?????? 198 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882061

parse time elapsed??????????????? 2648196

parse count (total)????????????? 12780482

parse count (hard)????? ??????????9890022

parse count (failures)???????????????? 71

-- 硬解析次數(shù)又加1了,沒有重用之前的執(zhí)行計劃

?

2.1.5 執(zhí)行相同的SQL 語句

SYS@anqing2(rac2)> select * from ta where id=198;

?

??????? ID NAME

---------- ------------------------------

?????? 198 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME? ??????????????????????????????VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882061

parse time elapsed??????????????? 2648196

parse count (total)????????????? 12780543

parse count (hard)??????????????? 9890022

parse count (failures)???????????????? 71

-- 測試硬解析沒有變化。 重用之前的cursor

?

總結(jié):

?????? 在這種模式下,只有SQL 語句完全相同的情況下,才會使用相同的cursor,即執(zhí)行計劃。

?????? 這種模式下,表有統(tǒng)計信息和沒有統(tǒng)計信息的執(zhí)行計劃是有出入的。 所以該模式下的表,需要定期的去收集統(tǒng)計信息。

?

2.2 cursor_sharing=force

--修改cursor_sharing

SYS@anqing2(rac2)> alter session set cursor_sharing='force';

Session altered.

SYS@anqing2(rac2)> show parameter cursor_sharing

NAME?????????? TYPE?????????? VALUE

------------------------- --------------------- ---------------

cursor_sharing???? string????????? force

?

--查看硬解析次數(shù)

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882075

parse time elapsed??????????????? 2648219

parse count (total)????????????? 12782090

parse count (hard)??? ????????????9890067 (硬解析次數(shù))

parse count (failures)???????????????? 71

?

-- select 查詢

SYS@anqing2(rac2)> select * from ta where id=88;

??????? ID NAME

---------- ------------------------------

??????? 88 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882075

parse time elapsed??????????????? 2648219

parse count (total)????????????? 12782215

parse count (hard)??????????????? 9890068 -- 硬解析次數(shù)加一

parse count (failures)???????????????? 71

?

-- 執(zhí)行相同的select,但謂詞值不一樣

SYS@anqing2(rac2)> select * from ta where id=99;

?

??????? ID NAME

---------- ------------------------------

??????? 99 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882075

parse time elapsed??????????????? 2648219

parse count (total)????????????? 12782285

parse count (hard) ???????????????9890068

parse count (failures)???????????????? 71

--注意,這里的硬解析次數(shù)沒有變化,這個就是force 的作用。只要sql語句相同,不管謂詞值是否相同,都會當(dāng)成相同的sql,重用之前的cursor,不會進行硬解析。

?

-- 查看child cursor 信息

SYS@anqing2(rac2)> select sql_text,child_number from v$sql where sql_text like 'select * from ta where%';

?

?

SQL_TEXT???????????????????????????????? CHILD_NUMBER

---------------------------------------- ------------

select * from ta where id=:"SYS_B_0" ???????????????0

select * from ta where id=:"SYS_B_0"??????????????? 1

select * from ta where id=:"SYS_B_0"??????????????? 2

?

注意:

?????? 對于相同的SQLoracle 在這里將不同的謂詞值改成了變量,這樣SQL_TEXT 就相同,正常情況下,應(yīng)該使用同一個cursor,即執(zhí)行計劃,但是在我上面的查詢中,Oracle 并沒有重用,而是重新生成了一個child_cursor.? 這就說明Oracle 認為這個cursor 并不是最優(yōu)的,所有重新生成了一個。

?

可以通過如下SQL 查看為什么沒有重用之前的cursor

?????? SQL>select * from v$sql_shared_cursor where sql_id='c9swtz4spq3xz';

?

如果這里有Y,就是導(dǎo)致不能重用的原因。

?

Oracle 性能相關(guān)的幾個 視圖 參數(shù)

http://blog.csdn.net/tianlesoftware/archive/2010/09/06/5867276.aspx

?

總結(jié):

?????? Allows the creation of a new cursor if sharing an existing cursor, or if the cursor plan is not optimal.

?

?????? When CURSOR_SHARING is set to FORCE, the database uses one parent cursor and one child cursor for each distinct SQL statement. The database uses the same plan for each execution of the same statement.

?

?????? FORCE limits the growth of child cursors that can occur when the setting is SIMILAR.

?

?????? 當(dāng)cursor_sharing 設(shè)置為force時, Oracle 會把相同SQL的不同謂詞值轉(zhuǎn)換成變量,這樣SQL_TEXT就看上去一樣。 Oracle 就會使用一個相同的cursor 這樣他們的執(zhí)行計劃也是一樣的。

?????? 當(dāng)Oracle 認為存在的cursor 不是最優(yōu)的時候,就會重新創(chuàng)建一個child cursor,而不重用之前的已經(jīng)存在cursor 可以通過v$sql_shared_cursor 查看為什么沒有重用。

?????? 這樣就會和我們上面查詢的一樣,會有多個child cursor,但是他們的parent cursor是一樣的。 這個child cursor 不是無限增常的,force similar 都會限制child cursor 的增長。

?

?

2.3 cursor_sharing=similar

?

?????? 在這種模式下,對表做統(tǒng)計和沒做統(tǒng)計分析是不一樣的。有關(guān)統(tǒng)計信息,參考我的Blog

?????? Oracle Statistic 統(tǒng)計信息 小結(jié)

?????? http://blog.csdn.net/tianlesoftware/archive/2009/10/14/4668723.aspx

?

?

2.3.1 沒有統(tǒng)計信息,沒有直方圖的情況

-- 查詢ta的統(tǒng)計信息

SYS@anqing2(rac2)> exec dbms_stats.delete_table_stats('SYS','TA');

PL/SQL procedure successfully completed.

?

-- 修改cursor_sharing 模式

SYS@anqing2(rac2)> alter session set cursor_sharing='similar';

Session altered.

SYS@anqing2(rac2)> show parameter cursor_sharing

NAME????????? TYPE?????? VALUE

---------------------- ------------------ ----------------

cursor_sharing??? string??????? similar

?

similer模式下,且沒有直方圖,等于force 模式。 看測試:

?

-- 查看硬解析次數(shù)

SYS@anqing2(rac2)>? select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882222

parse time elapsed??????????????? 2648406

parse count (total)????????????? 12793472

parse count (hard)??????????????? 9890538

parse count (failures)???????????????? 74

?

--做一次select 查詢

SYS@anqing2(rac2)> select * from ta where id=238;

?

??????? ID NAME

---------- ------------------------------

?????? 238 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882222

parse time elapsed??????????????? 2648406

parse count (total)????????????? 12793476

parse count (hard)??????????????? 9890539 硬解析加一

parse count (failures)???????????????? 74

?

-- 在次select

SYS@anqing2(rac2)> select * from ta where id=2397;

?

??????? ID NAME

---------- ----------

????? 2397 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME?? ?????????????????????????????VALUE

------------------------------ ----------

parse time cpu??????????????????? 1882337

parse time elapsed??????????????? 2648558

parse count (total)????????????? 12823605

parse count (hard)??????????????? 9890751

parse count (failures)???????????????? 75

?

-- 這里還是有增加硬解析,有點奇怪

?

-- 查看對應(yīng)的SQL

SYS@anqing2(rac2)> select sql_text,child_number from v$sql where sql_text like 'select * from ta where%';

?

SQL_TEXT???????????????????????????????? CHILD_NUMBER

---------------------------------------- ------------

select * from ta where id=238 ??????????????????????0

select * from ta where id=2396?? ???????????????????0

select * from ta where id=2391????????????????????? 0

select * from ta where id=2397????????????????????? 0

?????? 這里并沒有將謂詞值轉(zhuǎn)換成變量,也就是說similar 沒有生效,沒有達到force的效果。

?

在如下Blog 上有對Force 沒有生效的一個討論:

http://forums.oracle.com/forums/message.jspa?messageID=3569923#3569923

?

摘取一段如下:

?????? Interesting. You may need to flush the shared pool "harder"... Try your testcase again, but issue the ALTER SYSTEM FLUSH SHARED_POOL twice in a row before changing the cursor_sharing setting. It looks like that the statement doesn't show up in V$SQLAREA any longer but still seems not to be flushed entirely and I can find some left-overs of it in the underlying X$KGL library cache fixed tables with the same hash value. After the second "flush shared pool" these are gone and then the cursor sharing works as expected.

?

?????? 解決方法就是在指定cursor-_sharing 之前,執(zhí)行2flush shared_pool. 測試一下看看。

?

SYS@anqing2(rac2)> alter system flush shared_pool;

System altered.

SYS@anqing2(rac2)> alter system flush shared_pool;

System altered.

SYS@anqing2(rac2)> alter session set cursor_sharing=similar;

?

Session altered.

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse count (hard)??????????????? 9890936

?

?

SYS@anqing2(rac2)> select * from ta where id=232;

??????? ID NAME

---------- ----------

?????? 232 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

?

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse count (hard)??????????????? 9890946

?

--從硬解析來看,數(shù)量有增加

?

-- 在查詢一次

SYS@anqing2(rac2)> select * from ta where id=23218;

?

??????? ID NAME

---------- ----------

???? 23218 dave

?

SYS@anqing2(rac2)> select name,value from v$sysstat where name like '%parse%';

NAME??????????????????????????????? VALUE

------------------------------ ----------

parse count (hard)??????????????? 9890954

?

--硬解析又增加了,如果說只有這一條SQL執(zhí)行,不會增加硬解析。 這個是其他的SQL 帶來的硬解析,我們可以查看v$sql驗證:

?

SYS@anqing2(rac2)> select sql_text,child_number,executions from v$sql where sql_text like 'select * from ta where%';

?

SQL_TEXT????????????????? CHILD_NUMBER EXECUTIONS

---------------------------------------- ------------ ----------

select * from ta where id=:"SYS_B_0" ????????0???????? ?2

?

-- 在這里,已經(jīng)使轉(zhuǎn)成成了變量,并且執(zhí)行了2次。 這說明,我們的force是生效的。

?

2.3.2? 有統(tǒng)計信息和直方圖

?????? 當(dāng)cursor_sharing 設(shè)置為similar,并且表上存在histograms時, 這時候的similar 等于 默認值 exact.? 下面我們驗證一下。

?

-- 分析表

SYS@anqing2(rac2)> exec dbms_stats.gather_table_stats('SYS','TA', METHOD_OPT =>'FOR COLUMNS SIZE 10 ID');

PL/SQL procedure successfully completed.

--這里我手工的指定了收集的類型。

?

-- 查看直方圖: histograms

?

這部分內(nèi)容,具體可以參考我的blog? Oracle Statistic 統(tǒng)計信息 小結(jié)

?????? http://blog.csdn.net/tianlesoftware/archive/2009/10/14/4668723.aspx

?

SYS@anqing2(rac2)> SELECT column_name, num_distinct, num_buckets, histogram

? 2? FROM DBA_TAB_COL_STATISTICS WHERE table_name = 'TA' AND column_name = 'ID';

?

COLUMN_NAME?????? NUM_DISTINCT NUM_BUCKETS HISTOGRAM

------------------------------ ------------ ----------- ---------------

ID??????????????????? 1005510? ????????10 HEIGHT BALANCED

?

-- flush shared_pool 兩次

SYS@anqing2(rac2)>? alter system flush shared_pool;

System altered.

SYS@anqing2(rac2)>? alter system flush shared_pool;

System altered.

SYS@anqing2(rac2)> show parameter cursor_sharing

?

NAME????????? TYPE?????? VALUE

------------------------ -------------------------------- ----------

cursor_sharing???? string????? SIMILAR

?

-- select 查詢和對應(yīng)的解析

?

SYS@anqing2(rac2)> select sql_text,child_number,executions from v$sql where sql_text like 'select count(*) from ta %';

?

SQL_TEXT??????????????? CHILD_NUMBER EXECUTIONS

--------------------------------------------- ------------ ----------

select count(*) from ta where id>:"SYS_B_0"????????????? 0????????? 3

?

SYS@anqing2(rac2)> select count(*) from ta where id>10000;

?

? COUNT(*)

----------

??? 990000

?

SYS@anqing2(rac2)> select sql_text,child_number,executions from v$sql where sql_text like 'select count(*) from ta %';

?

SQL_TEXT????????????????????????????????????? CHILD_NUMBER EXECUTIONS

--------------------------------------------- ------------ ----------

select count(*) from ta where id>:"SYS_B_0"????????????? 0????????? 3

select count(*) from ta where id>:"SYS_B_0"????????????? 1????????? 1

?

--因為ID值和之前的不一樣,所以沒有重用之前的cursor,而是重新創(chuàng)建了一個

?

SYS@anqing2(rac2)> select count(*) from ta where id>100;

?

? COUNT(*)

----------

??? 999900

?

SYS@anqing2(rac2)> select sql_text,child_number,executions from v$sql where sql_text like 'select count(*) from ta %';

?

SQL_TEXT????????????????????????????????????? CHILD_NUMBER EXECUTIONS

--------------------------------------------- ------------ ----------

select count(*) from ta where id>:"SYS_B_0"????????????? 0????????? 3

select count(*) from ta where id>:"SYS_B_0"????????????? 1????????? 1

select count(*) from ta where id>:"SYS_B_0"??????????? ??2????????? 1

-- 這次ID 值又不一樣,又重新生成了一個cursor

?

..... 中間又生成了N ...

?

SYS@anqing2(rac2)> select count(*) from ta where id>90808;

?

? COUNT(*)

----------

??? 909192

?

SYS@anqing2(rac2)> select sql_text,child_number,executions from v$sql where sql_text like 'select count(*) from ta %';

?

SQL_TEXT????????????????????????????????????? CHILD_NUMBER EXECUTIONS

--------------------------------------------- ------------ ----------

select count(*) from ta where id>:"SYS_B_0"????????????? 0????????? 3

select count(*) from ta where id>:"SYS_B_0"????????????? 1????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 2????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 3????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 4????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 5????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 6????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 7????????? 1

-- 這個就像我們開始說的,雖然會對變量進行轉(zhuǎn)換,但不會重用,只有謂詞值一樣的時候才重用之前的cursor

?

SYS@anqing2(rac2)> select count(*) from ta where id>90808;

?

? COUNT(*)

----------

??? 909192

?

SYS@anqing2(rac2)> select sql_text,child_number,executions from v$sql where sql_text like 'select count(*) from ta %';

?

SQL_TEXT????????????????? CHILD_NUMBER EXECUTIONS

--------------------------------------------- ------------ ----------

select count(*) from ta where id>:"SYS_B_0"????????????? 0????????? 3

select count(*) from ta where id>:"SYS_B_0"????????????? 1????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 2????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 3????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 4????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 5????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 6????????? 1

select count(*) from ta where id>:"SYS_B_0"????????????? 7????????? 2

-- 注意這里,因為我們執(zhí)行了一個一樣的SQL,包括謂詞,這里的重用了之前的cursor

?

總結(jié):

?????? 當(dāng)cursor_sharing 設(shè)置為similar時,Oracle 會對SQL 的位置值轉(zhuǎn)換成常量,這個和force 一樣。 但是不同的是:

?????? 1)當(dāng)字段上有histograms時, 這時等于exact,雖然SQL text 一樣,但謂詞值不同就不會重用cursor 只有SQL 語句完全一樣,包括謂詞值,才會重用cursor

?????? 2)當(dāng)沒有statstics時,即沒有histograms,這時等于force,只要SQL 語句一樣,就會重用cursor

?

?

.? similar 模式對expdp 帶來的影響

?????? eygle blog上看到similar 對增加expdp備份的時間。

?????? 原理鏈接如下:

?????? http://www.eygle.com/archives/2011/01/cursor_sharing_expdp.html

?

?

相關(guān)鏈接:

?????? Oracle 10g Data Pump Expdp/Impdp 詳解

?????? http://blog.csdn.net/tianlesoftware/archive/2009/10/15/4674224.aspx

?

?????? Oracle expdp/impdp 使用示例

?????? http://blog.csdn.net/tianlesoftware/archive/2011/03/18/6260138.aspx

?

?

3.1按照默認的expdp

SYS@anqing2(rac2)> show parameter cursor_sharing

?

NAME???????????????????????????????? TYPE??????? VALUE

------------------------------------ ----------- ------------------------------

cursor_sharing?????????????????????? string????? EXACT

?

[oracle@rac2 backup]$ expdp /'/ as sysdba/' directory=backup full=y dumpfile=fullexp.dmp logfile=fullexp.log

?

?

Export: Release 10.2.0.4.0 - Production on Friday, 17 June, 2011 13:54:40

...............

Job "SYS"."SYS_EXPORT_FULL_01" successfully completed at 14:05:49

?

測試庫,全備花了11分鐘。

?

3.2 similar 模式 expdp 備份

?????? cursor_sharing是一個動態(tài)參數(shù),可以在執(zhí)行expdp之前進行修改,然后執(zhí)行導(dǎo)出, 備份完在改回來。

?

SYS@anqing2(rac2)> alter system set cursor_sharing=similar scope=memory;

System altered.

SYS@anqing2(rac2)> show parameter cursor_sharing

NAME? ??????????????????TYPE??????? VALUE

------------------------------------ ----------- ------------------------------

cursor_sharing????????????? string????? SIMILAR

?

[oracle@rac2 backup]$ expdp /'/ as sysdba/' directory=backup full=y dumpfile=fullexp.dmp logfile=fullexp.log

?

Export: Release 10.2.0.4.0 - Production on Friday, 17 June,2011 13:40:37

....

Job "SYS"."SYS_EXPORT_FULL_01" successfully completed at 13:52:42

?

備份了12分鐘.

?

?????? 因為庫不大,所以差距不明顯. ?不過如果庫大的話,一般也不會用expdp來備份。所以這里作為一個知識點,了解一下。

?

?

?

?

?

-------------------------------------------------------------------------------------------------------

Blog http://blog.csdn.net/tianlesoftware

Email: dvd.dba@gmail.com

DBA1 群:62697716(滿);?? DBA2 群:62697977(滿)?? DBA3 群:62697850(滿)??

DBA 超級群:63306533(滿);? DBA4 群: 83829929? DBA5群: 142216823???

DBA6 群:158654907? 聊天 群:40132017?? 聊天2群:69087192

--加群需要在備注說明Oracle表空間和數(shù)據(jù)文件的關(guān)系,否則拒絕申請

總結(jié)

以上是生活随笔為你收集整理的Oracle cursor_sharing 参数 详解的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。