PostgreSql 9.3 initdb - database

I am trying to log an application using postgresql and I want to use a database in a place other then where the installation creates it. I have done this several times in the past, but I guess postgresql has changed. The message told me I had to install some clustering solution, all I want to do is change to another database solution.
Is there a way to initialize a database in postgresql other then initdb and postgres-xc.
Also, pg_ctl is now only available on postgres-xs. I don't need a clustering solution, I just need to move the database location.

Related

How can I move the database parts of my matomo installation to another database?

I have several VMs in which the developers have access to one specific database they need for their project. (Mostly as a backend for Typo3). Now, some of them have installed Matomo in the Typo3-Database. This is not a clean solution - if they had asked me I would have created a separate database just for Matomo. The problem is that Matomo installations grow and with it the automysqlbackups until the complete filesystem is filled with Matomo-Backups.
I want to move all tables beginning with matomo to another existing but empty database which is called Matomo. I have tried the userfriendly way with Dbeaver and other tools but I guess that my solution is simply a line of SQL from someone with more database experience then me. After that the Matomo data would be dumped to a separate database and I could limit the number of stored backups with some simple housekeeping scripts without affecting long-term storage for the typo3-backend.
FYI: I am doing this on Debian Bullseye 11 which comes with MariaDB 10.5
Bye
Stefan

Why shouldn't PostGIS be installed in the PostgreSQL database "postgres"?

The PostGIS installation documentation reads:
PostGIS is an optional extension that must be enabled in each database you want to use it in before you can use it. Installing the software is just the first step. DO NOT INSTALL it in the database called postgres.
We're running PostgreSQL in Docker and only need one database, so we've been using the default database, postgres. My first inclination was to install PostGIS there, but the documentation seems pretty clear that we shouldn't be doing that.
Is there a reason for PostGIS not to be installed on the default database, or is this note meant to deter people from accidentally installing PostGIS in the postgres database when their data is in the foobar database?
Thanks!
There is no danger in installing PostGIS into the postgres database. The note is just so users don't confuse themselves, as you suspected.

PostgreSQL moving database with functions

I have strange problem.
I tried to move database from one server to another using pgAdmin III.
Database was created on server with PostgreSQL 8.4.9 and I wanted to move it on second server with PostgreSQL 8.2.11.
To do It, I used "backup" option and saved file, after that I used "restore" option on new database. Tables are loaded but there aren't any functions in new database.
Maybe it is because of different postgreSQL versions?
Does anyone know the reason? Any solution?
If the functions aren't around, double-check that plpgsql is available as a language. It's available by default nowadays, but making it available used to require a create language statement.
That said, I'd echo the comments: you really should be upgrading to a 9.x Postgres version that is still supported, rather than downgrading from an unsupported version to one that is even older.
I'd recommend to do it via pg_dump from an interactive session and export the complete database to one ore more sql files. There you can use the -s switch to have only the schema which should include created functions. Having this SQL file, you can also easier backport your changes or debug if something not applying to the old fallow.

Copying production database using Mysql

I have a huge production DB of around 30GB using Mysql present in remote machine. I want to make a copy of that DB on my local Mysql setup. But I don't want to use SQL dump files.
Is there any alternative to make a copy of production DB to my local machine without using SQL dump files? Please tell me.
Thanks in advance.
If you are using MySQL 5.x - you may use replication mechanism to make "mirror" database. You can run replication, then stop slave database and back it up very fast without stopping master database.
If you want to use it for backup - you can find more information here:
Using Replication for Backups at dev.mysql.com

create a database from installer file?

well for example you have build a program, for restaurant, for a cinema, wherever,
now how do you do when, you install your application, the database was installed correctly too? i dont sure but i believe this is a different database? for example a file?
(talking about sql).
and how different are going to be the queries? cuz i believe i am not going to have the same function on sql server than a file database
and what connection i shall use?
could i use entity framework?
and how capacity could to have the different file for databases?
regards
You can use a file-based database like SQLite that supports SQL queries. There are ADO adapters available as well. The link should take care of the rest of your questions as well.
Well, since you usually have absolutely no knowledge about target environment, user must configure program to his envronment at install time, or later (af first launch for example, this is much simplier than implement same functionality in installer). User specifies SQL server address (if we are talking about server-based systems) and database name he wants to use. Then database is created programmaticaly using that information.

Resources