Solid Edge SEWHD backup and restore the embedded PostgreSQL database

2021-10-06T23:58:24Z
APPLICATION

Summary


Details

Solid Edge Wiring and Harness Design (SEWHD) - how to create a backup of the embedded (PostgreSQL) database?



Solution

Exporting the database



1.    Open a Command Prompt window


2.    Navigate to [Install directory]\embeddeddb\bin


3.    Type the following two commands


> set pgport=portnumber


> pg_dump.exe -x -U DefaultUser -Fc DefaultPassword > Filepath/Filename


In the first line, replace portnumber with 5472 for the SEWHD database,  


In the second line replace DefaultUser and DefaultPassword per the tables below, depending on your software version. Choose your own filepath and filename to create the location of the database dump file.




For example:



Restoring the dumped backup file



The exported dump in the above step can be imported into the same (after dropping) or a brand new database.

Note: If you installed an empty database as part of the software installation, you will need to drop the database and the database schema owner (ie: user) first.  In this case, it is required because the pg dump already has the database user and schema defined within it.


Drop the existing postgres database, use the following commands:


1. Determine what databases postgres knows about:


 $SOLID_EDGE_WIRING_AND_HARNESS_DESIGN_HOME\embeddeddb\bin>.\psql.exe -U postgres --list


You should see a list of databases (electricalXXXX, etc.) returned, where xxxx is the version number.


2. Drop the desired database and user:


$SOLID_EDGE_WIRING_AND_HARNESS_DESIGN_HOME\embeddeddb\bin>.\psql.exe -U postgres  and issue the following commands


drop database <<DBName>>;

drop user <<UserName>>;

\q



Use the following commands to create a brand new database:


  > createuser -S -R -D -U <<Role>> <<New User>>


  > createdb -U <<Role>> -O <<User Name>> <<New DBName>>



For example,


  > createuser -S -R -D -U postgres electrical2021


  > createdb -U postgres -O electrical2021 electrical2021


 
Import the exported dump file into this new database using the command:


> pg_restore.exe -O  -U <<User Name>>  -Fc  -d <<database name>>  <<Filepath/Filename>>



Note: pg_restore.exe, createuser.exe and createdb.exe will be present in the $SOLID_EDGE_WIRING_AND_HARNESS_DESIGN_HOME inside the embeddeddb/bin folder.



Note:  For database name, default username and password, see the example table below.
SEWHD application expects a specific pattern for the database name. The pattern that should be followed is:
     electrical20[XX]  


That is, the database name must be "electrical". By default it matches the version of the software as shown in the table above.



For more detailed information on PostgreSQL see the PostgreSQL documentation at:

https://www.postgresql.org/docs/9.6/backup.html


Warning: Copying and pasting commands from this article may turn hyphens into long dashes and commands will not work. See KB Article Conversion from hyphens to long dashes with Capital product  


 



Hardware/Software Configuration

Platform: INTL64
OS: windows
OS Version: 1064
Product: SOLID_EDGE
Application: SE_ELECTRICAL
Version: V221.0
Function: OTHER

Ref: 002-8530297

KB Article ID# PL8530297

Contents

SummaryDetails

Associated Components

APPLICATION: SE_ELECTRICAL