Questions tagged [sql]
The sql tag has no usage guidance.
147
questions
0
votes
1
answer
35
views
why when I execute a select it works and when I execute an update the script blocks?
when I try to execute a query of type update the script hangs and the sql console stays still.
This command executes all queries in the script:
res=$(mysql --defaults-file=conf_file --skip-column-...
0
votes
1
answer
44
views
Slackware and postgres
I want to install postgres and psql via a Slackbuild and I did so. After installing it I tried running the command as suggested in the readme of the Slackbuild but I get an error upon running it as ...
0
votes
0
answers
57
views
tracker 3.2.1 queries not working
I'm on Fedora 35, tracker version is 3.2.1
I'm having strange issues with SPARQL queries in tracker (while SQL queries seem just impossible whatsoever). For example, the following query
tracker3 ...
0
votes
0
answers
23
views
psql not working in Slackware
I downloaded the slack builds for pd, pd-sql and postgres and when I Run psql in the terminal I receive:
bash-5.1# psql
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" ...
0
votes
0
answers
25
views
Understanding Mac Databases/plist - Identity Services and Statuskit
I'm trying to understanding Identity Services and StatusKit information on Mac.
Is there a way to differentiate between sent and received within idstatuscache.plist and ids-pub-id.db? What is the ...
0
votes
1
answer
47
views
Running SQL databases offline
I'm running a Debian 10 based distro. As an experiment, I downloaded one of these Wikipedia-like sites which gives you a download size of several gigabytes. I was hoping to run it offline.
I don't ...
2
votes
2
answers
287
views
How to store query multiple result in shell script variable(Array)?
I'm trying to do a query and store every row result in an array element in ksh (maybe bash).
I do:
result=($($PATH_UTI/querysh "
set heading off
set feedback off
SELECT columnA,columnb FROM user....
0
votes
0
answers
15
views
SQL script to accept INFILE as parameter?
I have an SQL script, in which some data is being loaded from a file,
something like this:
LOAD DATA local INFILE 'test.csv'
INTO TABLE test ...
Now the path & name of this INFILE is hardcoded ...
1
vote
3
answers
98
views
Regular expression - SQL manipulation
[pol@fedora data]$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 34 (Thirty Four)
Release: 34
Codename: ThirtyFour
I'm ...
1
vote
1
answer
23
views
whole data isn't showing on POST sql injection
sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=name&password=pass" -D get_method -T user --dump
Output :
[11:27:40] [INFO] the back-end DBMS is ...
0
votes
1
answer
26
views
not getting whole data by sqlmap
$ sqlmap -u http://192.168.0.106/get_method/get_data/?id=1 -D get_method -T user --dump
But, my data
CSV also completely same as terminal picture
name,serial,password,timestamp
asdf,1,asdf,2021-03-...
0
votes
1
answer
921
views
using of sqlmap by different ip addresses
sqlmap -u http://192.168.0.106/get_method/get_data/?id=1 --dbs
I know that if we sent any request to any server that server takes ip address of user(mine). So, while I am running the above source ...
1
vote
0
answers
78
views
making sqlcmd self-contained so it would be possible to run without installation, for CentOs
I am trying to make a bash script to connect to remote SQL server with sqlcmd
in the devp machine, as I have admin privileges, runs smoothly
but I NEED (and capitals because it is imperative) to build ...
0
votes
1
answer
26
views
Pass Linux variable in Oracle script
How to pass Linux variable in Oracle code?
I need to pass it in below format and it should not ask for "enter a value for 1:"
Please advise.
mount='/u08/dbname/'
sqlplus -s "/ as sysdba&...
2
votes
2
answers
245
views
Split long SQL expression at delimiter
Context
I'm trying to import a dump that have some long lines (8k+ character) with SQL*Plus, so I face the error SP2-0027: Input is too long (> 2499 characters). This is a hard-coded limit and ...
0
votes
1
answer
67
views
Weird ProFTPd and mod_sql string escaping
I am using/trying to use ProFTPd with users in SQL and using stock sql configuration.
I currently have a problem with weird string escaping, but ONLY for INSERT into the "tally" table, not ...
1
vote
1
answer
2k
views
SQL Server Connection Failed with Linux Mint + SQL Server 2008 R2 using any client
I am trying to connect to my SQL Server 2008 R2 with SP4 database, however, I got this error and I have tried some solutions that I found here, but none works for me.
PS. I do not know exactly how to ...
0
votes
1
answer
80
views
How to create an unprivileged sql database
I need to learn what sql is.
But am too scared of creating a database as root.
This is my current "progress":
$pacman -Syu mariadb # succeeds
$mysql_install_db --basedir=~/.sql/install --...
0
votes
1
answer
250
views
How to run multiple line sql from text file
a file.txt have a multipe sql update.
update table1 set meta_url = replace(meta_url,'test1.jpg','test1.gif');
update table1 set meta_url = replace(meta_url,'test2.jpg','test2.gif');
update table1 set ...
0
votes
1
answer
537
views
How to fetch Data of Previous date in shell script?
Kindly refer the script below.
#!/usr/bin/bash
#scirpt to connect with db
master_db_user=''
master_db_passwd=''
master_db_port='3306'
master_db_host=''
master_db_name='uppcldashboard'
Now=$(date +"...
0
votes
1
answer
625
views
Dynamic date in sql query shell script
Okay kindly refer the below code then I'll put my question.
#!/usr/bin/bash
#scirpt to connect with db
master_db_user='root'
master_db_passwd='123'
master_db_port='3306'
master_db_host='localhost'
...
0
votes
1
answer
531
views
how to get dynamic variable in a query of a shell script [duplicate]
The last piece of my script is only pending.
kindly refer to the code below.
master_db_user='root'
master_db_passwd='123'
master_db_port='3306'
master_db_host='localhost'
master_db_name='...
0
votes
1
answer
14
views
How do I write SQL to fetch strings that begin with % in Oracle?
Could someone please assist on how to fetch the data in SQL for all the strings starting with %%string?
I tried below to escape %% but it didn't work
SELECT * FROM Tablename WHERE host LIKE ‘[%][%]%’...
0
votes
0
answers
95
views
Convert 2 HTML file which is output from SQL query into 1 main HTML output file in shell script
In shell script, I used 2 different SQL query & output of these 2 files in HTML format like (eg- ab.html, cd.html). Before DML operation 1 SQL query will run then after DML operation another query ...
1
vote
1
answer
591
views
Convert 2 HTML file output from SQL query into 1 main HTML output file in shell script
In shell script, I used 2 different SQL query & output of these 2 files in HTML format like (eg- ab.html, cd.html). Shell script as ->
#/bin/ksh
ab=$(SQLPLUS -s <username>/<password>@...
1
vote
1
answer
61
views
Failed to find package in third party repository
I'm new to debian & linux, and I want to know how to download packages from third party repositories.
Specifically, I want to download a Microsoft SQL driver into a docker container (guide).
...
0
votes
1
answer
4k
views
How to get result of SQL query in shell script with same format that when we run on Oracle SQL developer/Toad/PLSQL developer
In shell script I am using SQL query.
#/bin/ksh
var=$(sqlplus -s <user>/<password>@DB <<EOF
set heading on
set trimspool off
set linesize 200
set feedback ...
0
votes
2
answers
962
views
sqlplus doesn't work in Crontab
/oracle/GR1/121/bin/sqlplus / as sysdba <<EOF >> $LOGFILE
whenever sqlerror exit sql.sqlcode;
set echo on;
set serveroutput on;
STARTUP;
EXIT
EOF
Already tried it with the path, but it ...
1
vote
4
answers
4k
views
Shell script to append single quotes and commas
I have a file named input.txt:
$cat input.txt
This is sample
Input file
To execute sql statement
I need output like below assigned to a variable:
X=('This is sample', 'Input file', 'To execute sql ...
0
votes
0
answers
74
views
Extract and combine values from an SQL dump
I have several large SQL dumps with very long lines, including one containing a version & subversion of the database in a long INSERT statement, formatted like this:
INSERT INTO `table` VALUES (.....
0
votes
1
answer
36
views
string substituton for match pattern
I have an SQL file of 170GB. I am trying to restore it on AWS RDS but i am not able because of keyring encryption is enabled on the file. I can't edit it using vi because it's causing my session ...
0
votes
2
answers
2k
views
Sybase query: save output to a file
I´ve created the following script:
#!/bin/bash
isql -U databasename_dba -P password -b <<EOF!
select quantity, date from name_table where numer_id="1234"
go
quit
EOF!
...
0
votes
1
answer
458
views
To print log file with out put of cron job scheduled for a sql block - with Date and time (all the executions of cron)
I have a shell script which executes a pl/sql block, I'm printing output to output file but it's not keeping old information and not displaying time and date when the script was executed.
My script ...
0
votes
1
answer
190
views
How to extract Oracle DML (insert,update) queries from a dump file?
Example:
$cat data.txt
SCN THREAD OPERATION ID OBJECT ID OBJECT NAME REPLICATE OPERATION SQL
------------- ------- ------...
1
vote
1
answer
3k
views
Manjaro MySQL - mariadb.service fails when trying to start
When trying to start MariaDB with systemctl status mariadb, I get:
● mariadb.service - MariaDB 10.3.15 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor ...
2
votes
3
answers
153
views
Prevent Script from Inserting Space in File Name
I have an Oracle database table that is storing the full path and name of a file in a table column. In a SQL client I can run:
select file_name from table where request_id=12345
and I will get this ...
1
vote
3
answers
272
views
Search for a dynamic pattern in a file in a file and replace it with variables
I have written the below commands that will generate three different shuffled vales
A=`echo 'abcdefghijklmnopqrstuvwxyz' | sed 's/./&\n/g' | shuf | tr -d "\n"`
B=`echo '...
0
votes
1
answer
87
views
Postfix: Whitelist all entries in address book
my postfix currently rejects emails that are potentially SPAM. Howver, some of my contacts have servers that are not correctly configured and I want to avoid rejecting their email.
...
0
votes
1
answer
221
views
Forgot sql password for a certain user (debian)
I have two sql users on my sql server: root and bob. I know the root password, but I forgot bob's password. How can I view/reset bob's password?
-1
votes
2
answers
3k
views
Adding headers to a CSV
I have an SQL command which fetches you an output like
70
138
200
This is stored in a csv and I have added headers to it but appears like
A,B,C
70
138
200
I wanted it to look like
A 70
B 138
C ...
1
vote
1
answer
398
views
PhpMyadmin times out with small SQL file
I am trying to upload bump to phpmyadmin, which has has only 2MB but it has 12 thousand lines.
I always get this error:
Service Unavailable
The server is temporarily unable to service your request ...
1
vote
1
answer
1k
views
make json from SQL query output
I have this query:
select hostname,size from tableinfo
output is like this:
hostname size
------------------------- -----------
host1 28
host2 ...
-1
votes
4
answers
4k
views
SQL operation on csv file using bash or shell
This is my input file
0164318,001449,001452,001922
0164318,001456,001457,001922
0842179,002115,002118,001485
0846354,001512,001513,001590
0841422,001221,001224,001860
0841422,001227,...
17
votes
2
answers
1k
views
How does this shebang that starts with a double hyphen (--) work?
I have found the following kind of shebang in the RosettaCode page:
--() { :; }; exec db2 -txf "$0"
It works for Db2, and a similar thing for Postgres. However, I do not understand the whole line.
...
0
votes
1
answer
448
views
How to compile a ".pc" file on Debian 9?
I need to compile a Pro*C - .pc file on Ubuntu.
So far what I have realised is that I need a Pro*C compiler to translate the Pro*C - .pc file into pure / standard C code.
But I need to have Oracle ...
0
votes
1
answer
543
views
Use sed to prefix and suffix multiple strings per line
I have a .sql file with some 15,000,000 INSERT commands on each line, which look something like this:
INSERT INTO tableName (col1,col2,col3,col4,col5,col6,col7,col8) VALUES ('Jan 7 2018 12:33PM', 'R'...
0
votes
1
answer
372
views
Incorrect syntax error in unix script while using if exists command (sybase as database)
I have the below script presenting me the following error:
isql -U$DBLogin -PDBPAss -S$DBName -e <<!
use $db
go
if exists (select 1 from syscolumns where id = object_id('Main_table') and ...
0
votes
1
answer
1k
views
Installing Oracle SQL Developer in Arch
I've spent >3 hrs trying to figure this out.
I've done both methods shown in the wiki. Both seem to have worked fine. When I search I can't find any newly installed software with any name like "...
-2
votes
1
answer
177
views
Delete remotely oracle schema using shell script [closed]
I have a remote instance like database-ora12 with existing user tester / password and SID=orac
How I can delete remotely database or schema from this system for this user using shell script without ...
0
votes
1
answer
274
views
REGEX search & replace with sed or other command
I have a big SQL file with content like
[code language="bash"]
git checkout master
git pull origin master
...
[/code]
Lorem ipsum dolor sit amet, consectetur adipiscing elitUt enim ad minim
[code]...