[POSTGRES] Easy to migrate
Little bash script
En poursuivant votre navigation sur ce site, vous acceptez l'utilisation de cookies. Ces derniers assurent le bon fonctionnement de nos services. En savoir plus.
Little bash script
Oracle backup batch file - Stack Overflow
need to split in two files: a batch file and RMAN script
Batch file: backup.bat
@echo off echo Automatic Backup Oracle pushd . SET ORACLE_HOME=C:apporacleproduct12.2.0dbhome_1 SET ORACLE_SID=ORCL echo ---------------------------------------------------- echo ORACLE_HOME : %ORACLE_HOME% echo ORACLE_SID : %ORACLE_SID% echo ---------------------------------------------------- RMAN TARGET / @file.rman log=backup.log
Script RMAN called file.rman or another name
run {
backup database;
backup archivelog all delete input;
}
This part is setup:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'c:backup%F';
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'c:backup%d_%T_%u';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'c:backupSNCFORCL.ORA';
Can be removed from the script and run once for each bank. Once configured, the settings are permanent.
script need two files: backup.bat and file.rman
Je partage une commande qui peut être utilisée pour afficher les connections actives d'une base, qui s'actualise toutes les 2 secondes, depuis le shell :
export BASE=tata
watch -n 2 "psql $BASE -c \"select * from pg_stat_activity where state='active' and datname='$BASE';\""
Connaitre la date du dernier reboot de l'instance :
SQL :
SELECT pg_postmaster_start_time();
Savoir depuis quand l'instance tourne :
SQL :
select current_timestamp - pg_postmaster_start_time() as uptime;
Commande système
systemctl status postgres
postgresql - How can I get my server's uptime? - Database Administrators Stack Exchange