Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Script for vacuum & analyzing selected postgresql tables


1.Script for vacuum and analyzing the tables
cat /home/script/vaccum_analyze_table.sh
#!/bin/bash
PGHOME=/opt/PostgreSQL/9.3/bin
LOG=/backups/logs/igr-vac-logs
LOGFILE=vacuum_analyze_`date +"%Y-%m-%d-%T"`.log
export PGOPTIONS='-c vacuum_cost_delay=10 -c maintenance_work_mem=3GB'
export PGPASSWORD=postgres
$PGHOME/vacuumdb -t schema1.table1,schema2.table2 -j 5 -p 5432 -z >> $LOG/$LOGFILE 2>> $LOG/$LOGFILE
exit 0
2.vacuum & analyze script sheduling on crontab everyday night at 10.pm
Befere scheduling crontjob check the current date becouse some server will running with wrong time that is what am telling check date and time before scheduling crontjob
 

To get date and time in Linux issue following command
$ date
To scheduling crontjob issue crontab -e command
crontab -e
0 22 * * * sh /home/script/vaccum_analyze_table.sh

more about crontab

Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

How to Configuration UDEV SCSI Rules In Oracle Linux 5, 6 and 7

aspell

Linux ctime,mtime,atime,cmin,amin,mmin