473,414 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

restoring a .dmp file to another table name

I've probably asked this question before, but what do people do when they
need to restore a table that has been dumped but as a different table
name? That doesn't appear to be an option in pg_restore. (Is that just
a front end to psql?)

I need both the old table and the live one in the same database so
that I can compare a set of values to see what changed, and I don't have
a spare system to do it on at the moment, nor can I rename the live file
since it is in use most of the day.

This is a fairly large table (2.8M rows, 500MB dump file) and I think
it may have some data in it that would get messed up if I were to try to
extract the DDL leading up to the COPY statement using head and tail
statements to change the table name.
--
Mike Nolan

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #1
1 4670
Hi,

Am Mo, den 23.08.2004 schrieb Mike Nolan um 6:15:
I've probably asked this question before, but what do people do when they
need to restore a table that has been dumped but as a different table
name? That doesn't appear to be an option in pg_restore. (Is that just
a front end to psql?)

I need both the old table and the live one in the same database so
that I can compare a set of values to see what changed, and I don't have
a spare system to do it on at the moment, nor can I rename the live file
since it is in use most of the day.

This is a fairly large table (2.8M rows, 500MB dump file) and I think
it may have some data in it that would get messed up if I were to try to
extract the DDL leading up to the COPY statement using head and tail
statements to change the table name.


Just use pg_restore -t tablename (and the other options according to
your pg_dump) and write the results in a file. Use an editor to change
tablename to your new tablename in the result. If you are absolute
sure your tablename does not appear as data payload in the table,
you can use sed like this:

pg_restore -t tablename | sed -e "s/tablename/newtablename/" | psql

HTH
Tino Wildenhain
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Adam Smith | last post by:
Hope this is the right news group!! I did a server upgrade and at the same time did a mysql update from 4.0.12 to Ver 12.22 Distrib 4.0.16 mach1# mysql --version mysql Ver 12.22 Distrib...
1
by: erin | last post by:
When I run: select * from testtable I get this error message: Invalid object name 'testtable'. However, if I run: select * from testuser.testtable
6
by: Edwinah63 | last post by:
Hi Gurus, i am having problems with restoring a ms sql database. i have restored the database using veritas to a different location ('g:\datafiles') in no recover mode. when i view the...
0
by: Martin Hart | last post by:
Hi, postgresql 7.4beta4 on linux and postgresql 7.3.4 on linux We have a database that we routinely backup using "pg_dump -a" We have to do this (dump the data only) because of various...
1
by: Luc Le Blanc | last post by:
I'm trying to restore a backup from a DMS DB2/2 database. The original DB has 3x 1Gb containers in the user tablespace. So the backup has 3 files, bearing the time of the backup as file name, with...
1
by: Tom | last post by:
I have a large application; lots of forms, multiple dynamic DLLs, etc. I also have, in the appliation, a general 'Preferences' class object (which is in itself a separate DLL, and I just include a...
5
by: Mike Nolan | last post by:
I have a 600K row table on my production system (running 7.3.3) that I dump and load on my development system (7.4.1) every night using cron jobs. I would like to be able to restore the table...
3
by: rdemyan via AccessMonster.com | last post by:
I'm thinking about providing a relatively easy method for users to restore the front end from a backup. The purpose is to allow for restoring if the front end becomes corrupt. Here are some...
5
by: Troels Arvin | last post by:
Hello, Every so often, I'm asked to help people recover data from tables that were either dropped or where to much data was DELETEed. The complications related to restoring data are a problem....
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.