Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [bash]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
191 views

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) ...
user avatar
0 votes
1 answer
311 views

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 ...
user avatar
  • 143
0 votes
0 answers
25 views

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/...
user avatar
  • 131
1 vote
1 answer
78 views

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 \ -...
user avatar
  • 11
2 votes
2 answers
436 views

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 ...
user avatar
  • 153
0 votes
2 answers
26 views

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 ...
user avatar
0 votes
0 answers
114 views

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 -...
user avatar
  • 109
2 votes
1 answer
147 views

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: ...
user avatar
  • 1,920
0 votes
1 answer
26 views

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 ...
user avatar
0 votes
0 answers
536 views

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 ...
user avatar
4 votes
1 answer
2k views

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 ...
user avatar
1 vote
1 answer
977 views

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 <...
user avatar
  • 69
1 vote
0 answers
313 views

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 ...
user avatar
  • 69
0 votes
1 answer
64 views

Why does Postgresql Data directory revert to default after updates/reboots?

I have something that is pretty simple to explain. We have certain server builds as it relates to directories in our CentOS boxes at my company and so to accommodate those, I have a script that ...
user avatar
0 votes
1 answer
117 views

Insert file content (with white line and special characters ) in bash variable for insert in oracle table with sqlplus

I write this simpe test.ksh scipt: #!/bin/ksh TEST=$(cat $1 ) sqlplus -S *****/*****@*****<<- EOF set define off; SET SQLBLANKLINES ON; INSERT INTO DBADOC.TEST ( "TEST" ) ...
user avatar
0 votes
0 answers
649 views

Bash Script Can't Connect to Azure Postgres using ENV Vars - "The Username should be in <username@hostname> format"

I have a bash script that exports ENV vars to use in connecting to an Azure Postgres DB (mydb.postgres.database.azure.com). For the user portion of that specifically it looks like this: export PGUSER=&...
user avatar
  • 137
1 vote
2 answers
740 views

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&...
user avatar
  • 73
0 votes
1 answer
94 views

Retreive the list of Up/Down status of Oracle database using Shell Script

I am trying to create a shell script for retrieving the list of Oracle database with status UP/DOWN.
user avatar
0 votes
1 answer
69 views

How to quote a SQL*Plus identifier in a bash script?

I get "ORA-00904: "MEMORY_TARGET": invalid identifier" no matter how I try to quote the identifier in the following command: MEMORY_TARGET=$(su - orat01 -c " echo 'select ...
user avatar
4 votes
3 answers
14k views

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 (...
user avatar
  • 193
0 votes
2 answers
18 views

Show full detail error message on the console

I try to get the error from this call: $ psql --dbname=synapse -c "SELECT (json::JSONB->>'content')::JSONB->>'name' AS channel_name, json::JSONB->>'room_id' AS room_id, ...
user avatar
  • 798