Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to export data from Sybase DB

Posted on 2008-09-29
7
Medium Priority
?
1,892 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 10

Assisted Solution

by:bret
bret earned 2000 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
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 

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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Secure Shell (SSH) is a network protocol for secure data communication, mainly used to administer remote Unix / Linux servers via command line. But it also allows the user to open a secure tunnel between a client and a server where he can send any k…
Hello to you all, I hear of many people congratulate AWS (Amazon Web Services) on how easy it is to spin up and create new EC2 (Elastic Compute Cloud) instances, but then fail and struggle to connect to them using simple tools such as SSH (Secure…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

609 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