PL/SQL – Useful queries

This is the place where some uncategorized, but usefull queries will be published:

select * from v$version; -- displays version of the database engine
select * from user_tables; -- lists all tables of current user
select * from user_objects; -- lists all user objects (like tables, sequences, indices, ...)
select * from user_tab_cols; -- list of all columns in user's tables
describe hr.countries -- show the table columns and types
SELECT * FROM v$sqlarea order by last_load_time desc -- lists last executed sql quries
select * from V$SESSION_LONGOPS -- lists long running queries
select * from V$SESSION -- current connections
ALTER SYSTEM KILL SESSION 'sid,serial#' -- kill session
select * from dba_source -- db packages sourcecode


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s