PostgreSQL "Database cluster initialisation failed" - windows

I got the error in question on my Windows11 for Postgres-V-12.
The followed the below steps suggested by ASL:
initdb -D "D:\PostgreSql\12\data" -U postgres
pg_ctl start -D "D:\PostgreSql\12\data"
Now after the last step I am getting an error message;
It says:
waiting for server to start....
postgres: could not find the database system
Expected to find it in the directory "D:/postgresqldata", but could not open file "D:/postgresqldata/global/pg_control": No such file or directory
stopped waiting
pg_ctl: could not start server.
Can someone please help me to resolve this issue?

Please check the service postgresql status in windows services.
Ensure it is running.

Related

Clickhouse server error - org.freedesktop.PolicyKit1

I am getting this error when i am trying to restart my clickhouse server.
Failed to start clickhouse-server.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status clickhouse-server.service' for details.
Upon further inspection of server. We noticed that Log directory was full. After flushing the logs clickhouse server restarted normally. But the error message made no sense cite the actual problem. then what is this error pointing to ? Pls enlight
org.freedesktop.PolicyKit1 , is like sudo but for systemd. It should be enabled for systemd to work. Resolved it by accessing ec2 superuser privelage.
sudo su

start postgres as service on windows

I am working on windows server and I want to start postgreSQL as service by the following command but it does not work. Could you tell me what is wrong ?
sc create postgresql binPath="C:\Program Files\PostgreSQL\13\bin\pg_ctl.exe" runservice -w -N "P4" -D "C:\Program Files\PostgreSQL\13\data" - start auto
UPDATE
I succedeed to create the service by running the command
pg_ctl.exe register -N PostgreSQL -D "%ProgramData%/db_data" –S auto
but when i tried to start it I have the following error message
The PostgreSQL service on local computer started and then stopped some services stop automatically if they are not in use by other services or programs
UPDATE2
One of my colleague resolved the issue. It was a per'ission issue. I hadn't the permission to start the service. The discussion is closed

Connecting to Oracle instance running on Docker

I spent more than two days on this and I ran out of ideas and I really hope someone here will be able to help.
I am running docker on my Linux Fedora laptop.
[julian#julian-hp ~]$ docker -v
Docker version 18.06.1-ce, build e68fc7a
I loaded an oracle 12c image from another laptop (running Linux Ubuntu) and ran it using the following command:
docker run --name oracle_12c_201 -p 1521:1521 -p 5500:5500
-v /opt/dev/data/oracle/o12c_201_u02/:/opt/oracle/oradata
-e ORACLE_PWD=admin 12a359cd0528
The container gets created and is displayed as healthy when running docker ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
544917a88b6b 12a359cd0528 "/bin/sh -c '/bin/ba…" 2 days ago Up 2 days (healthy) 0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp oracle_12c_201
However when I try to login to my running instance I am getting ORA-01017: Invalid username/password; logon denied message
All of the HOW TOs I found on the internet say that if you do not specify a password when you create the container using docker run the the SYS password will be displayed under this line:
ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN:
There is not such a line in my logs. Note I deleted the container using all possible permutations such following internet articles such as -e "ORACLE_PWD=admin" or not specifying a password at running docker run using sudo nothing worked.
When trying to change the password using below:
docker exec oracle_12c_201 ./setPassword.sh admin
It fails with the following error mesage:
OCI runtime exec failed: exec failed: container_linux.go:348: starting container
process caused "exec: \"./setPassword.sh\": stat ./setPassword.sh:
no such file or directory": unknown
I ran out of ideas. I can see from the logs that the database is up and running but it is useless as long as I cannot connect to it. Note that the same image runs OK and I can connect to it without any problems on my other laptop running Linux Ubuntu. Unfortunately I no longer have the commands that I used to install oracle on that machine.
Thank you in advance for your help.

Heroku DB deployment

I'm attempting my first Heroku deployment and am having trouble
heroku pg:backups:restore "https://s3.us-east-2.amazonaws.com/myusername/POSTGRESQL.dump"
DATABASE_URL --app MyAppName
I receive the error
! An error occurred and the backup did not finish.
!
! pg_restore: [archiver] did not find magic string in file header
! pg_restore finished with errors
! waiting for download to complete
! download finished with errors
! please check the source URL and ensure it is publicly accessible
!
! Run heroku pg:backups:info r006 for more details.
And sometimes the error is:
Starting restore of https://s3.us-east-2.amazonaws.com/talXXXXXXXX to postgresql-XXXXXXXXX... done
Use Ctrl-C at any time to stop monitoring progress; the ba
Use heroku pg:backups to check progress.
Stop a running restore with heroku pg:backups:cancel.
Restoring... !
! An error occurred and the backup did not finish.
!
! waiting for restore to complete
! pg_restore finished with errors
! waiting for download to complete
! download finished with errors
! please check the source URL and ensure it is publicl
!
! Run heroku pg:backups:info r015 for more details.
I have confirmed from various browsers that the url is accessible to the public and I can download the file. I'm using double quotes around the URL as recommended for Windows, what am I doing wrong?
I was facing the same problem. Turn out it was a problem with my dump file. I wasn't compressing it properly.
--format=c selects custom as the format output (which is the same as -Fc). It compress the file by default, but it wasn't enough so I also used the --compress flag.
This flag tells the level of the compression; it goes from 0 (lighter) to 9 (heavier).
I used 9, just in case, and my command end up like that
pg_dump --format=c --compress=9 --no-acl --no-owner -h THE_HOST -U YOUR_USER THE_DATABASE > YOUR_FILE.dump
And it worked.
In the end I couldn't work out how to import to Heroku as they advertise it can be done at https://devcenter.heroku.com/articles/heroku-postgres-import-export#import
So I used a DB connection client like DBeaver, converted my DB dump into an SQL script and ran the script manually to import the data.
:(
I was able to get this working by creating the backup through PgAdmin4, rather than through the console dump command on Heroku's official tutorial.
I also could only get this working through PgAdmin, here's the command line that the backup job in PgAdmin used. Windows 10 but the pg_dump options should work on any OS.
C:\Program Files\PostgreSQL\13\bin\pg_dump.exe --file "mydump.dump" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs --compress "8" --no-owner --section=pre-data --section=data --section=post-data --no-privileges --no-tablespaces --no-unlogged-table-data --no-comments "mydatabase"
I then uploaded that to a public Azure blob file and restored it like this:
heroku pg:backups:restore "https://redacted.blob.core.windows.net/piis2/mydump.dump" DATABASE_URL

Mac OSX - mongod and mongo not working

I'm completely new to databases and am trying to set up mongodb.
I've followed all the steps but neither the mongod or mongo commands work.
This is the output from mongod:
ERROR: could not read from config file
That is followed by all the mongo options (-h, -f, -v, etc.)
This is the output from mongo:
MongoDB shell version: 2.4.6
connecting to: test
Fri Sep 6 22:55:35.889 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
Any help is appreciated!
Try starting mongod with --config option specified. Something like /path/to/mongod --config /path/to/mongodb.conf.
In your mongodb.config check the location to the mongodb log. You should find additional details about errors there. Possible problems are: db path does not exist or is not writable, after an unclean shutdown mongod.lock file still exists etc.

Resources