Function and Limit

本文介绍了数学中的函数概念及其作用,并详细解释了极限的概念,包括单侧极限和常见极限类型及处理方法。
部署运行你感兴趣的模型镜像

Function and Limit

1. Function

1) What is a Function?

In mathematics, a function is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output.[1]

Think about a water dispenser, on the one side, we have a busket full of water, which inputs those water into the water dispenser fast. On the other side, the tag drains the water with much small speed. In this case, the water dispenser is somewhat a function of the speed of water. The input is fast, and the output is relatively slower.

We usually call the input as x , the function as f, and the output of f corresponding to an input x is denoted by f(x) (read “f of x”).[1]

2) What does a Function do?

A function map input (each number in its domain) to one and only output.

For example, f(x)=x+1( x ∈ {\rm I!R} )

x f(x)
1 2
2 3
3 4
5 6
x x+1

2. Limit

1) What is a Limit?

A limit is the function with a variable approach some value. Limits are essential to calculus (and mathematical analysis in general) and are used to define continuity, derivatives, and integrals.[2].

2) What is one-sided limit?

In short, one-sided limit is the limition with one value approach from one side, and different will may have way different result of the formula because, the value is always bigger/small than the other value.

When one-sided limits from both sides are equal to the same value, we could simply use two-sided limits to express. Whereas, the one-sided limits is not exactly the same, we have use one-sided limits.

See more at this blog What is one-sided limit

3) Some Rules of Limits

There are basically 4 types of limits

  1. 00()

    • ×0
    • Exponential e.g., 1 , 00 , 0
    • Note that, Tylor expansion could deal with all kinds of types.

      00()

      Use l’Hôpital’s rule to get the derivative of nominator and demoninator. That is 00()

      ×0

      Transform to type ①, and then use the method offered in type ①. For example, ×001 or 10

      ③ Exponential

      Transform exponential to logarithm, then you get type ②。Using this rule uv=e(vlnu) .For example, 1eln1 , 0e0ln0 , 1e0ln

      There are several detail for this type. But using Tylor expansion is the most powerful way for this type. Because Tylor expansion is an equation, so that you don’t need to worry about the other complicate prerequisite.

      Summary

      Reference

      [1] Wikipedia - Function (mathematics) https://en.wikipedia.org/wiki/Function_(mathematics)

      [2] Wikipedia - Limit (mathematics) https://en.wikipedia.org/wiki/Limit_(mathematics)



您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

<think> 我们正在讨论的是Oracle数据库中的`ALTER PROFILE`语句,特别是用于修改默认配置文件(profile)的密码验证函数限制。 用户想了解如何使用`ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION`语句,包括使用方法和注意事项。 首先,`PROFILE`在Oracle中用于管理数据库用户的资源限制和密码策略。`DEFAULT`是Oracle预定义的一个配置文件。 密码验证函数(PASSWORD_VERIFY_FUNCTION)是一个自定义的PL/SQL函数,用于实施密码复杂性规则。 步骤: 1. 创建密码验证函数:通常使用Oracle提供的脚本创建默认的密码验证函数(如`utlpwdmg.sql`),也可以自定义。 2. 将密码验证函数分配给配置文件(profile),特别是默认配置文件(DEFAULT)。 语法: ```sql ALTER PROFILE profile_name LIMIT PASSWORD_VERIFY_FUNCTION function_name [NULL]; ``` 其中: - `profile_name`:配置文件的名称,这里使用`DEFAULT` - `function_name`:密码验证函数的名称(如`verify_function`,或者自定义的函数名) - `NULL`:表示禁用密码验证函数 注意: - 使用`ALTER PROFILE`需要`ALTER PROFILE`系统权限。 - 修改配置文件后,新的密码策略将影响后续修改密码或新建的用户(使用该配置文件的用户)。 示例: 1. 启用密码验证函数(假设函数名为`my_verify_function`): ```sql ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION my_verify_function; ``` 2. 禁用密码验证函数: ```sql ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION NULL; ``` 注意事项: 1. 自定义密码验证函数必须满足特定的参数要求(三个输入参数:用户名、新密码、旧密码),并且返回布尔值(TRUE表示密码合格,FALSE表示不合格)。 2. 默认的密码验证函数(如`verify_function`)在`utlpwdmg.sql`脚本中定义(位于`$ORACLE_HOME/rdbms/admin`目录下)。在11g及以后版本,该脚本提供了更复杂的密码规则(要求密码长度至少8位,包含数字、字母、大小写、特殊字符等)。但在12c以后,该脚本默认创建的验证函数名变成了`ORA12C_VERIFY_FUNCTION`(版本不同可能有差异)。 3. 在分配密码验证函数之前,必须确保该函数已经创建且编译成功。 4. 修改配置文件只会影响后续密码修改操作,不会立即检查现有密码。 5. 如果密码验证函数本身有错误(例如编译错误),则可能导致用户修改密码失败(报错如`ORA-28003: password verification for the specified password failed`,但实际上可能是函数错误)。 6. 在修改配置文件后,可以通过修改某个用户的密码来测试策略是否生效。 操作步骤示例(以使用Oracle提供的默认密码验证函数为例): 1. 以DBA用户登录(如SYS)。 2. 运行脚本创建默认的密码验证函数(注意:运行脚本会覆盖已有的同名函数): ```sql @?/rdbms/admin/utlpwdmg.sql ``` 该脚本会创建名为`verify_function`(或根据版本不同而不同)的函数,并将默认配置文件(DEFAULT)的密码验证函数设置为它。 3. 如果脚本没有自动设置,则需要手动设置: ```sql ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION verify_function; ``` 验证: 尝试修改一个用户的密码,使用不符合规则的密码(如太简单)会报错: ```sql ALTER USER scott IDENTIFIED BY tiger; -- 错误:ORA-28003: 指定口令的口令验证失败 ``` 自定义密码验证函数示例(简化版): ```sql CREATE OR REPLACE FUNCTION my_verify_function ( username VARCHAR2, password VARCHAR2, old_password VARCHAR2 ) RETURN BOOLEAN IS BEGIN -- 密码长度至少8位 IF LENGTH(password) < 8 THEN RETURN FALSE; END IF; -- 至少包含一个数字 IF REGEXP_LIKE(password, '\d') THEN RETURN TRUE; ELSE RETURN FALSE; END IF; END; / ``` 相关数据字典视图: - `DBA_PROFILES`:查看配置文件的资源限制和密码策略。 ```sql SELECT resource_name, limit FROM dba_profiles WHERE profile = 'DEFAULT' AND resource_type = 'PASSWORD'; ``` 注意:`PASSWORD_VERIFY_FUNCTION`对应的资源名是`PASSWORD_VERIFY_FUNCTION`。 安全建议: - 在修改生产环境之前,在测试环境中测试密码策略。 - 确保密码验证函数不会过于复杂,以免影响性能。 最后,注意Oracle版本差异。例如,在12c及以上版本,引入了可插拔数据库(PDB),配置文件的作用范围可能是PDB级别(在PDB中修改)或CDB级别(在根容器中修改)。 参考文献: [Oracle Database Security Guide: Managing Password Complexity with Verification Functions](https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/managing-password-complexity.html)[^1] </think> 以下是关于 `ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION` 的详细使用指南,包含操作步骤、注意事项和最佳实践: ### 一、功能说明 通过 `PASSWORD_VERIFY_FUNCTION` 可强制执行自定义密码策略: 1. **核心作用**:创建密码复杂度规则(如长度、字符类型、历史记录等) 2. **触发时机**:用户修改密码或管理员重置密码时自动验证 3. **策略范围**:影响使用 `DEFAULT` profile 的所有用户(Oracle 默认分配) --- ### 二、完整操作流程 #### 步骤1:创建验证函数 使用官方模板脚本生成基础函数(需 DBA 权限): ```sql -- 执行官方脚本创建验证函数 @?/rdbms/admin/utlpwdmg.sql ``` 此脚本会创建 `VERIFY_FUNCTION`(Oracle 11g)或 `ORA12C_VERIFY_FUNCTION`(12c+) #### 步骤2:应用默认配置文件 ```sql ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION verify_function; -- 12c以下版本 -- 或 ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION ORA12C_VERIFY_FUNCTION; -- 12c+版本 ``` #### 步骤3:验证配置 ```sql SELECT resource_name, limit FROM dba_profiles WHERE profile = 'DEFAULT' AND resource_name = 'PASSWORD_VERIFY_FUNCTION'; ``` 预期输出: ``` RESOURCE_NAME LIMIT ------------------------------ ------------------------------ PASSWORD_VERIFY_FUNCTION VERIFY_FUNCTION ``` --- ### 三、自定义密码策略示例 修改函数实现以下规则: - 最小长度 10 位 - 包含大小写字母和数字 - 禁用用户名反转作为密码 ```sql CREATE OR REPLACE FUNCTION custom_verify ( username VARCHAR2, password VARCHAR2, old_password VARCHAR2 ) RETURN BOOLEAN IS BEGIN -- 长度检查 IF LENGTH(password) < 10 THEN RAISE_APPLICATION_ERROR(-20001, '密码至少10位'); END IF; -- 复杂度检查 IF NOT (REGEXP_LIKE(password, '[A-Z]') AND REGEXP_LIKE(password, '[a-z]') AND REGEXP_LIKE(password, '\d')) THEN RAISE_APPLICATION_ERROR(-20002, '需包含大小写字母和数字'); END IF; -- 禁止用户名反转 IF password = REVERSE(username) THEN RAISE_APPLICATION_ERROR(-20003, '不能使用用户名反转'); END IF; RETURN TRUE; END; / ``` 应用自定义函数: ```sql ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION custom_verify; ``` --- ### 四、关键注意事项 1. **权限要求**: - 执行 `ALTER PROFILE` 需要 `ALTER PROFILE` 系统权限 - 函数创建需要 `CREATE PROCEDURE` 权限 2. **版本差异**: | 版本 | 默认脚本函数名 | |------------|---------------------------| | Oracle 11g | `VERIFY_FUNCTION` | | Oracle 12c+ | `ORA12C_VERIFY_FUNCTION` | 3. **策略生效范围**: - 仅对新密码生效(已有密码不受影响) - 修改后首次密码变更时触发验证 4. **紧急禁用方法**: ```sql ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION NULL; -- 禁用验证 ``` 5. **函数开发约束**: - 必须包含三个参数:`(username VARCHAR2, password VARCHAR2, old_password VARCHAR2)` - 返回类型必须为 `BOOLEAN` - 验证失败时抛出 `RAISE_APPLICATION_ERROR` --- ### 五、最佳实践建议 1. **测试环境验证**: ```sql -- 测试密码策略 ALTER USER testuser IDENTIFIED BY "Weak123"; ``` 预期错误:`ORA-28003: 密码验证失败` 2. **密码历史策略组合**: ```sql ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION custom_verify PASSWORD_REUSE_MAX 5; -- 禁止重用最近5次密码 ``` 3. **多租户环境**: ```sql ALTER SESSION SET CONTAINER = PDB1; ALTER PROFILE DEFAULT ... ; -- PDB内单独配置 ``` > ⚠️ **重要**:生产环境修改前务必在测试库验证,错误密码策略可能导致账户锁定[^1]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值