`
wsql
  • 浏览: 12035419 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

Oracle 11g 使用 dbms_parallel_execute 对大表进行并行update

 
阅读更多

一. dbms_parallel_execute说明

Updating Large Tables in Parallel

TheDBMS_PARALLEL_EXECUTEpackage enables you to incrementally update the data in a large table in parallel, in twohigh-level steps:

(1)Group sets of rows in the table into smaller chunks.

(2)Apply the desired UPDATE statement to the chunks in parallel,committing each time you have finished processing a chunk.

--dbms_parallel_execute 包使用并行的2个步骤,一是将大表分成多个小的chunks。二对这些小的chunks 进行并行。

Thistechnique is recommended whenever you are updating a lot of data. Its advantages are:

(1)You lock only one set of rows at a time, for a relatively shorttime, instead of locking the entire table.

(2)You do not lose work that has been done if something fails beforethe entire operation finishes.

(3)You reduce rollback space consumption.

(4)You improve performance.

See Also:

OracleDatabase PL/SQL Packages and Types Referencefor more information about theDBMS_PARALLEL_EXECUTE package

http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_parallel_ex.htm#ARPLS233

-- 这个链接上有这个包的详细使用说明。

并行在一定程度上能够提高SQL 的性能, 在我的blog里对parallelexecution 这块有说明:

Oracle Parallel Execution(并行执行)

http://blog.csdn.net/xujinyang/article/details/6832630

提到这篇文章,是关注一个问题:

Oracle对Delete,update,merge的操作限制在,只有操作的对象是分区表示,Oracle 才会启动并行操作。原因在于,对于分区表,Oracle 会对每个分区启用一个并行服务进程同时进行数据处理,这对于非分区表来说是没有意义的。

如果我们要对一张大表进行update,而且该表又不是分区表,这时就可以使用我们的dbms_parallel­_execute包来进行并行操作。

dbms_parallel_execute包是把大表分成了多个小的chunks,然后对chunks进行并行,这个就类似把非分区表变成了分区表。

注意,该包是Oracle 11g 以后才有的。

二. 使用说明

以下内容转自:

http://www.oracle-base.com/articles/11g/dbms_parallel_execute_11gR2.php

2.1 操作需要createjob的权限,所以先赋权

SQL> conn / as sysdba;

Connected.

SQL> grant create job to icd;

Grant succeeded.

SQL> conn icd/icd;

Connected.

2.2 创建相关的测试表并插入数据

SQL> CREATE TABLE test_tab (
 2 id NUMBER,
 3 description VARCHAR2(50),
 4 num_col NUMBER,
 5 CONSTRAINT test_tab_pk PRIMARY KEY (id)
 6 );
Table created.

SQL> INSERT /*+ APPEND */ INTO test_tab
 2 SELECT level,
 3 'Description for ' || level,
 4 CASE
 5 WHEN MOD(level, 5) = 0 THEN 10
 6 WHEN MOD(level, 3) = 0 THEN 20
 7 ELSE 30
 8 END
 9 FROM dual
10 CONNECT BY level <= 500000;
500000 rows created.
SQL> commit;
Commit complete.

2.3 收集统计信息

SQL> EXEC DBMS_STATS.gather_table_stats(USER, 'TEST_TAB', cascade => TRUE);
PL/SQL procedure successfully completed.

SQL> SELECT num_col, COUNT(*)
 2 FROM test_tab
 3 GROUP BY num_col
 4 ORDER BY num_col;

 NUM_COL COUNT(*)
---------- ----------
 10 100000
 20 133333
 30 266667

2.4 创建task

TheCREATE_TASK procedure is used to create a new task. It requires a task name tobe specified, but can also include an optional task comment.

SQL> BEGIN

2DBMS_PARALLEL_EXECUTE.create_task (task_name => 'test_task');

3 END;

4 /

PL/SQL procedure successfully completed.

Informationabout existing tasks is displayed using the [DBA|USER]_PARALLEL_EXECUTE_TASKSviews.

SQL> COLUMN task_name FORMAT A10

SQL> SELECT task_name,

2 status

3 FROM user_parallel_execute_tasks;

TASK_NAMESTATUS

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

test_taskCREATED


The GENERATE_TASK_NAME function returns a unique task name ifyou do not want to name the task manually.

SQL> SELECTDBMS_PARALLEL_EXECUTE.generate_task_name FROMdual;

GENERATE_TASK_NAME

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

TASK$_1

2.5 Split the workload into chunks

将一张大表split 成多个chunks 有三种方法。

(1)CREATE_CHUNKS_BY_ROWID

(2)CREATE_CHUNKS_BY_NUMBER_COL

(3)CREATE_CHUNKS_BY_SQL

分配好的chunks 可以用drop_chunks 来删除。

2.5.1 CREATE_CHUNKS_BY_ROWID

TheCREATE_CHUNKS_BY_ROWID procedure splits the data by rowid into chunks specifiedby the CHUNK_SIZE parameter. If the BY_ROW parameter isset to TRUE, the CHUNK_SIZE refers to the number of rows, otherwise it refersto the number of blocks.

SQL> BEGIN

2dbms_parallel_execute.create_chunks_by_rowid(task_name => 'test_task',

3table_owner => 'icd',

4table_name=> 'test_tab',

5by_row => true,

6chunk_size=> 10000);

7 end;

8 /

PL/SQL procedure successfully completed.

一旦chunks创建完毕,task 的状态就变成了'chunked'.

SQL> COLUMN task_name FORMAT A10

SQL> SELECT task_name,

2 status

3 FROM user_parallel_execute_tasks;

TASK_NAMESTATUS

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

test_taskCHUNKED

The [DBA|USER]_PARALLEL_EXECUTE_CHUNKS views displayinformation about the individual chunks.

SQL> SELECT chunk_id, status,start_rowid, end_rowid

2 FROM user_parallel_execute_chunks

3 WHERE task_name = 'test_task'

4 ORDER BY chunk_id;

CHUNK_ID STATUS START_ROWID END_ROWID

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

2 UNASSIGNEDAAATMCAAMAABSMIAAA AAATMCAAMAABSMPCcP

3 UNASSIGNEDAAATMCAAMAABSMgAAA AAATMCAAMAABSMnCcP

4 UNASSIGNED AAATMCAAMAABSMoAAAAAATMCAAMAABSMvCcP

...

73 UNASSIGNEDAAATMCAAMAABS0yAAA AAATMCAAMAABS1jCcP

74 UNASSIGNEDAAATMCAAMAABS1kAAA AAATMCAAMAABS1/CcP

73 rows selected.

删除chunks

SQL> begin

2 dbms_parallel_execute.drop_chunks('test_task');

3 end;

4 /

PL/SQL procedure successfully completed.

再次查看chunk状态,又变成了created.

SQL> SELECT task_name,

2 status

3 FROM user_parallel_execute_tasks;

TASK_NAMESTATUS

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

test_taskCREATED

2.5.2 CREATE_CHUNKS_BY_NUMBER_COL

TheCREATE_CHUNKS_BY_NUMBER_COL procedure divides the workload up based on a number column. It uses the specifiedcolumns min and max values along with the chunk size to split the data intoapproximately equal chunks. For the chunks to be equally sized the column mustcontain a continuous sequence of numbers, like that generated by a sequence.

BEGIN

dbms_parallel_execute.create_chunks_by_number_col(task_name => 'test_task',

table_owner => 'ICD',

table_name => 'TEST_TAB',

table_column => 'ID',

chunk_size => 10000);

END;

/

The [DBA|USER]_PARALLEL_EXECUTE_CHUNKSviews display information about the individual chunks.

SQL> SELECT chunk_id, status, start_id,end_id

2 FROM user_parallel_execute_chunks

3 WHERE task_name = 'test_task'

4 ORDER BY chunk_id;

CHUNK_ID STATUSSTART_ID END_ID

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

75 UNASSIGNED1 10000

76 UNASSIGNED10001 20000

77 UNASSIGNED20001 30000

78 UNASSIGNED30001 40000

......

122 UNASSIGNED470001 480000

123 UNASSIGNED480001 490000

124 UNASSIGNED490001 500000

50 rows selected.

2.5.3 CREATE_CHUNKS_BY_SQL

TheCREATE_CHUNKS_BY_SQL procedure divides the workload based on a user-definedquery. If the BY_ROWID parameter is set to TRUE, the query must return a seriesof start and end rowids. If it's set to FALSE, the query must return a seriesof start and end IDs.

把之前创建的chunks drop 掉

SQL> exec dbms_parallel_execute.drop_chunks('test_task');

PL/SQL procedure successfully completed.

DECLARE

l_stmt CLOB;

BEGIN

l_stmt:= 'SELECT DISTINCT num_col, num_col FROM test_tab';

DBMS_PARALLEL_EXECUTE.create_chunks_by_sql(task_name => 'test_task',

sql_stmt => l_stmt,

by_rowid => FALSE);

END;

/

The[DBA|USER]_PARALLEL_EXECUTE_CHUNKS views display information about theindividual chunks.

SQL> SELECT chunk_id, status, start_id,end_id

2 FROM user_parallel_execute_chunks

3 WHERE task_name = 'test_task'

4 ORDER BY chunk_id;

CHUNK_ID STATUSSTART_ID END_ID

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

141 UNASSIGNED10 10

142 UNASSIGNED30 30

143 UNASSIGNED20 20

2.6 Run the task

Runninga task involves running a specific statement for each defined chunk of work.The documentation only shows examples using updates of the base table, but thisis not the only use of this functionality. The statement associated with thetask can be a procedure call, as shown in one of the examples at the end of thearticle.

There are two ways to run a taskand several procedures to control a running task.

2.6.1 RUN_TASK

TheRUN_TASK procedure runs the specified statement inparallel by scheduling jobs to process the workload chunks. Thestatement specifying the actual work to be done mustinclude a reference to the ':start_id' and ':end_id', which represent arange of rowids or column IDs to be processed, as specified in the chunkdefinitions. The degree of parallelism is controlled by the number of scheduledjobs, not the number of chunks defined. The scheduled jobs take an unassignedworkload chunk, process it, then move on to the next unassigned chunk.

DECLARE

l_sql_stmtVARCHAR2(32767);

BEGIN

l_sql_stmt:= 'UPDATE /*+ ROWID (dda) */ test_tab t

SET t.num_col = t.num_col + 10

WHERE rowid BETWEEN :start_idAND :end_id';

DBMS_PARALLEL_EXECUTE.run_task(task_name => 'test_task',

sql_stmt => l_sql_stmt,

language_flag =>DBMS_SQL.NATIVE,

parallel_level => 10);

END;

/

TheRUN_TASK procedure waits for the task to complete. On completion, the status ofthe task must be assessed to know what action to take next.

2.6.2 User-defined framework

TheDBMS_PARALLEL_EXECUTE package allows you to manually code the task run. The GET_ROWID_CHUNK and GET_NUMBER_COL_CHUNK proceduresreturn the next available unassigned chunk. You can than manuallyprocess the chunk and set its status. The example below shows the processing ofa workload chunked by rowid.

DECLARE

l_sql_stmt VARCHAR2(32767);

l_chunk_id NUMBER;

l_start_rowid ROWID;

l_end_rowid ROWID;

l_any_rows BOOLEAN;

BEGIN

l_sql_stmt := 'UPDATE /*+ ROWID (dda) */ test_tab t

SET t.num_col = t.num_col + 10

WHERE rowid BETWEEN :start_idAND :end_id';

LOOP

-- Get next unassigned chunk.

DBMS_PARALLEL_EXECUTE.get_rowid_chunk(task_name => 'test_task',

chunk_id => l_chunk_id,

start_rowid=> l_start_rowid,

end_rowid => l_end_rowid,

any_rows => l_any_rows);

EXIT WHEN l_any_rows = FALSE;

BEGIN

-- Manually execute the work.

EXECUTE IMMEDIATE l_sql_stmt USING l_start_rowid, l_end_rowid;

-- Set the chunk status as processed.

DBMS_PARALLEL_EXECUTE.set_chunk_status(task_name => 'test_task',

chunk_id=> l_chunk_id,

status =>DBMS_PARALLEL_EXECUTE.PROCESSED);

EXCEPTION

WHEN OTHERS THEN

-- Record chunk error.

DBMS_PARALLEL_EXECUTE.set_chunk_status(task_name => 'test_task',

chunk_id => l_chunk_id,

status =>DBMS_PARALLEL_EXECUTE.PROCESSED_WITH_ERROR,

err_num => SQLCODE,

err_msg => SQLERRM);

END;

-- Commit work.

COMMIT;

ENDLOOP;

END;

/

2.6.3 Task control

A running task can be stopped and restarted using the STOP_TASKand RESUME_TASK procedures respectively.

The PURGE_PROCESSED_CHUNKSprocedure deletes all chunks with a status of 'PROCESSED' or'PROCESSED_WITH_ERROR'.

The ADM_DROP_CHUNKS, ADM_DROP_TASK,ADM_TASK_STATUS and ADM_STOP_TASK routines have the same function as theirnamesakes, but they allow the operations to performed on tasks owned by otherusers. In order to use these routines the user must have been granted the ADM_PARALLEL_EXECUTE_TASKrole.

2.7 Check the task status

Thesimplest way to check the status of a task is to use the TASK_STATUS function. After execution of the task, the only possible return valuesare the 'FINISHED' or 'FINISHED_WITH_ERROR' constants. If the status isnot 'FINISHED', then the task can be resumed using the RESUME_TASK procedure.

DECLARE

l_try NUMBER;

l_status NUMBER;

BEGIN

--If there is error, RESUME it for at most 2 times.

l_try := 0;

l_status := DBMS_PARALLEL_EXECUTE.task_status('test_task');

WHILE(l_try < 2 and l_status != DBMS_PARALLEL_EXECUTE.FINISHED)

Loop

l_try := l_try + 1;

DBMS_PARALLEL_EXECUTE.resume_task('test_task');

l_status := DBMS_PARALLEL_EXECUTE.task_status('test_task');

ENDLOOP;

END;

/

The status of the taskand the chunks can also be queried.

COLUMN task_name FORMAT A10

SELECT task_name,

status

FROMuser_parallel_execute_tasks;


TASK_NAMESTATUS

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

test_taskFINISHED


If there were errors, thechunks can be queried to identify the problems.

SELECT status, COUNT(*)

FROMuser_parallel_execute_chunks

GROUP BY status

ORDER BY status;


STATUS COUNT(*)
-------------------- ----------
PROCESSED_WITH_ERROR 3

The[DBA|USER]_PARALLEL_EXECUTE_TASKS views contain a record of the JOB_PREFIX usedwhen scheduling the chunks of work.

SELECT job_prefix

FROMuser_parallel_execute_tasks

WHEREtask_name = 'test_task';

JOB_PREFIX

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

TASK$_368


Thisvalue can be used to query information about the individual jobs used duringthe process. The number of jobs scheduled should match the degree ofparallelism specified in the RUN_TASK procedure.

COLUMN job_name FORMAT A20

SELECT job_name, status

FROMuser_scheduler_job_run_details

WHEREjob_name LIKE (SELECT job_prefix || '%'

FROM user_parallel_execute_tasks

WHERE task_name = 'test_task');


JOB_NAME STATUS

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

TASK$_205_3 SUCCEEDED

TASK$_205_9 SUCCEEDED

TASK$_205_5 SUCCEEDED

TASK$_205_7 SUCCEEDED

TASK$_205_1 SUCCEEDED

TASK$_205_2 SUCCEEDED

TASK$_205_6 SUCCEEDED

TASK$_205_8 SUCCEEDED

TASK$_205_4 SUCCEEDED

TASK$_205_10 SUCCEEDED


2.8 Drop the task

Oncethe job is complete you can drop the task, which will drop the associated chunkinformation also.

BEGIN

DBMS_PARALLEL_EXECUTE.drop_task('test_task');

END;

/

三. 示例

3.1 Test 1

The following example shows the processingof a workload chunked by rowid.

DECLARE

l_task VARCHAR2(30) :='test_task';

l_sql_stmt VARCHAR2(32767);

l_try NUMBER;

l_status NUMBER;

BEGIN

DBMS_PARALLEL_EXECUTE.create_task (task_name => l_task);

DBMS_PARALLEL_EXECUTE.create_chunks_by_rowid(task_name => l_task,

table_owner => 'TEST',

table_name => 'TEST_TAB',

by_row => TRUE,

chunk_size => 10000);

l_sql_stmt := 'UPDATE /*+ ROWID (dda) */ test_tab t

SET t.num_col = t.num_col + 10

WHERE rowid BETWEEN :start_idAND :end_id';

DBMS_PARALLEL_EXECUTE.run_task(task_name => l_task,

sql_stmt => l_sql_stmt,

language_flag =>DBMS_SQL.NATIVE,

parallel_level => 10);

--If there is error, RESUME it for at most 2 times.

l_try := 0;

l_status := DBMS_PARALLEL_EXECUTE.task_status(l_task);

WHILE(l_try < 2 and l_status != DBMS_PARALLEL_EXECUTE.FINISHED)

Loop

l_try := l_try + 1;

DBMS_PARALLEL_EXECUTE.resume_task(l_task);

l_status := DBMS_PARALLEL_EXECUTE.task_status(l_task);

ENDLOOP;

DBMS_PARALLEL_EXECUTE.drop_task(l_task);

END;

/

3.2 Test 2

Thefollowing example shows the processing of a workload chunked by a numbercolumn. Notice that the workload is actually a stored procedure in this case.

CREATE OR REPLACE PROCEDURE process_update(p_start_id IN NUMBER, p_end_id IN NUMBER) AS

BEGIN

UPDATE /*+ ROWID (dda) */ test_tab t

SET t.num_col = t.num_col + 10

WHERE id BETWEEN p_start_id AND p_end_id;

END;

/


DECLARE

l_task VARCHAR2(30) :='test_task';

l_sql_stmt VARCHAR2(32767);

l_try NUMBER;

l_status NUMBER;

BEGIN

DBMS_PARALLEL_EXECUTE.create_task (task_name => l_task);

DBMS_PARALLEL_EXECUTE.create_chunks_by_number_col(task_name => l_task,

table_owner => 'TEST',

table_name => 'TEST_TAB',

table_column => 'ID',

chunk_size => 10000);

l_sql_stmt := 'BEGIN process_update(:start_id, :end_id); END;';

DBMS_PARALLEL_EXECUTE.run_task(task_name => l_task,

sql_stmt => l_sql_stmt,

language_flag =>DBMS_SQL.NATIVE,

parallel_level=> 10);

--If there is error, RESUME it for at most 2 times.

l_try := 0;

l_status := DBMS_PARALLEL_EXECUTE.task_status(l_task);

WHILE(l_try < 2 and l_status != DBMS_PARALLEL_EXECUTE.FINISHED)

Loop

l_try := l_try + 1;

DBMS_PARALLEL_EXECUTE.resume_task(l_task);

l_status := DBMS_PARALLEL_EXECUTE.task_status(l_task);

ENDLOOP;

DBMS_PARALLEL_EXECUTE.drop_task(l_task);

END;

/

3.3 Test 3

Thefollowing example shows a workload chunked by an SQL statement and processed bya user-defined framework.

DECLARE

l_task VARCHAR2(30) :='test_task';

l_stmt CLOB;

l_sql_stmt VARCHAR2(32767);

l_chunk_id NUMBER;

l_start_id NUMBER;

l_end_id NUMBER;

l_any_rows BOOLEAN;

BEGIN

DBMS_PARALLEL_EXECUTE.create_task (task_name => l_task);

l_stmt := 'SELECT DISTINCT num_col, num_col FROM test_tab';

DBMS_PARALLEL_EXECUTE.create_chunks_by_sql(task_name => l_task,

sql_stmt => l_stmt,

by_rowid => FALSE);

l_sql_stmt := 'UPDATE /*+ ROWID (dda) */ test_tab t

SET t.num_col = t.num_col

WHERE num_col BETWEEN:start_id AND :end_id';

LOOP

-- Get next unassigned chunk.

DBMS_PARALLEL_EXECUTE.get_number_col_chunk(task_name => 'test_task',

chunk_id => l_chunk_id,

start_id => l_start_id,

end_id => l_end_id,

any_rows => l_any_rows);

EXIT WHEN l_any_rows = FALSE;

BEGIN

-- Manually execute the work.

EXECUTE IMMEDIATE l_sql_stmt USING l_start_id, l_end_id;

-- Set the chunk status as processed.

DBMS_PARALLEL_EXECUTE.set_chunk_status(task_name => 'test_task',

chunk_id => l_chunk_id,

status =>DBMS_PARALLEL_EXECUTE.PROCESSED);

EXCEPTION

WHEN OTHERS THEN

-- Record chunk error.

DBMS_PARALLEL_EXECUTE.set_chunk_status(task_name => 'test_task',

chunk_id => l_chunk_id,

status =>DBMS_PARALLEL_EXECUTE.PROCESSED_WITH_ERROR,

err_num => SQLCODE,

err_msg => SQLERRM);

END;

-- Commit work.

COMMIT;

ENDLOOP;

DBMS_PARALLEL_EXECUTE.drop_task(l_task);

END;

/


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

分享到:
评论

相关推荐

    使用dbms_stats包手工收集统计信息

    Oracle 数据库中使用 dbms_stats 包手动收集统计信息 在 Oracle 数据库中,dbms_stats 包提供了一种手动收集统计信息的方式,包括基于表、用户和索引的统计信息。通过使用 dbms_stats 包,我们可以手动收集统计信息...

    DBMS_XMLDOM DBMS_XMLPARSER DBMS_XMLQUERY 文档

    例如,你可以使用DBMS_XMLDOM.newDoc()来创建一个新的XML文档对象,使用DBMS_XMLDOM.parseXML()将XML字符串解析成DOM树,然后通过DBMS_XMLDOM.getElementsByTagName()等方法对DOM树进行查询和操作。 DBMS_XMLPARSER...

    ORACLE SYS.DBMS_REGISTRY_SYS has errors

    标题中的问题“ORACLE SYS.DBMS_REGISTRY_SYS has errors”指的是在Oracle数据库系统中,系统包BODY `SYS.DBMS_REGISTRY_SYS` 出现错误,导致了一系列的PL/SQL调用失败。这种错误通常与数据库的元数据注册功能有关,...

    oracle dbms_lob

    通过阅读如“Oracle中的包――DBMS_LOB(一).pdf”、“ORACLE LOB大对象处理.pdf”和“DBMS_LOB包的使用.pdf”等资料,可以深入理解这些概念,并通过实践来熟练掌握。同时,“dbms_lob包学习笔记之二:append和...

    DBMS_JOB包创建ORACLE定时任务

    ### DBMS_JOB包创建Oracle定时任务详解 在Oracle数据库中,`DBMS_JOB`包提供了一种机制,用于创建和管理后台作业(Job),这些作业可以在特定的时间或按一定的时间间隔执行。这对于需要定期执行的任务非常有用,...

    DBMS_STATS.GATHER_TABLE_STATS详解.pdf

    1. **对于分区表**:建议使用 `DBMS_STATS` 而不是 `ANALYZE` 语句,因为 `DBMS_STATS` 支持并行处理、可以收集整个分区表的数据以及单个分区的数据,并且可以在不同级别上计算统计信息。 2. **对于非分区表**:同样...

    dbms_obfuscation_toolkit加密解密数据

    ### DBMS_OBFUSCATION_TOOLKIT:Oracle 数据库中的加密与解密工具包 DBMS_OBFUSCATION_TOOLKIT是Oracle数据库提供的一种用于数据加密解密的强大工具包,自Oracle 8i版本开始引入。它支持多种加密算法,如DES、...

    Oracle动态SQL之DBMS_SQL系统包的使用.pdf

    Oracle数据库作为当前企业级应用中广泛使用的数据库系统之一,其提供的动态SQL功能允许开发者在程序运行时构造和执行SQL语句,这种灵活性为程序开发提供了极大的便利。本文将探讨Oracle中的动态SQL实现机制,重点...

    DBMS_SQL的使用

    ### Oracle DBMS_SQL 使用详解 #### 一、概述 在Oracle数据库中,`DBMS_SQL`包是一个功能强大的工具,用于执行动态SQL语句。它提供了处理动态SQL语句的能力,使得开发人员能够灵活地构建和执行SQL语句,而不需要...

    Oracle统计分析-dbms_stats.pdf

    dbms_stats 是 Oracle 提供的一个统计分析工具,能够良好地估计统计数据,特别是针对较大的分区表,并且能获得更好的统计结果,最终制定出速度更快的 SQL 执行计划。 dbms_stats 的使用可以分为两个阶段:收集统计...

    ORACLE数据库封装过程DBMS_SQL的应用.pdf

    ORACLE 数据库封装过程 DBMS_SQL 的应用 DBMS_SQL 是 ORACLE 数据库提供的一种封装过程,它允许开发者在 PL/SQL 程序中执行 DDL 语句和动态的 SQL 语句。DBMS_SQL 的应用可以解决在项目开发中对用户管理和 DDL 使用...

    Oracle 18c bug 执行 DBMS_PDB.CHECK_PLUG_COMPATIBILITY报错_ITPUB博客.mhtml

    Oracle 18c bug 执行 DBMS_PDB.CHECK_PLUG_COMPATIBILITY报错_ITPUB博客.mhtml

    oracle数据库定时任务dbms_job的用法详解

    总结来说,DBMS_JOB是Oracle数据库中强大的定时任务管理工具,它可以灵活地安排和控制PL/SQL代码的执行,对日常维护和自动化工作流具有重要意义。理解并熟练运用DBMS_JOB,可以帮助开发者更有效地管理数据库中的定时...

    DBMS_SQL.rar_dbms_oracle

    在Oracle数据库系统中,DBMS_SQL是一个非常重要的包,它提供了动态执行SQL语句的功能,这对于开发复杂的数据库应用或者需要在运行时构建SQL语句的情况非常有用。DBMS_SQL允许我们处理那些在编译时未知的SQL语句,极...

    DBMS_REDEFINITION

    DBMS_REDEFINITION 是 Oracle 10g 中的一个包,主要用于在线修改表的属性,可以在线重定义表,性能调优方面用处很大。 DBMS_REDEFINITION 包提供了多个函数和过程,可以用于在线重定义表,包括判断某个表能否进行...

    Oracle用RMAN和DBMS_JOB包实现自动存储2

    总的来说,Oracle RMAN和DBMS_JOB的结合使用,不仅实现了数据库的自动备份,还提升了系统的可用性和安全性。通过这种方式,DBA可以从日常的备份和恢复操作中解放出来,专注于更高级别的系统管理和优化任务,进一步...

    Oracle 11g收集各种统计信息(DBMS_STAT)

    Oracle 11g中的DBMS_STATS包是用于收集数据库对象统计信息的重要工具,这些统计信息对于Oracle的优化器来说至关重要,因为它们影响到查询执行计划的选择。在Oracle 7版本中,analyze语句被用来收集统计信息,但在...

    Re-post: DBMS_XPLAN : Display Oracle Execution Plans

    在Oracle数据库中,执行计划是数据库执行SQL语句的步骤序列,包括表扫描、连接操作、排序和索引使用等。 描述虽然为空,但根据标题我们可以推测,这篇博文可能是关于如何使用DBMS_XPLAN包来解析和理解Oracle的执行...

    DBMS_RANDOM.VALUE OR DBMS_RANDOM.STRING

    在Oracle数据库系统中,`DBMS_RANDOM`是一个非常实用的包,它提供了生成随机数和随机字符串的功能。这个包在各种场景下都有广泛的应用,比如在测试数据的生成、模拟随机行为或者创建伪随机数据时。我们将深入探讨`...

Global site tag (gtag.js) - Google Analytics