Skip to main content

Questions tagged [bash]

Filter by
Sorted by
Tagged with
1 vote
1 answer
81 views

I need to backup the data of a specific table by week and then restore it but without truncate table . This table contains the fechaRegistro I prepared the following script but I'm not sure about the ...
Carolina's user avatar
0 votes
1 answer
239 views

I am trying to capture the number of deleted rows from mysql table from a bash script using --execute option, and it seems to be not working. I have gone through some questions where it mentions using ...
Avinash Pawar's user avatar
0 votes
1 answer
55 views

I have a development Airflow server. It uses MySQL as its database. In the mysqld settings, I have the user set to mysql. However, the log is being written out as a different user named adm whenever ...
Zack's user avatar
  • 121
0 votes
1 answer
205 views

I'm currently trying to script some migration of databases on a server. As part of this process I will need to create a new database with a similar name to the existing database. Whilst I have this ...
Mr-F's user avatar
  • 101
1 vote
0 answers
63 views

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. ...
DarkDead's user avatar
0 votes
1 answer
1k views

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 ...
M_Gh's user avatar
  • 101
0 votes
1 answer
511 views

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 ...
Luke Belbina's user avatar
0 votes
0 answers
827 views

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 ...
enrico_steez's user avatar
0 votes
2 answers
302 views

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 ...
crcoder's user avatar
2 votes
1 answer
11k views

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 ...
baxx's user avatar
  • 326
0 votes
1 answer
2k views

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) ...
W. Hunter Giles's user avatar
1 vote
1 answer
9k views

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 ...
rdbmsNoob's user avatar
  • 459
1 vote
1 answer
2k views

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 \ -...
Majd's user avatar
  • 121
2 votes
2 answers
2k views

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 ...
JohnEye's user avatar
  • 193
0 votes
2 answers
584 views

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 ...
Gaurav Gupta's user avatar
0 votes
0 answers
1k views

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 -...
tdranv's user avatar
  • 119
3 votes
1 answer
1k views

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: ...
IGGt's user avatar
  • 2,296
0 votes
1 answer
37 views

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
2k views

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 ...
Google Google's user avatar
7 votes
1 answer
9k views

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 ...
Adam Birds's user avatar
1 vote
1 answer
3k views

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's user avatar
  • 69
1 vote
0 answers
936 views

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 ...
DB guy's user avatar
  • 69
2 votes
1 answer
1k views

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
425 views

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" ) ...
Michele M's user avatar
0 votes
0 answers
1k views

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=&...
Madbreaks's user avatar
  • 137
2 votes
2 answers
3k views

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&...
apt605's user avatar
  • 83
0 votes
1 answer
182 views

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 ...
user11236651's user avatar
6 votes
5 answers
37k views

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 (...
NikolaS's user avatar
  • 272