You can either login to database server and take backup locally or you can connect remotely to the DB Server and take backup in certain directory in various output formats such as tar, dump or in plain text SQL. There are multiple ways to backup and restore PostgreSQL database. Similarly, to check the installed version of pg_restore, you can run pg_restore -version command as shown below. To check the installed version of pg_dump, you can run pg_dump -version command as shown below. To make the changes permanent, you need to add the path in ~/.zshrc if you are using zsh environment, ~/.bash_profile if you are using bash environment or in /etc/paths depending on the environment you are using. It is also important to understand that above export command will temporarily export the path in $PATH environment variable. ~ % export PATH="/usr/local/opt/libpq/bin:$PATH" If you have PostgreSQL already installed in your system and you need to have libpq first in your $PATH then you need to run export PATH="/usr/local/opt/libpq/bin:$PATH" command to detect pg_dump and pg_restore utility and avoid any conflict as shown below. This will download and install the formulae along with all its dependencies. Since in macOS, pg_dump and pg_restore are available through libpq formulae, so in order to install both the utilities you need to run brew install libpq command as shown below. In the first step, you need to update all the outdated formulae by using brew update command as shown below. How to Install pg_dump and pg_restore on macOS Using 7 Easy StepsĪlso Read: How to Find the Serial Number on a MacBook Using 2 Easy Methods Step 1: PrerequisitesĪ) You should have a running macOS System.ī) You should have brew utility available in your System.Ĭ) You should have access to install formulae in your System. Here we are going to look into the steps to install pg_dump and pg_restore utilities on macOS in great detail with the help of a real world example. It is also very easy to install both utilities in almost all the famous Linux and Unix systems. Then pg_restore can be used to restore data from an archive created by pg_dump. Pg_dump are being consistently used by database administrators to backup the data while users are still connected to the database. It provides the flexibility of using multiple options while taking the backup or during the restoration. Both of the tools are very simple to use and handle. Similarly, for restoring the database there is no better tool than pg_restore utility to perform the task. If you are using Postgresql database and planning to take the dump of the DB then there is no better tool than pg_dump to use here. In this article, we will see how to install pg_dump and pg_restore on macOS Using 7 Easy Steps.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |