使用 Oracle SQL Developer 更改密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3086332/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 02:39:02  来源:igfitidea点击:

Changing password with Oracle SQL Developer

oracleoracle-sqldeveloper

提问by Bob

Many of my users do not use SQLPlus. I cannot give them alter user. We expire passwords every 60 days.

我的许多用户不使用 SQLPlus。我不能给他们改变用户。我们每 60 天使密码过期一次。

I can't get the SQLPlus command "password" to work in SQL developer.

我无法让 SQLPlus 命令“密码”在 SQL 开发人员中工作。

  1. When I hit run, I get an invalid command error
  2. When I hit run script, nothing happens.
  1. 当我点击运行时,我收到无效命令错误
  2. 当我点击运行脚本时,没有任何反应。

I don't want to write them a package to change their passwords since we have a lot of databases. Do I have a better option?

我不想给他们写一个包来更改他们的密码,因为我们有很多数据库。我有更好的选择吗?

回答by Americo Savinon

The correct syntax for updating the password using SQL Developeris:

使用SQL Developer更新密码的正确语法是:

alter useruser_nameidentified bynew_passwordreplaceold_password;

alter useruser_nameidentified bynew_passwordreplaceold_password;

You can check more options for this command here: ALTER USER-Oracle DOCS

您可以在此处检查此命令的更多选项:ALTER USER-Oracle DOCS

回答by Niall

In an SQL worksheet:

在 SQL 工作表中:

  • Type in "password" (without the quotes)

  • Highlight, hit CTRL+ENTER.

  • Password change screen comes up.

  • 输入“密码”(不带引号)

  • 突出显示,点击CTRL+ ENTER

  • 密码更改屏幕出现。

回答by Frobbit

SQL Developer has a built-in reset password option that may work for your situation. It requires adding Oracle Instant Client to the workstation as well. When instant client is in the path when SQL developer launches you will get the following option enabled:

SQL Developer 有一个内置的重置密码选项,可能适合您的情况。它还需要将 Oracle Instant Client 添加到工作站。当 SQL 开发人员启动时即时客户端位于路径中时,您将启用以下选项:

SQL Developer: Drop Down menu showing reset password option

SQL Developer:显示重置密码选项的下拉菜单

Oracle Instant Client does not need admin privileges to install, just the ability to write to a directory and add that directory to the users path. Most users have the privileges to do this.

Oracle Instant Client 不需要管理员权限即可安装,只需能够写入目录并将该目录添加到用户路径即可。大多数用户都有权执行此操作。

Recap: In order to use Reset Password on Oracle SQL Developer:

回顾:为了在 Oracle SQL Developer 上使用重置密码:

  1. You must unpack the Oracle Instant Client in a directory
  2. You must add the Oracle Instant Client directory to the users path
  3. You must then restart Oracle SQL Developer
  1. 您必须将 Oracle Instant Client 解压到一个目录中
  2. 您必须将 Oracle Instant Client 目录添加到用户路径
  3. 然后您必须重新启动 Oracle SQL Developer

At this point you can right click a data source and reset your password.

此时,您可以右键单击数据源并重置密码。

See http://www.thatjeffsmith.com/archive/2012/11/resetting-your-oracle-user-password-with-sql-developer/for a complete walk-through

有关完整的演练,请参阅http://www.thatjeffsmith.com/archive/2012/11/resetting-your-oracle-user-password-with-sql-developer/

Also see the comment in the oracle docs: http://docs.oracle.com/cd/E35137_01/appdev.32/e35117/dialogs.htm#RPTUG41808

另请参阅 oracle 文档中的评论:http: //docs.oracle.com/cd/E35137_01/appdev.32/e35117/dialogs.htm#RPTUG41808

An alternative configuration to have SQL Developer (tested on version 4.0.1) recognize and use the Instant Client on OS X is:

让 SQL Developer(在 4.0.1 版上测试)识别和使用 OS X 上的 Instant Client 的替代配置是:

  1. Set path to Instant Client in Preferences -> Database -> Advanced -> Use Oracle Client
  2. Verify the Instance Client can be loaded succesfully using the Configure... -> Test... options from within the preferences dialog
  3. (OS X) Refer to this questionto resolve issues related to DYLD_LIBRARY_PATH environment variable. I used the following command and then restarted SQL Developer to pick up the change:

    $ launchctl setenv DYLD_LIBRARY_PATH /path/to/oracle/instantclient_11_2

  1. 在 Preferences -> Database -> Advanced -> Use Oracle Client 中设置 Instant Client 的路径
  2. 使用首选项对话框中的配置... -> 测试... 选项验证可以成功加载实例客户端
  3. (OS X) 请参阅此问题以解决与 DYLD_LIBRARY_PATH 环境变量相关的问题。我使用了以下命令,然后重新启动 SQL Developer 以获取更改:

    $launchctl setenv DYLD_LIBRARY_PATH /path/to/oracle/instantclient_11_2

回答by dpbradley

Your users can still change their passwords by "alter user onlyTheirUserNameidentified by newpassword". They do not have to have the ALTER USER privilege to change their own password.

您的用户仍然可以通过“alter user onlyTheirUserName标识为 newpassword”来更改他们的密码。他们无需具有 ALTER USER 权限即可更改自己的密码。

回答by Gerry Gurevich

Depending on the admin settings, you may have to specify your old password using the REPLACE option

根据管理员设置,您可能需要使用 REPLACE 选项指定旧密码

alter user <username> identified by <newpassword> replace <oldpassword> 

回答by spazzo

To make it a little clear :

说清楚一点:

If the username: abcdef and the old password : a123b456, new password: m987n654

如果用户名:abcdef 旧密码:a123b456,新密码:m987n654

alter user abcdefidentified by m987n654replace a123b456;

更改由m987n654标识的用户abcdef替换a123b456

回答by Saad A

I realise that there are many answers, but I found a solution that may be helpful to some. I ran into the same problem, I am running oracle sql develop on my local computer and I have a bunch of users. I happen to remember the password for one of my users and I used it to reset the password of other users.

我意识到有很多答案,但我找到了一个可能对某些人有帮助的解决方案。我遇到了同样的问题,我在本地计算机上运行 oracle sql develop 并且我有一堆用户。我碰巧记得我的一个用户的密码,我用它来重置其他用户的密码。

Steps:

脚步:

  1. connect to a database using a valid user and password, in my case all my users expired except "system" and I remember that password

  2. find the "Other_users" node within the tree as the image below displays

  1. 使用有效的用户名和密码连接到数据库,在我的情况下,我的所有用户都已过期,但“系统”除外,我记得该密码

  2. 在树中找到“Other_users”节点,如下图所示

enter image description here

在此处输入图片说明

3.within the "Other_users" tree find your users that you would like to reset password of and right click the note and select "Edit Users"

3.在“Other_users”树中找到您要重置密码的用户,然后右键单击该注释并选择“编辑用户”

enter image description here

在此处输入图片说明

4.fill out the new password in edit user dialog and click "Apply". Make sure that you have unchecked "Password expired (user must change next login)".

4.在编辑用户对话框中填写新密码并点击“应用”。确保您已取消选中“密码已过期(用户下次登录时必须更改)”。

enter image description here

在此处输入图片说明

And that worked for me, It is not as good as other solution because you need to be able to login to at least one account but it does work.

这对我有用,它不如其他解决方案好,因为您需要能够登录至少一个帐户,但它确实有效。

回答by pgs

I confirmed this works in SQL Developer 3.0.04. Our passwords are required to have a special character, so the double-quoted string is needed in our case. Of course, this only works if the password has not already expired and you are currently logged in.

我确认这在 SQL Developer 3.0.04 中有效。我们的密码需要有一个特殊字符,所以在我们的例子中需要双引号字符串。当然,这只适用于密码尚未过期且您当前已登录的情况。

ALTER USER MYUSERID
IDENTIFIED BY "new#password"
REPLACE "old#password"

回答by Leo

Try this solution if the Reset Password option (of SQL Developer) did not work:

如果重置密码选项(SQL Developer)不起作用,请尝试此解决方案:

Step 1: Open Run SQL Command Line (from the start menu, which comes with SQL Developer installation package)

第一步:打开Run SQL Command Line(从开始菜单,SQL Developer安装包自带)

Step 2: Run the following commands:

第 2 步:运行以下命令:

enter image description here

在此处输入图片说明

Note:If password has already expired, Changing password for <user>option will automatically come.

注意:如果密码已经过期,Changing password for <user>选项会自动出现。

回答by user2689487

The built-in reset password option may not work for user. In this case the password can be reset using following SQL statement:

内置的重置密码选项可能对用户不起作用。在这种情况下,可以使用以下 SQL 语句重置密码:

ALTER user "user" identified by "NewPassword" replace "OldPassword";