Need to export data from Sybase DB

I am trying to Gain access to a Sybase DB to export a copy of data.

The hosting company has given me SSH access to a Server and some other information.  I have never worked with Sybase and limited use of Linux.  I am more of a SQL windows person.

SSH Access

Site:            serveraddress.com
User name:      userID
Pass:            PW

Sybase Access:

      * isql: SYBASE=/opt/sybase LANG= /opt/sybase/bin/isql
      * Username: fm0
      * Server Name: Severx
      * Database Name: FM0

I do have access to Putty to connect SSH.
kwitcomAsked:
Who is Participating?
 
bretCommented:
I don't think the "sybase2' matters.   ASE uses a file called the interfaces file to associate logical names (like "sybase2" and "Serverx" to specific host and port combinations).   Multiple names can be associated with the same host and port.  Only one server can be running on a port at a time, but that server can be referenced by many different names (this is sometimes done when two servers are consolidated into one, this can be transparent to the clients who keep using the same server name).   However the server itself knows itself by (at most) one name, which is what it reports in the error messages.

Ok.  To get a list of user tables in the database, you can issue this in isql:

select name, uid from sysobjects where type = 'U'

Most if not all of the tables are probably owned by the "dbo" user, in which case the uid is not important.  If you have trouble getting to a table, though, see if it has a different uid.

You can then use sp_help <tablename>  to get the information about the table columns, indexes,e tc.

To get the contents out, it is probably best to use the bulk-copy utility rather than isql (although you can just do a "select * from table" is isql and save the output.)

bcp is probably in the same location as the isql binary, the syntax you would use would be

/opt/sybase/bin/bcp  <databasename>..<tablename> out <filename> -Ufm0 -P<password> -c

You can quickly generate all the bcp commands needed with this query:

select "/opt/sybase/bin/bcp  <databasename>.."
          + name
          + " out "
          + name
          + ".txt  -Ufm0 -P<password> -c"
from sysobjects
where type = 'U'

This will export the data for each table into a file that has the same name as the table plus ".txt"

0
 
bretCommented:
Is your problem with the SSH part or the ISQL part?

If you are able to get on the machine, then

csh
setenv SYBASE /opt/sybase
setenv DSQUERY Serverx

/opt/sybase/bin/isql -Ufm0 -P<password>

(account fm0 may be set up with a null password, in which case you just need "-P".
you should then get the isql prompt   '>1'

use FM0
go
select * from <tablename>
go

0
 
kwitcomAuthor Commented:
Msg 4002, Level 14, State 1:
Server 'sybase2':
Login failed.
CT-LIBRARY error:
        ct_connect(): protocol specific layer: external error: The attempt to connect to the server failed.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
bretCommented:
Ok, my best guess right now would be the password.  Did they give you both a SSH (os) password and an isql password, or are they supposed to be the same?  DId you try using a blank password as well (just -P?).

If they didn't address the issue of the isql password, you should probably ask them "What is the ISQL password for fm0  

Perhaps ambiguity on the login name?  try fm<zero> and fm<capital o>
0
 
kwitcomAuthor Commented:
I have requested to password again.  it says Server 'sybase2': in the error does that Matter?
0
 
kwitcomAuthor Commented:
well looks like I will not be able to get a Password till tomorrow.  

Can we maybe get a head start on how will see what tables are in the DB and how to export them to a File?

I am unsure what is in the DB until I can see what is there.  Thanks for help
0
 
kwitcomAuthor Commented:
THANK YOU VERY MUCH!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.