Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Important PostgreSQL DBA Commands -2

In this post, I am sharing few important and basic commands for Database Administrator of PostgreSQL.

Check the version of PostgreSQL:

SELECT version();
Create a database using the script:

CREATE DATABASE Database_Name WITH OWNER User_Name;
Change the owner of the database:

ALTER DATABASE Database_Name OWNER TO User_Name;
Create a full copy of the database with structure and data:

CREATE DATABASE NewDB WITH TEMPLATE OldDB;
Create a database User using the script:

CREATE USER Anvesh WITH password 'testPassword';
Change the password of the User:

ALTER USER postgres WITH PASSWORD 'temproot';
Upgrade the existing User to Superuser:

ALTER USER TestUser WITH SUPERUSER;
Reload the PostgreSQL configuration file:

SELECT  pg_reload_conf();
Rotate the PostgreSQL Log file:

SELECT pg_rotate_logfile();
Find the Postgres server start time:

SELECT pg_postmaster_start_time();

Comments

Popular posts from this blog

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

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

Ora2PG - Oracle/MySQL to Postgres DB migration Version 20.0

PostgreSQL Introduction