473,403 Members | 2,284 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,403 software developers and data experts.

creation permissions when moving from 7.2 -> 7.4

I am attempting to transfer a cluster of 28 databases from one machine to
another. The former machine runs PostgreSQL 7.2.3; the latter 7.4.2.

I first tried a filesystem-level backup. I stopped the old server, copied
its data directory, restarted the old server, transferred the copied data
to the new machine, and attempted to start the new server. The new server
complained about the version mismatch. Fair enough.

I then tried pg_dump and its ilk. As we rely on OIDs and BLOBs, I didn't
use pg_dumpall for everything, but rather used a shell script to grab the
global stuff and to iterate through the databases with pg_dump:

#!/bin/sh

export PGUSER=postgres
export PGPASSWORD=************

pg_dumpall -g > globals.sql

for i in $(psql template1 -t -A -c \
"select datname from pg_database;"); do
echo "Dumping catalog [$i] ..."
pg_dump -b -o -Ft $i > $i.tar
done

I then attempted to restore this data on the new machine:

#!/bin/sh

export PGUSER=postgres

psql template1 -f globals.sql

for i in *.tar; do
echo "Restoring from [$i] ..."
pg_restore -d template1 -C $i.tar
done

The new server's pg_hba.conf's first line is "local all all trust".

Most of the databases are owned by usesysid #1 ("postgres") and were
restored properly. The ones owned by a different user did not:

Restoring from [ajp.tar] ...
pg_restore: [archiver (db)] could not execute query: ERROR:
permission denied to create database

Given that (a) I'm using PGUSER=postgres and (b) my pg_hba.conf should be
sufficiently liberal anyway, I'm wondering why this is not working.

Also, template0 failed due to a null tar file, and template1 failed due to
it already existing. Would I be correct in assuming that the globals.sql
step takes care of the necessary items in template1, and that I can leave
template0 alone altogether?

--
Kevin DeGraaf

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

Nov 23 '05 #1
1 1434
Kevin DeGraaf <ke***@kevindegraaf.net> writes:
Restoring from [ajp.tar] ...
pg_restore: [archiver (db)] could not execute query: ERROR:
permission denied to create database Given that (a) I'm using PGUSER=postgres and (b) my pg_hba.conf should be
sufficiently liberal anyway, I'm wondering why this is not working.
I think you've got the other user not permitted to create databases?
I believe 7.4's pg_dump creates a script that handles this case
correctly, but 7.2's doesn't. (A hint for next time is that it's
usually best to use the latest available pg_dump.)
Also, template0 failed due to a null tar file, and template1 failed due to
it already existing. Would I be correct in assuming that the globals.sql
step takes care of the necessary items in template1, and that I can leave
template0 alone altogether?


template0 is do-not-touch. You need only worry about template1 if you
created stuff in it to have copied to other databases by CREATE
DATABASE. (The most common thing of that sort is procedural languages;
you'd be best advised to use "createlang" to reinsert them anyway.)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2

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

Similar topics

1
by: Ook | last post by:
I am trying to create a project. The web server is IIS running on a Win2000 pro box. I have shared the wwwroot directory under my inetpub directory. I have previously created the directory I'm...
3
by: Jennifer Sanders | last post by:
We're running windows 2000 server with IIS 5.0. We're trying to execute .asp scripts but we keep getting the 500 (internal server) error. It looks like the permissions might be corrupted. When...
6
by: jonathanmcdougall | last post by:
I have read many posts on this subject and found no satisfying answer. I am creating a file on the server via a PHP script. The file is created using GD (imagejpeg()), though I don't think it is...
1
by: William Grace via AccessMonster.com | last post by:
I still have not had an answer to this, anyone with any ideas? I create an MBE in Folder A, it works in folder A, it works when I double click on it. if I move it to Folder B, it will not launch...
1
by: Daniel Passwater via DotNetMonster.com | last post by:
I'm working on a app that displays according to a registry key value. The user needs the ability to update the display, and hense the registry key (via a click event on a popup menu). This all...
8
by: Anthony Munter | last post by:
I have a web application with impersonate=”true” in Web.config and on my own logon page I allow the user to either - specify a userid/password for the app to impersonate when calling legacy...
1
by: Fred W. | last post by:
I have an application that creates directories in ...\All Users\Application Data. When I create the directories I need to make sure all users can modify and add files to them. How do I set...
4
by: cybertoast | last post by:
i seem to have some misunderstanding about how roles work in sql server 2005. i see that i can add a role to a database (dbname->->properties->permissions->. THis allows me to add either users or...
2
by: =?Utf-8?B?am9obnByZW1p?= | last post by:
Hi there, I have a web app that adds user into w2k3 server and adds it to the administrator group. The code snippet is something like this: try { DirectoryEntry AD = new...
15
by: udayahirwal2 | last post by:
Can i create 4 sockets on same ip address with different portnumbers. I am working on windows mobile.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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 projectplanning, 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.