2021-11-16

PostgreSQL check all DB SIZE



#CHECK DB SIZE:

postgres=# select t1.datname AS db_name,pg_size_pretty(pg_database_size(t1.datname)) as db_size from pg_database t1 order by pg_database_size(t1.datname) desc;

        db_name         | db_size 
------------------------+---------
 xxx                    | 8109 MB
 xxx_20210622_14h05     | 7520 MB
 xxx_500001_1000000     | 1052 MB
 xxx_000001_500000      | 566 MB
 postgres               | 11 MB
 beta_xxxchat           | 8461 kB
 template1              | 7605 kB
 template0              | 7433 kB
(8 rows)

2021-11-07

[Solved] Percona XtraBackup for MariaDB/MySQL. Binary [HotBackup / HotRestore]

Steps:

A/ FULL BACKUP a DATABASE
A.1/ Backup Full Single Database
A.2/ Backup Schema of Single Database


B/ FULL RESTORE a DATABASE
B.1/ Create new empty Database <New DBName>
B.2/ Import Schema (A.2) to new Empty Database
B.3/ Discard Tablespace
B.4/ Copy all file of Backuped Database (A.1) to new Database
B.5/ 
chown -R mysql.mysql /opt/mariadb/data/<New DBName>
B.6/ Import Tablespace for all new Table
B.7/ DONE

P.S:
1/ Backup full a MariaDB/MySQL Database in Binary mode
2/ Backup full all 
MariaDB/MySQL Database in Binary mode
3/ Backup Incremental a or all database in Binary mode

4/ Restore full a or all 
database in Binary mode

For detail script, contact to me