0% found this document useful (0 votes)
58 views2 pages

Oracle Basics

This document provides useful Oracle SQL commands for deleting and truncating tables, checking the database version and structure, connecting to the database as different users, viewing tables and users, and clearing table data while keeping the structure intact. Some key commands are to truncate a table using "truncate table [table_name];", check the database version with "select * from v$version;", and clear table data but keep structure using "truncate table [table_name]".

Uploaded by

hungbonay87
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

Oracle Basics

This document provides useful Oracle SQL commands for deleting and truncating tables, checking the database version and structure, connecting to the database as different users, viewing tables and users, and clearing table data while keeping the structure intact. Some key commands are to truncate a table using "truncate table [table_name];", check the database version with "select * from v$version;", and clear table data but keep structure using "truncate table [table_name]".

Uploaded by

hungbonay87
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Some Useful Oracle SQL Commands

1, Delete the table including data: truncate table [table_name];

delete table: drop table [table_name]; 2, Check the DB Version: select * from v$version; 3, Get current active User: show user; 4, Show the table structure: desc [table_name]; 5, Conn DB using user name and password: conn hr/hr; if you use Conn sys/pswd; have the following issue oracle ora-28009 connection as sys should be as sysdba or sysoper. You might need more privilege. conn sys/[email protected] as sysdba; 6,Disconnect from current User: disconnect; 7, Get all the tables under certain user: select * from tabs; select * from user_tables;

select table_name from user_tables; 8,Check the current DB

!--I prefer this one

select * from v$database; !-- I do not like this one but sometime it might helpful! select name from v$database; 9,Check the Structure of DB desc v$database; 10, Get all users from one DB select * from v$instance; select instance_name from v$instance; 11, Get all the table names fr: select * from all_tables; select table_name from all_tables; select table_name from user_tables; select table_name from all_tables where owner='username'; 12, Clear the table data but keep the table structure. truncate table [table_name]

You might also like