0

I need to access a small database from about four years ago. I have the original installer and the entire original directory including the data folder. Unfortunately the installer for 9.3 and 12.0 absolutely refuse to create a service for Windows. After that one project I completely swore off PostgreSQL though I do need to access the database (ideally with HeidiSQL).

I have tried:

  1. Installing a clean copy of 9.3 (yes, old, not for permanent use).
  2. Installing a clean copy of 12.0.
  3. Installing a copy of 9.3 with the old installation directory in place which is did recognize and use those settings though still did not create the service.

I occasionally use Non-Sucking Service Manager to manage services and have attempted to create the service manually.

I have no idea how to get PostgreSQL running even with a completely clean install. I've looked at at-least a dozen threads (mostly Stack) and nothing is taking.

  • The installation directory is C:\MEDIA\INTERNET\WAMP\PostgreSQL 9.3 x64.

I just need to be able to view the old/small PostgreSQL database in HeidiSQL or if there is a smart program that will look at the raw database files and export all databases without requiring PostgreSQL to be running? I have zero confirmation that it has been running in any context.

How do I manually create a service for PostgreSQL or how do I export all databases from PostgreSQL without PostgreSQL running in any context?

John
  • 134
  • 10

1 Answers1

1

Hmmm... I've been using Postgres since '95 and running Postgres on Windows since, oh, the early naughts, surely before version 8.2 and I am right now still running 9.3 on Windows 7 on the very box I'm typing this on.

One thing you don't state is what version of Windows you're trying to run on, though we see it's a 64 bit processor.

It's been a little while since I've done this installation, but I believe the installer for Windows isn't provided by the PostgreSQL team, but by EnterpriseDb - is that what you ran?

Perhaps you have bit-rot? sha1sum on the 9.3.1.1 release:

20bd1b72b5707c74a013e1bcb9a36502c8f0544e  postgresql-9.3.1-1-windows-x64.exe

I have successfully used Cygwin's tools to add service to Windows. Here's a brief description of what it can do (this is an older version):

$ cygrunsrv.exe --help
Usage: cygrunsrv [OPTION]...

Main options: Exactly one is required.

  -I, --install <svc_name>  Installes a new service named <svc_name>.
  -R, --remove <svc_name>   Removes a service named <svc_name>.
  -S, --start <svc_name>    Starts a service named <svc_name>.
  -E, --stop <svc_name>     Stops a service named <svc_name>.
  -Q, --query <svc_name>    Queries a service named <svc_name>.
  -L, --list [server]       Lists services that have been installed
                            with cygrunsrv.
  <svc_name> can be a local service or "server/svc_name" or "server\svc_name".

Required install options:
  -p, --path <app_path>     Application path which is run as a service.

Miscellaneous install options:
  -P, --crs-path <path>     Path to cygrunsrv. This is useful for testing or
                            when installing a service on a remote machine.
  -a, --args <args>         Optional string with command line options which
                            is given to the service application on startup.
  -c, --chdir <directory>   Optional directory which will be used as working
                            directory for the application.
  -e, --env <VAR=VALUE>     Optional environment strings which are added
                            to the environment when service is started.
                            You can add up to 255 environment strings using
                            the `--env' option.
                            Note: /bin is always added to $PATH to allow all
                            started applications to find cygwin DLLs.
  -d, --disp <display name> Optional string which contains the display name
                            of the service. Defaults to service name.
  -f, --desc <description>  Optional string which contains the service
                            description.
  -t, --type [auto|manual]  Optional start type of service. Defaults to `auto'.
  -u, --user <user name>    Optional user name to start service as.
                            Defaults to SYSTEM account.
  -w, --passwd <password>   Optional password for user. Only needed
                            if a user is given. If a user has an empty
                            password, enter `-w '. If a user is given but
                            no password, cygrunsrv will ask for a password
                            interactively.
  -s, --termsig <signal>    Optional signal to send to service application
                            when service is stopped.  <signal> can be a number
                            or a signal name such as HUP, INT, QUIT, etc.
                            Default is TERM.
  -z, --shutsig <signal>    Optional signal to send to service application
                            when shutdown has been initiated.  Default is the
                            same signal as defined as termination signal.
  -y, --dep <svc_name2>     Optional name of service that must be started
                            before this new service.  The --dep option may
                            be given up to 16 times, listing another dependent
                            service each time.
  -0, --stdin <file>        Optional input file used for stdin redirection.
                            Default is /dev/null.
  -1, --stdout <file>       Optional output file used for stdout redirection.
                            Default is /var/log/<svc_name>.log.
  -2, --stderr <file>       Optional output file used for stderr redirection.
                            Default is /var/log/<svc_name>.log.
  -x, --pidfile <file>      Optional path for .pid file written by application
                            after fork().
                            Default is that application must not fork().
  -n, --neverexits          Service should never exit by itself.
  -O, --preshutdown         Stop service application during system preshutdown.
  -o, --shutdown            Stop service application during system shutdown.
                            (Only one of --preshutdown and --shutdown is
                             accepted.  Preshutdown is preferred, but only
                             available since Windows Vista/Longhorn.  On earlier
                             OS versions it's silently converted to --shutdown).
  -i, --interactive         Allow service to interact with the desktop
                            (No effect since Windows Vista/Longhorn).
  -j, --nohide              Don't hide console window when service interacts
                            with desktop.

Informative output:
  -V, --verbose             When used with --query or --list, causes extra
  -h, --help                print this help, then exit.
  -v, --version             print cygrunsrv program version number, then exit.

I have used this to successfully add services to windows (up to and including, but not beyond Windows 7), and the Cygwin project is active and likely works well on the youngest version.

Additionally, I have run Postgres on many systems where Postgres was NOT formally installed; it has its own configuration files and is self-contained. If you're comfortable using command-line tools, you can probably pretty easily get Postgres running for you "by hand" - just follow the directions as if it was running on a Linux / Unix box! (If you try this, I STRONGLY recommend using Cygwin as your CLI.) That said, it's a sure bet that PGAdmin requires those Windows registry entries, so your graphical tools likely won't run this way, but who knows, they might! It's just a port to connect to and some permissions / authentication passing.

Also, along all these years, I wrote myself some installation notes to help out those who follow. Here's what I wrote about Postgres on Windows, last updated in '09, so the links may no longer be valid:

$ cat PostgresOnWindows/README.TXT
NOTE! Before you run the installation, you must extract the entire
ZIP file to a temporary directory. Just double-clicking on the
MSI files inside the ZIP will NOT work.

Before you begin, please read the installation instructions at
http://pginstaller.projects.postgresql.org
Also see the FAQ available at
http://www.postgresql.org/docs/faqs.FAQ_windows.html

As an alternative, find someone like me who has it installed and running to extract your data since it doesn't sound like you care about using Postgres.

Richard T
  • 1,206
  • 12
  • 29
  • Windows 7 x64 and the first install was on a clean OS. I managed to get it running on one of my laptops. I then did a backup with one of the utilities that comes with the installer (not the post install utilities). I did have to clean up the `CREATE TABLE` and other syntax though I managed well enough. The software from that project was a bit of a mess though I managed to replicate a build and get it running on MariaDB. I've heard many people speak highly of PostgreSQL though while I was trying to get used to it I encountered nothing but challenges without any justifiable reasons. – John Nov 13 '19 at 21:49
  • Yes, EnterpriseDB. I have encountered numerous highly subjective bugs in my time building an entire web platform. In fact now I'm dealing with an issue that I can not directly replicate on any of my computers with Firefox and some odd PHP session bug. It's very frustrating to be one of the few to deal with bugs that others simply never encounter and it limits what I can do. I'm happy with MariaDB and I appreciate you taking the time to answer. – John Nov 13 '19 at 21:52