Version: 7.0.0

CREATE PROFILE ​

Function Description ​

Creates a user profile, which is used to manage resource limits and password policies for database users. A profile can be shared by multiple users, facilitating unified management of user security and resource usage policies.

Precautions ​

Creating or replacing a profile requires the corresponding system permissions. Improper parameter settings may cause account lockout or overly strict password policies. Configure the parameters appropriately based on actual service requirements.

Syntax ​

sql
CREATE PROFILE profile_name [REPLACE] LIMIT
{
    parameter1 [ { UNLIMITED | DEFAULT | value } ]
    [ parameter2 [ { UNLIMITED | DEFAULT | value } ] ]
    ...
}

Parameter Description ​

Basic Parameters ​

NameDescription
profile_nameName of the profile
REPLACEOptional. If the specified profile already exists, replaces it.

Parameter Value Options ​

OptionDescription
UNLIMITEDIndicates no limit.
DEFAULTUses the system default value.
valueA specific value

Configurable Parameter List ​

NameTypeDefault ValueUnitDescription
FAILED_LOGIN_ATTEMPTSInteger10CountSpecifies the maximum number of failed login attempts for a user. The account will be locked after this number is exceeded.
PASSWORD_LIFE_TIMEInteger15552000SecondsSpecifies the validity period of a password. The password will expire after this period, and the user must change the password to log in.
PASSWORD_REUSE_TIMEIntegerUNLIMITEDSecondsSpecifies the number of days that must elapse before a password can be reused. If this parameter is set to an integer, PASSWORD_REUSE_MAX must be set to UNLIMITED.
PASSWORD_REUSE_MAXIntegerUNLIMITEDCountSpecifies the number of password changes required before a password can be reused. If this parameter is set to an integer, PASSWORD_REUSE_TIME must be set to UNLIMITED.
PASSWORD_LOCK_TIMEInteger86400SecondsSpecifies the duration for which an account is locked.
PASSWORD_GRACE_TIMEInteger604800SecondsSpecifies the grace period after a password expires. During this period, a warning is displayed upon login, but the user can still log in.
SESSIONS_PER_USERIntegerUNLIMITEDCountSpecifies the maximum number of concurrent sessions allowed per user.
PASSWORD_MIN_LENInteger8CharactersSpecifies the minimum length of a password.

Examples ​

Creating a Basic Profile ​

CREATE PROFILE app_user_profile LIMIT
    FAILED_LOGIN_ATTEMPTS 5;

Replace an Existing Profile ​

CREATE OR REPLACE PROFILE app_user_profile LIMIT
    FAILED_LOGIN_ATTEMPTS 20;

Creating a Profile Using Default Values ​

CREATE PROFILE default_profile LIMIT
    FAILED_LOGIN_ATTEMPTS DEFAULT;

Creating an Unlimited Profile ​

CREATE PROFILE unlimited_profile LIMIT
    PASSWORD_LIFE_TIME UNLIMITED;