Solved

Need to export data from Sybase DB

Posted on 2008-09-29
7
1,842 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
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…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

705 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