ITPub博客

首页 > 应用开发 > IT综合 > Time stamp Checking (253)

Time stamp Checking (253)

原创 IT综合 作者:tsinglee 时间:2007-11-27 09:26:40 0 删除 编辑

In the time stamp checking dependency model, whenever a
procedure is compiled or recompiled its time stamp (the time it is created, altered, or
replaced) is recorded in the data dictionary. The time stamp is a record of the time the
procedure is created, altered, or replaced. Additionally, the compiled version of the
procedure contains information about each remote procedure that it references,
including the remote procedure’s schema, package name, procedure name, and time
stamp.

When a dependent procedure is used, Oracle compares the remote time stamps
recorded at compile time with the current time stamps of the remotely referenced
procedures. Depending on the result of this comparison, two situations can occur:

■ The local and remote procedures run without compilation if the time stamps
match.
■ The local procedure is invalidated if any time stamps of remotely referenced
procedures do not match, and an error is returned to the calling environment.
Furthermore, all other local procedures that depend on the remote procedure with
the new time stamp are also invalidated. For example, assume several local
procedures call a remote procedure, and the remote procedure is recompiled.
When one of the local procedures is run and notices the different time stamp of the
remote procedure, every local procedure that depends on the remote procedure is
invalidated.

Actual time stamp comparison occurs when a statement in the body of a local
procedure runs a remote procedure. Only at this moment are the time stamps
compared using the distributed database’s communications link. Therefore, all
statements in a local procedure that precede an invalid procedure call might run
successfully. Statements subsequent to an invalid procedure call do not run at all.
Compilation is required.

Depending on how the invalid procedure is called, DML statements run before the
invalid procedure call are rolled back. For example, in the following, the UPDATE
results are rolled back as the complete PL/SQL block changes are rolled back.
BEGIN
UPDATE table set ...
invalid_proc;
COMMIT;
END;

However, with the following, the UPDATE results are final. Only the PROC call is rolled
back.
UPDATE table set ...
EXECUTE invalid_proc;
COMMIT;

时间戳检查
1.
时间戳是一个过程创建,修改时记录的包括此过程所引用的所有远程过程的所属方案,包名称,过程名称,及时间
戳等信息
2. 时间戳比较发生在本地过程中调用远程过程时 ,使用分布式数据库的通信链接
3. 本地过程中位于无效远程过程调用之前的语句可能全部运行正常,调用无效对象之后的语句
不会运行。 无效远程过程调用之前的 DML 语句是否被回滚,是由此无效远程过程的调用方式决定的
4. 当运行一个依赖过程时,Oracle将对此过程编译时所记录的远程时间戳与远程引用对象当前的时间戳进行
比较。根据比较结果,可能有两种情况发生:
* 如果时间戳比较结果一致,那么本地及远程过程均无需编译就可直接运行。
* 如果存在时间戳比较结果不一致的远程引用对象,那么本地过程将被置为无效状态,发送一个错误信
息。此后,Oracle还会将所有引用了时间戳发生变化的远程过程的本地过程置为无效状态。

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-985292/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    740
  • 访问量
    1897914