Questions tagged [bash]

21 questions
4
votes
2 answers

What does "psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql)" actually mean?

I have a question regarding following output: [nikola@192 ~] $ sudo su - postgres [postgres@192 ~] $ psql dvdrental postgres psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql) psql: /usr/pgsql-11/lib/libpq.so.5:…
NikolaS
  • 193
  • 1
  • 1
  • 9
3
votes
1 answer

How to pass environment variables to a sql file from bash shell (PostgreSQL)

I need to be able to pass environment variables, from a bash shell executing a .sql file using psql. The psql command I am running is: su postgres -c "psql -v ON_ERROR_STOP=1 -v dbname=example -v dbuser=example -e" < ./create-db.sql Where I have…
Adam Birds
  • 133
  • 4
2
votes
2 answers

pg_dump hangs in Git Bash but works in Windows command line

I tried to make a backup of a database from Git Bash environment, but the executable does not output anything. If I specify the filename using the -f flag, a blank file gets created, so the executable obviously runs, but it does not do anything -…
JohnEye
  • 153
  • 7
2
votes
1 answer

execute mysqlshell from within a bash script? is it possible?

I am writing a backup script for a database and want to use mysqlshell util.dumpSchemas() utility. But how on earth can I make it work from within a shell script? The basic process I have is this: filename_1: backup.sh . . . mysqlsh --file…
IGGt
  • 1,855
  • 3
  • 21
  • 39
1
vote
1 answer

How to return values from psql to bash with custom session settings

I need to set the datestyle to "dd/mm/yyyy" before calling a procedure and getting it's return value back to bash. I tried the following: read return <<< $(psql \ -x \ -U postgres \ -d MY_DB \ …
Majd
  • 11
  • 1
1
vote
1 answer

Save output of a Mongo Command to a Variable bash script

I have been writing a script to find and kill slow mongodb queries, how can I store output of db.currentOp() in a variable? current I am using this but failing #! /bin/bash out="" mongo <<…
DB guy
  • 69
  • 5
1
vote
0 answers

How to simulate slow queries on MongoDB

I need to write a shell script that finds and kills long running mongodb queries, but I don't have access to the database that runs slow queries, how to I simulate running slow queries on my local machine running mongodb v3.6.8, so that I get some…
DB guy
  • 69
  • 5
1
vote
2 answers

Could not find a "psql" to execute

I have a bash script that run on a Linux (AWS Centos) server. There's an odd, but annoying warning message that pops up in the stdout whenever the script executes psql: could not find a "psql" to execute. What is odd is that that the Postgresql…
apt605
  • 73
  • 1
  • 1
  • 4
0
votes
1 answer

I get the error "(psycopg2.OperationalError) FATAL: role "wsb" does not exist", but the user does exits

I am trying connect to my postgress database using SQLAlchemy. I was working fine yesterday (01/27/22). Now I get the following error: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: role "wsb" does not exist Only the user…
0
votes
1 answer

Postgres how do return a message if no results for SELECT query

Have been trying to work out how to return a message if the result is empty. I am running a select statement as below: select * from maxIDValue where max_value > 1000000 order by max_value desc; I am running this in a bash script via psql however…
rdbmsNoob
  • 143
  • 9
0
votes
0 answers

Communication error between Oracle and Nagios

I'm trying to adapt some Perl scripts to Bash to run them in Nagios XI. The complete script, so far, is this one: . /home/oracle/.profile_RAC ORACLE_HOME=/oracle/app/grid/19300 ORACLE_BASE=/oracle/app/base nagios_exit_codes=('UNKNOWN', 3, 'OK', 0,…
lk2_89
  • 131
  • 6
0
votes
2 answers

Connecting to multiple Oracle databases hosted on different machines - Username as common and different password for each database

Environment: We have ~100 databases hosted on multiple machines. All databases have common username but password is different on every database. Issue: How can I read the password and TNS (Service name) from an external file one by one and connect…
0
votes
0 answers

Dump all data to json files

I'm working on a script that has to dump app data from a schema to json files. Here is what I have thus far: export SCHEMA="citydb" export DB="kv_db" export PGPASSWORD=root psql -U postgres -Atc "select tablename from pg_catalog.pg_tables where…
tdranv
  • 109
  • 2
0
votes
1 answer

Merging one SQL database into another

Currently in my CI I'm completely wiping production db with development db. That was fine for testing but I'm coming to a stage where I need to start merging instead of completely wiping. Right now the command I'm using to wipe and write is as…
Ashmore11
0
votes
0 answers

Local Postgres Server on Mac Pw Auth Fail

Disclaimer: I am new to MacOs. Haven't found any useful related question. After successfully installing postgresql 13.2 via homebrew on MacOs 11.2.1 (BigSur) i run into the following problem: Use terminal for the command psql postgres Prompts user…
1
2