Oracle queries the current user for information

Source: Internet
Author: User

First, view the current user information:
1. View the current user-owned Role Permissions information: SELECT * from Role_sys_privs;
2. View the details of the current User: SELECT * from User_users;
3. View the current user's role information: SELECT * from User_role_privs;

Summary: The data dictionary view in Oracle is divided into 3 categories, with prefixes distinguished by: User,all and DBA,
Many data dictionary views contain similar information.

User_*: Information about the object that the user owns, that is, the object information that the user creates.
All_*: Information about the objects that the user can access, that is, the information that the user creates for the object, plus the other user-created object but the user has permission to access the information.
Dba_*: Information about an object in the entire database.

Other:
View the relationship between the user and the default tablespace.
Select Username,default_tablespace from Dba_users;
1. View table structure: DESC table name
2. View the table for the current user:
Select table_name from User_tables;
3. View the table names for all users:
Select table_name from All_tables;
4. View all table names (including system tables)
Select table_name from All_tables;
5. View all the tables:
SELECT * from Tab/dba_tables/dba_objects/cat;


The following describes the Oracle query user table space

Oracle Query User Table space: SELECT * from User_all_tables

Oracle queries all functions and stored procedures: SELECT * FROM User_source

Oracle Queries All users: SELECT * FROM All_users.select * from Dba_users

Oracle View Current User connection: SELECT * from V$session

Oracle View Current User rights: SELECT * FROM Session_privs

Oracle View User table space usage:

Select a.file_id "Fileno", A.tablespace_name

"Tablespace_name",

A.bytes "bytes", A.bytes-sum (NVL (b.bytes,0)) "used",

Sum (NVL (b.bytes,0)) "Free",

Sum (NVL (b.bytes,0))/a.bytes*100 "%free"

From Dba_data_files A, dba_free_space b

where a.file_id = B. file_id (+)

Group BY A.tablespace_name,

A.file_id,a.bytes ORDER by A.tablespace_name;

1. View All Users:
SELECT * from Dba_user;

SELECT * from All_users;

SELECT * from User_users;

2. View User system permissions:
SELECT * from Dba_sys_privs;

SELECT * from All_sys_privs;

SELECT * from User_sys_privs;

3. View User Object permissions:
SELECT * from Dba_tab_privs;

SELECT * from All_tab_privs;

SELECT * from User_tab_privs;

4. View all roles:
SELECT * from Dba_roles;

5. View the roles owned by the user:
SELECT * from Dba_role_privs;

SELECT * from User_role_privs;

6. View the permissions that the role has:
SELECT * from Role_sys_privs;

SELECT * from Role_tab_privs;
7. View all system permissions
SELECT * from System_privilege_map;

8. View all object permissions
SELECT * from Table_privilege_map;

The above is to view the user rights in Oracle,


In the DB2:


SELECT * FROM Syscat.dbauth
Or
Get authorizations

View SIDs
SELECT * FROM V$instance

Oracle queries the current user for information

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.