Questions tagged [scripting]

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

Filter by
Sorted by
Tagged with
0
votes
3answers
30 views

DB2, How to save all stored procedures as files

How does one extract all stored procedures from a DB2 schema as individual files (without using Data Studio so it can be scripted). I need them all so I can uploaded to source control. I have found ...
1
vote
0answers
37 views

Keeping the same order of selected records while inserting to another table

I am running a below query in big query insert into `test-project.temp_test_dataset.cluster_records` (pm,col1,col2,col3,total) select pm,col1,col2,col3,total from ( select 'ingest' as pm,col1,col2,...
2
votes
1answer
38 views

Where can I find SQL Developer Database examples (scripts) to add data to practice?

Where can I find SQL Developer Database examples (scripts) to add data to practice? I require SQL scripts that will add tables and data on those tables in order to practice with Power Bi.
0
votes
2answers
48 views

Postgresql Backup all databases seperate files

I need to create an automatic backup of all databases from PostgreSQL ( running on a Windows machine ). I need to know if is possible to get backup of all databases but on separate files? Using ...
0
votes
1answer
45 views

SQL Server Command Line Install - How to change the edition?

I am creating a script to install SQL Server via the command line. I cannot see a way to choose the edition I want to install. The GUI on my install media offers Evaluation, Developer or Express: (...
0
votes
1answer
21 views

How to save Outlook attachment in a drive with a new name and overwrite if it already exists? [closed]

I am using below VBA script to download attachments from email and save it to my windows directory. I need help to modify this script - 1) to save rename the attachment before saving it 2) Overwrite ...
0
votes
1answer
55 views

Oracle - Delete dmp files from ASM diskgroup

I want to delete my export files daily from ASM diskgroup with a crontab job. I want to prepare a script for it. ASMCMD> ls exp1.dmp exp2.dmp exp3.dmp exp4.dmp ASMCMD> pwd +DATA/EXP How ...
1
vote
4answers
288 views

Error “the system cannot find the file specified” when opening a large SQL Server file

I have generated the script of my whole SQL Server database into a file and it's more than 36 GB. When I try to open it, I get the following error: The system cannot find the file specified. At ...
0
votes
0answers
13 views

How to shutdown and startup a database to delete datafiles in between

OS: Windows 10 Professional / DBMS: Oracle 18c XE How would one approach the issue of losing a connection while shutting down the database? I would like to have one script which deletes datafilepaths ...
0
votes
0answers
28 views

SQL Failover and Failback Script for SRM Recovery Plan(preferably power shell or CMD or Batch script)

OS: Windows Server 2016 Standard SQL: SQL Server 2016 Enterprise SQL Setup: Two Nodes(Primary and Secondary Node) in PDC(Primary Data Center) having Always On Availability Group with Synchronous Mode ...
1
vote
1answer
26 views

Generate SQL scripts in powershell

I want to be able to generate simple repetitive scripts in SQL using Powershell as the scripting language. For example, If I want to generate a SQL GRANT command for every table in a database, and ...
0
votes
1answer
38 views

How to quote a SQL*Plus identifier in a bash script?

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 ...
0
votes
1answer
92 views

generated column in mySQL workbench

I am a beginner and start designing small database. I've found that to automatically generate value from the table, I can either use a trigger or compute them when forward engineering. Therefore, I've ...
3
votes
2answers
4k views

What does “psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql)” actually mean?

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 (...
2
votes
1answer
28 views

How to change user running audits mssql

I've been tasked with setting up our SQL server audits - despite having never done this before. So please forgive a really basic question. I setup a specific user, sqlAudits, that I would like to own ...
0
votes
1answer
21 views

PostgreSQL - How to list all foreign key link to Primary key of a table

I have a table res_users with primary key id I would like to list all the foreign key link to id from all the tables in my database.
0
votes
1answer
204 views

output psql results and errors to a file

I want to display the results of psql queries on a file.In the log just the name DO for the anonymous Bloc is being displayed. The following is being executed from a shell script file : psql --host=...
0
votes
1answer
152 views

Shell script - psql run multiple statements from a variable one by one in one transaction

Im preparing a shell script to generate analyze command and all the commands will go to a variable. echo $analyze_query analyze tbl1; analyze tbl2; analyze tbl3; Now I want to run one by one, and ...
1
vote
1answer
38 views

how to script out proxy accounts?

I have servers where I use proxy accounts to run ETL processes or even to backup SSAS databases using powershell through a job. I can see what AD Accounts are related to my proxies: use msdb go ...
0
votes
1answer
59 views

v$ tables not recognized in a sql statement of a shell script

I have .sh script with this block: sqlplus -S / as sysdba <<EOFILE set feedback off set lines 2000 set pages 20000 col db_size for a15 alter session set nls_date_format = 'DD-MM-YYYY HH24:MI:...
0
votes
1answer
38 views

script to find all bigint that can be converted to int fields in postgresql performance

I want to compact a postgresql 11 db and my idea is to convert lots of bigint to int data types if and only if there is a reasonable lag to the limit of int data type considering the data inside. So, ...
-2
votes
1answer
95 views

How to resolve error “SQL0104N” when running “db2 prune logfile prior to” command?

I wrote an script to delete transaction log files in db2. I need to delete all the files prior to the active log file.I wrote this code as .sh file db2 connect to DWHDB db2 get db cfg | grep '/...
0
votes
0answers
56 views

Loading 260GB worth of CSV into MySQL in Linux

I'm bulk loading a few thousand CSVs totaling ~260GB and ~4.5 billion rows to MySQL using mysqlimport calls on each CSV executed within a bash script. The MySQL installation and the data itself are ...
1
vote
2answers
405 views

How to pass Oracle Wallet auth to sh script?

I am running an Oracle DB update script that requires password. I have Oracle wallet installed. How to pass Oracle wallet to sh script so that I don't have to enter password when running the script? ...
4
votes
1answer
90 views

how to remove all permissions in a database?

every time I need to either restore a database or reinitialize a replication publication I first (on the restored to be or subscription database) I script all the permissions, triggers, indexes, ...
0
votes
0answers
18 views

Is it possible to replace trigger with a job with postgres?

I am using Postgres XL 10R1.1, even tough it utilises PostgreSQL 10.6 .. It is still impossible to use triggers. I want to use the inherence partitioning in order to partition my data using my some ...
0
votes
1answer
216 views

MySQL ERROR 1064 (42000) insert via bash script (RHEL)

MySQL Server: 8.0.16 Commercial OS: RHEL 7.5 I have written a simple script, to insert certain information into a database table. Following is my script # cat ~mysqldba/bin/connections.sh #!/...
0
votes
4answers
990 views

oracle oraenv script bash

I want to do same commande shell CLi into a script Command shell without script (CLI) su - oracle export ORAENV_ASK=NO export ORACLE_SID=HRPRD . oraenv env | grep ora output: USER=oracle **...
3
votes
0answers
792 views

Generate scripts wizard hangs when loading database information [closed]

I am trying to script out a database from an instance of SQL Server 2017, so I can load it into an instance of SQL Server 2014. I right-clicked on the database, chose Tasks -> Generate Scripts, and ...
-1
votes
1answer
175 views

Syntax Error in Create Table Statement

I'm using Oracle 12c, I want to create a table with partition by year and subpartition by month like this. create table par.Log_his ( ID NUMBER(20) not null, Year number(4,0), -- ...
0
votes
1answer
671 views

Script to install Oracle client 12c2 on Redhat linux 7.5

Can someone help me to provide a script which I can use to install the Oracle client as part of the server build or AMI. Below script I was able to pull out from the guide in the Oracle site. But ...
0
votes
3answers
71 views

How do you generate a build script for all views [duplicate]

I would like to create a build script that can run through and recreate all views (and stored procedures too, but one step at a time). I am trying to create a baseline of all of our user databases (...
2
votes
2answers
759 views

how to add data compression to a primary key of a table?

We work with tables with over 300GB of size, a small percentage of them tables use sparse columns although that doesn't always agree with CPU utilization as this question shows. For the tables that ...
1
vote
2answers
83 views

Find jobs that succeeded, but had steps that failed

Is it possible to find jobs that succeeded, but that had steps that failed like the desired output shows? I'm new to this side of development and I'm not sure about all of the system tables, etc. If ...
3
votes
2answers
491 views

Suppress database change message in SQLCMD.exe

I am writing a script generation script. The script is generating list of DDL statments. The util_generator.sql generation starts with database connection: USE [TARGET_DATABASE] GO ... Many queries ...
2
votes
1answer
292 views

How to insert multiple IP addresses in a pg_hba.conf file via unix shell script?

I need to write some IP addresses to the pg_hba.conf file of my Postgresql, in order to allow remote access from those IP to my machine. I have the following code in shell script to do that for a ...
0
votes
2answers
24 views

Fetching wrong results on comparing a variable with 0 in unix

I have the following code in unix #!/bin/bash user=$1 username=$user'%' DB_name=$2 userpwd=$4 export PGPASSWORD=$3 psql -h localhost -U postgres -d $DB_name -At -c "SELECT COUNT(*) AS ...
1
vote
1answer
35 views

Access .sql script files on other partition or hdd [closed]

I'm running a Linux Mint 19.1 - Tessa OS, which for you who might not know it is based on Ubuntu 18.04 - Bionic Beaver. On this I have installed postgresql 11 which work well. There is one problem ...
1
vote
1answer
209 views

How to find out if an index is aligned

I'm struggling to find any confirmation within sql server or sql management studio that my index is in fact aligned with my partition. I'm creating a primary key constraint on a partitioned table: ...
1
vote
1answer
56 views

How to create a job that uses Powershell script? [duplicate]

I have a powershell script which deletes old backups from NAS storage. I have already tested it using Windows Powershell and it works but I couldn't perform the same thing in SQL Server. I have ...
-3
votes
2answers
269 views

Need a shell script that can run a oracle query and produce output in .csv format

Can you please help- need a shell script that will have a oracle query inside it and produce a .csv format output in specific location, that script should be a scheduled in a cron job which runs, the ...
1
vote
0answers
884 views

Show Collections in MongoDB throwing

I am connecting to MongoDB hosted on EC2 instance of AWS. I am connecting through ssh command. Upon entering the command "show collections", I am getting uncaught exceptions. Please see the sequence ...
0
votes
2answers
73 views

TSQL script returning wrong result

I'm trying to find out if a particular index name "Test" exists in all databases using below code. The result I'm getting is always "NOT EXIST" for all databases in an instance. However, the index ...
4
votes
2answers
2k views

how to script out the user defined table types?

I can Get name and definition of all table types using either of the following scripts: SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED IF OBJECT_ID('TEMPDB..#RADHE') IS NOT NULL DROP TABLE #...
2
votes
0answers
48 views

the mystery of the table showing up in the subscription, but not in the publication

TL;DR: This question refer to sql server 2016, transactional replication I've got a table that shows up in the subscription but not in the publication. Here are the details: In one of my servers ...
4
votes
1answer
998 views

Scripting a Maintenance Plan in SQL Server Express

How would I run each aspect of Ola Halengren's sql maintenance plan on SQL Express? It's my understanding that each job should be run in a specific order. I'm sure that a .bat or cmd file can do ...
2
votes
4answers
1k views

Copy table from one server to another including keys and indexes

I have been working on a small project for about two weeks. We want to consolidate a few tables from several remote server databases in order to run queries and reports on separate from the live ...
0
votes
1answer
97 views

how to script server side permissions - specifically EXECUTE ON SYS.XP_PROP_OLEDB_PROVIDER?

I could not script the following server side permissions: GRANT VIEW DEFINITION ON LOGIN::[site_helpdesk] TO [Radhe] but thanks to the question below I found a solution to that: How to script out ...
0
votes
0answers
90 views

Using SQL script in Toad, how do I suppress the echo of the SQL statements

I'm using a script (Toad, Oracle) so that I can use variables and enter two values that get repeated in multiple SQL statements. That's working great, but the SQL statements echo into the console ...
2
votes
2answers
517 views

Handling data encoding issues while loading data to SQL from Script (Notepad++)

I'm pretty sure this is not a SQL Server problem. I already asked a question HERE with an awesome explanation, BUT I still can't explain to the guys where I work that it has nothing to do with SQL ...

1
2 3 4 5
7