Versiones comparadas

Clave

  • Se ha añadido esta línea.
  • Se ha eliminado esta línea.
  • El formato se ha cambiado.

The steps to be performed to establish the connection to the machine using SSH/WinSCP will now be described. It will move the database modification script, generated as specified in the previous section from the local machine to the remote machine and will run.

WinSCP will be used to send to the remote system, and the script will be executed on the remote system from a PuTTY session. Since the script has few lines, you could also not use WinSCP and use a terminal text editor (such as nano) to directly create the contents of the script on the remote system.


1-      Before carrying out the connection to the machine it will be necessary to have:

  • The IP address (or host address) of the machine.
  • An open port 22 on the machine for connection (or another ssh-enabled port)
  • Authentication credentials to connect to machine

2-      Connection via PuTTY

  • If you do not have it, you can download PuTTY from the following location
  • The IP address to which to connect is written in the main window of Putty.
  • The port is written, for SSH connections it is usually used port 22)
  • In the login window, the authentication credentials are written.

3-  Once the SSH is started, the file system of the machine should be accessible. Navigate to the directory where the script will be created and run. This manual used the directory /home/fuseadmin/Downloads/

cd ~/Downloads/

If you do not want to use WinSCP, once you have made the necessary edits to the script, you can open a text editor and create the script directly from the PuTTY session using nano.

Nano GenerationDatos.sql

Paste the contents, save (Ctrl + O) and exit nano (Ctrl + X)


4-      Connecting via WinSCP

  • If you do not have it installed, it is possible to download WinSCP from this location
  • The SFTP protocol is chosen as the file transfer protocol.
  • Enter the IP address
  • User credentials are entered.

Once logged in, and once the necessary script editions have been performed described in the following sections, you can drag the file using the pointer from our local file system to the remote file system using the WinSCP graphical interface

5-      Once we have changed the data of the script, we execute it, there are two methods to execute it: From terminal command or from graphical interface with pgadmin.

a-      You can run the script directly from a terminal, indicating as an argument the location of the script

Fuse Case

psql -U fuseadmin -d siiprod_db -a -f ~/Downloadss/fuse_conf/scripts-sql/GeneraciondetablasPostgreSQLv1.sql

Pasarela Case

psql -U fuseadmin -d siiprod_db -a -f ~/Downloadss/fuse_conf/scripts-sql/GeneraciondetablasPostgreSQLPASARELAv1.sql

b-     Execution using pgadmin (if the graphic option is available from SSH)

  • If the database user is the same between systems it is not necessary to change it, otherwise, it will have to change the OWNER in all the tables
  • Open pgadmin3
  • Click on the sql icon
  • Script content is pasted and executed