Home > Database > Oracle > body text

How to query oracle username and password

PHPz
Release: 2023-04-04 09:54:56
Original
21509 people have browsed it

In Oracle database, each user has his own username and password. If you need to query the username and password of a user, you can do so through the following methods:

1. Use the SQL*Plus command line tool to query

In Oracle, you can use SQL Plus command line tool to query username and password. Open SQLPlus and enter the following command:

SQL> SELECT username, password FROM dba_users WHERE username='<用户名>';
Copy after login

where, is the username you need to query. After executing this command, the system will return the user's username and encrypted password.

2. Use PL/SQL to query

If you are familiar with the PL/SQL language, you can also use PL/SQL statements to query the user name and password. For example, the following statement queries the user name and password of user SCOTT:

DECLARE
   v_username VARCHAR2(30) := 'SCOTT';
   v_password VARCHAR2(30);
BEGIN
   SELECT password INTO v_password FROM dba_users WHERE username = v_username;
   DBMS_OUTPUT.PUT_LINE('Username: ' || v_username || ' Password: ' || v_password);
END;
Copy after login

After executing this statement, the system will return the user name and encrypted password of user SCOTT.

It should be noted that since passwords are usually stored encrypted, the clear text password cannot be directly viewed. If you need to change the user password, it is recommended to use the ALTER USER command.

The above is the detailed content of How to query oracle username and password. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template