Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a push in the right direction...

Status
Not open for further replies.
Sep 5, 2003
87
US
We have Oracle running on an HP RS9000 running HP UX. I was wondering if some one could tell me how to get to the Oracle command line and execute a basic sql command. I can't find a tutorial that tells me how to get started.

If you know of a good tutorial that would be helpful as well. Thanks in advance.

 
Hi,

Its been a while but:
From the shell prompt
( after insuring that your environment 'knows' about
Oracle_Home and has Oracle_Home/bin in the PATH, as well as all the other configuration info needed - see the README )
just type sqlplus and see what happens...


[profile]
 
You also need the environment variable ORACLE_SID to be defined.

You will also need access to a database user. The best person to ask these questions is you DBA.

To learn more you can check Oracle's documentation. You can find this online.
 
Dsanchez2, ORACLE_SID is not necessary if connecting (even locally) via sql*net. Though in this case either @tns_alias should be specified or LOCAL environment variable correctly set.

Regards, Dima
 
Thanks Guys for the help... I found a UX user and password that was setup to use oracle. I found a system username and password for oracle.

I know the name of the (chist.dbf) file that I need to see. I know how to set a spool to a file so I can ftp it off the system.

Could you tell me how to choose the file so it appears as a table that I can query. If I do a "select * from chist;" I get "table or view does not exist".
 
The dbf file is NOT a table ( it is probably a data file that is part of a tablespace which contains ( along with other stuff) the table data you are trying to access)..

Try:

Code:
Select owner,table_name from all_tables order by owner,table_name;


This will give you a list of all the tables ( and their fully qualified names owner.tablename) you have access to..Find the table name you need and use that in your select statement.

Oracle usage needs study..IT is not Access or SqlServer.
[profile]
 
In Oracle table is not represented by single file. A file may contain multiple tables as well as 1 table may ocupy multiple files. I'd suggest you to read about Oracle concepts, namely DATABASE, TABLESPACE, TABLE, SCHEMA, probably INSTANCE and DICTIONARY words.

Regards, Dima
 
To restrict Turkbear's query, try this:

select t.table_name, d.name, s.name
from v$datafile d, v$tablespace s, user_tables t
where d.TS#=s.TS# and t.tablespace_name=s.name
and d.name like '%CHIST.DBF'


Then you may export specific table and import it on target system. Or query/spool it.

Regards, Dima
 
I think I have figured out how to get in. I found the table I need. I have some harddrive restrictions that won't let me pull the whole file at once. I don't have a unique primary key in the file.

I know how to add a field to the file. Could anyone tell me how to increment a number and put it in a field to act as a primay key so I can query out several fields at a time and rebuild the file in anouther platform.

Thanks again to all those who have given me hints.

 
You can use Sequence to populate the primary key field.
Create a sequence in the database schema which owns the table. If the table is already populated then update the column with sequence. Then make the column as primary key. For future inserts include sequence in your insert statement.

Hope this helps.

Anand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top