The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
2answers
84 views

INSERT and DELETE in single operation (moving from one table to other)

Stemming from this question, I am going to use that complex sort's results to decide which rows' data to move from one table to another. Though I have not yet tried it, I think there should be no ...
3
votes
2answers
82 views

Automate COPY command - Postgres 9.2

I've a backup table with several distinct IDS... I wanna do a BACKUP of those rows, by ID. The function has to be executed by a limit of account_id ( select dump(21); - Where 21 = number of ...
0
votes
0answers
32 views

parallel postgres libpq copies with different db connections

At the moment I'm doing bulk database inserts with the libpq copy command (PostgreSQL 9.5): copy abc (col1, col2, col3) from stdin delimiter ";" NULL 'Null'; (PQexec) PQputline PQendcopy I know ...
1
vote
0answers
36 views

Distributing MS Access Database

I develop an application that saves records in MS Access DB. Each user has it own DB copy on his local machine, and there is a central DB that reflects all the copies from everyone. The central DB is ...
4
votes
1answer
33 views

Copy-only as the routine backup

We are in planning to upgrade from SQL Server 2008 R2 to SQL Server 2014, with the intention of using Availability Groups. One of the secondaries will be used to do backups. I have tested and ...
2
votes
1answer
40 views

Why does CURRENT_LOAD_SOURCE() return “Batch No. 1” instead of the actual source file name?

I'm loading some data into a table like this: COPY table1 ( col1, col2, file_name AS CURRENT_LOAD_SOURCE() ) FROM LOCAL :src_file REJECTED DATA :rejected_file EXCEPTIONS :exceptions_file ...
2
votes
2answers
63 views

Does the PostgreSQL COPY command have the option of choosing with fields to map the CSV columns to?

Does the PostgreSQL COPY command have the option of choosing with fields to map the CSV columns to? The PostgreSQL COPY command appears to expect that the target table matches its columns exactly. Am ...
2
votes
1answer
124 views

Postgres \copy from CSV: how to format range variables?

Consider a Postgres table containing a range variable: CREATE TABLE my_table (t_range tsrange, field1 text); If I want to manually insert a row via psql, I can run: INSERT INTO my_table (t_range, ...
-1
votes
1answer
236 views

COPY in TSV data enclosed by quotes; treat empty strings as NULLs

I have a TSV file like this, except with many more columns: "name"\t"color"\t"lucky_number" "Nick"\t"Red"\t"" ""\t"Blue"\t"8" I'm trying to COPY this file into a table and have empty cells (i.e. "")...
1
vote
0answers
30 views

What controls the precision when writing reals in postgres copy command?

I do the following copy command from psql: copy yy_caa_epdall to '/tmp/CAAImport-1234567' delimiter '|' csv header; and get a file with lines like the following: 1011192|1|1.2|0.34|44.8|0.3|57.4|0....
0
votes
1answer
35 views

Fast copy/rename database, not mysqldump

I would like to keep a "default" setup for a database on a testing server, which can be used to "restore" a "dirty" testing database back to the default state. mysqldump is very fast, done in a few ...
0
votes
0answers
46 views

Copy data from one table to another

I have a table named cameraInfo and another named macTable. Both tables have a column for mac address and password. Not all the mac address in macTable are in the cameraInfo table. However, if the mac ...
4
votes
1answer
98 views

Is Vertica's COPY atomic?

Seems like a simple thing, but I can't seem to find it in the docs for COPY. Is Vertica's COPY atomic? If a data load is interrupted or somehow fails, does Vertica take care of the cleanup?
3
votes
1answer
99 views

CREATE DATABASE … WITH TEMPLATE seems to lose relations in PostgreSQL

I'm trying to Create a copy of a database in postgresql per the SO answer from 2009, but running into problems. In Postgres 9.3.9, this creates a database with no relations (the gcis db exists and ...
1
vote
0answers
61 views

Space usage when copying

Short version Copy table took up more space than I expected or tested Why would that be? Could it be the replication / binlog? If so, what then is written to the binlog during this query: INSERT ...
3
votes
2answers
471 views

Moving database objects to another database without wizard

I have several databases on production and i have also test environment. I don't have permission to do backup and restore operations. Actually i am using wizard to generate scripts (schema + data) and ...
5
votes
2answers
1k views

Scripting the copy of SQL Server production database to test environment

We are introducing continuous integration on our project and we decided to automate the refresh of our test database instance with fresh production data. I'm currently looking for the best way to go ...
2
votes
0answers
501 views

postgres \copy file to RDS timeout

Postgres version 9.3, hosted on Amazon RDS. I have a messages table with 10G of data. I connected the database using psql on the EC2. Then used \COPY (select * from messages) TO '/tmp/messages.csv' ...
0
votes
1answer
95 views

Exporting / copying a database with phpMyAdmin

I have a database on a hosting website so I am using phpMyAdmin to experiment with it, before I change anything I would like to make a copy of it or download it and look at it through MS Access or a ...
-1
votes
3answers
1k views

Pasting data from Excel table takes very long [closed]

I use SQL Server Management Studio 2012 to import data from Excel sheet to a table on SQL Server. I use the most straightforward way that I just Ctrl+C a table in Excel and Ctrl+V in table edit window ...
1
vote
0answers
91 views

Does psql print command results to standard error?

I am running COPY command through psql 9.1.15 as a cronjob to append data in csv file to table1: psql -q -h $DB_HOST -d $DB_NAME -p $DB_PORT -U $DB_USER <<EOF copy table1 from '${BUCKET}/${...
0
votes
1answer
200 views

Errors importing data using COPY comand at postgresql 9.3.5

I am trying import a database table to Postgres 9.3.5 database server using COPY command as follows: COPY comment (generatedid, id, "timestamp", message, bugreport_id, personcontainer_id) FROM ...
-4
votes
1answer
876 views

How to use variable value inside copy function [closed]

I want to send data to .csv file using COPY function in Postgres. But I am using anonymous block so my table name should be value of variable. COPY (SELECT cname.portal from user) To '/tmp/out.csv' ...
1
vote
1answer
44 views

Instant File Initialization on Backup drive

I know IFI (Instant File Initialization) is good to have enabled on SQL Servers. How about backup archive locations? We backup our DBs to a local SSD drive (so it backs up quickly), then throughout ...
1
vote
1answer
4k views

Select into existing table where ID is in another table [closed]

I have one table containing ~35k IDs (TableC), one table that features multiple columns (TableA), amongst others the ID from the before mentioned table and a third empty table, featuring the same ...
0
votes
1answer
28 views

Copy every entry from TableA to TableB where the ID is in a textfile containing a list of IDs

I have a text file (or an xls) with a 35k lines, each containing a single ID. I'm required to copy every entry of TableA to TableB where the ID is in said list. Would it be best if I'd create a new ...
2
votes
1answer
139 views

Copying database to different hard disk

Total noob at database administration here, excuse my ignorance. I have a server running a Rails application that's using PostgreSQL. The database is saved on drive /z/, which seems to have filled up....
0
votes
0answers
43 views

MySQL: migration huge tables between two databases

Hello guys (and sorry for my English). I have 2 DB's - DB1 (staging) and DB2 (production), each day some contend added/changed in some tables in DB1 and should be moved to DB2. Right now it works ...
0
votes
0answers
513 views

Restore from copy of SQL Server backup file produces invalid data error

We have an instance of SQL Server 2008 R2 SP2 sitting in a DMZ. When I back up one of its databases to a drive local to that server, then run a RESTORE VERIFYONLY against the backup file, it declares ...
2
votes
4answers
2k views

Postgres inherit indexes for partitioned tables

I have a table with approximately 60 million rows that I have partitioned by state into 53 sub-tables. These tables "inherit" the big table like so: CREATE TABLE b2b_ak (LIKE b2b including indexes, ...
1
vote
1answer
2k views

Escaping delimiter in postgresql

I am trying to import data into postgres. Data fields are comma separated, strings may contain commas, in which case those are escaped: Data structure: create table v (a varchar); Data file: bus '...
2
votes
2answers
176 views

What is the fastest way to clone/copy oracle databases on the same machine?

I want to clone oracle databases on the same machine and I need to change user etc. from e.g. PROD to DEV. For that I use expdp/impdp, but this tends to be slow with increasing database size. I need ...
1
vote
2answers
2k views

Change permissions of postgres copy to exported file

I have asked this question on SO but perhaps that was the wrong location. Apologies for double posting but the question may have a better audience here. The original question is: http://stackoverflow....
3
votes
1answer
735 views

Copy database and clear down data (including linked tables) older than N days

I have a sizable production database (140GB) on MS SQL Server 2012, which I'm trying to automatically download to our development environments on a periodical basis (every week or on demand). I'm not ...
0
votes
0answers
405 views

Copying a table with its structure, indexes, and associated triggers?

I have studied this post on Stack Overflow: Fastest way to copy a table in MySQL. But no answer is copying everything like the table's structure, data, indexes as well as associated triggers. Is it ...
0
votes
1answer
115 views

PostgreSQL: How does the implicit index work when using “COPY” for loading bulk rows into a newly created table?

What I know for fast loading bulk rows into a new table is: Create the table(without creating the index) Use "COPY" to load data from a file into the table Create the index What if I added a ...
1
vote
1answer
133 views

I need to copy data from remote Postgres server that has limited disk space and limited connectivity to a server

I have a remote Postgres server recording some data every second. the server has very less space like 6-7 GB, currently I write data to a remote VM server but due to poor connectivity the applications ...