千家信息网

oracle修改用户密码的方法

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,修改oracle用户的密码有以下方法:普通用户(1)通过alter user语法来进行修改 ,这也是最常见的方式:(2) 第二种方式,是通过password命令来修改:从安全性角度来说 ,推荐大家通过
千家信息网最后更新 2026年11月03日oracle修改用户密码的方法

修改oracle用户的密码有以下方法:

普通用户

(1)通过alter user语法来进行修改 ,这也是最常见的方式:

(2) 第二种方式,是通过password命令来修改:


从安全性角度来说 ,推荐大家通过第二种方式来修改用户密码,这样可防止明文密码泄露。


sys用户

另外关于sys用户密码,不要使用password以及alter user 方式去修改,原因主要如下:

(1) 当REMOTE_LOGIN_PASSWORDFILE参数设置为shared时,我们使用alter user 修改sys密码时,会报

ORA-28046: Password change for SYS disallowed error.

测试如下:


(2) 大多数内部递归SQL都使用SYS用户。因此,如果您试图在数据库打开时使用ALTER USER语句更改此密码,则可能会导致死锁。


因此,对于sys用户我们需要使用orapwd来进行修改:

[oracle@orcl dbs]$ orapwd file='orapworcl' entries=5 force=y 这里注意等号左右不能有空格;


关于orapwd说明引用官网,如下:

ArgumentDescription
FILEName to assign to the password file. You must supply a complete path. If you supply only a file name, the file is written to the current directory.
ENTRIES(Optional) Maximum number of entries (user accounts) to permit in the file.
FORCE(Optional) If y , permits overwriting an existing password file.
IGNORECASE(Optional) If y , passwords are treated as case-insensitive.


FILE

This argument sets the name of the password file being created. You must specify the full path name for the file. This argument is mandatory.

The file name required for the password file is operating system specific. Some operating systems require the password file to adhere to a specific format and be located in a specific directory. Other operating systems allow the use of environment variables to specify the name and location of the password file.

Table 1-1 lists the required name and location for the password file on the UNIX, Linux, and Windows platforms. For other platforms, consult your platform-specific documentation.

Table 1-1 Required Password File Name and Location on UNIX, Linux, and Windows

PlatformRequired NameRequired Location)

UNIX and Linux

orapw ORACLE_SID

ORACLE_HOME /dbs

Windows

PWD ORACLE_SID .ora

ORACLE_HOME \database


For example, for a database instance with the SID orcldw , the password file must be named orapworcldw on Linux and PWDorcldw.ora on Windows.

In an Oracle Real Application Clusters environment on a platform that requires an environment variable to be set to the path of the password file, the environment variable for each instance must point to the same password file.

Caution:

It is critically important to the security of your system that you protect your password file and the environment variables that identify the location of the password file. Any user with access to these could potentially compromise the security of the connection.
ENTRIES

This argument specifies the number of entries that you require the password file to accept. This number corresponds to the number of distinct users allowed to connect to the database as SYSDBA or SYSOPER . The actual number of allowable entries can be higher than the number of users, because the ORAPWD utility continues to assign password entries until an operating system block is filled. For example, if your operating system block size is 512 bytes, it holds four password entries. The number of password entries allocated is always a multiple of four.

Entries can be reused as users are added to and removed from the password file. If you intend to specify REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE , and to allow the granting of SYSDBA and SYSOPER privileges to users, this argument is required.

Caution:

When you exceed the allocated number of password entries, you must create a new password file. To avoid this necessity, allocate more entries than you think you will ever need.
FORCE

This argument, if set to Y , enables you to overwrite an existing password file. An error is returned if a password file of the same name already exists and this argument is omitted or set to N .

IGNORECASE

If this argument is set to y , passwords are case-insensitive. That is, case is ignored when comparing the password that the user supplies during login with the password in the password file.


用户 密码 方式 方法 普通 安全 原因 参数 命令 安全性 常见 数据 数据库 明文 等号 角度 语句 语法 开时 会报 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 手冲咖啡和咖啡机区别 互联网科技工作委员会副主任毛军 科技互联网公司装修 互联网巨头反垄断金融科技 朗新科技与工业互联网 上海挚品互联网科技 壹账通互联网科技 成都玖崟互联网科技有限公司乐商圈怎么样 重庆威客帮互联网科技 移动互联网科技公司 互联网5g黑科技有哪些 新兴科技互联网创新大赛颁奖典礼 用友工业互联网科技发展 科技赋能视角下互联网保险发展 厦门江牛科技互联网 国产互联网科技公司 长沙易易互联网科技有限公司 恒生互联网科技趋势 科技互联网企业在行动 山东亿川互联网科技有限责任公司 中关村互联网科技集团 互联网电商科技 圆梦互联网科技 关于新基建和互联网科技 互联网金融 科技创新 互联网科技公司实习生 科技类公司包括互联网吗 广州有谷有贝互联网科技有限公司 马化腾互联网科技教学 现代互联网科技公司
0