BTW, all the examples above were performed on a Sun E5000 w/solaris 2.6 & Oracle 8.1.6
enjoy,
dBalaski
Main Topics
Browse All TopicsI want to make sure i created a table in the oracle 8i DB
I need the simple command to show me all the tables in the DB.
I use the system/manager to create the table and it should be there I think.
My DB is on solaris but I think it should be the same in NT
I tried
echo "select * from all_tables" |sqlplus system/manager |grep <MyTable> but no luck.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: dbalaskiPosted on 2000-12-29 at 10:51:22ID: 57930
That is not exactly how to do it...
---- ---------------
---- ---------------
---- ---------------
---------- ---------- ----
---------- ----- -------- -------------------------- --
---- -------------------------- ----
========== ==
You need to log into sqlplus before you start the script.
however, you do not need to use grep -- you can specify the table_name in the where clause to limit the output, I will show an example below....
Here is a way to do it from a DBA account....
------all tables using the DBA_Tables VIEW ------------
$ sqlplus system
SQL*Plus: Release 8.1.6.0.0 - Production on Fri Dec 29 13:32:29 2000
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Enter password:
Connected to:
Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
SQL> select owner, table_name, tablespace_name
2 from dba_tables
3 group by owner,table_name, tablespace_name
4 /
OWNER TABLE_NAME TABLESPACE_NAME
-------------- --------------------------
OUTLN OL$ SYSTEM
OUTLN OL$HINTS SYSTEM
SCOTT CUSTAB DATA
SCOTT CUSTOMER3 DATA
SCOTT CUSTOMERTABLE DATA
SCOTT DATA DATA
SCOTT DISTINCTDEMO DATA
SCOTT HOUSING DATA
SCOTT INNER DATA
SCOTT OUTER DATA
SCOTT PLAN_TABLE DATA
OWNER TABLE_NAME TABLESPACE_NAME
-------------- --------------------------
SCOTT STUDENT DATA
SCOTT TEST DATA
SCOTT TESTING DATA
SCOTT TEXTLOAD DATA
SCOTT UPDATETEST DATA
SCOTT WASHERS DATA
……. (I cut the out put short --- too many lines to post)
Another way would be to query the tables owned by the user that you are logged in as,
for example, using the scott user:
------- All user tables using the USER_TABLES view-------
SQL> connect scott
Enter password:
Connected.
SQL> l
1 select table_name, tablespace_name
2 from user_tables
3* group by table_name, tablespace_name
SQL> /
TABLE_NAME TABLESPACE_NAME
--------------------------
CUSTAB DATA
CUSTOMER3 DATA
CUSTOMERTABLE DATA
DATA DATA
DISTINCTDEMO DATA
HOUSING DATA
INNER DATA
OUTER DATA
PLAN_TABLE DATA
STUDENT DATA
TEST DATA
TESTING DATA
TEXTLOAD DATA
UPDATETEST DATA
WASHERS DATA
15 rows selected.
--------------------------
Another way to check the table's existance is from the object's owner account ( for example puposes, we will be using the scott user again), using the sqlplus DESCRIBE command
SQL> describe STUDENT
Name Null? Type
--------------------------
SID NOT NULL CHAR(4)
FNAME NOT NULL VARCHAR2(10)
LNAME NOT NULL VARCHAR2(10)
MAJOR NOT NULL VARCHAR2(10)
DORM NOT NULL VARCHAR2(7)
------ Example of narrowing the output using the where clause to search for your object ---------
$ sqlplus scott/tiger
SQL*Plus: Release 8.1.6.0.0 - Production on Fri Dec 29 13:48:25 2000
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
SQL> select table_name, tablespace_name
2 from user_tables
3 where table_name = 'STUDENT'
4 /
TABLE_NAME TABLESPACE_NAME
--------------------------
STUDENT DATA
==========================
To it from the system prompt, put the sql in a file, and then execute it, example:
$ cat tables.sql
select table_name, tablespace_name
from user_tables
group by table_name, tablespace_name
/
exit
$ sqlplus scott/tiger @tables.sql |grep STUDENT
STUDENT DATA
$
======================
Hope this answers your question....
sincerely,
dBalaski