The tag has no usage guidance.

learn more… | top users | synonyms (4)

1
vote
1answer
29 views

how to execute unix commands within nzsql?

I'm converting a script from Teradata to Netezza, and I'm stuck at the portion where BTEQ uses the functionality of the OS to check if a file contains any data. If it does, it is deleted. I want to ...
1
vote
1answer
831 views

pgpool-II doesn't execute my failover script

I have been installed pgpool-II 3.3.4 from source. I have two pgpool nodes and I also used the watchdog configuration to get a pgpool services with High Availability. When I stop one, the other wake ...
3
votes
1answer
406 views

How do you generate the DDL that created a DB2 LUW database?

There are various options for db2look you can use to see the DDL for just about every object in the database except the command that created the database itself. Is there any way with db2look, or ...
0
votes
1answer
9 views

Insert into table which contains nested-table inside (Object in Oracle)

I have script of creating here: create type Ingredients_type as object ( Ingredient_ID varchar2(20), Ingredient_Name varchar2(50), ICalori int, IPretein int); create type Food_type as object ( ...
0
votes
0answers
23 views

Need Help Shell Script Connecting MySQL DB

I am running this script to connect to the MySQL DB and achieve the following goal. Run the script for a set period of time. Run the Script for a set number of iterations within the that time. ...
-1
votes
0answers
20 views

How to script sftp using PSFTP.exe with private and public key [migrated]

We are doing ftp to remote server, and using password, but now they want us to use private and public key instead. just wonder if any one have done scripting(command line) ftp that use private and ...
-1
votes
1answer
38 views

Oracle csv line size more than 32767

How to generate csv in oracle if it's query result return more than 32767 character per line in linux shell script
0
votes
1answer
26 views

PostgreSQL - cannot create RULE from stored procedure

I'm trying to automate boring database work. I would like to have one function which creates views, rules, etc so I don't need to run corresponding SQL queries from file. Currently I faced an issue ...
0
votes
0answers
17 views

Need to run mysql script from monit

I wrote a shell script for mysql alerts which need to run under monit. The script is as below: #! /bin/bash -x tmp="/root/$$.txt" emailid="xyz@xyz.com" subject="Running Processes" echo "Running ...
0
votes
1answer
900 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="$...
2
votes
1answer
96 views

Grant sysadmin permissions to 'NT AUTHORITY\SYSTEM'

As you all know, Microsoft SQL Server version 2012 and above are not enabled any more sysadmin role flag to Local System (NT AUTHORITY\SYSTEM) account. In my case it's becomes a problem: I have a WiX ...
0
votes
0answers
33 views

Backup /www/ directory and all mysql databases

I'm trying to write simple shell script which will zip all databases + www directory. I don't know what is the problem but I've got wired output. I've got zip with .sql file full of hieroglyphics... ...
1
vote
1answer
41 views

Why does SQL Server Mangement Studio not script Indexes by default?

Recently I realized by default, scripting the database does not including indexes, and I have to change the option every time. Could anyone please explain the reason? Is there any insight about this ...
0
votes
1answer
336 views

Migration script fires 'The data definition language (DDL) command cannot be executed at the Subscriber'

Yesterday I had run a migration script, produced by Visual Studio 2008 schema compare option, on a SQL Server 2008 database. It had run correctly. But today, when I executed the same script, it threw ...
0
votes
0answers
14 views

Windows Powershell - multiline indirect for psql connection

I have a script that goes like psql << EOF sql 1 sql 2 EOF I want to do the same in Windows powershell. I learned about the script block, but tried passing it in Invoke-command, but hitting a ...
0
votes
2answers
41 views

sp_configure: Preserve values of 'xp_cmdshell' and 'Show Advanced Options'

I dont want to disturb the server values of xp_CMDShell & Show Advanced options. The criteria is to use SQL to run a batch file. This is the script i am trying to solve it with: DECLARE @...
0
votes
1answer
27 views

Powershell: Does System.Data.SqlClient.SqlDataAdapter usange in powershell need some ADO.Net installation?

In PowerShell, goal is to query some data from Sql Server and put that into a preformatted Excel file. Towards that, the following PowerShell script snippet, throws an error saying "assemblies are ...
0
votes
0answers
14 views

What is the best practice of storing mysql connection details to use in ruby/python scripts

I have ruby and python scripts that connect to mysql DBs. They are controlled in github and can populate to different servers. They run in a schedule way (not adhoc). What is the best practice of ...
0
votes
2answers
84 views

oracle rman connecting to a database in not mount state

When connected to oracle database through rman directly from the terminal, everything works fine, but when the same connection string is executed through a shell script rman connects to the database ...
4
votes
1answer
50 views

Scripting Microsoft Data Warehouse Wizard

I am trying to automate the MDW setup process in my environment. Currently I have everything complete except for enabling the data collectors (usually uses a wizard as seen ). Has anyone seen or ...
0
votes
1answer
14 views

Setting Blank lines to ON before executing a SQLFILE in shell script

echo exit | sqlplus username/password@host_ip:port/Service_name @SQLFILENAME I want to execute set sqlbl on before executing The SQLFILENAME and also want that after executing SQLFILENAME it should ...
1
vote
2answers
22 views

How to grant permissions to users based on table information?

Say I have a table: +------------------------+ | Employees | +------+--------+--------+ | Dept | Name | Salary | +------+--------+--------+ | 1 | John | 10000 | | 1 | Mary | ...
1
vote
1answer
85 views

Include scripts for Indexes on Alter Views

After a Developer altered an Indexed View to add a comment, the clustered index that was created on it was dropped with no warning. This caused a failure as there are a couple of procedures that have ...
1
vote
1answer
51 views

How is powershell commonly used in SQL server? [closed]

I am wondering how is powershell used in SQL Server? I heard people saying that powershell makes a DBA's life easier. But I dont know how is powershell commonly used in SQL server. Can anyone provide ...
0
votes
1answer
69 views

Generate backup script of SQL Agent Jobs using c#

I am using C# code to read all the SQL Agent Jobs: static readonly string SqlAgentJobName = "SqlAgentJob_123"; static ServerConnection conn; static Server server; static Job job; try { conn = ...
10
votes
3answers
58k views

Easy way to check connectivity to SQL Server from client

For troubleshooting purposes, I would like to be able to check if a client can connect to a SQL Server instance, independent of the application that possibly can't connect to the SQL Server. Is there ...
0
votes
1answer
240 views

Shell script for partial table backup

I have multiple database in my MYSQL server and i want to take some particular tables backup from each database. can anyone help me in writting a shell script for this scenario.
8
votes
5answers
3k views

How can I detect broken stored procedures after a schema change?

I've modified a central table in my database, and sp_depends literally returns hundreds of results, and I'm concerned some of those stored-procedures might not compile anymore after my change. ...
4
votes
2answers
106 views

How to script permissions for all logins/users/tables/schemas

Over the years, I have used countless scripts and applications to generate all permissions for SQL Server databases. I have used both paid and free tools. I feel that not one of them seems to be ...
3
votes
2answers
8k views

Copy SQL Logins and Permissions From One Server to Another

I need to duplicate all Logins and their associated database-level permissions from one server to another. I am using SQL Server 2008 R2 for Server A and SQL Server 2012 for Server B I am able to find ...
0
votes
1answer
134 views

List of role permissions including other roles - how can I find out the roles that belong to other roles?

I can see the permissions of a role in a database using the scripts in List all permissions for a given role? However, It does not show me when the role belongs to a another role. For ...
0
votes
0answers
15 views

How to migrate logins ( not users ) from one instance to another? [duplicate]

I have lots of instances here where I work, and I'm planning to put all of them into just one. I will migrate all databases from these instances to only one instance. Ok, I can do this (I will backup-...
0
votes
1answer
26 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?
1
vote
3answers
431 views

DB collation is used for comparison instead of column collation

I am moving data from one SQL Server to another. lets call them source and destination SQL server. The source SQL Server has collation SQL_Latin1_General_CP1_CI_AS and the destination has collation ...
1
vote
1answer
59 views

Ola Hallengren Scripts and Maintenance Plan Editor - How to execute sequentially on completion?

I'm using Ola Hallengren's scripts to perform maintenance on my databases. In the Maintenance Plan Designer I am trying to setup a plan that works step by step, but no matter what I try everything ...
0
votes
1answer
37 views

how to access a table containing . in its name

I have created a database schema as "mytest.us" and inside this schema, I have created a table "a.b.c". When I do select * from select * from "mytest.us"."a.b.c"; year | mydata ------+-------- ...
4
votes
2answers
3k views

How to compare two SQL Servers instance level objects for a migration?

I'm currently working on a SQL Server migration (from a SQL Server 2005 to a 2008 R2 server, on a new physical server). The databases themselves will be transferred using a database backup and ...
1
vote
1answer
38 views

What is the purpose of the command-line options “-ANe” for MySQL?

I've recently changed how a mysqldump backup is set up, and happened across a helpful answer by RolandoMySQLDBA where his example: mysql ${MYSQL_CONN} -ANe"${SQL}" Uses the -ANe command line ...
2
votes
2answers
706 views

Scripting all of available databases to .sql files containing schema+data+users with single command

I have a SQL 2008 Express with 80 databases in it. I want to move these databases completely to another server which is hosting a SQL 2008R2 Enterprise instance. As i'm told it is better to script ...
0
votes
1answer
175 views

How do you dump specific table(s)?

Hi i have a shell script for doing a selected databases backup. Now my requirement is i wanted to take a particular tables in a database to be backed up. Each database backup need to be created in ...
0
votes
1answer
18 views

Prostrct create causes windows batch file to exit

I have a daily job to restore a database from last night's back up before doing other things to it and moving on. I'm trying to automate this with a script, but when I get to the following command the ...
1
vote
1answer
28 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 ...
14
votes
1answer
418 views

User-shared queries: Dynamic SQL vs. SQLCMD

I have to refactor and document a number of foo.sql queries which will be shared by a team of DB tech support (for customer configurations and things like that). There are types of tickets that come ...
2
votes
2answers
272 views

PostgreSQL - is it possible to use a plpgsql function in a bash script?

Target : What i'm trying to achieve is to restore a partial backup of a database (only certain rows that satisfied certain conditions have been backed up). Problem : Since between the partial-backup ...
0
votes
2answers
151 views

Find database user name from sysprocesses

I know that this is a strange requirement but I need to find out database user name(not the login name) from sys.sysprocesses for all the currently running processes. For e.g. select spid,dbid, uid ...
-2
votes
1answer
116 views

Script to check CPU, memory, server type

Can someone please help me with the script to get CPU, total physical memory, server type(i.e. physical/VM), maxdop and max server memory details? I need it to run for 50 servers. All the servers are ...
4
votes
2answers
944 views

Variable substitution in psql when using \copy

I'm using the psql command \copy and I would like to pass a variable to it from the shell (for table name) like I've done when scripting queries. I've read in the documentation for psql that: The ...
3
votes
1answer
423 views

many csv file loading using bash script

#!/bin/bash # show commands being executed, per debug #set -x # define database connectivity _db="mydata" _db_user="root" _db_password="123" # define directory containing CSV files _csv_directory="/...
2
votes
1answer
46 views

SQL Server: Programatically trigger export of db schema

SQL Server 2014, Std edition We have seen and used, over the years, a variety of sprocs and non-MS tools to export the DB schema. The way we really like to do this is the built in utility, in SSMS, ...
1
vote
3answers
347 views

Need to get identify all tables and columns in a SQL Query

I have a massive task to go through hundreds of SQL scripts and identify the Table and Columns in each query as we are updating our system and some of the columns and tables may be renamed or ...