CREATE PROFILE

Purpose

Use the CREATE PROFILE statement to create a profile, which is a set of limits on database resources. If you assign the profile to a user, then that user cannot exceed these limits.


See Also:

Oracle Database Security Guide for a detailed description and explanation of how to use password management and protection

Prerequisites

To create a profile, you must have the CREATE PROFILE system privilege.

To specify resource limits for a user, you must:

  • Enable resource limits dynamically with the ALTER SYSTEM statement or with the initialization parameter RESOURCE_LIMIT. This parameter does not apply to password resources. Password resources are always enabled.

  • Create a profile that defines the limits using the CREATE PROFILE statement

  • Assign the profile to the user using the CREATE USER or ALTER USER statement


    See Also:


Syntax


create_profile::=
Description of create_profile.gif follows
Description of the illustration create_profile.gif


resource_parameters::=
Description of resource_parameters.gif follows
Description of the illustration resource_parameters.gif


password_parameters ::=
Description of password_parameters.gif follows
Description of the illustration password_parameters.gif

Semantics


profile

Specify the name of the profile to be created. Use profiles to limit the database resources available to a user for a single call or a single session.

Oracle Database enforces resource limits in the following ways:

  • If a user exceeds the CONNECT_TIME or IDLE_TIME session resource limit, then the database rolls back the current transaction and ends the session. When the user process next issues a call, the database returns an error.

  • If a user attempts to perform an operation that exceeds the limit for other session resources, then the database aborts the operation, rolls back the current statement, and immediately returns an error. The user can then commit or roll back the current transaction, and must then end the session.

  • If a user attempts to perform an operation that exceeds the limit for a single call, then the database aborts the operation, rolls back the current statement, and returns an error, leaving the current transaction intact.


    Notes:

    • You can use fractions of days for all parameters that limit time, with days as units. For example, 1 hour is 1/24 and 1 minute is 1/1440.

    • You can specify resource limits for users regardless of whether the resource limits are enabled. However, Oracle Database does not enforce the limits until you enable them.



UNLIMITED

When specified with a resource parameter, UNLIMITED indicates that a user assigned this profile can use an unlimited amount of this resource. When specified with a password parameter, UNLIMITED indicates that no limit has been set for the parameter.


DEFAULT

Specify DEFAULT if you want to omit a limit for this resource in this profile. A user assigned this profile is subject to the limit for this resource specified in the DEFAULT profile. The DEFAULT profile initially defines unlimited resources. You can change those limits with the ALTER PROFILE statement.

Any user who is not explicitly assigned a profile is subject to the limits defined in the DEFAULT profile. Also, if the profile that is explicitly assigned to a user omits limits for some resources or specifies DEFAULT for some limits, then the user is subject to the limits on those resources defined by the DEFAULT profile.


resource_parameters

SESSIONS_PER_USER

Specify the number of concurrent sessions to which you want to limit the user.


CPU_PER_SESSION

Specify the CPU time limit for a session, expressed in hundredth of seconds.


CPU_PER_CALL

Specify the CPU time limit for a call (a parse, execute, or fetch), expressed in hundredths of seconds.


CONNECT_TIME

Specify the total elapsed time limit for a session, expressed in minutes.


IDLE_TIME

Specify the permitted periods of continuous inactive time during a session, expressed in minutes. Long-running queries and other operations are not subject to this limit.


LOGICAL_READS_PER_SESSION

Specify the permitted number of data blocks read in a session, including blocks read from memory and disk.


LOGICAL_READS_PER_CALL

Specify the permitted the number of data blocks read for a call to process a SQL statement (a parse, execute, or fetch).


PRIVATE_SGA

Specify the amount of private space a session can allocate in the shared pool of the system global area (SGA), expressed in bytes.


Note:

This limit applies only if you are using shared server architecture. The private space for a session in the SGA includes private SQL and PL/SQL areas, but not shared SQL and PL/SQL areas.


COMPOSITE_LIMIT

Specify the total resource cost for a session, expressed in service units. Oracle Database calculates the total service units as a weighted sum of CPU_PER_SESSION, CONNECT_TIME, LOGICAL_READS_PER_SESSION, and PRIVATE_SGA.


See Also:



password_parameters

Use the following clauses to set password parameters. Parameters that set lengths of time are interpreted in number of days. For testing purposes you can specify minutes (n/1440) or even seconds (n/86400).


FAILED_LOGIN_ATTEMPTS

Specify the number of failed attempts to log in to the user account before the account is locked.


PASSWORD_LIFE_TIME

Specify the number of days the same password can be used for authentication. If you also set a value for PASSWORD_GRACE_TIME, the password expires if it is not changed within the grace period, and further connections are rejected. If you do not set a value for PASSWORD_GRACE_TIME, its default of UNLIMITED will cause the database to issue a warning but let the user continue to connect indefinitely.


PASSWORD_REUSE_TIME and PASSWORD_REUSE_MAX

These two parameters must be set in conjunction with each other. PASSWORD_REUSE_TIME specifies the number of days before which a password cannot be reused. PASSWORD_REUSE_MAX specifies the number of password changes required before the current password can be reused. For these parameter to have any effect, you must specify an integer for both of them.

  • If you specify an integer for both of these parameters, then the user cannot reuse a password until the password has been changed the password the number of times specified for PASSWORD_REUSE_MAX during the number of days specified for PASSWORD_REUSE_TIME.

    For example, if you specify PASSWORD_REUSE_TIME to 30 and PASSWORD_REUSE_MAX to 10, then the user can reuse the password after 30 days if the password has already been changed 10 times.

  • If you specify an integer for either of these parameters and specify UNLIMITED for the other, then the user can never reuse a password.

  • If you specify DEFAULT for either parameter, then Oracle Database uses the value defined in the DEFAULT profile. By default, all parameters are set to UNLIMITED in the DEFAULT profile. If you have not changed the default setting of UNLIMITED in the DEFAULT profile, then the database treats the value for that parameter as UNLIMITED.

  • If you set both of these parameters to UNLIMITED, then the database ignores both of them.


PASSWORD_LOCK_TIME

Specify the number of days an account will be locked after the specified number of consecutive failed login attempts.


PASSWORD_GRACE_TIME

Specify the number of days after the grace period begins during which a warning is issued and login is allowed. If the password is not changed during the grace period, the password expires.


PASSWORD_VERIFY_FUNCTION

The PASSWORD_VERIFY_FUNCTION clause lets a PL/SQL password complexity verification script be passed as an argument to the CREATE PROFILE statement. Oracle Database provides a default script, but you can create your own routine or use third-party software instead.

  • For function, specify the name of the password complexity verification routine.

  • Specify NULL to indicate that no password verification is performed.

If you specify expr for any of the password parameters, the expression can be of any form except scalar subquery expression.

Examples


Creating a Profile: Example

The following statement creates the profile new_profile:

CREATE PROFILE new_profile
  LIMIT PASSWORD_REUSE_MAX 10
        PASSWORD_REUSE_TIME 30;


Setting Profile Resource Limits: Example

The following statement creates the profile app_user:

CREATE PROFILE app_user LIMIT 
   SESSIONS_PER_USER          UNLIMITED 
   CPU_PER_SESSION            UNLIMITED 
   CPU_PER_CALL               3000 
   CONNECT_TIME               45 
   LOGICAL_READS_PER_SESSION  DEFAULT 
   LOGICAL_READS_PER_CALL     1000 
   PRIVATE_SGA                15K
   COMPOSITE_LIMIT            5000000; 

If you assign the app_user profile to a user, the user is subject to the following limits in subsequent sessions:

  • The user can have any number of concurrent sessions.

  • In a single session, the user can consume an unlimited amount of CPU time.

  • A single call made by the user cannot consume more than 30 seconds of CPU time.

  • A single session cannot last for more than 45 minutes.

  • In a single session, the number of data blocks read from memory and disk is subject to the limit specified in the DEFAULT profile.

  • A single call made by the user cannot read more than 1000 data blocks from memory and disk.

  • A single session cannot allocate more than 15 kilobytes of memory in the SGA.

  • In a single session, the total resource cost cannot exceed 5 million service units. The formula for calculating the total resource cost is specified by the ALTER RESOURCE COST statement.

  • Since the app_user profile omits a limit for IDLE_TIME and for password limits, the user is subject to the limits on these resources specified in the DEFAULT profile.


Setting Profile Password Limits: Example

The following statement creates the app_user2 profile with password limits values set:

CREATE PROFILE app_user2 LIMIT
   FAILED_LOGIN_ATTEMPTS 5
   PASSWORD_LIFE_TIME 60
   PASSWORD_REUSE_TIME 60
   PASSWORD_REUSE_MAX 5
   PASSWORD_VERIFY_FUNCTION verify_function
   PASSWORD_LOCK_TIME 1/24
   PASSWORD_GRACE_TIME 10;

This example uses the default Oracle Database password verification function, verify_function. Please refer to Oracle Database Security Guide for information on using this verification function provided or designing your own verification function.

<think>好的,我需要回答用户关于如何在Qt Creator中使用和配置Profile模式的问题。首先,我要回忆一下之前用户提供的引用内容,特别是引用4和引用5,里面详细介绍了Debug、Release和Profile模式的区别以及编译配置的相关信息。 用户的问题集中在Profile模式的使用和配置上,所以需要重点解释如何启用和设置这个模式。首先,我应该检查Qt Creator中是否默认有Profile配置。根据引用5,Profile模式是介于Debug和Release之间的构建配置,用于性能分析,可能需要在构建套件中进行配置。 接下来,我需要考虑如何添加或选择Profile模式。通常,Qt Creator的构建配置可能默认只有Debug和Release,所以可能需要复制Release配置并调整优化和调试选项。例如,在项目设置中复制Release,然后修改编译器标志,保留部分调试信息,如使用-g标志,同时开启优化选项-O2。 另外,引用4提到Profile模式链接的库不带d结尾,这点需要注意,避免错误地链接Debug库。同时,编译后的文件大小介于Debug和Release之间,这也需要用户在配置时注意检查生成的文件是否符合预期。 还需要提到性能分析工具的使用,比如在Profile模式下使用Valgrind或perf工具来分析性能瓶颈。这部分可能需要指导用户如何在Qt Creator中集成这些工具,或者如何运行生成的可执行文件进行分析。 最后,应该提醒用户确保安装了必要的调试库,根据引用4,新的Qt安装程序可能需要手动勾选安装Debug库,但Profile模式并不依赖这些带d的库,所以需要确认构建配置是否正确。 总结步骤应该是:检查现有配置、复制Release配置、调整编译选项、验证配置、进行性能分析。同时,给出具体的操作路径,如进入项目设置,选择构建步骤等,确保用户能逐步操作。</think>### Qt Creator中Profile模式的使用与配置指南 Profile模式是介于Debug和Release之间的构建配置,主要用于性能调优和基准测试。以下为详细操作步骤: #### 一、配置Profile模式 1. **检查现有配置** - 打开项目后,点击左下角构建套件选择器 - 默认可能只显示Debug/Release(图1) - 若已有Profile配置可直接选择[^5] 2. **手动添加配置(若无默认)** 1. 项目→构建设置→克隆Release配置 2. 重命名为"Profile" 3. 修改编译选项: ```makefile QMAKE_CXXFLAGS += -O2 -g # 保留部分调试符号 QMAKE_LFLAGS += -no-pie # 禁用地址随机化便于性能分析 ``` 3. **关键参数对比表** | 配置项 | Debug | Release | Profile | |--------------|-------------|------------|------------| | 优化等级 | -O0 | -O3 | -O2 | | 调试符号 | -g3 | 无 | -g | | 断言检查 | 启用 | 禁用 | 选择性启用 | | 库文件后缀 | *d.so | *.so | *.so | #### 二、使用Profile模式 1. **构建过程** ```bash qmake CONFIG+=profile make -j4 ``` 2. **性能分析工具集成** - 在Qt Creator→分析→Valgrind设置中添加检测工具 - 示例检测配置: ```xml <valgrind> <tool name="callgrind" arguments="--collect-jumps=yes"/> </valgrind> ``` 3. **实战技巧** - 使用$$QMAKE_PRL_BUILD_DIR变量定位生成文件 - 通过.pro文件条件判断: ```qmake CONFIG(profile) { DEFINES += PROFILING_ENABLED LIBS += -lprofiler } ``` #### 三、验证配置有效性 1. 文件大小检查: ```bash ls -lh build-profile/* | grep -E 'debug|release|profile' ``` 正常应满足:Debug > Profile > Release 2. 符号表验证: ```bash objdump -t MyApp | grep _Z # 应显示部分函数符号 ``` #### 四、常见问题处理 1. **性能数据异常** - 现象:采样率过低 - 解决方案: ```qmake QMAKE_CXXFLAGS += -fno-omit-frame-pointer ``` 2. **库链接错误** - 错误提示:`undefined reference to [symbol]_debug` - 检查.pro文件是否误用`CONFIG += debug` 3. **Qt版本适配** - Qt5.7+支持完整Profile特性 - 旧版本需手动添加`QT += testlib`
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值