2
votes
2answers
917 views

How do I determine what object two SQL process are contending over?

When long running Query#1 exclusively locks an object (table, index or page), and then Query#2 is executed by another user and becomes blocked on the lock held by Query:1, how would I get the name of ...
3
votes
3answers
417 views

Semi-Annual archiving of SQL Server database

Twice a year we create a static, archived subset of our production database. The newly created database contains roughly half of the tables as the production db (log/audit tables, etc. are not copied ...
2
votes
2answers
97 views

Is it Possible to have Multiple Named Instances with No Default Instance?

Using SQL Server 2008 R2, is it possible to install multiple named instances, and no default instance?
2
votes
2answers
867 views

How to compare performances of two databases

There are two database servers and I want to compare their performances. Both have Windows operating system and and Oracle (10.2.0.4 and 11.0.2) database. Both are OLAP databases with 15-20 users ...
6
votes
2answers
3k views

sp_executesql with user defined table type not behaving correctly

Problem Is there a known issue with user defined table types as parameters to sp_executesql? Answer - no, I'm an idiot. Set up script This script creates one each of table, procedure and user ...
0
votes
1answer
124 views

Checking for ApplicationName in a transaction through a Before Trigger

I would like to be able to build a trigger that checks the ApplicationName coming across on a transaction, and if the ApplicationName is of a certain value, then I want to throw an error, saying the ...
2
votes
2answers
771 views

mySQL 5.1 changed innodb_log_file_size getting error on restart

In order to optimise my MySQL 5.1 (running on Window 2008 WebServer). I changed a few InnoDB options in my.ini namely the innodb_buffer_pool_size and innodb_log_file_size. But now when I am trying to ...
3
votes
2answers
92 views

FK on NON Primary Keys

Is there any performance problem / difference if I have one Foreign Key that points to another table Indexed Fields that is NOT the PK ? Something like DECLARE @T1 TABLE ( T1_ID INT ...
4
votes
2answers
1k views

PostgreSQL unexplained table bloat

I have a table in a Postgres 8.2.15 database. The table bloated to almost 25GB but after running vacuum full and cluster the table size was dramatically smaller, well under 1GB. A few weeks later ...
1
vote
2answers
7k views

Single User mode can't be turned off and no users are connected

I have a database that is in Single User Mode. When I run this: exec sp_dboption 'MyDb', 'single user', 'FALSE' It fails, telling me that there is still a user connected. But when I run both of ...
1
vote
1answer
750 views

T-SQL, show a set of rows (specific column) as a field, for a better desc, please see the table relationship

I have been having a problem for quite a while now, that I can show with a sample of 5 tables (I'm actually dealing with more than 5!): -------------------------------- shipments ...
10
votes
2answers
6k views

Create View in specified database with dynamic sql?

I am writting a dynamic sql to drop and create view in different database. So I wrote: set @CreateViewStatement = ' USE ['+ @DB +']; CREATE VIEW ...
0
votes
2answers
343 views

Slony - Wait for Event

What is the behavior of Slony waiting for an event after lock set command? Basically I am trying to do a switchover and it takes a lot of time. We are following these steps: Lock Set Wait for Event ...
2
votes
2answers
684 views

MyISAM table keeps crashing. What are my options?

My MYSQL table is very large (250GB, around 200M rows). Recently I've been putting it through a lot -- parallel processes that do a large number of reads. It has started locking and crashing with ...
5
votes
1answer
941 views

Deadlocks in SQL Server

We're currently encountering a problem with out ASP.NET Application that results in deadlocks on the SQL Server database. A bit of background information I can provide is that we rely heavy on AJAX ...
3
votes
4answers
2k views

Optimize Query with Derived Table

I have the following query select ps.id, ps.title , IFNULL(s.likes,0) as num_likes , IFNULL(s.comments,0) as num_comments , IFNULL(s.ratings,0) as num_ratings , IFNULL(s.views,0) as num_views , ...
2
votes
1answer
608 views

InnoDB not enabled

I have a mysql database that when I run SHOW ENGINES; innodb does not show up as an engine. This seems strange as I have an identical server setup where innodb is enabled and in use. I have checked ...
1
vote
1answer
478 views

Good strategy to replicate MySQL data

I'm working on MySQL database, well i have a master instance and slaves, and i need to add a new slave to Master. I adopt a simple strategy to do so: Stop slave, import data to new slave, and finally ...
4
votes
4answers
828 views

How are foreign key indexes helpful?

How are foreign key indexes helpful? What is the criteria for keeping a foreign key index?
2
votes
1answer
16k views

SQL Developer cannot connect to Oracle database, yet sqlplus can!

I am having a problem connecting sql developer to my Oracle 10g database. sqlplus is able to connect fine, but when I try to open the connection in sql developer, I get 'ORA-12514 TNS does not know ...
1
vote
1answer
144 views

SSAS cell permission

I'm trying to restrict the access to the cube to certain dimension members. I Used the following function on the "Cell Data" tab of the role editor: [Magatzems].[Codi Magatzem].CURRENTMEMBER = ...
4
votes
2answers
781 views

How to resolve the master server shut down/unavailability in mysql with master - slave replication

Let us suppose that we have a master/slave setup and the application is running fine for the time being. All of a sudden the master server suddenly shuts down due to some problem. Now how can I ...
0
votes
1answer
839 views

Changing MASTER_CONNECT_RETRY - Anything pit falls to keep in mind?

We run your basic Master + Multi-slave mysql replication setup. We would like to lower the MASTER_CONNECT_RETRY parameter on each of our slaves. Is there anything beyond re-executing CHANGE MASTER ...
1
vote
1answer
126 views

Pointers to multiple index allocation mappings

In sql server 2008, the sysindexes table contains a pointer to the first page of the index allocation mapping. If a table consists of multiple IAM pages, will the sysindexes table contain a pointer to ...
4
votes
2answers
2k views

Does SQL Server have Date_Format function?

As title, does it? All I found is a list of predefined DateFormat that I can choose from, like this As I remember in MySQL (and PostgeSQL too?) you can defines your Date Format: i.e ...
5
votes
3answers
6k views

Are there any advantages in SQL Server Always On vs. SQL Server 2008 R2 Mirroring with only two nodes?

We are currently hosting a SaaS website on two Windows 2008 R2 / SQL Server 2008 R2 Servers. Would upgrading to SQL Server 2012 / Always On give us any advantages with respects to high availability? ...
1
vote
1answer
53 views

Database partition efficiency

Let's assume that you have a table that partitions on CATEGORY and SUBCATEGORY. Also assume that every subcategory can be mapped to a category, i.e. subcategory are proper subsets of categories. ...
3
votes
2answers
2k views

How can I optimize performance on a MySQL ndbcluster?

So, this is what I have: A simple table classes__to_students: |class |student| --------------- Math Alice Math Bob Math Peter Math Anne Music Bob Music Chis Music ...
1
vote
1answer
22k views

Oracle SQL create view privileges

This is more of a theoritical question but I need help ASAP. Here it is: With the appropriate use of SQL queries, grant as system administrators the required access privileges to a database user ...
5
votes
2answers
3k views

The order of INNER JOIN's

I would like to know if there are any rules about the order of INNER JOIN's in T-SQL 2000. I had 62x the performance on my query when my INNER JOIN that act like a filter is placed at first instead ...
1
vote
1answer
2k views

Copy blob from one row to another

I have a corrupt blob in a row. I'd like to replace that with another blob from the same table. How can I do that with sql statements only? (No file system access if at all possible.)
0
votes
2answers
1k views

Clustered index always better than Non-Clustered index?

When I have a clustered index on 'A', is it better to use this clustered index even if I have selection of 'A=constant'? If not, why? Thank you!
0
votes
1answer
124 views

TSQL - Bringing Data Together from Different Sources …refactoring PK and FKs

I have various offices and one central head office. Each office has its own SQL Server instance so each office has its own data set with its own set of IDs. Each office has already imported data ...
3
votes
1answer
1k views

Status for a service broker queue

Looking at the sys.service_queues DMV, I see that there are columns called "is_enqueue_enabled" and "is_receive_enabled". However, in the "ALTER QUEUE" DDL, there only seems to be a "STATUS" that can ...
0
votes
2answers
10k views

how to send mail from gmail smtp server by using the ssis [duplicate]

I'm just getting into sql-server SSIS, so forgive me if this is a basic question. Use the SSISwant to send mail from gmail smtp server. Smtp host =smtp.gmail.com port=587 , ...
2
votes
4answers
177 views

Non clustered index : performance issue

I have table which has schema as follows TABLE EMP EMPID - Primary KEY DEPTID - NON Clustered Index ISActive - NON Clustered Index It has other non index columns as well This table is ...
4
votes
2answers
6k views

mysql auto adjusting max connections values

I have set max connections to around 2000 in my.cnf file. max_connections=2048 I have upgraded to 5.5.20 and now I see the following line in the error log. 120201 19:40:24 [Warning] Changed ...
4
votes
1answer
4k views

What is a basic model for making a database with users and groups?

I'm trying to find the best way for a basic security system for a website. I know I want users and groups. I thought I'd have: user_table user_id user_name ... group_type group_id group_name ...
1
vote
1answer
164 views

Why isn't the result of an OpenQuery refreshing?

I'm trying to get some data from the Active Directory in SQL. I use the code: SELECT * FROM OpenQuery ( ADSI, 'SELECT objectGUID, objectSID, employeeID, lastLogon, mobile, telephoneNumber, mail, ...
5
votes
2answers
3k views

ORA-04031: unable to allocate bytes of shared memory (“”,“”,“”,“”)

I am receiving this error in a development database. It happens on some specific queries (simple inserts and deletes via .NET application). The database is used by one user, and error happens ...
2
votes
1answer
1k views

can mysql cli exit with error if no records returned?

I would like to execute a sql command in bash, and do something based on whether or not there was a result. e.g. $ LOOKUP=123; mysql -e \ 'SELECT id FROM table WHERE id='$LOOKUP dbname \ ...
1
vote
1answer
651 views

SSAS Modelling - many to many with one dimension

I'm having bit of a hard time modelling an OLAP cube. My analogy is this: I have a list of students. Each one has one Major subject of study, and zero or more minors, up to five in total. The raw ...
0
votes
1answer
3k views

restoring a table from sql file in postgresql through Windows Command prompt

Im trying to restore an sql file which contains the dumpf a table (with COPY commands) into a table into the database, it would be great if someone could share an example, as the pg_restore doesn't ...
1
vote
4answers
7k views

Attaching MDF without LDF

I only have an .mdf file of my database which is not attaching. I am using the following command: EXEC sp_attach_single_file_db @dbname = 'Test_Data', @physname = N'D:\Test_Data\Test_Data.mdf'; ...
2
votes
2answers
15k views

Oracle11.2g post-installation problem on Oracle Linux kernel

[question copied from stackoverflow] After installation of Oracle 11.2g in silent mode on the Oracle Linux kernel, I have the following error: [u01/app/oracle/product/11/bin] $ sqlplus sqlplus ...
5
votes
1answer
2k views

Why does it take so long to calculate an Execution Plan?

One of our customers has just upgraded to a new server. For a particular stored procedure the first time you execute it, is taking over three minutes to run. Subsequent runs are less than 1 second. ...
0
votes
2answers
1k views

SHRINK FILE works with SA but not as a normal user

My problem is that when I try to shrink the Log it works when I am logged in as SA but when I log in as a "normal" USER it does not shrink the log. (SQL Express 2008r2) I have tried to find a answer ...
1
vote
3answers
245 views

how to set default charset while create new field

Is there any command in mysql that makes the following: if I create a new field and I set the type to TEXT than it automatically knows that by this I mean not latin1_swedish_ci but utf8_hungarian_ci ...
3
votes
2answers
7k views

sp_send_dbmail with attachment

SQL Server 2008, connecting via SQL Server Authentication. I have a sproc in DatabaseA which calls sp_send_dbmail in msdb to send an email with a file attachment. The file is on the db server, not on ...
2
votes
1answer
693 views

MySQL wont start after modifying /etc/my.cnf

I have Linux Red Hat 5, with Zend Server and MySQL Server installed. I am trying to change the default MySQL port to 512. However, after making this change, MySQL will no longer startup. I get the ...

15 30 50 per page