0
votes
2answers
3k views

Save data to variable and use it in stored procedure

I have a table of 2 columns (Date, Text). I am getting data from the Text column according to the Date using a query like this: SELECT Text FROM MyTable WHERE Date>= @userDate; This works, ...
2
votes
1answer
547 views

Upgrading from 10.2g to 11g by incrementals

I know it's possible to generate a full rman backup in a 10.2g database, move it to another server containing 11g, restore it there and finally do an upgrade. Since I have to do this to a large ...
19
votes
4answers
11k views

Locking issue with concurrent DELETE / INSERT in PostgreSQL

This is pretty simple, but I'm baffled by what PG does (v9.0). We start with a simple table: CREATE TABLE test (id INT PRIMARY KEY); and a few rows: INSERT INTO TEST VALUES (1); INSERT INTO TEST ...
5
votes
1answer
370 views

Troubleshooting Postgresql spatial query failure. Next steps?

We have a set of spatial queries that are failing and I'm struggling with troubleshooting them. I suspect that we're running into some bug, but I'd like to nail things down a bit better so as to be ...
5
votes
3answers
106 views

I want to perform multiple date adds on a date range and select those individual dates

I have a table of schedules with an effective date, discontinue date, and seven boolean fields indicating days of the week when that schedule is in use. Here's a sample: effDate discDate opMon ...
8
votes
1answer
2k views

Unexpected Seq Scan when doing query against boolean with value NULL

I have a database column called auto_review where column type is boolean. There is an index for that field, created using the ActiveRecord ORM. CREATE INDEX index_table_on_auto_renew ON table USING ...
1
vote
1answer
60 views

What type of files are C-9999-yyyymmdd-00 in Oracle

At my {ORACLE_HOME}\database I found like 3GB of this type of files: I think they are not backup of controlfile because size of files changes over time.
2
votes
1answer
8k views

Oracle error “too many values”, must be solved with nested SELECTs

I have hit upon a "too many values" error in Oracle, when working with some intricate nested SELECTs. A simplified description of my problem, on a toy problem describing the hierarchy in a company. ...
3
votes
1answer
1k views

SSIS Script to split string into columns

I have a dataset (log file) with a number of columns; one of them is "Other-Data" below (unordered string) and need to parse the string to create the derived columns according the u value (U1, U2, U3, ...
5
votes
1answer
2k views

Does UPDATE INDEXES work for local indexes?

I have two tables in Oracle 11.2. First is partitioned and has local index (non-prefixed): CREATE TABLE table1 (col1 INT, col2 INT) PARTITION BY LIST(col1) ( PARTITION p1 VALUES(1), PARTITION ...
2
votes
3answers
3k views

Table with identity column in merge replication

I have a table in SQL Server 2005 and I have an IDENTITY(1,1) property set for an ID column. Records are inserted in a table at a local server as well as a remote server. I am using Merge ...
1
vote
1answer
2k views

Passing path from batch file to mysql [closed]

My batch file will contain some thing like this : set MUSER=root set MPASS=xprd123 set MHOST=172.33.49.55 set DB=DBName1 set MBIN=C:\Program Files\MySQL\MySQL Server 5.5\bin ...
0
votes
1answer
1k views

MySQL query with an OUTFILE to csv not working when called from a batch file

When I execute the following query, it works: SELECT 'INNODB_OS_LOG_WRITTEN','QUESTIONS' INTO OUTFILE 'D:/stats.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'; But when I ...
6
votes
3answers
400 views

MySQL single table static and dynamic pivot

I have a table that looks like this: +----------------------------------------+ |Name | kode | jum | +----------------------------------------+ | aman |kode1 |...
2
votes
3answers
463 views

How can I identify and fix bottlenecks in an Oracle11gR2 import

I've recently been tasked with moving our Oracle 11g database from a linux CentOS desktop to a windows 2008 server. Given I've not done much behind the scenes stuff with oracle before I'm a bit out of ...
1
vote
2answers
643 views

How to connect to SQL Server Analysis Server via Management Studio command line

I can connect SQL Server Management Studio to a SQL DB by passing command line parameters like this: "C:\Program Files (x86)\....\Ssms.exe" -E -S SERVERNAME -d DB_NAME -nosplash (Obviously -E is ...
6
votes
5answers
4k views

Connect to SQL Server behind NAT from remote machine

The scenario is that this is a SQL Server behind a corporate firewall with your standard setup to allow only minimal outbound traffic and zero inbound. However, port 80/443 are open, per the usual ...
2
votes
1answer
3k views

Query performance of a NULL vs an empty ('') varchar in SQL Server 2012

I have 3 indexed fields in a query: int, int, and varchar(250). The query performs well when all 3 conditions are specified with real values. The int columns always have values, but there are plenty ...
5
votes
2answers
26k views

Oracle Enterprise Manager 11g dbconsole “Internet Explorer cannot display the webpage”

The dbconsole is configured and started, but when I navigate to it, Internet Explorer shows the page stating that "Internet Explorer cannot display the webpage". This is the error that means that IE ...
3
votes
2answers
4k views

Merge two records in the same table, keeping foreign key relationships intact for both

I have a table, called SITES, that has three columns, lets say it looks like this: ID Name Path 1 Google http://www.google.com/ 2 Microsoft http://www.microsoft.com/ I also have ...
4
votes
2answers
4k views

Hibernate Query Running Slow

I am currently facing a problem with a slow running Hibernate query that is being kicked off from a Java program. It is making a call to Oracle 11g at the back end. This query is taking anything from ...
1
vote
1answer
1k views

Can't create archived redo logs

Oracle 11.2.0.3 in Windows Server 2008 64 bits. I try to set up archive mode in a database: C:\Users\Admin>SET ORACLE_SID=BDSPROD C:\Users\Admin>SQLPLUS /nolog SQL*Plus: Release 11.2.0.3.0 ...
2
votes
1answer
2k views

How to choose working database in DB2?

In SQL server I can use the USE statement to switch between working databases. Is there a similar command for DB2?
3
votes
1answer
680 views

How are foreign keys resolved when creating tables in batch?

I am creating a database version management tool with the goal of being able to recreate a database from scratch using text/sql files contained in source control. As part of establishing a baseline ...
0
votes
1answer
496 views

Choosing shard key and friendly URL Ids for my MongoDB

I have decided to use MongoDB as my Database for a web application. However, I have some difficulties to get started and I hope that you can help me out with a few questions. I am developing my ...
3
votes
2answers
8k views

Oracle Procedure to Enable/Disable all constraints

I have this nice piece of code: begin for i in ( select constraint_name, table_name from user_constraints where constraint_type ='R' and status = 'ENABLED' ) LOOP execute immediate ...
0
votes
3answers
142 views

Joining two tables and query them

I want to select the name and date of birth of all living artists who have value more than 50. My tables are artist and picture and I wrote this SQL statement but it is not giving me the desired ...
1
vote
1answer
173 views

oracle how to call procedure

This is very basic question, but I couldn't find an answer here... So I have this very useful procedure without any parameters: CREATE OR REPLACE PROCEDURE DISABLE_TRIGGERS IS v_statement VARCHAR2(...
5
votes
1answer
1k views

Calculating Median Value within a Group By

I have a Stored Procedure which calculates the Mean duration of a request / response cycle within 10 minute intervals. This works well and suits my needs for plotting charts. What I would like to do ...
3
votes
1answer
1k views

SQL Server database has very small backup

I have a database of 216 GB. 75% is used by data, the rest is used by index and log. When I check free space in the database files I get values around 300 MB. The database is split over 3 data files. ...
0
votes
1answer
2k views

Find ID columns with null value in oracle database

I need a way to iterate through all tables in tablespace "T_ECOS" and find all ID with null value in oracle database Any suggestion?
2
votes
3answers
204 views

How to trigger an action without using triggers

I just want to ask. We have a calendar table, let's call it CAL1 in one database, lets call it DB1. CAL1 is manually populated. Now in another database, DB2, there is another calendar table CAL2. What ...
5
votes
2answers
2k views

Powershell script executing within SQL Server Agent

I am trying to use Powershell within a SQL Server Agent job to download a zip file. The script uses PuTTY (PSCP.exe) to download a zip file from a SFTP site. The issue I am having is that when the ...
0
votes
1answer
112 views

Logging of incorrect row in SQL Server Integration Services

I newbie to SQL Server Integration Services and I have a problem: Data loaded from file looks like this: 1 'a' 'b' 2 'a' 'b' 1 'c' 'd' And this rows would be loaded in table like this: CREATE ...
2
votes
1answer
122 views

mysql read slave to fetch entire database on start

I am building a standart infrastructure, where writes are going to master db, and reads are going to slave dbs. The idea is that when I need more read power - I just spawn more MySQL slave servers. ...
0
votes
1answer
392 views

SQL Server using incorrect plan

In our application we have the following tiers for data processing: .NET orchestration application that works out which SSIS packages to fire SSIS packages that do much of the work and call Stored ...
2
votes
1answer
1k views

Data archival strategy that handles schema changes?

I am working with a legacy application that has about ten years of customer data. A majority of this data is not used in day-to-day operations but there is a business requirement to have the data ...
6
votes
3answers
11k views

How to map another server through SQL Server Management Studio

I am trying to map another server by giving the command EXEC xp_cmdshell 'NET USE H:\\568.256.8.358\backup_147 1234abc /USER:cranew /PERSISTENT:yes' I got an error with this: network path ...
2
votes
1answer
745 views

Recovering from a stuck query

I have a big DELETE query (deleting 20M rows from a 600M row table with condition according to indexed column) that is stuck - running already for 17hrs. Because it's an InnoDB table, killing it will ...
1
vote
3answers
127 views

Storing summed values

I'm trying to create a database to store values for Profit & Loss statements and I'm wondering what the best way to structure this would be. Specifically, amounts that are are equated from other ...
4
votes
1answer
914 views

Select one name per person where spelling variations exist

I have a source table that contains Employee IDs and names. The employee names may be listed multiple times with variations on the exact spelling (see 'source table' for example - note the middle ...
14
votes
2answers
13k views

For absolute performance, is SUM faster or COUNT?

This relates to counting the number of records that match a certain condition, e.g. invoice amount > $100. I tend to prefer COUNT(CASE WHEN invoice_amount > 100 THEN 1 END) However, this is ...
2
votes
2answers
2k views

remove almost duplicates based on insert time

Have a MySql table that records magnetic stripe swipe times from identity cards: CREATE TABLE `swipes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `personalid` varchar(20) NOT NULL, `swipe_time` ...
3
votes
2answers
15k views

mysqldump: Error: 'Can't create/write to file

Can't create temporary files on /var/tmp. mysqldump: Error: 'Can't create/write to file '/var/tmp/mysql.k6NKGk/#sql_5dc_2.MAI' (Errcode: 2)' when trying to dump tablespaces On my OS. id mysql uid=...
2
votes
1answer
381 views

Post replication powershell script - on subscriber

I need to execute a command before a replication executes on the publisher, and after, on the subscriber. I seem to have it working on the publisher, by adding another step in the replication agent. ...
5
votes
0answers
3k views

Availability Group reporting disconnected replica [closed]

I'm trying to configure availability groups in a VM environment so I can run some tests. I think I've got the group created correctly, I can see the Always on group on both servers. However when I ...
0
votes
1answer
802 views

Query performance and join hints, plan cost, and duration

Having some trouble identifying why a query's duration would decrease when using OPTION (HASH JOIN) or OPTION (MERGE JOIN), although plan cost increases. Background I have a reporting database using ...
3
votes
1answer
131 views

query discrepancies on very large postgres table

I have a fairly large table (25m entries) which stores tracking data, I am not a postgres admin by trade so this may be a simple problem. these two queries although similar are taking massively ...
2
votes
1answer
70 views

Is it possible to determine what part of a stored procedure is currently executing?

Say I have a stored procedure like this (assume that the table schemas are fine): CREATE PROCEDURE p_MyProc AS INSERT MyTable SELECT Col1 FROM Table1 INSERT MyTable SELECT Col2 FROM Table2 INSERT ...
2
votes
1answer
284 views

tempdb thrashing and mirroring permissions (SQL Server) [closed]

We have a client site that uses SQL Server. The site this morning was slow, and we realised that the primary database server was responsible for a lot of disk activity on tempdb (Server 2008, SQL ...

15 30 50 per page