company logo  TIPS IT Consulting

                                                            Note: TIPS IT Consulting acquired TIPS BF Consulting on Jan. 6, 2011




Oracle Cheat Sheet

To list all table in current schema SELECT table_name FROM user_tables;
All tables current user has access to SELECT table_name FROM all_tables;
To list all schemas SELECT username FROM all_users ORDER BY username;
To find all locked accounts select * from dba_audit_session
where username='username' and returncode != 0 order by timestamp desc;
To list top n rows of a
table in order
SELECT * FROM (SELECT * FROM t ORDER BY c) WHERE ROWNUM <= n
Show current database SELECT * FROM global_name;
Use database CONNECT schema/password@tnsname;
Describe table DESC tablename
Read field constraints SELECT constraint_name, search_condition FROM user_constraints
WHERE table_name='tablename';
To start a session as
sysdba
Sqlplus "/as sysdba"
To start Oracle
Log on as sysdba
Startup
To shutdown Oracle
Log on as sysdba
Shutdown
To start Oracle listener lsnrctl start
To check status of
Oracle listener
lsnrctl status
To check if Oracle is
running
ps -ef | grep pmon
To check Oracle SID env | grep ORA
export ORACLE_SID = xxx

Copyright@2010 Bela Feketekuty