Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [scripting]

For questions about generating or using language scripts, for example scripting a database object definition.

1
vote
3answers
3k views

Running Oracle Export Utility within a Shell script

I have wasted a lot of time on this. Any ideas of what I am doing wrong here? Script in bash #!/usr/bin/bash . . . /export/home/app/oracle/product/10.2.0/bin/exp $uname/$passw \ FILE="$...
3
votes
1answer
762 views

select two tables and print the columns side by side with matching key in hive

I have the below tables: table_1 name_1 id_1 value_1 avi 1 21 adi 2 X table_2 name_2 id_2 value_2 avi 1 21 adi 2 22 metadata_info: can be read from ...
2
votes
1answer
39 views

How can I optimize this MYSQL Script For many Records?

I have This script by Helping @lukstorms , -- DROP TABLE IF EXISTS test_words; CREATE TABLE IF NOT EXISTS test_words ( id int unsigned NOT NULL PRIMARY KEY, words text NOT NULL ); -- DROP TABLE ...
2
votes
1answer
33 views

How to order databases by size? (For use in full backups)

Recently, I've been trying to make our company's full backup process more efficient. In order to do this, my team has decided that instructing the backup job to tackle the full backups starting with ...
1
vote
1answer
58 views

is there a way to improve this query by not re calculating functions? cross apply?

when I set up replication I like to take a count of each table in the publisher, then I go to the subscriber I do the same thing in order to compare both pictures. this is the picture from the ...
1
vote
1answer
64 views

How to make performance tests for DML

I created two multi-column indexes on a big table (~2,5 millions rows 370Mb and 621Mb with indexes). SELECT queries are very fast. Know I want to check if we have a regression for INSERT/UPDATE ...
1
vote
1answer
59 views

Parsing a manifest.xml of a table schema to script?

I have a manifest.xml sent to me by a vendor that accompanies some extracts they are also sending. I assume there should be a way to parse this into an actual table structure (or a script to create a ...
0
votes
1answer
53 views

Realtime Update MySQL on every Update occurred on PostgreSQL

I have a PostgreSQL for my accounting system and a MySQL database for my php website, i want to sync these two database for every update may occurred on PostgreSQL it also updates MySQL database, they ...
0
votes
1answer
54 views

How to upgrade a MySQL database using numbered scripts based on a version field

I have a database that contains a version table with one value stored in it which is the database version number. I would like to be able to update the database version automatically using numbered ...
0
votes
1answer
529 views

Restoring multiple files to multiple database with pg_restore

I have multiple dump files and want to restore them with single command. something like this pg_restore -h localhost -p 5432 -U postgres -d gl_election gl_world gl_tourism -c "gl_election" ...
0
votes
1answer
72 views

Create a table with the same constraints,triggers,indexes, and statistics for house-keeping table

I have a current database with few hundred tables, say, tables A,B,C... and I want to create the same tables with the same constraints,triggers,indexes, and stats as the original tables. I know I ...
0
votes
1answer
69 views

My SSMS is bringing wrong object in “Script Stored Procedure as” > “CREATE To” > “New Query Editor Window”

When I go to Object Explorer and expand down to Stored Procedures (or Tables), right-click on one of them and choose "Script Stored Procedure / Table as" > "CREATE To" > "New Query Editor Window", it ...
0
votes
1answer
181 views

Starting SQL script with bash passing values

My use case is as follows. I have some SQL scripts which copy data from a CSV to a Vertica database. For every run, I want to add a special date to the rows. Since I am starting those SQL scripts ...
0
votes
1answer
187 views

Is it possible to take the table level backup in mysql using any of the script?

I am new to MySQL and I am in need of the script which is taking backup of multiple tables from the multiple databases in single file in MySQL?
0
votes
1answer
126 views

Generate Schema Only Script from SQL Server 2012 to SQL Server 2008R2

Hi this is the first time that I've encounter this error in generating script for my database, what do you think causes this error? Thanks. Please see image.
0
votes
1answer
98 views

databases cross references baselines

We have on several databases on same instances, some stored procedures have references to tables on other databases. We are in the middle of a big project to take our database under source control. ...
-2
votes
1answer
27 views

How to write a shell script to disable the database accounts from a list of user IDs

I am new to Unix scripting...I have a list of userids for terminated employees. I want to write a script that will check these userids against my databases and disable/remove the user accounts ...
2
votes
0answers
357 views

SSIS Script Component errors sporadically with the same code

I have a SSIS Data Flow Task that takes CSV output (from a flat file connection) and passes that to a Script Component. When I run the task I get the following error: Script Component has ...
2
votes
0answers
8k views

DROP DATABASE IF EXISTS CREATE DATABASE IF NOT EXISTS USE in PostgreSQL

I always was used following header in files that defined database in MySql: DROP DATABASE IF EXISTS base; CREATE DATABASE IF NOT EXISTS base; USE base; In PostgreSQL there are the following ...
2
votes
0answers
654 views

execute R script using a postgresql trigger:

This is my first question here, so excuse me if it does not look well organized: I want to call a R script from a trigger (postgresql) so this script will be executed after an INSERT on my table (...
2
votes
0answers
784 views

How to get status of “opatch prereq CheckApplicable” via script

I want to check if a patch is Applicable via opatch prereq CheckApplicable -oh <oracle home> -ph <patch home> but the returncode is always 0! It doesn't matter if the text output says ...
2
votes
0answers
1k views

Scripting Local Policy Perform Volume Maintenance Tasks

I am working on an automated SQL 2012 install process on Windows 2012 R2 and have everything complete except for one task. My process launches secpol.msc but I am still required to drill in and ...
1
vote
0answers
34 views

Checking if schema name is included in every sentence

I got some oracle database scripts for creating the whole database of an application, including sentences for creating tables, sequences, synonyms, inserts and updates of data, etc I need to ensure ...
1
vote
0answers
43 views

How to save SSMS 2012 Object Explorer Scripting Settings?

I'm generating a bunch of object creation scripts in SSMS 2012, using the Object Explorer context menu. The default options for these generated scripts are not to my liking (for example, I want the ...
1
vote
0answers
156 views

How to investigate non-specific Generate and Publish Scripts Wizard errors

I am trying to use the Generate and Publish Scripts wizard in SSMS 2012 against a 2012 SQL instance and am getting errors. Trying to generate a schema-only script of the tables and schemas. I allowed ...
1
vote
0answers
147 views

Loop a script for all DBs in SQL Server

I am trying to run Kendra's script for all DBs but running into issues.I have tried below. http://www.littlekendra.com/2016/05/05/how-to-script-out-indexes-from-sql-server/ DECLARE @SQLCmd VARCHAR(...
1
vote
0answers
78 views

SQL Server and Network considerations to transfer backup file to a shared folder

I'm facing with a situation where backups are being transferred manually to a Shared Folder and my goal is to optimize all of this. What I have to deal with is: 8 Windows 2008 R2 Servers 2 Windows ...
1
vote
0answers
122 views

What should be the best practice to alter the table using the script to shift columns

I have a MySQL table which has columns 93 in it. All first 92 columns are INT(11) and the last column is of type DATE. |number|0|1|2|3........|88|89|90|ddate| | | | | | ........| | | | | ...
1
vote
0answers
54 views

Disable the Task action button

How can I disable the "Tasks ->" button in SQL Server Management Studio? I need to prevent users scripting objects.
1
vote
0answers
48 views

T-SQL stored procedure: granting general user access to specific stored procedure

I'm attempting to alter a stored procedure that needs the line added: grant exec on dbo.sproc_name to exec_proc I believe the admin setup the exec_proc as a group. I added this grant line following ...
1
vote
0answers
268 views

Parallel insert in db2

I am trying to import from 8 files and insert into a single table in db2. I am running 8 .sql files that will do the task, but only one of them actually seem to be running and inserting into table. ...
0
votes
0answers
8k views

execute .sql script inside an anonymous pl/sql block which is invoked by a shell script

I got a shell script which connects to SQLPLUS and executes the .sql file like below: read a x=`echo $a | cut -d , -f 1` y=`echo $a | sed 's/.*,//'` c=`echo $USER | cut -c -2`"OPR"`echo $USER | ...