0% found this document useful (0 votes)
388 views

Useful Oracle Commands

This document provides useful Oracle commands for starting SQLPlus sessions, listing database objects, setting display options, describing tables, copying tables between databases, modifying user accounts, and more. Key commands include sqlplus sys@tnsname as sysdba to start a session as sysdba, SELECT table_name FROM user_tables to list tables, SET PAGESIZE to set the display row count, and ALTER USER to change passwords or unlock accounts.

Uploaded by

j2eeguy2010
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
388 views

Useful Oracle Commands

This document provides useful Oracle commands for starting SQLPlus sessions, listing database objects, setting display options, describing tables, copying tables between databases, modifying user accounts, and more. Key commands include sqlplus sys@tnsname as sysdba to start a session as sysdba, SELECT table_name FROM user_tables to list tables, SET PAGESIZE to set the display row count, and ALTER USER to change passwords or unlock accounts.

Uploaded by

j2eeguy2010
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

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;

You might also like