[how to] SQL Database Query [on hold] |
- SQL Database Query [on hold]
- Use Oracle Wallet without autologin enabled
- How to get data comparations from to mysql tables
- Distributed Database Architecture Using MySQL Replication
- How to get MAX and MIN in GROUP BY query?
- No SQL instances show in upgrade setup
- Moving MySQL Cold Backup to Another DB Server
- Is it possible that a same INSERT operation performance will suddenly degrade?
- Query for View with unique entries from Database with repeated entries
- SQL Server 2012 Express fails at repair install, produces error 5178
- Example optimisic offline lock in SQL/PL?
- Error creating XTP Table in SQL Server 2014 CTP1 with Powershell
- Modeling a database for easy counting / reporting
- Putting a Select statement in a transaction
- INT or TIMESTAMP for the change time column in a logging table?
- Problem compiling view when it is referencing a table in an other view: insufficient privileges
- Help creating this query
- representation in ms-access
- "Cannot add or update a child row" when deleting a record?
- What is the best way to transport database fields from one database to another?
- How to setup SQL active/active cluster to achieve Blue / Green instance switching?
- copy package from schema B to schema C
- Time series data for ad platform
- If an account has REQUIRE SUBJECT, does it still need a password?
- MySQL users corrupt
- I have multiple sources INSERTing into a MySQL innodb table. My periodic aggregation script never makes accurate aggregates. Why?
- Log Shipping - RESTORE WITH STANDBY - on SQL Server 2012 keeps breaking
- Coding an accounting database from scratch?
- Converting dbo file from windows to linux
Posted: 15 Aug 2013 08:56 PM PDT select CustomerName, City,CustomerReferrelID, Customerid,CustomerCode, RightId,leftID from customers where rightid>62000 and leftid>=62000 and customerid not between 70000 and 75000 and customerid not in( 62927, 63056, 63060, 63069, 63072, 63126, 64095, 64101, 64103, 64112, 64119, 64142, 64153, 64159, 75095, 75237, 75401, 75489, 75512, 75530, 75540, 75558, 75566, 75655, 75656, 75787, 75897, 75898, 75928, 75936, 76081, 76198, 76486, 76716, 76717, 76731, 76774, 76777, 76929, 77165, 77184, 77571, 77592, 77731, 77732, 77925, 77941) order by rightid asc i want to get creationdate of customerid, leftid, rightid from customers table..all info is persent in customers table....customerid is primary key too. note: rightid, leftid are also customerid of some other customers thanks in advance. |
Use Oracle Wallet without autologin enabled Posted: 15 Aug 2013 06:39 PM PDT Question: is it possible to use the Oracle Wallet without enabling auto login in Wallet manager? Problem I'm facing: When auto login is disabled, the sqlplus call: fails with: When enabling autologin, it connects automatically. The expected behaviour is that, when autologin is disabled, you are asked the wallet password, and then connect. |
How to get data comparations from to mysql tables Posted: 15 Aug 2013 05:50 PM PDT What I have: The next structure: table_ChrM -> id (PRIMARY with auto increment) -> LOCUS (varchar (9)) Example value: (At1g30500) (Fixed Number of LOCUS values =173 rows) -> StartPoint (INT) (Exclusive value assigned by locus) -> EndPoint (INT) (Exclusive value assigned by locus) table_DMRs -> id (Primary with auto increment) -> StartPos (INT)(Exclusive value assigned by id) -> EndPos (INT) (Exclusive value assigned by id) -> Other... What I want : Select all values from table DMRs that fulfill the next condition, EndPos >= EndPoint AND StartPos <= StartPoint This for every LOCUS in table ChrM (Total of 173 times) and get an (LOCUS,EndPos,StartPos) array. For example, if I search with the At1g30500 LOCUS... I should get all values from table DMRs that fulfill the established condition. |
Distributed Database Architecture Using MySQL Replication Posted: 15 Aug 2013 06:46 PM PDT I've been task to move our web servers to the cloud for all countries that use our services for localization. The issue is, they must share the same data and therefore I need to set up some database architecture that reads/writes locally but is shared amongst other servers. I found an article that is pretty much what I want to do. Example below. http://www.compassitesinc.com/blogs/distributed-database-architecture-using-mysql-replication/ However my DBA says this is not possible. So my question is, is this possible? And if so, how? We are a LAMP shop (Redhat, Apache, PHP5, MySql 5.5). Thank you. |
How to get MAX and MIN in GROUP BY query? Posted: 15 Aug 2013 12:09 PM PDT In a simple query each row includes the first value of How to select something like |
No SQL instances show in upgrade setup Posted: 15 Aug 2013 11:35 AM PDT I'm trying to upgrade sql 2005 sp4 to sql 2008 r2. However on the upgrade wizard it doesn't show me any instances to upgrade. Any ideas? The instance is there just fine. I can connect via sql mgmt studio. |
Moving MySQL Cold Backup to Another DB Server Posted: 15 Aug 2013 12:38 PM PDT I am new to MySQL and want to know the info whether taking a cold backup from source and copying it onto new server with same version require any additional configurations settings to be changed. As I have gone through few of the tutorials, none of the config changes are required. Steps I am following
Thanks in advance |
Is it possible that a same INSERT operation performance will suddenly degrade? Posted: 15 Aug 2013 11:33 AM PDT I am working on a code performance test project. Let me first describe the enviorment: MsSql Server, Ria Service The automation test runs a big set of Test cases in midnight where have minimum network traffic or CPU usage on the server. The tests will calls the Ria Service and the Ria Service will make calls to the database to do same operation repeatedly for couples times. The performance metric is measured using Sql Profiling Trace, so we got all sql calls that made within each test and we can associates each of them. I notice sometime a same SQL calls in a test its performance will suddenly jump up. i.e. An INSERT operation of a test, usually is around 0.807 ms and its jumps to 200ms. I wonder is this a normal behavior? Say there is no environment impacts to the test... |
Query for View with unique entries from Database with repeated entries Posted: 15 Aug 2013 02:51 PM PDT I have a table with columns of Hotel names, city name and country name (of the respective hotels). I need to create a view of unique entries which will contain city name and country name columns. Any suggestions on how to go about it? Eg: There may be 100 hotels with city_name = Miami and country_name = USA. The view should however contain only 1 city_name = Miami and country_name = USA. I figured I'd need a loop to run through the table but still struggling to put together a query. Thanks in advance! |
SQL Server 2012 Express fails at repair install, produces error 5178 Posted: 15 Aug 2013 01:48 PM PDT My SQL Server Express Service will not start up. To produce this problem, I basically cloned my old hard drive (Which had SQL Server Express 2012 installed) to a new hard drive (Seagate Momentus XT 750). EDIT: I am adding info on how I cloned my hard drive as per request of SQLRockStar. I used Seagate DiscWizard. The program was producing errors when trying to clone the HD when using the simple "clone HD" command. So I "cloned" it the following way with the help of SeaGate Tech support:
Afterwards, I tried starting SQL Server Express 2012 on my Momentus XT and it would not start. So, I tried performing a repair installation of SQL Server, and it failed: see summary below: I looked at the error log and it said
I read that last error message and am really confused. I'm led to believe that this is a problem with SQL Server, My HD has 4096 sector size. UPDATE:More information: I have discovered that My old hard Drive was 512 physical sector size and my new HD is 4096 sector size. I hear that there are conversion issues between the two sector sizes, but SQL Server is the only program that is producing errors on my system, I don't understand it. |
Example optimisic offline lock in SQL/PL? Posted: 15 Aug 2013 10:31 AM PDT Can someone show me an example of an optimistic offline lock in an Oracle Stored Procedure? |
Error creating XTP Table in SQL Server 2014 CTP1 with Powershell Posted: 15 Aug 2013 09:55 AM PDT Having a couple of hours to play I created a SQL Server 2014 box on Azure and followed This SQLServerCentral Post to create a File Group and table with T-SQL. All good. I then decided to take a look at doing it with Powershell and I cannot create the table. I think it is to do with my Index creation. Can anyone see my mistake as I am going round in circles now. Here's the T-SQL And Here is my Powershell I can create the filegroups and the database with PS and use SSMS to create Memory Optimised Tables (XTP) and if I take out the index creation then the table creates but isnt XTP obviously. I know I can take the T-SQL and put it into Can anyone point me in the right direction? For interest only, maybe its not available in the CTP |
Modeling a database for easy counting / reporting Posted: 15 Aug 2013 08:05 PM PDT I have an app where user is known (user_id) and he can do several actions (action_id). Every time he makes an action I need to save the fact that he made it for reports/analytics. I guess it is similar to other analytic solutions and their db design. Once I have the data, provided with a time window (minutes resolution) I need to count for each user (all or some) the number of times he did actions and which actions he did. (sum all data grouped by action_id). Some assumptions:
I'm considering SQL, NoSQL and RRD to save the data. I put RRD here because it's easy to implement the insert of the data into statds+graphite. I'm concerned if I take this approach, the querying (although provided by graphite) will not be indexed and will probably have to count all the data whenever I ask for a window/user (no indexing). Another problem is that when querying all the data, all users info will be needed, resulting in reading all the files concurrently which I'm not sure is a good thing. SQL - Very easy implementation when inserting the data and querying. Easy to index, order and group by. However I'm not sure it's easy if I'm anticipating high traffic. Also, I'm not sure how effective is the count() of sql (haven't used SQL in the last few years) after group by. Can it offer parallel computation? NoSQL - Is there a solution out there that is the right fit for this type of scenario (perhaps a Map/Reduce algorithm to fast generation of counts in a time window?) Thanks for helping me model |
Putting a Select statement in a transaction Posted: 15 Aug 2013 01:05 PM PDT What is the difference between these 2 queries: And without transaction: What is the effect of having a If |
INT or TIMESTAMP for the change time column in a logging table? Posted: 15 Aug 2013 02:05 PM PDT We're having an argument over what to use for storing change date in a new log table for our site. One side says, use The other side says, use Since this is a logging table, we're not concerned about the 1970-2038 range of TIMESTAMP. Which makes more sense? |
Problem compiling view when it is referencing a table in an other view: insufficient privileges Posted: 15 Aug 2013 11:05 AM PDT Oracle 11g R2 Logged on: SYS / AS SYSDBA When I try to compile or create a view that is referencing local schema tables. It works fine. Problem does occur when I try to compile the same view referencing a table in another schema like schema.table in my query. Oracle throws the exception ORA-01031: insufficient privileges. Remember I am using SYS account (sysdba). |
Posted: 15 Aug 2013 09:05 PM PDT I'd like to integrate the following query:
INTO this query:
Here's a sql fiddle: http://sqlfiddle.com/#!2/bef27/1 Here's my schema: Thanks for the help! QUESTION: This query limits the data to only |
Posted: 15 Aug 2013 07:05 PM PDT I have a database in microsoft access. I want to know how to look up a singular datum from a reference table giving a dynamic set of values. Here is a representation of what I mean: I have the following tables: Points for Pushups(m): Fitness Tests: People: I want the query to use People.DOB and the Test date to find the age the person was during the test. I then want the query to use this value to determine which column to look in, and the value from reps to determine which row to look in coming back with the singular value and naming it points. for example I want bob to show Query: Does anyone know how to do the dynamic reference part? I know how to make the query and I know how to get age I just don't know how to use the values as columns in the reference table, I've seen it done, but long ago and never looked into it. |
"Cannot add or update a child row" when deleting a record? Posted: 15 Aug 2013 12:48 PM PDT I have the two following tables: I have the following foreign key constraint on the answers_main table: If I try to delete a record from survey_main that has child records in the
I understand what the error is saying, but shouldn't the fact that I have cascading deletes make it so this error would never be thrown? What am I missing here? UPDATE: Here is the command I am running and the error it throws, copied directly form the command line: Here is what is showing under last foreign key error when I do UPDATE #2: Below are the create table statements for both tables. |
What is the best way to transport database fields from one database to another? Posted: 15 Aug 2013 04:05 PM PDT I have two databases. The table name and fields name are different and field numbers are unequal. I need to transport all fields from one database to another. I can import the database as CSV format. I can use a PHP script which will accomplish this. But is there any other way to do this easily without any script. |
How to setup SQL active/active cluster to achieve Blue / Green instance switching? Posted: 15 Aug 2013 04:45 PM PDT I am wondering if anyone has ever used a multi-instance cluster (nee 'Active/Active') to achieve blue/green (or A/B) deployment scenarios, and what the best way of configuring it is (using SQL 2012 / Windows 2008 R2)? To be specific, the scenario I want to achieve is to be able to switch between which cluster instance is being connected to by clients without either the clients or the SQL instances knowing (I stress I'm not talking about node failover here). I'm envisaging that the best way to achieve this is something like:
This should hopefully enable me to do the following:
Joining the dots, it seems like this should be possible:
... but I've never seen a full example. Has anyone done it? Will what's proposed above work? What have I missed? |
copy package from schema B to schema C Posted: 15 Aug 2013 10:05 AM PDT I am in the next situation: I am using oracle 11g. I am connected to an user, lets say schema1, where are a lot of permissions. I want to create a script which will copy the Package1 (and its body) from schema2 to schema3. The script will be executed from schema1. PS: I already look for a solution and I am not interested in export/import or in using other tools from toad, sql developer etc. |
Time series data for ad platform Posted: 15 Aug 2013 12:05 PM PDT I am trying to figure out how to store time series data for an ad platform I am working on. Basically I want to know some strategies/solutions for storing billions of rows of data so that I can easily search it (about 6-8 indexes on the table) and get fast counts based on queries. I tried mySQL with the tokuDB engine and this seems to be very fast but is extremely slow when I try to do a COUNT query when the rows reached about 5-8 million. I was looking at some noSQL alternatives but since I want to be able to search this data this is probably not the best solution. I was using dynamoDB. I would have had to store the data is many places in order to account for all the searching on the data. What I am storing is a row in the database for each click on an AD that occurs. This table will grow very fast, especially when this site gets large. Another solution would be to separate this data per advertiser. This means each advertiser will have their own table where all their data goes into. This means it will be much smaller and the COUNT queries will be much faster. I can even split it up by advertiser and month. My goal is to give an advertiser the ability to search and display in a paginated way all their clicks. They should be able to get data between a time period and filter by about 5-8 other indexes if they want to. |
If an account has REQUIRE SUBJECT, does it still need a password? Posted: 15 Aug 2013 06:05 PM PDT I'm in the process of setting up SSL-secured replication between two servers. Each server has its own public/private keypair, and the CA cert is just the concatenation of the two public certs, like this answer. Now I'm updating the replication account with REQUIRE SUBJECT "exact subject of the client" Is there any practical value to also having a password on the replication account (IDENTIFIED BY "secret")? |
Posted: 15 Aug 2013 05:05 PM PDT I have a strange situation here: From time to time I cannot log in with any of my mysql users. I even cannot make a mysql dump. So I started searching in mysql files and I found that I searched about the problem and I found that there was some bug in the MySQL, but it was in the older versions (4.X). I'm running 5.5. Any ideas? Thanks! |
Posted: 15 Aug 2013 05:03 PM PDT I apologize in advance if this is a repeat. I'm not really sure how to properly ask for what I'm running into. I have a large InnoDB table set up. I have 3 sources that all INSERT concurrently at a moderately high volume (300-500 INSERT/s). I have a PERL script running on a cron job every 5 minutes that aggregates data from the last time it ran. It keeps track of the last record it processed by storing the auto_increment value of the last row in a metadata table. The aggregates are always off. But not by much. This has been so frustrating because it's just plain simple math (SELECT account_id,sum(sold) GROUP BY account_id). I have a suspicion that it has something to do with the transaction isolation (repeatable-read). I recently found FlexViews which looks very cool and might address my problem. But I was wondering if anyone could:
I'm like 95% sure the auto_increment thing along with transaction commit ordering is hosing me up, but I don't understand enough about DBs to really ask the right question. Oh, one thing to note, I've already checked over the field types. This issues isn't the result of rounding. |
Log Shipping - RESTORE WITH STANDBY - on SQL Server 2012 keeps breaking Posted: 15 Aug 2013 04:58 PM PDT We are using log shipping and My only intuition about this is that the primary database is not that dynamic. Therefore, when there are no transactions, this causes issues with the Any ideas, known fixes? I had it working for a few days by running a regular job that does heavy updating on two tables. When the job stopped running the log shipping setup quickly failed, unable to process the .trn file. I reset log-shipping and tried to see if it would keep running by just doing a small update, changing the value of one column of one record in a table, whoever it still failed. Thanks for all your responses. PS: An excerpt from our log 02/25/2013 13:00:00,LSRestore_DBDB01-A_BulldogDB,In Progress,1,DBREPORTS,LSRestore_DBDB01-A_BulldogDB,Log shipping restore log job step.,,2013-02-25 13:00:12.31 *** Error: Could not apply log backup file '\\dbsan01\DBBackups\LSBackup_BulldogDB\BulldogDB_20130225180000.trn' to secondary database 'BulldogDB'.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.31 *** Error: An error occurred while processing the log for database 'BulldogDB'. If possible restore from backup. If a backup is not available it might be necessary to rebuild the log. An error occurred during recovery preventing the database 'BulldogDB' (8:0) from restarting. Diagnose the recovery errors and fix them or restore from a known good backup. If errors are not corrected or expected contact Technical Support. RESTORE LOG is terminating abnormally. Processed 0 pages for database 'BulldogDB' file 'BulldogDB' on file 1. Processed 1 pages for database 'BulldogDB' file 'BulldogDB_log' on file 1.(.Net SqlClient Data Provider) *** 2013-02-25 13:00:12.32 *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.32 *** Error: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.(System.Data) *** 2013-02-25 13:00:12.32 Skipping log backup file '\\dbsan01\DBBackups\LSBackup_BulldogDB\BulldogDB_20130225180000.trn' for secondary database 'BulldogDB' because the file could not be verified. 2013-02-25 13:00:12.32 *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.32 *** Error: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.(System.Data) *** 2013-02-25 13:00:12.33 *** Error: An error occurred restoring the database access mode.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.33 *** Error: ExecuteScalar requires an open and available Connection. The connection's current state is closed.(System.Data) *** 2013-02-25 13:00:12.33 *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.33 *** Error: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.(System.Data) *** 2013-02-25 13:00:12.33 *** Error: An error occurred restoring the database access mode.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.33 *** Error: ExecuteScalar requires an open and available Connection. The connection's current state is closed.(System.Data) *** 2013-02-25 13:00:12.33 *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.33 *** Error: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.(System.Data) *** 2013-02-25 13:00:12.33 Deleting old log backup files. Primary Database: 'BulldogDB' 2013-02-25 13:00:12.33 *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) *** 2013-02-25 13:00:12.33 *** Error: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.(System.Data) ***,00:00:12,0,0,,,,0 |
Coding an accounting database from scratch? Posted: 15 Aug 2013 04:29 PM PDT My new medical practice is picking up fast and my homemade Libreoffice Calc spreadsheet is quickly becoming cumbersome to track patient visits, accounts receivable, overhead reconciliation, etc. Most practices use some sort of practice management software to handle accounting as well as scheduling, paying bills, submitting insurance claims, etc. but my budget can't afford to pay for overpriced software. Besides, I like to do things my own way, as well as support open source software. (I've already determined that I don't need this function to come from my electronic charts) Google searching didn't yield any templates and all of the accounting programs found were built for traditional businesses with purchasing, warehousing, human resource management, etc. that aren't adaptable for my needs and are unusable. You wouldn't think that I would be the first physician to attempt something like this, but the only thing that I could find is a design plan here: http://www.databaseanswers.org/data_models/ So now, I'm considering importing my spreadsheet into Libreoffice Base and slowly developing a custom accounting program for myself. However, I have no experience with databases and I don't want to spend a large amount of time on this if the amount or complexity of coding is beyond what I am willing to sacrifice from my study time. After browsing through textbooks at the local B&N, the first 1/3 of most books on MySQL, Filemaker Pro, and Access seem applicable for what is needed (complex mathematical modeling and data analysis is overkill), but I'm still hesitant about heading into this endeavor if the work load is larger than I care to handle. So, is it doable for someone with remote programming experience (qbasic, visual basic) and basic spreadsheet knowledge to code a simple custom accounting database? If so, is LibreOffice Base sufficient? What program or textbook would you recommend? Thank you! |
Converting dbo file from windows to linux Posted: 15 Aug 2013 09:05 AM PDT I have a .dbo file which is created from windows. This file is succesfully reloaded into the mysql database in windows. I need to reload the dbo file into the mysql/mariadb database in linux. How I convert the file that was created from windows to linux? |
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