Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / Oracle selected docs / SQL reference.pdf
Скачиваний:
24
Добавлен:
12.05.2015
Размер:
11.92 Mб
Скачать

ALTER PROCEDURE

ALTER PROCEDURE

Purpose

Use the ALTER PROCEDURE statement to explicitly recompile a standalone stored procedure. Explicit recompilation eliminates the need for implicit run-time recompilation and prevents associated run-time compilation errors and performance overhead.

To recompile a procedure that is part of a package, recompile the entire package using the ALTER PACKAGE statement (see ALTER PACKAGE on page 9-120).

Note: This statement does not change the declaration or definition of an existing procedure. To redeclare or redefine a procedure, use the CREATE PROCEDURE statement with the OR REPLACE clause (see CREATE PROCEDURE on page 14-64).

The ALTER PROCEDURE statement is quite similar to the ALTER FUNCTION statement.

See Also: ALTER FUNCTION on page 9-59

Prerequisites

The procedure must be in your own schema or you must have ALTER ANY

PROCEDURE system privilege.

Syntax

alter_procedure::=

 

schema

.

 

DEBUG

REUSE

SETTINGS

ALTER

PROCEDURE

procedure

COMPILE

 

 

;

Semantics

schema

Specify the schema containing the procedure. If you omit schema, Oracle assumes the procedure is in your own schema.

9-124 Oracle9i SQL Reference

ALTER PROCEDURE

procedure

Specify the name of the procedure to be recompiled.

COMPILE

Specify COMPILE to recompile the procedure. The COMPILE keyword is required. Oracle recompiles the procedure regardless of whether it is valid or invalid.

Oracle first recompiles objects upon which the procedure depends, if any of those objects are invalid.

Oracle also invalidates any local objects that depend upon the procedure, such as procedures that call the recompiled procedure or package bodies that define procedures that call the recompiled procedure.

If Oracle recompiles the procedure successfully, the procedure becomes valid. If recompiling the procedure results in compilation errors, then Oracle returns an error and the procedure remains invalid. You can see the associated compiler error messages with the SQL*Plus command SHOW ERRORS.

During recompilation, Oracle drops all persistent compiler switch settings, retrieves them again from the session, and stores them at the end of compilation. To avoid this process, specify the REUSE SETTINGS clause.

See Also: Oracle9i Database Concepts for information on how Oracle maintains dependencies among schema objects, including remote objects and "Recompiling a Procedure: Example" on page 9-126

DEBUG

Specify DEBUG to instruct the PL/SQL compiler to generate and store the code for use by the PL/SQL debugger.

See Also: Oracle9i Application Developer’s Guide - Fundamentals for information on debugging procedures

REUSE SETTINGS

Specify REUSE SETTINGS to prevent Oracle from dropping and reacquiring compiler switch settings. With this clause, Oracle preserves the existing settings and uses them for the recompilation.

If you specify both DEBUG and REUSE SETTINGS, Oracle sets the persistently stored value of the PLSQL_COMPILER_FLAGS parameter to INTERPRETED, DEBUG. No other compiler switch values are changed.

SQL Statements: ALTER CLUSTER to ALTER SEQUENCE 9-125

ALTER PROCEDURE

See Also: PL/SQL User’s Guide and Reference and Oracle9i Application Developer’s Guide - Fundamentals for more information on the interaction of the PLSQL_COMPILER_FLAGS parameter with the COMPILE clause

Example

Recompiling a Procedure: Example To explicitly recompile the procedure remove_emp owned by the user hr, issue the following statement:

ALTER PROCEDURE hr.remove_emp

COMPILE;

If Oracle encounters no compilation errors while recompiling credit, credit becomes valid. Oracle can subsequently execute it without recompiling it at run time. If recompiling credit results in compilation errors, Oracle returns an error and credit remains invalid.

Oracle also invalidates all dependent objects. These objects include any procedures, functions, and package bodies that call credit. If you subsequently reference one of these objects without first explicitly recompiling it, Oracle recompiles it implicitly at run time.

9-126 Oracle9i SQL Reference

ALTER PROFILE

ALTER PROFILE

Purpose

Use the ALTER PROFILE statement to add, modify, or remove a resource limit or password management parameter in a profile.

Changes made to a profile with an ALTER PROFILE statement affect users only in their subsequent sessions, not in their current sessions.

See Also: CREATE PROFILE on page 14-71 for information on creating a profile

Prerequisites

You must have ALTER PROFILE system privilege to change profile resource limits. To modify password limits and protection, you must have ALTER PROFILE and ALTER USER system privileges.

Syntax

alter_profile::=

 

 

 

 

resource_parameters

ALTER

PROFILE

profile

LIMIT

;

 

 

 

 

password_parameters

SQL Statements: ALTER CLUSTER to ALTER SEQUENCE 9-127

ALTER PROFILE

resource_parameters::=

SESSIONS_PER_USER

CPU_PER_SESSION

CPU_PER_CALL

CONNECT_TIME

IDLE_TIME

LOGICAL_READS_PER_SESSION

LOGICAL_READS_PER_CALL

COMPOSITE_LIMIT

integer

PRIVATE_SGA UNLIMITED

DEFAULT

K

M

integer

UNLIMITED

DEFAULT

password_parameters::=

FAILED_LOGIN_ATTEMPTS

PASSWORD_LIFE_TIME

PASSWORD_REUSE_TIME

PASSWORD_REUSE_MAX

PASSWORD_LOCK_TIME

PASSWORD_GRACE_TIME

PASSWORD_VERIFY_FUNCTION

expr

UNLIMITED

DEFAULT

function NULL

DEFAULT

9-128 Oracle9i SQL Reference

ALTER PROFILE

Semantics

The keywords, parameters, and clauses in the ALTER PROFILE statement all have the same meaning as in the CREATE PROFILE statement.

Note: You cannot remove a limit from the DEFAULT profile.

See Also: CREATE PROFILE on page 14-71 and the examples in the next section

Examples

Making a Password Unavailable: Example The following statement makes the password of the new_profile profile (created in "Creating a Profile: Example" on page 14-76) unavailable for reuse for 90 days:

ALTER PROFILE new_profile

LIMIT PASSWORD_REUSE_TIME 90

PASSWORD_REUSE_MAX UNLIMITED;

Setting Default Password Values: Example The following statement defaults the

PASSWORD_REUSE_TIME value of the app_user profile (created in "Setting Profile Password Limits: Example" on page 14-77) to its defined value in the DEFAULT profile:

ALTER PROFILE app_user

LIMIT PASSWORD_REUSE_TIME DEFAULT

PASSWORD_REUSE_MAX UNLIMITED;

Limiting Login Attempts and Password Lock Time: Example The following statement alters profile app_user with FAILED_LOGIN_ATTEMPTS set to 5 and

PASSWORD_LOCK_TIME set to 1:

ALTER PROFILE app_user LIMIT

FAILED_LOGIN_ATTEMPTS 5

PASSWORD_LOCK_TIME 1;

This statement causes app_user’s account to become locked for 1 day after 5 unsuccessful login attempts.

SQL Statements: ALTER CLUSTER to ALTER SEQUENCE 9-129

ALTER PROFILE

Changing Password Lifetime and Grace Period: Example The following statement modifies profile app_user2 PASSWORD_LIFE_TIME to 90 days and

PASSWORD_GRACE_TIME to 5 days:

ALTER PROFILE app_user2 LIMIT

PASSWORD_LIFE_TIME 90

PASSWORD_GRACE_TIME 5;

Limiting Concurrent Sessions: Example This statement defines a new limit of 5 concurrent sessions for the app_user profile:

ALTER PROFILE app_user LIMIT SESSIONS_PER_USER 5;

If the engineer profile does not currently define a limit for SESSIONS_PER_USER, the preceding statement adds the limit of 5 to the profile. If the profile already defines a limit, the preceding statement redefines it to 5. Any user assigned the engineer profile is subsequently limited to 5 concurrent sessions.

Removing Profile Limits: Example This statement removes the IDLE_TIME limit from the app_user profile:

ALTER PROFILE app_user LIMIT IDLE_TIME DEFAULT;

Any user assigned the app_user profile is subject in their subsequent sessions to the IDLE_TIME limit defined in the DEFAULT profile.

Limiting Profile Idle Time: Example This statement defines a limit of 2 minutes of idle time for the DEFAULT profile:

ALTER PROFILE default LIMIT IDLE_TIME 2;

This IDLE_TIME limit applies to these users:

Users who are not explicitly assigned any profile

Users who are explicitly assigned a profile that does not define an IDLE_TIME limit

This statement defines unlimited idle time for the app_user2 profile:

ALTER PROFILE app_user2 LIMIT IDLE_TIME UNLIMITED;

Any user assigned the app_user2 profile is subsequently permitted unlimited idle time.

9-130 Oracle9i SQL Reference

Соседние файлы в папке Oracle selected docs