Solved

Need to export data from Sybase DB

Posted on 2008-09-29
7
1,855 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:kwitcom
  • 4
  • 3
7 Comments
 
LVL 10

Assisted Solution

by:bret
bret earned 500 total points
ID: 22609885
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
 

Author Comment

by:kwitcom
ID: 22610048
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
 
LVL 10

Expert Comment

by:bret
ID: 22610121
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:kwitcom
ID: 22610241
I have requested to password again.  it says Server 'sybase2': in the error does that Matter?
0
 

Author Comment

by:kwitcom
ID: 22610433
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
 
LVL 10

Accepted Solution

by:
bret earned 500 total points
ID: 22615489
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
 

Author Closing Comment

by:kwitcom
ID: 31501401
THANK YOU VERY MUCH!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
telnet from windows to hp-ux 8 61
SSH blocked !!!:::SSH over a browser into AWS or Digital ocean ? 3 157
AWS RDS 3 68
ssh setup on Cisco swith 11 45
We all know how boring and exhausting it is to transfer huge web projects developed locally to a webserver simply via FTP. The File Transfer Protocol is a really nice solution if you need to transfer small amounts of files, but if you're plannin…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now