[how to] Does MySQL close cursor if stored procedure encounters an exception? |
- Does MySQL close cursor if stored procedure encounters an exception?
- Branching Source Control at development
- SCCM 2007 SQL Query Code - Help Needed
- Merge reports 'You must rerun snapshot because current snapshot files are obsolete', gets caught in Death Loop
- Experience with Scalearc sharding?
- Unify case when changing fields values
- Updating an indexed column performance impact in SQL server
- Use of Case Statement result in Join
- MySQL on DRDB very fragile
- Failover scenario with principal "hard down"
- SQL Agent still attempting replication for deleted publication
- SQL Server backup fails on disk space error
- Does failed task considered to be run to completion in SQL Server maintenance plan terminology?
- query cache hit value is not changing in my database
- postgresql replication - pg_stat_replication is showing empty columns
- SQL-Server 2008R2: Maintenance plan fails - failover server
- SQL Server: subscriber as publisher and hierarchical replication
- Cannot see Green Button with white arrow in object explorer; DTC config problems?
- MySQL failover - Master to Master Replication
- multi-master to single-slave replication at table level with PostgreSQL or MySQL
- FOR UPDATE or INSTEAD OF UPDATE Trigger?
- How to search whole MySQL database for a particular string
- SQL Server connection failed for domain user from Mac OS machine
- Is it bad to assign specific processors to SQL Server 2008 R2 cluster instances?
- Trouble setting up Nagios to monitor Oracle services
- How to user the Tablediff Utility with Replication Filters
- SQL Server Database Mirroring : strange client application behavior upon failover
- What are the advantages of having a centralised SQL database server for development?
- SQL Server Rebuild/Reorganize Fragmented Indexes causes CRC error or consistency errors
- some SQL Server MSX targets show as Normal, Blocked
Does MySQL close cursor if stored procedure encounters an exception? Posted: 25 Sep 2013 06:39 PM PDT I've seen two different approaches of cursor handling is MySQL stored procedures. Now I'm curious about their stability, due to potential Assuming, that Approach #1: Note that if Somewhere I've seen following... Approach #2: And now I'm a bit confused about Question: Which of this approaches is more accurate and reliable? If I'm not closing |
Branching Source Control at development Posted: 25 Sep 2013 05:38 PM PDT At my current employer, the developers are branching for development per story and merging for release in Git - and frankly I'm jealous. ...but I haven't been able to wrap my head around how a SQL Server DB workflow should work in this manner, especially considering tooling that I am aware of / using. So, I'm curious if anyone has some thoughts. ~Our SQL Server environment Each team has a dev server stack where stories are worked. There are 25+ databases per server. When product/project determine which stories are to release, those changes are merged to Dev Release - and eventually flow back to team dev. Dev Release is then used to script the deployment. Thus any ongoing projects (long term / third party integrations / etc) aren't included with the release. This means that there is not a point guaranteed where dev release and any team dev are fully synchronized. Also of note, the sequence of changes made to dev release are not related to the sequence that changes are applied within team dev... Some ponderings: One way (problem): If we have a single branch for each team dev server - it appears to be easy to keep in sync with tooling (RedGate Source Control, etc)... ...but prepping for a release (in Git) either means cherry-picking commits (too much work) or git copying files and losing dev commit history (too much work). (I assume that SVN's file deltas would preserve dev history - but would still be a pain (as its not a merge)... guessing) Although dev history is lost, we would still have a list of release changes - but that doesn't work for me. This feels wrong. Another way (problem): If we branch per story - then it would be fairly trivial to merge to dev release and preserve object history. However, there wouldn't be a single branch that matches the state of the database, and thus tooling (RedGate, etc) will always be complaining that the DB and the repo are out of sync. This feels annoying. At my previous employer, we branched for release using SVN. All forward development teams worked towards a common release - thus forward changes were developed against the trunk (or a dev branch reconciled to the trunk), and hotfixes were applied to the release branches. Depending upon the product, we had different workflows for publish - but the idea was similar. Most all the links I've found (even on this site) seem to point to that workflow - as described very well here: http://www.infoq.com/articles/agile-version-control However, all the teams (excluding hotfixes) were working towards a common release - thus the dev branches had to reconcile / merge. So, if we had a project / integration that wasn't in the release, we'd have to back out changes of the trunk for the freeze - and reapply once the next release cycle started. Annoying - but doable. Of note, the changes to the database could be applied in a serial fashion - as they were (mostly) all related. So, it's no surprise that tooling SSDT / RedGate / etc seem to be geared for this... So, just curious if anybody has any pointers, helpful URLs, or can point out where my ponderings have gone awry, I'd be grateful for the info. |
SCCM 2007 SQL Query Code - Help Needed Posted: 25 Sep 2013 05:25 PM PDT I am trying to write a report where I grab data showing all server collections with maintenance windows. How I want to do this is to show only those server collections where those computers are also members of my "All Server" collection as well. So as to identify them as servers. I cannot use the OS caption like '%Server%' because some of these computers are also Windows 7, but are being used as a server role. Here is the code I came up with, but the output is blank. Any help would be very much appreiated. Thank you very much |
Posted: 25 Sep 2013 06:56 PM PDT We have a very large Merge publication for a data warehouse with some large (.bcp files on the order of 20GB) fact tables that is causing us tremendous trouble. Specifically, we created a publication and a subscription, and things ran OK w/ a couple hiccups (disk space). After the first hiccup (log space exhausted) we saw this:
On restart, it did pretty much what one would expect (went through the process, skipping things it had already done). At the end we saw the 'nothing to do' message, but immediately it went back into the ftp/apply process, failing b/c when it tries to apply the .sch file 'can't drop the table because it is being used in replication'. So things are obviously hosed. Restarting from zero might be advised but we did the 'remove publication' sproc on the offending subscriber last night so we should have been clean. Also, this whole process (downloading and applying) took 9 hours, so if possible I would like to get to the root of it before restarting the process. Why would the snapshot have become obsolete in such a short period? What could have gone awry? If you have any questions or need info, let me know. |
Experience with Scalearc sharding? Posted: 25 Sep 2013 06:34 PM PDT Does anyone have experience with Scalearc sharding and it's ability to scale ? Does Scalearc needs to have the whole data in memory or does it behave well with disk storage ? I'm thinking to big database application like 10TB and above. |
Unify case when changing fields values Posted: 25 Sep 2013 04:16 PM PDT I have the following code: I want to unify the I want something like this: Here, @AaronB says that the |
Updating an indexed column performance impact in SQL server Posted: 25 Sep 2013 01:08 PM PDT I am trying to understand is there any performance impact if I am trying to update a column which is the key column of a non-clustered index in SQL server 2008? For e,g I have a column IsActive in the table TestTable. I have created a non clustered index on column IsActive. Now I am trying to update the value of the column IsActive through an update query like I need to understand will this perform better or not having the index on it will be better. I am asking his as reindexing takes place when index vales are updated. So will this reindexing have a impact on the query performance? Note : The table has excess of 100 million rows. |
Use of Case Statement result in Join Posted: 25 Sep 2013 12:18 PM PDT Let's say I have a Case statement, something like this: Is there a good way to use that value in a Join (ideally without the use of a derived table)? Ideally, I have another table named |
Posted: 25 Sep 2013 11:51 AM PDT My website (a Magento store) runs perfectly fine most of the time, until at some point MySQLd gets hammered with a few more INSERTs than normal, and then locks up. I run MySQL on Linodes with Debian 7.0 and ext4 on DRDB (for failover). When it locks up, no queries are passed through and all activity is halted. I then SSH into the machine and see that the load is at 0.00, and the mysqld process itself is in Sl mode. I can't find any dead or zombie processes. I also tried to issue Where can i start to find out the issue of this? Can it be related to DRBD or ext4 somehow? Can it be the issue of some mysqld setting hitting the ceiling? This is my custom my.cnf: https://gist.github.com/jonathanselander/0c4f22ba06b613083d3c |
Failover scenario with principal "hard down" Posted: 25 Sep 2013 02:59 PM PDT My company has a failover pair of SQL Server 2005 instances, which provide database availability for a UL-licensed alarm/call center, where uptime and availability are critical for life safety. Here's an example line from the connectionStrings of one of the business-critical applications (sanitized for our protection): About half an hour ago, this was the scenario as we believe it to be:
Our theory was that, because Principal-DB was not in a state to respond to connection requests at all, when it would normally refuse such connections quickly if it were in the restoring state, the client applications ended up waiting for the entire allotted connection timeout (default, 20 seconds) for the primary server to respond, then returning the timeout error without ever attempting to connect to the listed failover partner. The quick fix was to push an update to the client application containing an App.config that swapped the Data Source and Failover Partner instances, so Mirror-DB was now the server to which the app attempted to connect first. When we fail back to Principal-DB, we will have to undo this change with another application update. I need a more permanent fix. This was not our expected behavior for a failover pair, and it cannot be allowed to happen again. There has to be a way to configure the client application so that it will correctly try to connect to the failover partner in this circumstance before returning an error. |
SQL Agent still attempting replication for deleted publication Posted: 25 Sep 2013 07:58 PM PDT We recently retired a replication publication, deleting each subscription (push subscriptions) and then deleting the publication, all from within SSMS. However, we continue to get the following message (once every minute) in the four days since deleting this publication.
Why is it still trying to run a deleted publication, and how do I stop it? Additional information: This is on SQL Server 2008 SP3 running on Windows Server 2008 R2. |
SQL Server backup fails on disk space error Posted: 25 Sep 2013 01:35 PM PDT SQL Server 2008 R2 RTM running on Windows 2008 64bit. Having problems backing up a single database with the following command The database backs up just fine for a while Then I get an error about diskspace
This doesn't make any sense because there is over 800GB of available disk space and the backup is using 121GB. In SQL Server's logs I get this message Some information:
Any assistance on getting to real cause of these backup failures would be appreciated. Thank you Update 16:48 As of R2, Compression is a backup option on standard. Thank you RLF. Still having the same problem with or without. The only difference is that the backup fails at 18% without compression. Decided to monitor disk space to make sure nothing else was eating up GB during the backup. As expected, available disk space went down to 600GB while using compression and 400GB without. Disk space never dipped below 400 though. |
Does failed task considered to be run to completion in SQL Server maintenance plan terminology? Posted: 25 Sep 2013 03:02 PM PDT The replies to my previous question: "How to specify a SQL Server maintenance plan subtask to run unconditionally on success or failure of preceding tasks?" answered me that I should change "Evaluation operation:" in my maintenance plan from "Success" to "Completion".
Though, I am still in doubt about the term "Completion" and that the proposed solution will completely address my situation. All tasks are configured over "All user databases" that:
So, the nightly databases backup (penultimate) task in screenshot above failed. There is no diagnostics or logging except the fact that all tasks failed. I corrected the situation by detaching the culprit offline database. So, after that, maintenance plan job started to complete successfully (with backup task). But I could not understand: Some doubts remain because I made other changes which I am sure could not prevent maintenance pla completion. But who knows... UPDATE: As I could see by the duration of maintenance plan job in comparison to the successful job runs, the the tasks were not even started because their corresponding previous task did not start and they did not start because probably failed to find "All user databases". So, the definition of:
IMO. does not assure the previous task completion because it could have been simply not being started and run at all |
query cache hit value is not changing in my database Posted: 25 Sep 2013 06:22 PM PDT The query cache hit value is not changing in my database only for some queries.If I write the query cache hit has changed, but if I execute the following queries for two to three times the query cache hit is not changing. The queries as follows: like this. I don't know what is the problem. The table, which contains 64500 rows: and the query: and my settings are Why is this? |
postgresql replication - pg_stat_replication is showing empty columns Posted: 25 Sep 2013 12:55 PM PDT I've a postgresql 9.2 streaming replication setup. It appears that the slave is getting the updates from master and is in sync. I've verified it by looking at pg_xlog dir and process list. $ ps aux | grep 'postgres.*rec' postgres 26349 2.3 42.9 38814656 18604176 ? Ss Sep20 24:06 postgres: startup process recovering 000000010000026E00000073 postgres 26372 4.9 0.1 38959108 78880 ? Ss Sep20 51:27 postgres: wal receiver process streaming 26E/731E05F0 And the startup logs on the slave also look alright. 2013-09-21 03:02:38 UTC LOG: database system was shut down in recovery at 2013-09-21 03:02:32 UTC 2013-09-21 03:02:38 UTC LOG: incomplete startup packet 2013-09-21 03:02:38 UTC FATAL: the database system is starting up 2013-09-21 03:02:38 UTC LOG: entering standby mode 2013-09-21 03:02:38 UTC LOG: redo starts at 26E/71723BB8 2013-09-21 03:02:39 UTC FATAL: the database system is starting up 2013-09-21 03:02:39 UTC LOG: consistent recovery state reached at 26E/75059C90 2013-09-21 03:02:39 UTC LOG: invalid xlog switch record at 26E/75059E98 2013-09-21 03:02:39 UTC LOG: database system is ready to accept read only connections 2013-09-21 03:02:39 UTC LOG: streaming replication successfully connected to primary What worries me is that the archive=> select * from pg_stat_replication; pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | state | sent_location | write_location | flush_location | replay_location | sync_priority | sync_state -----+----------+------------+------------------+-------------+-----------------+-------------+---------------+-------+---------------+----------------+----------------+-----------------+---------------+------------ 999 | 16384 | replicator | walreceiver | | | | | | | | | | | (1 row) Is this the expected behavior? I remember seeing values for client_addr, sent_location, replay_location etc. when I did a test run some time back. Is there anything that I'm missing? |
SQL-Server 2008R2: Maintenance plan fails - failover server Posted: 25 Sep 2013 09:20 PM PDT I am trying to get a maintenance plan (called New HS BKUP) to execute and I am receiving the following error: I have 2 databases in a failover setup. The one that I'm referencing here is the secondary/target server. I had the server named Here are some queries that I've ran:
So what I'm getting from these results is that the job that I'm trying to execute is owned by The server name isn't even Before I hit this problem I worked on getting the mail to send (which it does now). In order to do this I had to force regenerate the master key, in case that is important here. |
SQL Server: subscriber as publisher and hierarchical replication Posted: 25 Sep 2013 04:23 PM PDT In Oracle Streams one way replication from one DB to another is a basic block for many replication topologies (N-way, hierarchical, combined and so on), and changes could be captured and applied for the same table at the same time. But I can't find anywhere in SQL Server documentation whether table (article) could be a source (publisher) and destination (subscriber) simultaneously. Is it possible, for example, to setup bidirectional replication using two pairs of publisher->subscriber transactional replication? Naturally I am more interested in multi-level hierarchy: for example one table is replicated from root node through intermediate nodes to leaves, second one - from leaves to root, and third one - bidirectionally, and for all tables intermediate nodes could perform DMLs to be replicated too. With Oracle Streams it is easy to achieve, and even more sophisticated configurations are possible, but are they with SQL Server? UPDATE: It seems it is with use of merge replication and republishing (http://msdn.microsoft.com/en-us/library/ms152553.aspx), but what about transactional replication? |
Cannot see Green Button with white arrow in object explorer; DTC config problems? Posted: 25 Sep 2013 02:23 PM PDT I have SQL Servers across locations setup for replication. One of the SQL Server instances that I installed, running locally I can see the green button with the white arrow in the object explorer when I connect to it. However, when I connect to it from any other location, I cannot see that or neither can I start or Stop the SQL Serer Agent; even though locally I am able to do that. Additionally, the MDTC doesn't has only 2 items sent both with were rejected, where as other servers have 100's committed and sent. Is there something wrong with the DTC settings? Please help. |
MySQL failover - Master to Master Replication Posted: 25 Sep 2013 05:23 PM PDT My company is trying to implement a MySQL failover mechanism, to achieve higher availability in our webservices tier - we commercialize a SaaS solution. To that end we have some low-end VMs scattered through different geographical locations, each containing a MySQL 5.5 server with several DBs, that for the time being are merely slave-replicating from the production server - the objective up until now was just checking the latency and general resilience of MySQL replication. The plan however is to add a Master-Master replication environment between two servers in two separate locations, and these two instances would handle all the DB writes. The idea wouldn't necessarily imply concurrency; rather the intention is having a single one of the instances handling the writes, and upon a downtime situation using a DNS Failover service to direct the requests to the secondary server. After the primary comes back online, the b-log generated in the meantime in the secondary would be replicated back, and the DNS Failover restored the requests back to the first one. I am not an experienced administrator, so I'm asking for your own thoughts and experiences. How wrong is this train of thought? What can obviously go wrong? Are there any much better alternatives? Bash away! Thanks! |
multi-master to single-slave replication at table level with PostgreSQL or MySQL Posted: 25 Sep 2013 01:23 PM PDT Here is my scenario I've read similar questions and they recommend to start different instances at Slave1 and simply do MasterN-Slave1(instanceN) replication, as instructed here: Single slave - multiple master MySQL replication That would be piece of cake, but running different instances might be a waste of resources. I really want to achieve this with an single DBMS instance at Slave1, and if possible with PostgreSQL; but can try with MySQL if there is a solution for this. Any help is appreciated. |
FOR UPDATE or INSTEAD OF UPDATE Trigger? Posted: 25 Sep 2013 06:42 PM PDT I am working on my project at university - database in MS SQL Server for some sort of travel agency. I would like to create a trigger to check if I can add another reservation for specific Holiday (i.e. Hawaii 01-08 Sep 2013). I wrote a trigger: 'FOR UPDATE','FOR INSERT', but I have problem with checking availability. When I check No. of places left the inserted/updated reservation is already in DB so I cannot fill last place. Of course I can change the trigger to 'INSTEAD OF UPDATE' but I do not know if it is a good solution. I have more constraints in this trigger so I do not know if I should change them too. Additional constraints I have are:
Here you can find part of my DB Diagram: http://s11.postimage.org/t7m32amrn/Scheme.jpg I hope it will help everyone to understand what I mean. I would be very grateful for any help. |
How to search whole MySQL database for a particular string Posted: 25 Sep 2013 12:22 PM PDT is it possible to search a whole database tables ( row and column) to find out a particular string. I am having a Database named A with about 35 tables,i need to search for the string named "hello" and i dont know on which table this string is saved.Is it possible? Using MySQL i am a linux admin and i am not familiar with databases,it would be really helpful if u can explain the query also. |
SQL Server connection failed for domain user from Mac OS machine Posted: 25 Sep 2013 02:08 PM PDT I have SQL Server 2008 R2 SP1. I am using connection string to connect to SQL Server. In connection string I am passing the driver path, server name, TCP port number, user name with which I want to connect, password , DSN name, TDS driver version number, db name.
But if I try with normal domain user, I am getting the SQL Server connection failed error. After searching about it I found that some authentication is failing. Can anyone help me in resolving this issue? I believe that some settings need to be changed or there should be some modification on connection string. Please help me in it. Thanks, Tausif. |
Is it bad to assign specific processors to SQL Server 2008 R2 cluster instances? Posted: 25 Sep 2013 08:14 PM PDT I have a SQL Server 2008 R2 failover cluster with a passive node and an active node. The servers are physically identical. I have two instances of SQL Server, one set to use all the CPUs in the first 3 NUMA nodes, the other set to use all the CPUs in the 4th NUMA node. This seems to be working okay, even when failover occurs, but is this a bad idea? What would happen in failover if the passive server didn't have as many processors? |
Trouble setting up Nagios to monitor Oracle services Posted: 25 Sep 2013 03:23 PM PDT I've got an install of Nagios XI that doesn't seem to want to talk to any of my Oracle services here. I've pulled out the monitoring command and am running it manually, after setting I'm still fairly new to Oracle, but my googlings seem to indicate that As a note, there are multiple instances of oracle sharing the target box, but each seems to be intalled to separate partitions and are running their own listeners or various ports. |
How to user the Tablediff Utility with Replication Filters Posted: 25 Sep 2013 04:03 PM PDT I am using merge replication in SQL 2012. I am trying out the TableDiff utility to show non convergence. I see a problem with this approach though. This is because I am using parameterised filters to filter the subscriptions. In this instance the TableDiff utility tells me that there are missing rows in the subscription and generates the SQL to insert them. If I swap the source and destination around it generates a whole lot of delete statements to remove the records at the publication. This is not a correct result. It should just check the rows that exist at the subscriber, or understand the filters and know which rows should be at the subscriber. Can I use this utility in this instance? If not is there an alternative? I find it surprising that none of the documentation about this utility mentions this problem. |
SQL Server Database Mirroring : strange client application behavior upon failover Posted: 25 Sep 2013 07:28 PM PDT I am putting a HA SQL server environment up based on three SQL Server 2008 R2 machines and database mirroring. I'll name them :
The "company.intra" domain is the holding company's domain. Both database engines are listening on the static 52002 port so client applications access them the following way : Endpoints are called Service accounts are correctly configured and granted connect permissions on each other's endpoints. The mirroring feature is working fine, and databases correctly failover in case of TSQL manual failover or simulated system failure. The problem is with applications behaving strangely upon failover. The application testing context is the following : A small .NET app consisting of two textboxes and a button : When the button is clicked, it makes a stored proc call and fills Textbox1 with the sp's output and Textbox2 with the Data source property of my The connection string looks like : I launched this app from my laptop, located in another domain : Scenario 1:
Scenario 2:
I then tried to launch the app on the mirror server, locally via RDP Scenario 3
I checked MSDN for Ole DB connectivity behavior in case of failover to understand why in the third scenario the data source property of my connection was set to I learned that the failover server property of my connection string is only used in the case of an initial connection to the principal failing (explaining why scenario 2 correctly worked), but that in the case of an existing connection, the principal server has already provided the app with the mirror server address (in something called "failover cache"); the provided information is wrong, no listening port information and host name instead of FQDN thus failing outside the holding company domain. Next step, I checked the sys.database_mirroring view : And noticed that the "mirroring_partner_instance" field containes "MIRROR" instead of "mirror.company.intra,52002". A quick check to Books Online informed me that this is the field used to inform client apps of the failover partner upon initial connection to the principal DB Engine. So, finally, my question is : Is there a way to correct that behavior, and make the "mirroring_partner_instance" field hold the FQDN of the mirror, with the listening port? At endpoint creation? At mirroring configuration level (via an alter database statement)? DB Engine configuration? I already successfully tried setting up a SQL Server Native client alias at client computers as a workaround, however I'd really prefer if the principal server returned the correct failover information to client applications. |
What are the advantages of having a centralised SQL database server for development? Posted: 25 Sep 2013 12:46 PM PDT I have an idea to use for my fellow developers and basically wanted feedback. The idea is to have a centralised SQL Server database server for all developers to use. Each developer would have either own database on the server for the specific project (for example, Therefore if a developer was off for a week and we needed to hit a deadline we could easily hook into their database by changing our local config connection string. In addition to this their would be a test database (for example Can anybody think of any advantages and disadvantages for this approach instead of having everybody having their own local databases for development. |
SQL Server Rebuild/Reorganize Fragmented Indexes causes CRC error or consistency errors Posted: 25 Sep 2013 07:50 PM PDT In our test lab I've been experimenting with different jobs to keep our critical indexes from becoming too fragmented. I'm currently using the approach described here: sys.dm_db_index_physical_stats (under the Examples -> D section: Using sys.dm_db_index_physical_stats in a script to rebuild or reorganize indexes). Basically every hour I query the
When I run I'm not positive, but I suspect this error is caused by rebuilding or reorganizing indexes while my load tests are running in the test lab. I've searched around and found nobody else reporting this consistency error related to rebuilding indexes. You can see more information about my problem on my blog post: SQL Server Index Corruption: CRC Error & DBCC CHECKDB Is my approach to tuning indexes flawed? Should I not be trying to rebuild indexes on a "live" database (while traffic is hitting it)? Should I be using SQL Server Enterprise Edition's feature of rebuilding an index with (online=on)? Any help is appreciated. I'm running SQL Server 2008 R2 Standard. |
some SQL Server MSX targets show as Normal, Blocked Posted: 25 Sep 2013 08:17 PM PDT I've centralized my farm's jobs in MSX, covering about 70 instances of SQL Server. Seemingly randomly, at least once a week, several instances will stop accepting instructions. Within the MSX window Manage Target Servers, instead of all instances showing as Normal, they show as Normal, Blocked. I have failed to figure out why this happens. Defecting and re-enlisting usually cures this ill, but that means having to re-add that target in any appropriate jobs, so I would rather resolve the cause than endure the workaround. Any advice? I would like to keep using SQL Server's tools for multi-server administration, but am open to other avenues. |
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