1.
Some useful oracle commands
To start a session as sqlplus sys@tnsname as sysdba;
sysdba:
To start a sysdba session sqlplus "/as sysdba"
under Windows (9iAS):
To list all tables in SELECT table_name FROM user_tables;
current schema:
or, all tables current user SELECT table_name FROM all_tables;
has access to:
To list all schemas: SELECT username FROM all_users ORDER BY username;
To turn pause on: SET PAUSE ON;
To list top n rows of a SELECT * FROM (SELECT * FROM t ORDER BY c) WHERE
table in order: ROWNUM <= n;
Show current database: SELECT * FROM global_name;
Use database: CONNECT schema/password@tnsname;
Show who I am: SHOW USER;
Describe table: DESC tablename;
Set display rows: SET PAGESIZE 66;
SELECT constraint_name,search_condition FROM
Read field constraints: user_constraints WHERE table_name='tablename';
Copy table from foreign COPY FROM user@tnsname CREATE tablename USING SELECT
host to here: * FROM tablename;
Start SQLPLUS without SQLPLUS /NOLOG
login:
Change a user's ALTER USER user IDENTIFIED BY password;
password:
Unlock an account ALTER USER user ACCOUNT UNLOCK;