使用 Oracle SQL Developer 更改密码
我的许多用户不使用 SQLPlus。我无法给他们更改用户。我们的密码每 60 天就会过期。
我无法让 SQLPlus 命令“密码”在 SQL Developer 中工作。
- 当我点击运行时,出现无效命令错误
- 当我点击运行脚本时,没有任何反应。
我不想给他们写一个包来更改他们的密码,因为我们有很多数据库。我有更好的选择吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
您可以在 DBA_USERS 表中找到该用户,例如
现在转到 sys/system(管理员)并使用查询
来验证帐户状态,只需通过
即可查看用户的状态。
you can find the user in DBA_USERS table like
Now go to the sys/system (administrator) and use query
To verify the account status just go through
and you can see status of your user.
您现在可以在 SQL Developer 4.1.0.17,不需要 PL/SQL,假设您有另一个具有管理权限的帐户:
You can now do this in SQL Developer 4.1.0.17, no PL/SQL required, assuming you have another account that has administrative privileges:
对于那些可能没有 sysdba 或 sys 设置密码并经常使用第三方客户端的人来说,需要注意一下。
这里有一些关于在没有密码的情况下登录命令行 sqlplus 的信息,对我有帮助。
顺便说一句,我正在使用 fedora 21。
就我而言,sqlplus 位于此处:
现在运行
现在您需要使用旧凭据连接到数据库。
您可以在输出中找到 Oracle 提供的模板:
在我的例子中,我有用户“oracle”和密码“oracle”,所以我的输入看起来像“
完成”。现在输入新密码两次。
然后,如果您不想让密码再过期,您可以运行
One note for people who might not have the set password for sysdba or sys and regularly use a third party client.
Here's some info about logging into command line sqlplus without a password that helped me.
I am using fedora 21 by the way.
In my case, sqlplus is located here:
Now run
Now you need to connect to database with your old credentials.
You can find Oracle provided template in your output:
In my case I have user "oracle" with password "oracle" so my input looks like
Done. Now type your new password twice.
Then if you don't want your password to expire anymore you could run
我使用版本 21.2.0.187(2021 年 7 月发布)。
有一个重置按钮,可让您将密码重置为新密码,如下图所示。您可以通过在连接上右键单击鼠标来访问它。
我重置密码,然后使用新密码登录。
I use version 21.2.0.187 (released on july 2021).
There is a reset button that enable you to reset password to a new password as shown in the next figures. you can reach it by right click mouse on the connection.
I rest the password, then login with the new password.
使用 SQL Developer 更新密码的正确语法是:
您可以在此处查看此命令的更多选项: ALTER USER- Oracle 文档
The correct syntax for updating the password using SQL Developer is:
You can check more options for this command here: ALTER USER-Oracle DOCS
在 SQL 工作表中:
输入“password”(不带引号)
突出显示,按 CTRL+ ENTER。
出现密码更改屏幕。
In an SQL worksheet:
Type in "password" (without the quotes)
Highlight, hit CTRL+ENTER.
Password change screen comes up.
SQL Developer 有一个内置的重置密码选项,可能适合您的情况。它还需要将 Oracle Instant Client 添加到工作站。当即时客户端位于 SQL Developer 启动时的路径中时,您将启用以下选项:
Oracle Instant Client 不需要管理员权限即可安装,只需能够写入目录并将该目录添加到用户路径中。大多数用户都有权执行此操作。
回顾:为了在 Oracle SQL Developer 上使用重置密码:
此时您可以右键单击数据源并重置您的密码。
请参阅 http://www .thatjeffsmith.com/archive/2012/11/resetting-your-oracle-user-password-with-sql-developer/ 查看完整演练
另请参阅 oracle 文档中的评论: http://docs.oracle.com/cd/E35137_01/appdev.32 /e35117/dialogs.htm#RPTUG41808
让 SQL Developer(在版本 4.0.1 上测试)识别并使用 OS X 上的 Instant Client 的替代配置是:
使用 Oracle 客户端
(OS X) 请参阅此问题来解决与 DYLD_LIBRARY_PATH 环境变量相关的问题。我使用以下命令,然后重新启动 SQL Developer 以获取更改:
$ launchctl setenv DYLD_LIBRARY_PATH /path/to/oracle/instantclient_11_2
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:
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.
Recap: In order to use Reset Password on 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
Also see the comment in the oracle docs: 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:
Use Oracle Client
(OS X) Refer to this question to 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
您的用户仍然可以通过“alter user onlyTheirUserNameidentified by newpassword”来更改密码。他们不必拥有 ALTER USER 权限即可更改自己的密码。
Your users can still change their passwords by "alter user onlyTheirUserName identified by newpassword". They do not have to have the ALTER USER privilege to change their own password.
根据管理设置,您可能必须使用 REPLACE 选项指定旧密码
Depending on the admin settings, you may have to specify your old password using the REPLACE option
说得更清楚一点:
如果用户名:abcdef,旧密码:a123b456,新密码:m987n654
alter user abcdefidentified by m987n654 Replace a123b456;
To make it a little clear :
If the username: abcdef and the old password : a123b456, new password: m987n654
alter user abcdef identified by m987n654 replace a123b456;
我意识到有很多答案,但我找到了一个可能对某些人有帮助的解决方案。我遇到了同样的问题,我正在本地计算机上运行 oracle sqldevelopment 并且我有很多用户。我碰巧记住了其中一位用户的密码,并用它来重置其他用户的密码。
步骤:
使用有效的用户和密码连接到数据库,在我的情况下,除了“system”之外的所有用户都已过期,并且我记得密码
在树中查找“Other_users”节点,如下图所示
3.在“Other_users”树中找到您想要重置密码的用户,右键单击注释并选择“编辑用户”
4.填写新密码编辑用户对话框并单击“应用”。确保您未选中“密码已过期(用户下次登录时必须更改)”。
这对我有用,它不如其他解决方案好,因为您需要能够登录至少一个帐户,但它确实有效。
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.
Steps:
connect to a database using a valid user and password, in my case all my users expired except "system" and I remember that password
find the "Other_users" node within the tree as the image below displays
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"
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)".
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.
我确认这在 SQL Developer 3.0.04 中有效。我们的密码需要有一个特殊字符,因此在我们的例子中需要双引号字符串。当然,这仅在密码尚未过期并且您当前已登录的情况下才有效。
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 的)重置密码选项不起作用,请尝试此解决方案:
步骤 1:打开“运行 SQL 命令行”(从 SQL Developer 安装包附带的开始菜单)
步骤 2:运行以下命令:
注意:如果密码已过期,
更改<用户>密码
选项将自动出现。Try this solution if the Reset Password option (of SQL Developer) did not work:
Step 1: Open Run SQL Command Line (from the start menu, which comes with SQL Developer installation package)
Step 2: Run the following commands:
Note: If password has already expired,
Changing password for <user>
option will automatically come.内置重置密码选项可能对用户不起作用。在这种情况下,可以使用以下 SQL 语句重置密码:
The built-in reset password option may not work for user. In this case the password can be reset using following SQL statement:
还有另一种方法可以通过命令提示符重置密码 ...
1) 在开始菜单中转到 Oracle 数据库文件夹(在我的例子中是 Oracle Database 11g Express Edition) 。
2) 在该文件夹中单击“运行 SQL 命令行”
Oracle 数据库文件夹图像
3) 输入“连接用户名/密码”(您的用户名和旧密码,不带引号)
4) 显示的消息是...
错误:
ORA-28001: 密码已过期
更改 hr 的密码
-->新密码:
输入用户名、密码图片
5) 输入新密码
6) 重新输入新密码
7 ) 显示的消息是...
密码已更改
已连接。
SQL>
8) 转到 Sql 开发人员 -->输入新密码 -->已连接
There is another way to reset the password through command prompt ...
1) Go to the Oracle Database Folder ( In my case Oracle Database 11g Express Edition) in the START MENU.
2) Within that folder click "Run SQL Commandline"
Oracle Database Folder image
3) Type "connect username/password" (your username and old password without the quotation marks)
4) The message displayed is ...
ERROR:
ORA-28001: the password has expired
Changing password for hr
--> New password:
Enter Username, Password image
5) Type the new password
6) Retype the new password
7) Message displayed is ...
Password changed
Connected.
SQL>
8) GO TO Sql developer --> type the new password --> connected