This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing few important and basic commands for Database Administrator of PostgreSQL.
Check the version of PostgreSQL:
1 |
SELECT version(); |
Create a database using the script:
1 |
CREATE DATABASE Database_Name WITH OWNER User_Name; |
Change the owner of the database:
1 |
ALTER DATABASE Database_Name OWNER TO User_Name; |
Create a full copy of the database with structure and data:
1 |
CREATE DATABASE NewDB WITH TEMPLATE OldDB; |
Create a database User using the script:
1 |
CREATE USER Anvesh WITH password 'testPassword'; |
Change the password of the User:
1 |
ALTER USER postgres WITH PASSWORD 'temproot'; |
Upgrade the existing User to Superuser:
1 |
ALTER USER TestUser WITH SUPERUSER; |
Reload the PostgreSQL configuration file:
1 |
SELECT pg_reload_conf(); |
Rotate the PostgreSQL Log file:
1 |
SELECT pg_rotate_logfile(); |
Find the Postgres server start time:
1 |
SELECT pg_postmaster_start_time(); |