'PostgreSql Equivalent of sqlplus -S username/password \@lock?

What will be Postgres equivalent of following:

sqlplus -S username/password \@lock.

Also what does @lock means here?



Solution 1:[1]

I don't know PostgreSQL, but - as of Oracle, here you are:

That command means that

  • you'll connect to Oracle's command line tool called SQL*Plus (executable name is sqlplus)
  • in silent mode (that's what -s does)
  • providing username and password
  • and execute .SQL script whose name is lock (I have no idea what it does; you'll have to open it in any text editor and have a look)

Now, how someone establishes connection to PostgreSQL and runs a .SQL script, that's something I wouldn't know, but - reading online documentation - it might be

psql -U username -d database_name -a -f lock

Solution 2:[2]

According to the explanations in the comments and the other answer, the equivalent in PostgreSQL should be

psql 'user=username password=password dbname=mydatabase' -f lock

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Littlefoot
Solution 2 Laurenz Albe