SQLPlus Connection Issue when using bash script

Advertisements Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID #!/bin/sh cd /dev/shrd/alt/test1/stest/ptest V1=`sqlplus testuser/passwd@testSID <<EOF SELECT count(*) FROM test_table WHERE region=’Aus’; EXIT; EOF` if [ -z "$V1" ]; then echo "No… Read More SQLPlus Connection Issue when using bash script

Why am I getting this '#########' as output in the fields of a column?

Advertisements I am using ORACLE SQL* PLUS XE 11g. I made a Vehicles table with: CREATE TABLE Vehicles ( vehicle_id NUMBER PRIMARY KEY, v_type VARCHAR2(50) NOT NULL, v_price DECIMAL(10,2) NOT NULL ); And added data with: INSERT ALL INTO Vehicles VALUES (1, ‘Car’, ‘Limousine’, 67113480) INTO Vehicles VALUES (2, ‘Car’, ‘Toyota Camry’, 19000000) Note: Original… Read More Why am I getting this '#########' as output in the fields of a column?

Connecting to Oracle XE edition with sqlplus but without password

Advertisements Yes, I’ve seen https://dba.stackexchange.com/a/140147 The command sqlplus / as sysdba mentioned in this answer and elsewhere on the web still asks me for password on my installation: Oracle Linux 7.7 oracle-database-xe-21c-1.0-1.x86_64 However, that command still asks me for password: [root@localhost ~]# su – oracle Last login: Fri Sep 2 09:01:34 EDT 2022 on pts/0… Read More Connecting to Oracle XE edition with sqlplus but without password

Oracle database SQLPLUS: How to enter password has character @?

Advertisements Oracle database 21c express edition on Windows 11. My error ORA-12154: TNS:could not resolve the connect identifier specified My password is xxxxxa@ . I see https://stackoverflow.com/a/67141887/3728901 How to enter password? Update: Thank to Connor’s answer. I catch Microsoft Windows [Version 10.0.19044.1889] (c) Microsoft Corporation. All rights reserved. C:\Users\Administrator>sqlplus /nolog SQL*Plus: Release 21.0.0.0.0 – Production… Read More Oracle database SQLPLUS: How to enter password has character @?

Executing multiple sql files in a bash for loop

Advertisements I’m trying to run the following lines of code in bash to run multiple files on a database. #!/bin/bash for file in ${arrIN}; do echo "Executing ${file}.."; sqlplus ${db_user}/${db_password}@${db_host}:1521/${db_sid} @${file}; done For some reason, it will only execute the first file on the database, but won’t keep executing them. When I check how many… Read More Executing multiple sql files in a bash for loop

CREATE TABLE – Concatenating a variable with a string to name the new table

Advertisements I want to create a tables concatenating a prefix with a given identifier. The prefix will change every time I create a new table with the same query. I have tried a few variation of the following idea without success: DEF prefix_edms = ‘z_edm’; CREATE TABLE CONCAT(&prefix_edms,’_TABLE_A’) as ( SELECT ‘HolaPoho’ from dual );… Read More CREATE TABLE – Concatenating a variable with a string to name the new table

Oracle – How to use & without being asked about the value?

Advertisements Basically, I don’t want to be asked about the value like this:: SQL> select &test from dual; Enter value for test: I want only declare the &test along the script, something like it: &test varchar2(100):= ‘some value’; –of course, this don’t work. >Solution : Execute SQL> set define off before running your code. SQL>… Read More Oracle – How to use & without being asked about the value?