Archive for March, 2006

 

Oracle basic info ..

Mar 02, 2006 in Database, Oracle

sqlplus user@db/password

  • Execute a script from sqlplus
    @[/path/]script.sql
  • List schemas:
    SELECT username FROM all_users ORDER BY username;
  • List tables in a schema:
    SELECT object_name, created FROM user_objects WHERE object_type=’TABLE’;
  • Get number of rows
    SELECT COUNT(*) FROM table;
  • Show table schema
    DESC table;
  • Limit number of rows
    SELECT * FROM table WHERE rownum < N;
  • Get current datetime
    SELECT to_char(sysdate, ‘mm/dd/yyyy hh:mi:ss’) FROM dual;

See http://www.oracle.com/technology/oramag/code/tips2004/011104.html for
a procedure to list table names and number of rows.

See http://www-it.desy.de/systems/services/databases/oracle/sqlplus/sqlplus.html.en
for an introduction to sqlplus.

Objects and resources:
http://www-it.desy.de/systems/services/databases/oracle/at_desy/user_objects.html.en