<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ravi Suthan</title>
    <description>The latest articles on DEV Community by Ravi Suthan (@mathisuthanan).</description>
    <link>https://dev.to/mathisuthanan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2461954%2F46ba83d3-534b-422f-9139-dac4482d469c.jpg</url>
      <title>DEV Community: Ravi Suthan</title>
      <link>https://dev.to/mathisuthanan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mathisuthanan"/>
    <language>en</language>
    <item>
      <title>PostgreSQL basic</title>
      <dc:creator>Ravi Suthan</dc:creator>
      <pubDate>Thu, 21 Nov 2024 05:42:21 +0000</pubDate>
      <link>https://dev.to/mathisuthanan/postgresql-basic-8j0</link>
      <guid>https://dev.to/mathisuthanan/postgresql-basic-8j0</guid>
      <description>&lt;p&gt;\c -- database connected&lt;br&gt;
\l -- listout of databases&lt;br&gt;
\l+-- listout databse with database size&lt;br&gt;
\dt--listout the tables from databases&lt;br&gt;
\q--exit from psql&lt;br&gt;
sudo systemctl start postgresql -- start the postgressql server&lt;br&gt;
sudo systemctl restart postgresql -- restart the postgresql server&lt;br&gt;
sudo systemctl stop postgresql -- stop the postgressql server&lt;br&gt;
journalctl -u postgresql -- postgressql logs&lt;br&gt;
Primary (Master) Server: This server will send its WAL (Write-Ahead Log) data to the standby server. enble the WAL &lt;br&gt;
Standby (Replica/Slave) Server: This server will receive and apply the WAL data from the primary server, keeping itself in sync.&lt;br&gt;
SELECT datname FROM pg_database;&lt;br&gt;
pg_dump command for logical backups &lt;br&gt;
pg_basebackup for physical backups&lt;br&gt;
default portnumber--5432&lt;br&gt;
sudo -i -u postgres postgres connect commond linux machine&lt;br&gt;
sudo su switchuser&lt;br&gt;
sudo su - username&lt;br&gt;
cd change dirctory&lt;br&gt;
ls listout dirctory&lt;br&gt;
ls -r  show the reverse process files &lt;br&gt;
ls -R  show the folder inside file&lt;br&gt;
ls -a  show the hidden files&lt;br&gt;
ls -l show the file/directory size,owner,created date&lt;br&gt;
ls -l filename* filter condition file&lt;br&gt;
ls -f  show the folder end /&lt;br&gt;
cat -- view the inside file data  cat -n&lt;br&gt;
ctrl o enter ctrl x -- save the file in nano format&lt;br&gt;
esc button :  x --- save the file normal format.&lt;br&gt;
tail -- view the data last row tail -n bottom &lt;br&gt;
head -- view the data bregin row tail -- n &lt;br&gt;
ps -- monitoring of process&lt;br&gt;
ps -ef -- monitoring process&lt;br&gt;
top -- process of cpu monitoring&lt;br&gt;
vi -- edit the file &lt;br&gt;
mv oldname.txt newname.txt --rename moving files cmd mv doc/fall ls -R&lt;br&gt;
rm -i removefilename y -- remove delete file.&lt;br&gt;
rm -ir deletedirectoryname y -- remove delete dirctory.&lt;br&gt;
rm -iF force deleting&lt;br&gt;
wild card method ? ls -l f?ll&lt;br&gt;
find --- find . -name/marvel find the folder and dirctory.&lt;br&gt;
cp test1 test2 -- copy the file test1 to test2 &lt;br&gt;
cp test1 /home/appuser/anotherdirctory&lt;br&gt;
ln -s filename sl_filename --create symbolicfile name&lt;br&gt;
ln filename hl_filename -- create hardlink file name&lt;br&gt;
RAM: free -h or cat /proc/meminfo&lt;br&gt;
CPU: lscpu or cat /proc/cpuinfo&lt;br&gt;
Disk: df -h / du -h&lt;br&gt;
kill -- kill process id&lt;br&gt;
free -h -- memory&lt;br&gt;
ls -l list and file type access&lt;br&gt;
df -th drive sapce and type&lt;br&gt;
du -sh  disk useage size of files&lt;br&gt;
grip three filename cmd -- find &lt;br&gt;
df -h size &lt;br&gt;
du -sh/etc &lt;br&gt;
gzip filename -- compress the file&lt;br&gt;
gzip -c filename &amp;gt; file.gz -- rename compress file&lt;br&gt;
gzip -d filename -- uncompress the filename&lt;br&gt;
unzip filename -d --- unzip &lt;br&gt;
lsb_release -a version &lt;br&gt;
tar -- compress and uncompress file.&lt;br&gt;
SSH -- review&lt;br&gt;
service --&lt;br&gt;
traceroute --&lt;br&gt;
ipconfig--&lt;br&gt;
wget --&lt;br&gt;
ufw -- Fire wall related cmd&lt;br&gt;
cd ..&lt;br&gt;
cd /home/appuser/&lt;br&gt;
mkdir make dirctory&lt;br&gt;
rmdir remove dirctory&lt;br&gt;
cp filename foldername copy &lt;br&gt;
touch -- file create touch file1 file2 file3&lt;br&gt;
permission based cmd&lt;br&gt;
chmod u -w --- changemode denined u write permission&lt;br&gt;
chmod g +w -- changemode grnated group write permission.&lt;br&gt;
u user/owner g -- group a-all&lt;br&gt;
chown username filename -- change ownername &lt;br&gt;
rwx &lt;br&gt;
passwd&lt;br&gt;
useradd,usermod&lt;br&gt;
peckage mangement system.&lt;br&gt;
debian -- ubuntu/linux mint apt ,packman&lt;br&gt;
redhot -- centos/fedora yum list installed / yum,rpm zip install&lt;br&gt;
sudo &lt;br&gt;
ctrl c  down &lt;br&gt;
cltr l clear&lt;br&gt;
hostnamectl -- os verion&lt;br&gt;
psql -U postgres -d mydatabase -- database connection&lt;br&gt;
psql -h 10.20.56.134 -p 5432 -U admin -d postgres -- postgres connet command&lt;br&gt;
whoami -- current user name&lt;br&gt;
pwd- current dirctory&lt;br&gt;
uname -os name&lt;br&gt;
uname -r -- version&lt;br&gt;
date - date&lt;br&gt;
hostname -- show the hostname&lt;br&gt;
hostname -i -- hostname ip&lt;br&gt;
10.20.56.134&lt;br&gt;
10.20.96.209&lt;/p&gt;

&lt;p&gt;appuser&lt;/p&gt;

&lt;p&gt;P@ssw0rd@12&lt;/p&gt;

&lt;p&gt;database creation ;&lt;/p&gt;

&lt;p&gt;sudo -i -u postgres  # Switch to the postgres user&lt;br&gt;
psql                 # Access the PostgreSQL shell&lt;br&gt;
CREATE DATABASE mydatabase;  # Create a new database&lt;br&gt;
\l                   # List all databases to verify creation&lt;br&gt;
\q                   # Exit the psql shell&lt;br&gt;
psql -d mydatabase   # Connect to your new database (optional)&lt;/p&gt;

&lt;p&gt;backup command ;&lt;/p&gt;

&lt;p&gt;pg_dump -U postgres -d mydatabase -f /path/to/backup/file.sql&lt;/p&gt;

&lt;p&gt;create login :&lt;br&gt;
CREATE ROLE username WITH LOGIN PASSWORD 'password';&lt;br&gt;
ALTER ROLE username CREATEDB;&lt;br&gt;
ALTER ROLE username SUPERUSER;&lt;/p&gt;

&lt;p&gt;import tool in postgrssql :&lt;/p&gt;

&lt;p&gt;1.pgLoader-- tool (linux)ubentu / centos&lt;/p&gt;

&lt;p&gt;-Automated schema conversion.&lt;br&gt;
-Efficient data transfer.&lt;br&gt;
-Support for complex data types.&lt;br&gt;
-Minimal downtime migration.&lt;/p&gt;

&lt;p&gt;2.SQL Server Integration Services (SSIS) (windows) SSDT (GUI)&lt;/p&gt;

&lt;p&gt;3.DBConvert&lt;br&gt;
DBConvert is a commercial tool with a user-friendly interface for database conversion.&lt;/p&gt;

&lt;p&gt;Features:&lt;/p&gt;

&lt;p&gt;Support for both schema and data conversion.&lt;br&gt;
Customizable migration settings.&lt;br&gt;
Data validation and consistency checks.&lt;/p&gt;

&lt;p&gt;always encription / Case-insensitive encryption &lt;/p&gt;

&lt;p&gt;Install the Foreign Data Wrapper -- Linked server concept&lt;/p&gt;

&lt;p&gt;-- Install the mysql_fdw extension&lt;br&gt;
CREATE EXTENSION IF NOT EXISTS postgres_fdw;&lt;/p&gt;

&lt;p&gt;-- Define the foreign server&lt;br&gt;
CREATE SERVER foreign_server&lt;br&gt;
FOREIGN DATA WRAPPER postgres_fdw&lt;br&gt;
OPTIONS (host 'remote_host', port '5432', dbname 'remote_db');&lt;/p&gt;

&lt;p&gt;-- Create a user mapping&lt;br&gt;
CREATE USER MAPPING FOR local_user&lt;br&gt;
SERVER foreign_server&lt;br&gt;
OPTIONS (user 'remote_user', password 'remote_password');&lt;/p&gt;

&lt;p&gt;-- Create a foreign table&lt;br&gt;
CREATE FOREIGN TABLE local_mysql_table (&lt;br&gt;
    id integer,&lt;br&gt;
    name text,&lt;br&gt;
    value numeric&lt;br&gt;
)&lt;br&gt;
SERVER mysql_server&lt;br&gt;
OPTIONS (dbname 'mysql_db', table_name 'mysql_table');&lt;/p&gt;

&lt;p&gt;-- Query the foreign table&lt;br&gt;
SELECT * FROM local_mysql_table;&lt;/p&gt;

&lt;p&gt;Verion:&lt;/p&gt;

&lt;p&gt;ersion Type Example Purpose Usage&lt;br&gt;
Major Version   13, 14, 15  Introduces new features and improvements    Production (after thorough testing)&lt;br&gt;
Minor Version   13.1, 13.2  Provides bug fixes and security patches Production&lt;br&gt;
Release Candidate   15rc1, 15rc2    Pre-release versions for final testing  Testing&lt;br&gt;
Beta Version    15beta1, 15beta2    Early testing of new features   Testing&lt;br&gt;
Development Snapshots   -   Daily or periodic builds for development and early testing  Development only****&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
