<?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: Maulik Paneliya</title>
    <description>The latest articles on DEV Community by Maulik Paneliya (@maulik2900).</description>
    <link>https://dev.to/maulik2900</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%2F1478156%2Fba0de3b0-4401-4e06-ba70-e5857fb5bb05.jpg</url>
      <title>DEV Community: Maulik Paneliya</title>
      <link>https://dev.to/maulik2900</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maulik2900"/>
    <language>en</language>
    <item>
      <title>Store PostgreSQL Data on Another Drive (D: or E:)</title>
      <dc:creator>Maulik Paneliya</dc:creator>
      <pubDate>Tue, 21 Jan 2025 09:40:42 +0000</pubDate>
      <link>https://dev.to/maulik2900/store-postgresql-data-on-another-drive-d-or-e-29ne</link>
      <guid>https://dev.to/maulik2900/store-postgresql-data-on-another-drive-d-or-e-29ne</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Initialize a New Data Directory
You can use the initdb command to create a new data directory on your desired drive.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open Command Prompt as Administrator.&lt;br&gt;
Run the following command to initialize a new data directory on your chosen drive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;initdb -D D:\PostgreSQLData
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace D:\PostgreSQLData with the desired folder path on your other drive.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update PostgreSQL Configuration to Use the New Data Directory
You need to inform PostgreSQL to use this new location.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Stop the PostgreSQL service:&lt;/p&gt;

&lt;p&gt;Open the Services Manager (press Win + R, type services.msc, and hit Enter).&lt;br&gt;
Find the PostgreSQL service (e.g., postgresql-x64-17) and stop it.&lt;br&gt;
Edit the PostgreSQL service to point to the new data directory:&lt;/p&gt;

&lt;p&gt;Open a Command Prompt as Administrator.&lt;br&gt;
Run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pg_ctl register -N "postgresql-x64-17" -D "D:\PostgreSQLData"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace "D:\PostgreSQLData" with your new data directory path.&lt;br&gt;
Update postgresql.conf if needed:&lt;/p&gt;

&lt;p&gt;Locate the postgresql.conf file in your new data directory.&lt;br&gt;
Check for any absolute paths that reference the old directory and update them to the new directory.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Restart the PostgreSQL Service
Go back to the Services Manager and restart the PostgreSQL service.
Alternative During Installation
If you're installing PostgreSQL for the first time:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;During installation, choose the "Advanced Options" step.&lt;br&gt;
Change the data directory path to your preferred location (e.g., D:\PostgreSQLData).&lt;/p&gt;

&lt;p&gt;Additional Notes&lt;br&gt;
Ensure the drive you choose has sufficient space for your database needs.&lt;br&gt;
Back up your data regularly to avoid accidental data loss, regardless of the drive used.&lt;/p&gt;




&lt;h2&gt;
  
  
  Fixing Services Issue
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net stop postgresql-x64-17
cd C:\Program Files\PostgreSQL\17\bin
pg_ctl unregister -N "postgresql-x64-17
pg_ctl register -N "postgresql-x64-17" -D C:\Program Files\PostgreSQL\17\data
net start postgresql-x64-17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>DUMP MSSQL DATABASE INTO POSTGRES</title>
      <dc:creator>Maulik Paneliya</dc:creator>
      <pubDate>Fri, 26 Jul 2024 12:56:08 +0000</pubDate>
      <link>https://dev.to/maulik2900/dump-mssql-database-into-postgres-20i1</link>
      <guid>https://dev.to/maulik2900/dump-mssql-database-into-postgres-20i1</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Install pgloader into system:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pgloader.readthedocs.io/en/latest/install.html" rel="noopener noreferrer"&gt;Download pgloader&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OR Run&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ apt-get install pgloader&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. create config file and add below code to file: [ex: pgloader.conf]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;load database&lt;br&gt;
from mssql://Username:Password@Host:Port/dbname&lt;br&gt;
into postgresql://Username:Password@Host:Port/dbname&lt;br&gt;
ALTER SCHEMA 'dbo' RENAME TO 'public';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. run following command in terminal:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pgloader pgloader.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pgloader.readthedocs.io/en/latest/command.html#connection-string" rel="noopener noreferrer"&gt;Click here for more info&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank You&lt;/p&gt;

</description>
      <category>pgsql</category>
      <category>mssql</category>
      <category>database</category>
      <category>dump</category>
    </item>
  </channel>
</rss>
