Questions tagged [bash]
The bash tag has no usage guidance.
26
questions
1
vote
0
answers
24
views
Taking full and incremental backups with authentication in MongoDB
We have a multi-tenant micro-service (it's basically kafka with some bells and whistles). We are using Mongodb to store multi-tenant credentials and kafka data so the authentication is really tight. ...
0
votes
1
answer
500
views
ORA-19504: failed to create file "bh2jk0h7_1_1"
I want to create a script to get incremental backup of the remote Oracle database every week. I save this command in rman_command.sh and give permission to it:
BACKUP INCREMENTAL LEVEL 0 DATABASE ...
0
votes
1
answer
298
views
Issues using a psql -v variable with jsonb_set
Pretty obscure situation and a couple hours of trying different things with no luck.
I have a bash script which restores a production database backup locally. Part of the script runs some SQL to set ...
0
votes
0
answers
315
views
Escape single quotes when passing command to psql -c
I need to run the following command in a BASH shell:
sudo -u postgres /usr/pgsql-15/bin/psql -c "select count(*) from web_site where web_page like '%something%' " -d 'some_database'
The ...
0
votes
2
answers
236
views
Command line command to read Oracle Database export Success Message In log File
We have several oracle 19c servers with daily exports. I would like to find a way to run a command to read the export log file to find the success message for the day. e.g. I would like to putty into ...
2
votes
1
answer
8k
views
Run PSQL command from bash script
I would like to know how to run \du within a script, and output that to a file.
Something like the following:
# some_script.sh
psql <database connection> & \du > output_of_du.txt
I can ...
0
votes
1
answer
2k
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) ...
1
vote
1
answer
6k
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 ...
1
vote
1
answer
1k
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 \
-...
2
votes
2
answers
2k
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 ...
0
votes
2
answers
477
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 ...
0
votes
0
answers
887
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 -...
2
votes
1
answer
1k
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:
...
0
votes
1
answer
31
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 ...
0
votes
0
answers
2k
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 ...