About 648,000 results
Open links in new tab
  1. How to run SQL in shell script - Stack Overflow

    How do you run a SQL command in a shell script while setting a variable? I had tried this method and it isn't executing the command, it is thinking the command is just a string.

  2. Connect to sqlplus in a shell script and run SQL scripts

    Apr 23, 2012 · I have a .sql file, which is a bunch of oracle pl/sql commands and I want to create a shell script to run these commands. Suppose that user/pass@server is my credentials. What will be the shell script to do such a task?

  3. Shell Script to Perform Database Operations - GeeksforGeeks

    Jan 30, 2023 · In this article, we have seen how to create a shell script to perform various database operations using the MySQL database management system. We have created functions to create a database, create and modify tables, and query data. With these building blocks, you can easily create a script to automate any database-related tasks you might have.

  4. How do you execute SQL from within a bash script?

    If you want to be able to pass data into your scripts you can do it via SQLPlus by passing arguments into the script: Contents of file-with-sql-1.sql. select * from users where username='&1'; Then change the bash script to call sqlplus passing in the value #!/bin/bash MY_USER=bob sqlplus <user>/<password> @file-with-sql-1.sql $MY_USER

  5. Oracle Shell Scripting

    This article presents some basic techniques for creating Windows batch files and UNIX/Linux shell scripts that connect to SQL*Plus and RMAN. To run a SQL script using SQL*Plus, place the SQL along with any SQL*Plus commands in a file and save it on your operating system. For example, save the following script in a file called "C:\emp.sql".

  6. How To Use Oracle / MySQL SQL Commands In UNIX Shell Scripts

    Jan 29, 2010 · Explains how to call Oracle or MySQL/MariaDB/PostgreSQL database SQL and dba statements using UNIX or Linux ksh, sh or bash shell scripts.

  7. Executing an SQL Script From the Command Line - Baeldung

    Apr 20, 2024 · In this article, we discussed how to execute a .sql script for MySQL from the Bash command line. First, we looked at the steps to connect to a MySQL server and also explored its various options. After that, we executed the .sql script using …

  8. Connecting SQL Server using Sqlcmd and Bash Script

    Dec 18, 2024 · Database Administering of MS SQL Server can be done using many tools and utilities. One of them is SQLCMD command line tool used in a non-graphical interface medium. Since SQL server is also available in Linux this command line tool (SQLCMD) is available Bash as well as PowerShell.

  9. Running SQLPlus within a Bash Script: A Step-by-Step Guide

    Feb 25, 2024 · SQL\*Plus is a command-line tool that allows you to interact with an Oracle database using SQL and PL/SQL commands. By integrating SQL\*Plus commands into a Bash script, you can automate repetitive tasks, such as data …

  10. How to write a shell script to run a sql query and send the query ...

    Dec 3, 2022 · I need to run a SQL query using SHELL script in PUTTY and send the results in email body in table format with headers along with a message line on top. I have written this so far but I am not able to get results in table format.

  11. Some results have been removed
Refresh