How to backup and restore sybase database tables using command line [closed] - sybase

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
How can I backup my sybase tables and restore using command line?
please help me with the command using bcp
I have tried using sybase central GUI
Thanks.

Since you didn't specify whether you are running on Windows or Unix I'll try to cover both.
Unix
bcp is located in $SYBASE/$SYBASE_OCS/bin/
Windows
bcp is located in %SYBASE%\%SYBASE_OCS%\bin
Export
bcp DB_NAME..TABLE_NAME out TABLE_NAME.bcp -Sservername -Uusername -Ppassword -[c or n]
Choose either -c or -n depending if you want the file to be human readable or not. I recommend using -n unless you have a compelling need to use -c TABLE_NAME.bcp can be any filename, with any extension.
Import
$SYBASE/$SYBASE_OCS/bin/bcp DB_NAME..TABLE_NAME in TABLE_NAME.bcp -Sservername -Uusername -Ppassword -[c or n]
There are many more options and flags available, but these are the basics to get it to work.
More information abou the bcp utility can be found here:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc30191.1570/html/utilityguide/BABGCCIC.htm
and
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc30191.1570/html/utilityguide/X14951.htm

Related

How do I automate a sequence of server updates? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
At my job, I occasionally have to perform the following tasks:
Use Remote Desktop Connection to log on to a server.
Copy a set of files from a specific folder on my computer to a specific folder on the server.
Execute an SQL query on the server in SQL Server Management Studio, copied from a text file on my computer.
Log out of the server.
And then repeat for a whole bunch of other servers. This adds up to more than an hour, and I'm trying to figure out a way to automate it. What's the best way to go about doing this? I don't think Windows is as feature-rich as Linux when it comes to the command line, and I'm inexperienced with network protocols as it is.
You can automate this kind of behavior using batch files and scheduled tasks.
You can install the Command Line Utilities 11 for SQL Server from here:
http://www.microsoft.com/en-us/download/details.aspx?id=36433
And find reference material for the utilities it offers here:
http://technet.microsoft.com/en-us/library/ms162816.aspx
You will want to write a batch file that executes your actions in order. I recommend running a non-lethal SQL query against a test database while you develop your batch file, but it will be something like this:
::Copy the files
xcopy "\\server\c$\Source\*.*" "\\server\c$\Destination\"
::Set your MS SQL variables
set /p SName="Server Name"
set /p UName="User Name"
set /p Pwd="Password"
set /p DbName="Database Name"
::Execute your SQL query
sqlcmd -S %SName% -U %UName% -P %Pwd% -d %DbName% -i "c:\sqlCommand.sql"
Then you'll want to set it up to run as a Windows scheduled task by a user account (or service account) that has access to both of these network locations.
That should do the trick.

command line tool for export data from server to server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
In SqlServer Management Studio, if we click on data database there is menu task > export data.
This help me to export this database to another server.
However, I need to run this wizard to complete this task and need to specify source and destination sever information every time that I want to use it.
I think it would be convenient if I could use command line to do the same task and write batch file to automate it.
Please could you help me give some suggestion or introduce me a command line program that can do this task since I googled search but not found any useful information.
Thank you so much.
U can use BCP Utility
BCP Out
BCP server.schema.TableName out c:\TableName.txt -c -t -T –SServerName -UUsername -Password
BCP In
BCP server.schema.TableName In c:\TableName.txt -c -t -T –SServerName -UUsername -Password
The 1st statement is to export the data to a csv file and BCP IN is used to import the data from csv file to Destination table
Here
-T stands for Trusted connection and -t represents field delimeter
You can write these BCP commands in batch file
Or you can create a simple ssis package for exporting the data

how to take dump of a table in parts and save it on different server? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a DB server and it has a table of 90 GB. Now I want to take a back up of that table.
But DB is almost full and I cannot take back up into the same server.
Is there any way of taking backup using mysqldump -u username -ppassword dbname tablename > different_server_location
I used to do it on same server these days.
example:
mysqldump -u username -ppassword dbname tablename > /tmp/file_name
Since there is NO space available on DB server, how can I take backup of a table which is 90 GB!
and can I take backup of a file in few pieces. I mean 10 GB at once and so on ?
Why don't you dump from another server in same network like:
mysqldump --host=myserver -u backup mydb > test.sql

Setting up a database in Ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am working on Ubuntu 12.04. I need to set up a database with the help of something like SQL server. Or is there anyway to set up a database on our own?
I need to practice using SQL, now I am working on "Informix AIX" systems to practice. I need this set up to be done asap.
I would recommend installing MySQl as it is open source and free to use for educational purposes. If you want to redistribute it for commercial purposes it requires a license (thought I would throw that in just in case).
It is pretty simple to get installed on Ubuntu, simply type in sudo apt-get install mysql-server in a terminal and it will do the rest for you. It will prompt you to set a password for the database, but once the installation is complete the server should start up automatically and be ready to start using.
If you have any questions, a good tutorial to look at can be found at: https://help.ubuntu.com/12.04/serverguide/mysql.html
To access the database from the command line simply use: mysql -u <username> -p (don't give an argument to the -p switch; just hit enter and make sure -p is the last word on the command line). That command will prompt you to enter in your password. The password should be entered password interactively because the command history is saved in plain text and anyone can thus press the up arrow key to find your password if you entered it in the command line.
Hope that helps,
Trevor
MySQL is popular, but I prefer PostgreSQL. It has more complete support for SQL standards and ACID transactions. But it does not have quite the performance of MySQL for read actions.

Is there any way to find the list of Oracle DBs installed on a UNIX server? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I know there are Oracle DBs installed on my UNIX server. Is there any way to get those DB names? I'm using Sun OS.
You can also try ps -ef | grep -i pmon. Each running pmon process would be for one DB and base on the pmon name your database would be ora_pmon_<db sid>. There could be additional DBs that are not running currently but this would give you the active running database on a Sun box. Also check the /var/opt/oracle/oratab as mention above for the listing of the DBs if the DB admin is keeping the DB properly listed in oratab.
cat /etc/oratab|grep -v "^#"|grep -v "N$"|cut -f1 -d: -s

Resources