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

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

Related

How to backup and restore sybase database tables using command line [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 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

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

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

PostgreSQL: Drop PostgreSQL database through command line [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'm trying to drop my database and create a new one through the command line.
I log in using psql -U username and then do a \connect template1, followed by a DROP DATABASE databasename;.
I get the error
database databasename is being accessed by other users
I shut down Apache and tried this again but I'm still getting this error. Am I doing something wrong?
You can run the dropdb command from the command line:
dropdb 'database name'
Note that you have to be a superuser or the database owner to be able to drop it.
You can also check the pg_stat_activity view to see what type of activity is currently taking place against your database, including all idle processes.
SELECT * FROM pg_stat_activity WHERE datname='database name';
Note that from PostgreSQL v13 on, you can disconnect the users automatically with
DROP DATABASE dbname WITH (FORCE);
or
dropdb -f dbname
This worked for me:
select pg_terminate_backend(pid) from pg_stat_activity where datname='YourDatabase';
for postgresql earlier than 9.2 replace pid with procpid
DROP DATABASE "YourDatabase";
http://blog.gahooa.com/2010/11/03/how-to-force-drop-a-postgresql-database-by-killing-off-connection-processes/
Try this. Note there's no database specified - it just runs "on the server"
psql -U postgres -c "drop database databasename"
If that doesn't work, I have seen a problem with postgres holding onto orphaned prepared statements.
To clean them up, do this:
SELECT * FROM pg_prepared_xacts;
then for every id you see, run this:
ROLLBACK PREPARED '<id>';
When it says users are connected, what does the query "select * from pg_stat_activity;" say? Are the other users besides yourself now connected? If so, you might have to edit your pg_hba.conf file to reject connections from other users, or shut down whatever app is accessing the pg database to be able to drop it. I have this problem on occasion in production. Set pg_hba.conf to have a two lines like this:
local all all ident
host all all 127.0.0.1/32 reject
and tell pgsql to reload or restart (i.e. either sudo /etc/init.d/postgresql reload or pg_ctl reload) and now the only way to connect to your machine is via local sockets. I'm assuming you're on linux. If not this may need to be tweaked to something other than local / ident on that first line, to something like host ... yourusername.
Now you should be able to do:
psql postgres
drop database mydatabase;

How do I change where databases are created in SQL Server Management Studio? [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
By default, all new databases are created on C:\. I need them to be created on E:\. My first instinct was to move the database files for the model database, but SSMS is not giving me the option to detach it.
So, my question is, is there a way to set up the server so that all of the new databases are created on E:\ by default?
In SSMS, right click on the server and choose "Properties". On the "Database Settings" page of the Server Properties window, specify your new locations for data and log files.
You could also do this with T-SQL by writing directly to the registry:
USE [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultData', REG_SZ, N'E:\YourData'
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultLog', REG_SZ, N'E:\YourLogs'
GO
There is a guide here for SQL Server 2000 og 2005, my guess it's probably the same for SQLServer 2008:
http://support.microsoft.com/kb/224071
Go down to the "Moving the model database" section.
I hope this helps.

Resources