[how to] How to arrange rows selected in MYSQL query? |
- How to arrange rows selected in MYSQL query?
- Looking for JET Blue (Extensible Storage Engine - ESE) administration tool
- Query with PIVOT fails with second LEFT OUTER JOIN to same table
- Why do I have hundreds of connections open
- How do I determine the licensing cost of Oracle Standard Edition for HyperV instances? [on hold]
- MDX: How do I combine/merge/union two Measures dimensions with calculated members?
- Why is there a difference between these transaction DMVs in SQL Server 2008 R2?
- How to use column name 'use' in SQL Server [on hold]
- Joining on a field with different values
- Restrict range of dynamic ports available to SQL Server
- If a transaction is "committed" , is it then saved for sure?
- Trigger and temp table or materialized view
- Is MSDTC required for SQL Server 2012 Fail Over Cluster?
- Optimize IN clause in where query with order by - MySQL
- Issue moving database between servers (cannot find .frm file even though it's there)
- Microsoft SQL server 2012 error 18456 with domain credentials
- How to set identity_insert to on in SQL Server
- Double queue reader or is it still busy?
- Oracle: Tables and Views missing from the all_objects dictionary
- put number inside database sqle server in arabic format I do not want it in english format I need it in arabic [on hold]
- Performance setting for MyISAM tables - my.cnf file
- Possibilities to speed up InnoDB INSERTs and UPDATEs
- why do I have three copies of data/log files per database on same server instance
- How can I get my linked server working using Windows authentication?
- Connection to local SQL Server 2012 can be established from SSMS 2008 but not from SSMS 2012
- Inserting Records - How to get next incremented PK for each insert
- Mysql DB server hits 400% CPU
- Multiple database servers for performance vs failover
- Best way to delete very large recordset in Oracle
How to arrange rows selected in MYSQL query? Posted: 01 Oct 2013 08:46 PM PDT I'm fetching data from a table "TABLE_A", it's having Primary Key as "PK_ONE" (which is unsigned INT) . I'm fetching data from "TABLE_A" with where clause on PK_ONE ; Ex: SELECT PK_ONE from TABLE_A where PK_ONE in (2,88,3999,4,282,33399,1,394); When I'm using dataset mentioned above in PHP cursor; I want to ensure that data fetched comes in the sequence of values of "PK_ONE" in WHERE clause. Can you please give me some direction to achieve same? [Currently rows are coming in asending order] |
Looking for JET Blue (Extensible Storage Engine - ESE) administration tool Posted: 01 Oct 2013 06:44 PM PDT I am looking for database administration/viewer/editor tool for JET Blue / ESE databases - basically, any database using esent.dll. Something similar to HeidiSQL for MySQL. I would expect Google would return quick results especially as it is built into Windows but I could not find any tool for that. Can anyone recommend any (free or open source if possible) tool for that? Perhaps some of the other tools that support other database formats have an ESE "driver". Thanks in advance. |
Query with PIVOT fails with second LEFT OUTER JOIN to same table Posted: 01 Oct 2013 06:02 PM PDT I have a big query that contains a It appears to me that the HERE is a SQL Fiddle Schema Build for reference I tried to create a minimal sample for this question, the SQL statement below will not run in SQL Fiddle however so I dont know how much help this is. Here is the current query that works as expected. Sample output is along the lines of this (heavily trimmed for readability): The second query, I add a second join to the These are the error messages I received. It seems to me the |
Why do I have hundreds of connections open Posted: 01 Oct 2013 04:44 PM PDT I just had a transient issue with a development server. So this isn't urgent. I had a "successful" restore that wasn't So as part of checking I ran sp_who and found 307 open connections 2 minutes later when I ran it again there were 77 open connections But what I saw causing the connections was that there were 3 connections open from the SQL Server host using the NT Authority account to every single database on the server. I've never seen that before, and having spent 10 minutes playing with Google I can't see anything that looks like an explanation, so I was wondering if anyone knew what was going on. |
How do I determine the licensing cost of Oracle Standard Edition for HyperV instances? [on hold] Posted: 01 Oct 2013 02:02 PM PDT I'm confused by Oracle's licensing for their Standard Edition. My understanding is that licensing for the Standard Edition is determined by the number or physical processors (actual chips, not cores) available in the host machine. For example if I have a host box with 8 processors and I have 4 virtual machines running on it, Oracle's documentation says that each of those processors counts toward the license total regardless of how many are allocated to the virtual machine running the database. The part that confuses me is that Standard Edition is limited to 4 processors. Does this mean that I'd have to pay for 4 processor licenses, 8 processor licenses, or not be allowed to install Oracle Standard on such a box because it has too many processors? |
MDX: How do I combine/merge/union two Measures dimensions with calculated members? Posted: 01 Oct 2013 12:54 PM PDT I am trying to combine two dimensions in an MDX query. This produces results where all the I've tried the solution here, but I get '#Error' in my results with the message "Aggregate functions cannot be used on calculated members in the Measures dimensions". Any ideas? Thanks :) |
Why is there a difference between these transaction DMVs in SQL Server 2008 R2? Posted: 01 Oct 2013 02:45 PM PDT When I execute the two queries below, AND I've read the BOL for both 1 and 2 but don't see any clear explanation as to why the difference would occur. I get different results. The former query returns no results, but the latter returns active transactions with session and transaction ids. The EDIT I just reran the queries and now I get a result for the first DMV which has a |
How to use column name 'use' in SQL Server [on hold] Posted: 01 Oct 2013 01:52 PM PDT I have a database that I migrated from MySQL to SQL Server. One of the table's column names is I'm getting the error:
My insert looks something like: |
Joining on a field with different values Posted: 01 Oct 2013 06:22 PM PDT I am trying to join data from two completely different sources. One source contains an employee's schedule information, and the other tracks what they actually worked (like what time they actually took lunch or break). The problem is, the schedule program gives times as BREAK1, BREAK2, BREAK3, and LUNCH, while the tracking program simply lists them as Lunch and Break. I can join the data and get the lunches just fine, but the breaks are throwing me off. If I convert BREAK1, BREAK2, and BREAK3 to just "Break", I end up with too many segments because it is matching every instance with every other instance. Is there a way that anyone can think of to join these two pieces of information? Here is some sample data: This is the Scheduled Times: This is the Actual Times I am trying to get the difference (in minutes) between when they are scheduled, and when they are actually taking breaks. A correct example is: Thank you |
Restrict range of dynamic ports available to SQL Server Posted: 01 Oct 2013 11:33 AM PDT Is there a way to limit the range of dynamic ports available to SQL Server from the database side, or database server side? Our SOP is to use static ports across the network firewall and a vendor is having trouble locking down their ports. Theoretically, if we allowed a range of 1000 ports inside the dynamic range (49152–65535) across the firewall how would I limit SQL Server to only assign a dynamic port inside that range? |
If a transaction is "committed" , is it then saved for sure? Posted: 01 Oct 2013 12:13 PM PDT If a transaction is committed successfully, can I then be 100% sure that it has been written to the database AND to the log files? Can I be sure that the data is SAVED ? Today our log files had reached the limit of the drive and we got a lot of errors. Furthermore, some other services crashed. We increased the disk and restarted the server. During startup, the server did a "database recovery" -- can I be sure that everything is okay again ? |
Trigger and temp table or materialized view Posted: 01 Oct 2013 11:01 AM PDT I'm looking for the better/best solution to compare data in a table before update and after. This can be done with trigger and temp/global temp table or with read only m-view as far as I know. Would like to ask DBA community which solution is better, more efficient etc... The table is not big, less then 1000 rows. It may grow in the future, but not much. Which is better for big tables, with million(s) rows please? Thank you all. |
Is MSDTC required for SQL Server 2012 Fail Over Cluster? Posted: 01 Oct 2013 11:21 AM PDT I am making a 2 node SQL Server 2012 Fail Over Cluster, do I need to install MSDTC also? |
Optimize IN clause in where query with order by - MySQL Posted: 01 Oct 2013 11:41 AM PDT I am trying to optimize a query that using IN clause in WHERE to avoid file sorting. To make it easy , I created the following sample which shows the problem. Here is my query: Here is the result of explain, as you can see the query is filesort Here is my table structure How can I optimize the query? In my real table I can see the following information in error log: |
Issue moving database between servers (cannot find .frm file even though it's there) Posted: 01 Oct 2013 09:15 AM PDT I used MAMP on my local machine to make a little site with a mysql database. I moved all the site files over the to server. Great. The name of my database is roster and it has one table called users. I copied the 'roster' folder which contains the following files: I put the 'roster' folder in the mysql directory. I run the following: No error. Awesome. But when I run the following: Then I receive the following error: Furthermore, when I login to the server and login to mysql. I see the database and table: I checked the 'roster' folder and it contains the four files mentioned at the beginning of this post. The file is where it supposed to be, right? Did I move the database wrong? What gives? Any ideas? |
Microsoft SQL server 2012 error 18456 with domain credentials Posted: 01 Oct 2013 08:53 AM PDT I have a SQL server 2012 setup to use windows authentication. Remotely I can connect to "Server A" no problem with domain credentials but when I try to locally connect to "Server A" with SSMS it errors out to say that there is a login failure. I have all the correct permissions set I beleive any other suggestions? |
How to set identity_insert to on in SQL Server Posted: 01 Oct 2013 01:52 PM PDT EDIT: See answer here: http://stackoverflow.com/questions/19119303/how-to-set-identity-insert-to-on-in-sqlserver I get the command Whenever I run the command under either account I get the result of '0 rows affected', then I am unable to run the query to insert the rows I wish to insert with the following error:
Additionally I've tried to include the schema name in the query like: but I get the following error:
Also of note, my project looks like: Does anyone know a solution to this problem? Thanks. |
Double queue reader or is it still busy? Posted: 01 Oct 2013 08:45 AM PDT I came across this line in the verbose log on replication QueueReader Agent job startup.
The first clue I had that something was wrong was the vague replication message:
Replication IS working but Replication Monitor is showing red X's. This second error has shown up from time to time and sometimes goes away. For a while now I though this was a bug as it has been reported a few times on Connect. Assuming the first quoted error is correct, how can I find the double QueueReader or previous request?
Returns nothing.
Returns 1 row on each distributor. Setup:
Both Svr01 and Svr02 are reporting these errors. Resources: |
Oracle: Tables and Views missing from the all_objects dictionary Posted: 01 Oct 2013 01:17 PM PDT I have a couple of database instances that are having the curious issue where tables and views do not show up in the all_objects dictionary which is causing some issue with certain schema viewing applications. Not all are missing, but there is only like a dozen of the 130 or so tables/views that are in the schema. If you query all_tables or all_views, they all show up just fine. If you select/update/delete with those tables, it works fine. Any one know of what types of things I should be looking at that would cause this? BTW, I am not the DB administrator to this DB, I'm just trying to figure this out for our client. I don't have full access to the DB. |
Posted: 01 Oct 2013 02:49 PM PDT I do not want the number in English format I need it in Arabic I am sorry my problem I inserted number in my table in English(e.g 5),but I want to replace it in Arabic format. because I need it in Arabic to return it in text box in my windows form . hope you get what I want thanks |
Performance setting for MyISAM tables - my.cnf file Posted: 01 Oct 2013 09:02 AM PDT I have a 4-core MySQL server with 4 GB of RAM, holding 19 MyISAM tables (total: ~164GB of data) and 32 innodb tables ( 5mb ) . QUESTIONS
|
Possibilities to speed up InnoDB INSERTs and UPDATEs Posted: 01 Oct 2013 09:41 AM PDT My website retains user sessions in an innodb table. This usually works well, but a few hundred times a day, the INSERT and particularly the UPDATE statements run slower. I'm monitoring when, and it turns out it's usually when a bot is hitting my site (googlebot for instance always gets the same session assigned, so each hit will require an UDPATE on the session table). I presume google hits me so hard that mysql can't keep up with updating the same record. Usually an update takes a few mills, but I've seen it reach a full second. My table btw has never reached more than 7000 records. Knowing that I have only 1 disk at my disposal, but still some free memory to spare, I was wondering what would be the best possibilities to enhance the UPDATE performance on this particular table (I'm not experiencing any issues on other tables as it's much less write intensive). |
why do I have three copies of data/log files per database on same server instance Posted: 01 Oct 2013 06:23 PM PDT OS: Windows 7 Professional Database: SQL Server 2008 R2 Standard Edition Just detected by SpaceMonger that, each of my databases on test instance has three copies of data files (.mdf) and log files (.ldf). they are located at three folders:
and they have exactly same file size and timestamp. I confirmed that I have no mirroring setup for any of my databases, neither do I have any special setup to enforce the database to have files splitted. The only suspicious setting I can find is:
This annoying problem has made my server available disk space very low and forced me to do housekeeping very often. any idea why does this happen? any methodology i can follow to find out what has been wrong? -- EDIT --- Thank you all for the comments and reply. We have identified the problem - not related to the sql database setting, but the folders themselves: the three folders have a setup to mirror each other. we have got our network team to investigate why it's so. |
How can I get my linked server working using Windows authentication? Posted: 01 Oct 2013 04:24 PM PDT I'm trying to get a linked server to ServerA created on another server, ServerB using "Be made using the login's current security context" in a domain environment. I read that I'd need to have SPNs created for the service accounts that run SQL Server on each of the servers in order to enable Kerberos. I've done that and both now show the authentication scheme to be Kerberos, however, I'm still facing the error: In Active Directory, I can see that the service account for ServerB is trusted for delegation to MSSQLSvc, but I noticed that the service account for ServerA does not yet have "trust this user for delegation" enabled. Does the target server also need to have that option enabled? Is anything else necessary to be able to use the current Windows login to use a linked server? |
Connection to local SQL Server 2012 can be established from SSMS 2008 but not from SSMS 2012 Posted: 01 Oct 2013 05:24 PM PDT I have two local SQL Server instances running on my local machine. The first is SQL Server 2008 R2 Enterprise Edition (named MSSQLSERVER) and the 2nd is SQL Server 2012 Business Intelligence Edition. My problem is with SSMS 2012 which can connect to distant servers but not the local 2012 instance; I can however connect to this instance from SSMS 2008. The error message I get when trying to login is
I must point out that I don't have the necessary privileges to access SQL Server Configuration Manager (blocked by group policy). Any help would be appreciated. |
Inserting Records - How to get next incremented PK for each insert Posted: 01 Oct 2013 01:54 PM PDT I'm using spoon to look for Here's some pseudo code for what I want to do:
Thanks for any guidance. |
Posted: 01 Oct 2013 01:42 PM PDT I have been facing problem with my database server quite a month, Below are the observations that I see when it hits the top. And then drains down within 5 minutes. And when I check the show processlist I see queries for DML and SQL are halted for some minutes. And it processes very slowly. Whereas each query are indexed appropriately and there will be no delay most of the time it returns less than 1 second for any query that are being executed to server the application.
Below url shows show innodb status \G and show open tables; at the time spike. And this reduced within 5 minutes. Sometimes rare scenarios like once in two months I see the processes takes more than 5 to 8 hours to drain normal. All time I notice the load processor utilization and how it gradually splits its task and keep monitoring the process and innodb status and IO status. I need not do anything to bring it down. It servers the applications promptly and after some time it drains down to normal. Can you find anything suspicious in the url if any locks or OS waits any suggestion to initially triage with or what could have caused such spikes ? http://tinyurl.com/bm5v4pl -> "show innodb status \G and show open tables at DB spikes." Also there are some concerns that I would like to share with you.
|
Multiple database servers for performance vs failover Posted: 01 Oct 2013 07:24 PM PDT If I have two database servers, and I am looking for maximum performance vs high-availability, what configuration would be best? Assuming the architecture is two load-balanced web/app servers in front of two db servers, will I be able to have both db servers active with synced data, with web1 to db1, web2 to db2 setup? Is this active/active? I'm also aware that the two db servers can have their own schema to manually 'split' the db needs of the app. In this case daily backups would be fine. We don't have 'mission critical data.' If it matters, we have traffic around 3,000-7,000 simultaneous users. |
Best way to delete very large recordset in Oracle Posted: 01 Oct 2013 12:22 PM PDT I manage an application which has a very large (nearly 1TB of data with more than 500 million rows in one table) Oracle database back end. The database doesn't really do anything (no SProcs, no triggers or anything) it's just a data store. Every month we are required to purge records from the two of the main tables. The criteria for the purge varies and is a combination of row age and a couple of status fields. We typically end up purging between 10 and 50 million rows per month (we add about 3-5 million rows a week via imports). Currently we have to do this delete in batches of about 50,000 rows (ie. delete 50000, comit, delete 50000, commit, repeat). Attempting to delete the entire batch all at one time makes the database unresponsive for about an hour (depending on the # of rows). Deleting the rows in batches like this is very rough on the system and we typically have to do it "as time permits" over the course of a week; allowing the script to run continuously can result in the a performance degradation that is unacceptable to the user. I believe that this kind of batch deleting also degrades index performance and has other impacts that eventually cause the performance of the database to degrade. There are 34 indexes on just one table, and the index data size is actually larger than the data itself. Here is the script that one of our IT people uses to do this purge: This database must be up 99.99999% and we've only got a 2 day maintenance window once a year. I'm looking for a better method for removing these records, but I've yet to find any. Any suggestions? |
You are subscribed to email updates from Recent Questions - Database Administrators Stack Exchange To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment