Db2 11.5.6.0 on AIX 7.1 - How to guess size of full and incremental backup images? - db2

Db2 11.5.6.0 on AIX 7.1
Is there any way to guess size of full and incremental backup images?

No way.
There is no ability to get count of a tablespace pages changed since the last full or incremental backup.
There is only a flag (TrackmodeState column in the db2pd -db mydb -tablesp output) available for whole tablespace.

Related

How can I change my postgresql WAL file size?

How can I change my PostgreSQL WAL file size as my wish. By default at pg_wal directory postgres generate 16MB WAL files. I try to change using max_wal_size, min_wal_size parameter. But I think it is not right parameter to change. Necessary details given in the below screenshot.
With an old and outdated version like 9.4, your only option is to build PostgreSQL from source and configure it with
./configure --with-wal-segsize=1024
Then you have to dump and restore the cluster to that new installation.
With current versions. You could simply shut down PostgreSQL cleanly (important!) and run pg_resetwal with the appropriate option.
Upgrade!

Backup taken from pgadmin is smaller than backup taken from pgdump

Hello experts I am using postgres 9.5 . When I take a backup from pgadmin it has 950 MB size but when i take the same db backup from pgdump.exe command the backup size is with 7.5 GB. I am confused which backup file will be secured for me that I can use to restore? the restoring process is also slow in postgresql. Please help me.
When you backup something in pgadmin it just calls pg_dump with appropriate options, so both your backups are made by the same pg_dump utility.
I guess you're comparing dumps in two different formats.
Default format for pg_dump is plain, which is basically an enormous uncompressed SQL file.
As for pgadmin, it uses custom format by default, which is a highly compressed binary file.
Also note that pgadmin always displays the actual pg_dump command used to create your dump in the log window, along with its full output.
You should be able to call this command in your command prompt to generate an identical backup file.
You can read more about different output formats and other pg_dump options in PostgreSQL docs.

PostgreSQL backup with smallest output files

We have a Postgresql database that is over 732 GB when backed as a file system backup. When we do a pg_dump we can get it down to 585 GB. If I combined the pg_dump with the PITR method will this give me the best backup with smallest backup data file size? My plan was to run the pg_start_backup, then the pg_dump, then the pg_stop_backup. I know the documentation states to run a file system backup but I want a smaller backup data set. I would then copy off WAL files and then backup them up at night.
To truly get the smallest file, you'll have to try compressing your pg_dump -Fc dump file with one of many compression tools and settings. Using gzip or xz with maximum possible compression would be a start. This will of course require an excellent CPU and lots of CPU time.

Copy data between postgres databases

I need, as a one-off, to copy data from one table in a PostgreSQL database to the corresponding table in a different database. There's not that much data: about 2500 rows, 8 columns (some numeric, some varchar).
My first thought was to simply pg_dump -a -t table -f output.file and then pg_restore on another database. However, as it turned out, the versions of pg_dump and the source server do not match - and I have no control over versions, so upgrading is not an option:
pg_dump: server version: 9.1.2; pg_dump version: 9.0.5
pg_dump: aborting because of server version mismatch
Unfortunately, with version 9 of Postgres, option -i (ignore version) is not longer available. I do know what I am doing, but it still wouldn't let me (naturally).
What other options do I have?
I would use COPY TO and COPY FROM. Works in either of the versions and is the optimal tool for this.
If you want to use pg_dump, you have to use the appropriate version. There are separate executables for each version. On Linux you can get the path of the currently used executable with which pg_dump.

How do I use PG_restore to backup/move my DB?

I am fairly new with PQSQL and am slowly picking things up - I have added a new disk and would like to do two things:
Restore a backup to this new disk - /hda2/pgdata/
Move a database from /hda1/pgdata to /hda2/pgdata/
Q1. Use pg_restore to restore a database. Check out the documentation which is very clear.
One important thing to remember, if you want to move to a later version of PostgreSQL use the later version of pg_dump to create a backup dump file. For example if you want to move from PostgreSQL version 8.3 to version 8.4, then create a backup dump file using pg_dump from version 8.4 and then use pg_restore 8.4 to recreate database in the 8.4 server.
http://www.postgresql.org/docs/8.4/static/app-pgrestore.html
Q2. Backup and restore is a safe way of doing it. Before restoring one can create a tablespace on the new disk and place the database in that space.
CREATE DATABASE mydb TABLESPACE myspace;
http://www.postgresql.org/docs/8.4/interactive/manage-ag-tablespaces.html
Simple command to restore database
Open PSQL Command console
Provide credentials
go to specific database that you need to restore (If the dataabse is not there Create empty database
/i < sql Dump file Path > e.g. \i /usr/local/pgsql/db20121109.sql