Как поменять пароль в oracle sql developer
Перейти к содержимому

Как поменять пароль в oracle sql developer

  • автор:

Изменить пароль пользователя в Oracle

Вопрос: Как изменить пароль для пользователя в Oracle?

Ответ: Для того, чтобы изменить пароль пользователя в Oracle, необходимо выполнить команду ALTER USER.

Синтаксис

Синтаксис для изменения пароля пользователя в Oracle:

ALTER USER user_name IDENTIFIED BY new_password;

Параметры или аргументы:

user_name
Пользователь, чей пароль вы хотите изменить.
new_password
Новый назначенный пароль

Пример

Рассмотрим пример того, как изменить пароль для пользователя в Oracle/PLSQL.

Изменение пароля

Администратор базы данных создает учетную запись и инициирует пароль для каждого пользователя. Пароль можно изменить с помощью инструкции ALTER USER .

В примере на слайде показано, что пользователь demo изменяет свой пароль с помощью инструкции ALTER USER .

ALTER USER user IDENTIFIED BY password;

  • user имя пользователя;
  • password новый пароль.

Хотя эта инструкция может использоваться для изменения пароля, существует много других возможностей. Для изменения любого другого параметра необходимо обладать привилегией ALTER USER .

Более подробно в руководстве Oracle Database 11g SQL Reference (Справочник по SQL для базы данных Oracle 11g).

Примечание. В SQL*Plus существует команда PASSWORD ( PASSW ), которая может использоваться для изменения пароля пользователя, когда пользователь зарегистрировался в системе. Эта команда недоступна в SQL Developer.

Далее: Разница между параметрами INITIALLY DEFERRED и INITIALLY IMMEDIATE

Changing password with Oracle SQL Developer

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?

801 3 3 gold badges 13 13 silver badges 20 20 bronze badges
asked Jun 21, 2010 at 16:10
2,526 4 4 gold badges 21 21 silver badges 18 18 bronze badges

You cannont change an expired password in SQL Developer via SQL command. It is not supported in the JDBC stack. You need the OCI libraries for this. SQL developer has an option to reset and expired password via the OCI stack if it has been correctly installed. See my answer for full details.

Mar 7, 2013 at 18:44
You can do this with SQL Developer 4.1.0.17. See my answer below.
Feb 14, 2015 at 9:31

15 Answers 15

The correct syntax for updating the password using SQL Developer is:

alter user user_name identified by new_password replace old_password ;

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

2,764 1 1 gold badge 18 18 silver badges 30 30 bronze badges
answered May 30, 2012 at 2:09
Americo Savinon Americo Savinon
2,589 1 1 gold badge 19 19 silver badges 16 16 bronze badges

Also, you may need to wrap the password(s) in double quotes to escape any special characters in the password. For example, alter user __user_name__ identified by «newp@ss. » replace «oldp@ss. » More info at asktom.oracle.com/pls/asktom/…

Jul 16, 2012 at 20:07

If your pwd has expired then good luck logging in to run this. Answers A question, but not THE question.

Apr 28, 2016 at 3:58

So I just ran this. For future readers. You an fix another account (if you are a «super» with privs account). But you cannot fix YOURSELF with this syntax IF YOU(RSELF) has already expired. Lesson learned! Heed the warnings! Thanks A.M. I am running Sql Developer ( Version 19.4.0.354) against Oracle 18c .. FYI.

Aug 7, 2020 at 15:24

You need to be admin to run this command, cannot update the user self password. I.e. user: sys as SYSDBA . Check docs.oracle.com/database/121/ADMQS/… .

Nov 29, 2020 at 20:54

In an SQL worksheet:

  • Type in «password» (without the quotes)
  • Highlight, hit CTRL + ENTER .
  • Password change screen comes up.

2,764 1 1 gold badge 18 18 silver badges 30 30 bronze badges
answered Feb 4, 2013 at 22:21
1,127 1 1 gold badge 7 7 silver badges 3 3 bronze badges
You can also do «password someusername»
Jun 21, 2013 at 16:04
I suppose you mean the «Run statement» action. The default short-cut seems to be Ctrl+Enter.
Mar 25, 2014 at 15:09

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: Drop Down menu showing reset password option

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:

  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

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

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

  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 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. Сменить пароль пользователя в SQL*Plus

Доброго времени суток. У меня случилась неприятность при работе с БД Oracle в программе SQL*Plus, пароль для схемы «SYSTEM» оказался просроченным. Я просто напросто забыл его сменить, прошло 7 дней и он «протух». А мне нужно работать с таблицей product_user_profile, права назначать. Поэтому решил написать небольшую заметку для себя, чтобы раз и навсегда запомнить как менять пароль юзера в SQL*Plus.

Что делать если протух пароль для SYSTEM в Oracle

Первым делом нужно подключиться с привилегиями SYSDBA от лица пользователя SYS. Сделать это можно двумя разными способами.

1.1) Если мы уже зашли под любым пользователем, то используем команду connect.

connect sys as sysdba

1.2) Иначе запустить SQL*Plus сразу с нужными привилегиями.

sqlplus «sys as sysdba»

В обоих случаях вводить пароль пользователя SYS, по умолчанию oracle.

2) Убедимся, что мы находимся в «главной» базе данных — CDB$ROOT.

ALTER SESSION SET container = CDB$ROOT;

3) Настал тот самый момент, когда можно менять пароль для SYSTEM, не забываем указать, чтобы это действо применилось ко всем контейнерам.

ALTER USER SYSTEM IDENTIFIED BY password container=all;

Смена пароля для любого пользователя

Проделываем тоже самое, но на последнем шаге не указываем контейнер.

ALTER USER username IDENTIFIED BY password;

Oracle кажется мудреной базой данных по сравнению со старым добрым MySQL, но я начинаю потихоньку разбираться. С помощью ALTER USER можно таких дел натворить, поэтому приложу ссылочку на официальный сайт с описанием всех чудес этой команды.

А самой запутанной вещью для меня пока является разница между CDB и PDB контейнерами, поэтому абсолютно точно я в этом разберусь и подробно опишу. Спасибо за внимание!

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *