Monday, November 22, 2010
Script Executor for DB2 free today
Download a free, fully functional trial version and see for yourself what you have been missing until now: http://www.xsql.com/download/script_executor/
Thursday, May 13, 2010
Can a simple Alter Trigger statement cause serious blocking?
After a quick investigation here is what I found: the Alter Trigger had blocked virtually everyone (it was a trigger on a critical, heavily used table) but it wasn’t the head blocker! Instead, a “long” query that appeared to be doing some sort of data aggregation had blocked the Alter Trigger statement. But wait how can that be, the query was written with the NOLOCK option - apparently the person who wrote it knew that this query could potentially wreck-havoc on the production system so he tried to make sure he wouldn’t block anyone. And yes, most of the time his query would not cause any trouble to “others” except… while the nolock directive ensures that the query takes no data locks the query still takes what’s called a schema stability lock (in other words it’s saying: I will read un-committed data but don’t change the schema on me while I am reading) which prevents the Alter Trigger from taking the schema modification lock it needs. So, while the Alter Trigger is patiently waiting in line to get the schema modification lock it needs the rest of the processes that desperately need access to that table start piling up!
Wednesday, March 25, 2009
Script Executor now supports DB2 and SQL Server Compact
Script Executor provides for deploying Sql Scripts to multiple target databases with a click of a button and allows you to:
- organize target databases into logical groups
- organize your Sql Scripts into containers and order scripts within each container
- map script containers to database groups
- order mappings and set precedence constraints
- get a comprehensive execution report
- view execution results in one integrated easy to navigate interface
Download your trial copy today from: http://www.xsql.com/download/script_executor/
Tuesday, February 24, 2009
The Script Executor you have been waiting for
The previos version of Script Executor has been renamed to "Script Executor Community Edition" and will continue to be available free of charge from our website.
Check the new Script Executor out - you will be impressed!
Download your free trial now: http://www.xsql.com/download/script_executor/
Thursday, January 15, 2009
Wrap your insert, update and delete statements on a transaction – ALWAYS
Well, we are humans and as such we are prone to making mistakes, sometimes, big and costly mistakes so, wouldn’t it be nice to “erase” our mistakes when we realize that? That’s what a simple Begin Transaction statement provides us – the ability to rollback our mistakes. How does one realize that he made a mistake – the first indicator is the “number of rows effected” which SQL Server reports – if that number is larger than you expected then maybe you made a mistake on your statement. How else can I tell? The cool thing is that SQL Server will let you read the uncommitted rows and see what your statement did - so you can issue a select and review the rows you just updated for example. If you do realize that you made a mistake you simply issue a rollback and all is good – it is like it never happened. If you are sure your statement did what you intended it to do then you issue a commit transaction and the changes you just made become permanent.
So again, be diligent and wrap every update, delete or insert statement in a begin transaction / rollback / commit transaction. It is much better to be safe then sorry!
Applies to: SQL Server, SQL Server Mangement Studio, Query Analyzer
Wednesday, January 14, 2009
SQL Server Query Governor way off on its estimates!
So, here is the scenario: as a diligent DBA you audit a SQL Server you just took over and you realize that the query governor cost limit is set to 0 which means in essence that as far as the query governor is concerned any queries can run on the server for as long as they need to run. That’s not good so you go ahead and set a high limit to start with, let’s say 300 seconds. Your thinking is that if a query that is estimated to run for more than 5 minutes ever comes across it should be stopped dead on its tracks before hundreds of calls from angry users reach your desk. To your surprise 5 minutes after you have set that limit you get a call from Jane Doe – she has seen this strange message on her screen she never saw before “you can’t execute this query because it is estimated to take 450 seconds”. Jane assures you that the report she is running usually runs in 5 to 10 seconds!
You go ahead and raise the limit to 500 seconds – Jane runs the report and sure enough the report takes less than 6 seconds! Something is not right – why is the query optimizer so grossly overestimating the time this query will take to run?
The answer is simple indeed – remember the query optimizer is estimating - estimates are made based on available information and if the available information is either missing or not accurate than the estimate won’t be accurate. The information that the query optimizer uses is in the statistics that SQL Server maintains and that is where you need to look. So, check it Auto Create Statistics is on first – if not no then you either need to turn it on or manually create the statistics the optimizer needs for estimating this query (this is the case when the necessary statistics information may be missing). Second check if Auto Update Statistics is on – if not you may need to update the stats to enable the query optimizer to produce a more accurate estimate.
Furthermore, you may find that all is in order that is no statistics are missing and the stats are up to date and yet the estimate is wrong! Try forcing a recompile of the query in question and see what happens. What may have happened is that SQL Server is using a cashed plan that was optimized for the “wrong” parameter values – that is values which are not good representatives of the dataset and based on that plan it is estimating that 10,000 rows will be returned from table a when in fact in 90% of the cases the number of rows returned from table a on that query is under 1000. By forcing a recompile of the query you are forcing SQL Server to re-evaluate and possibly pick a better plan this time based on new parameter values.
The objective of using the query governor cost option is to prevent “stupid” queries from degrading the system performance and not to prevent legitimate queries from running. So you may be forced to raise the limit but you should look at that as a temporary measure until you have dealt with the legitimate queries by taking the above mentioned actions as well as optimizing the query itself. Then, you should go back and start gradually lowering the query governor cost limit.
Friday, October 24, 2008
Stored Procedure naming conventions
- The most important thing is to have a standard that is accepted by the whole team and is followed (possibly enforced). The actual standard that is adapted is not very important. You should remember that there are two main goals that the standard (naming convention) is intended to achieve:
- Avoid potentially costly mistakes (for example dropping a table while you think you are dropping a view)
- Improve the productivity of the developers by making the code much easier to read (understand) and reducing the time it takes to locate an object.
- Given those two simple objectives it follows that the name of the object should tell us:
- What type of object it is;
- What is the base object on which this depends (if applicable)
- What does it do (Insert, Delete, Update, Create etc.)
- Other group identifiers if necessary
As far as specifics the only warning I am aware of (this was valid in SQL Server 2000 and I am not sure it applies to 2005) is that you should not prefix the stored procedures with sp_ - there is an article by Brian Moran on SQL Server Magazine (http://www.sqlmag.com/Article/ArticleID/23011/sql_server_23011.html) that explains why.
Wednesday, September 17, 2008
New version of xSQL Profiler released
The performance reports included in this release are:
- Top N queries by number of times executed
- Top N queries by CPU time
- Top N queries by duration
- Top N queries by number of Reads
- Top N queries by Read/Writes
- Top N queries by number of Writes
Completely free with no restrictions or limitations for up to two SQL Server instances. Download your copy today from: http://www.xsql.com/download/sql_server_profiler/
Tuesday, July 8, 2008
Tracking database schema changes - why and how
Why can’t we use the daily full database backups to always go back and figure out what changed when – after all the database backup does not only capture the data but it also captures the database schema? Yes, BUT:
- full database backups are in many cases only available for the last few days / weeks and you are not able to go back beyond that period;
- it takes a long time to let say restore 20 different versions of a large database and figure out what changed in the schema from one version to the other
in short, even if it is possible it is not practical.
A nifty feature in xSQL Object called “schema snapshot” addresses this issue in very elegant and practical way – it allows you to take snapshots of the database schema that:
- capture 100% of the database structure – not the data, just the schema;
- have a very small footprint thus enabling you to store them forever – the database itself could be in the tenths or hundreds of Gigabytes in size whereas the schema snapshot could be a few Kilobytes in size;
- can be compared with each other and with the live database instantly without having to restore anything – instead of taking days restoring and comparing trying to track down a change you can do that in minutes using the snapshots.
xSQL Object is free for SQL Server Express with no limitations and is also free for other editions of SQL Server as long as the number of objects in the database does not exceed certain limits that you can find here…
Wednesday, June 4, 2008
Making changes to your production SQL Server database
Here is a common scenario I run into:
A while back you have developed a web site that uses SQL Server on the back-end. The initial deployment was a breeze and everything worked perfectly. Now it is time to tweak and enhance the website with new features and functionality. In addition of making changes and additions in your code you start making changes to the database as well:
- added a couple of new tables
- modified a handful of tables (added columns, changed column types, added indexes, added /changed constraints, added new relationships etc.)
- added a few new stored procedures and views and modified some more of them
- added / modified a dozen user defined functions
- added / modified triggers
- etc., etc…
And all the while you diligently kept track of every change you were making knowing that you would soon need that log of changes.
After two months of hard work and sleepless nights, after testing and retesting everything you are ready to deploy your new version of the website – you know that deploying the application is a click of a button but the application is not going to work unless all the database changes you made are correctly propagated to the production database. You look at your long list of changes and realize that it is going to take hours to manually apply those changes. You wish you could just back up your development database and restore it on the production server but the production database contains live data which must be preserved.
So, you tell your client that you need to take the website off-line from 10 PM on Saturday night to 6 AM on Sunday morning. And when that day comes you take the site off-line, make a full backup of the database and start applying those changes one after the other. The cascading “can’t change this 'object' because it references this other 'object'” messages start to drive you insane but you have to do this so you keep moving along. After hours of frustration you seem to have reached the end of your list and as the sun is dawning you start getting more cheerful. You click on that “button” and publish your application – you run through some tests and everything seems to be working great!
You write an email to all people involved to let them know that you successfully published the new version of the website – pet yourself on the back and go to take a few hours of much deserved sleep. You have just fallen asleep when the phone rings and you get up again to take your client’s frantic call - customers are getting errors and not being able to complete their transactions – something is very wrong! Your nightmare scenario has come true! You jump into action again, quickly look at the error logs and try to determine if the cause is something you can fix quickly or whether you need to restore the old version of the database and application. Fortunately for you this time you discover that the culprit is a single Stored Procedure that had been modified but which somehow you missed. You change that SP and everything is fine – you are finally relieved, it could have been a lot worst!
The question is why anyone would go through this pain when they can use a tool like xSQL Object which in matter of minutes can identify all the database changes that were made and generate a safe SQL change script that will propagate those changes to the production server. It appears to be even more puzzling when considering that xSQL Object is completely free for SQL Server Express and it is also free for other editions of SQL Server as long as the database contains less than a certain number of objects. Even if you were in the small group of users (less than 10% of our user base) who work with larger databases and have to pay a couple hundred dollars xSQL Object more than pays for itself in just one time you use it. The answer unfortunately lies in our inability to reach out to all those potential users to let them know what they are missing. So, if you read through this please help spread the word – let all your friends and colleagues know that they can download this tool and use it to save many valuable hours of their time.
Friday, May 30, 2008
RSS feed from SQL Server – cool
No more wasting time updating your many bosses with the results of whatever ad-hoc queries they keep asking you to run for them, no more IT meetings to decide whether you need to take the time to implement a report that you think you will be asked to generate again and again. With RSS Reporter you write your query once and you send your bosses the link to the automatically generated RSS feed and they can get an update anytime they want, on whatever device they want without having to bug you ever again for that same query.
Is this cool tool expensive you ask? How does free sound to you? Yes, it is completely free for one SQL Server instance and only $99 for 5 SQL Server instances.
You can read more about it and download your free copy from: http://www.xsql.com/download/rss_reporter/
Thursday, May 22, 2008
xSQL Profiler - what sets it apart from the competition
Before we get to "what sets xSQL Profiler apart" we need to first explain what it does so here is the brief list of what it allows you to do:
- register SQL Server instances and databases in the xSQL Profiler workspace;
- define highly granular events that you may want to trace (a predefined set comes with the product);
- define traces (choose the servers / databases you wish to trace; choose the events; set filters so that you can trace exactly what you want nothing more, nothing less);
- schedule traces - you can define as many start/stop intervals as you wish and set those intervals to occur only once or recur daily, weekly, monthly;
- view trace data using the xSQL Profiler predefined viewing panel that allows you to filter sort and group the events;
- query the central repository directly using T-SQL.
Now, how is this different from the rest of the tools out there:
- you can deploy this monitoring and auditing platform in minutes days, weeks or months - there are no agents on the servers that will be traced - you simply install the xSQL Profiler on a workstation or server where the xSQL Profiler service will also be running and you are done with the installation.
- allows a high level of granularity in defining events / traces thus eliminating the unnecessary load placed on servers when you trace more than you need to.
- It is so simple even a "cave man could do it" - these geico commercials are getting to me :)
- IT IS ABSOLUTELY FREE (only for up to two SQL Server instances that is - what did you think, someone's got to pay for all that work we have done) <- -="" any="" couldn="" fine="" finer="" here="" i="" it="" li="" make="" print="" read="" t="" than="" the="" this="">->
Tuesday, April 22, 2008
Unique, hassle free software licensing - pay if you can
Almost every software company out there gives away some version of their software but usually the give away version is either a watered down version with severely limited functionality or a version loaded with annoying messages trying to get the user to pay for the full version.
Our approach however was fundamentally different. First, we “discovered” that not everyone gains the same amount of benefit from our software – while for some it pays off with a single use for some others it may take multiple times to get a return. Second, while for some a couple of hundred dollars for a useful piece of software is nothing, for some others it is indeed a big deal and it so happens that, most likely, the ones who would really think twice before spending any money on software are the ones who whose benefit would be relatively smaller. So, we decided that anyone, individual or company, for whom a couple of hundred dollars are indeed a big deal should not have to pay at all – only if and when they would reach a certain threshold then they would have to pay.
The challenge then became how to determine who should and should not pay for our software. Well, while that may not generally be a trivial task in our case it wasn’t very hard since our products are tightly related to SQL Server and we know that:
- if you are using the free SQL Server Express then there is a high likelihood that you have not yet made it in the big league and you are counting every penny;
- if the databases you work with, regardless of what edition of SQL Server you may be using, have a small number of objects in them (tables, views, stored procedures etc) then not only is that generally an indication of a small business but the benefit you gain from utilizing our tools is directly correlated with the size and complexity of the databases you work with.
- everyone downloads a fully functional version of our software from our website – no hassle, no registration, no reminders, no limitations.
- after 2 weeks have passed the software checks the edition of the SQL Server and if it is SQL Server Express then it simply continues to work without hassling the user in any way shape of form; If it finds that you are trying to compare and synchronize a database that is on another edition of SQL Server then it performs another simple check – it looks at the number of objects you have on the database and if those are below a certain limits then again it does not bother the user at all - in fact the user does not notice anything the product simply continues to work.
- Only if the 2 weeks have passed AND it is a SQL Server edition other than SQL Server Express AND the number of objects in the database exceeds certain limits THEN we kindly remind the user that this edition of our software does not support comparing those databases. At this point we have established two things – first that in this user’s case our software will pay off for itself right away (in fact it has likely paid off already during the first two weeks) and second that this user can certainly afford it:)
A few words about the tools discussed above: xSQL Object allows programmers and database administrators that work with SQL Server to compare the structures (schemas) of two databases, see where the differences are, generate the change script that synchronizes the structures and execute the script. It supports SQL Server 2005, SQL Server 2000 and will soon support SQL Server 2008. All objects are supported – tables, views, stored procedures, user defined functions, users, permissions, roles, assemblies, service brokers, synonyms, assemblies etc. xSQL Data Compare provides for comparing and synchronizing the data in two SQL Server databases.
Monday, November 26, 2007
Is your SQL Server exposed?
Thursday, October 4, 2007
Upgrade to SQL Server 2005 or wait for SQL Server 2008?
So, if you are still in SQL Server 2000 the most efficient and painless approach maybe to upgrade to SQL Server 2005 first and then upgrade from SQL Server 2005 to SQL Server 2008.
Thursday, September 27, 2007
Is there such thing as free software?
Be that as it may, when you hear “free software” keep in mind that it does not always mean the same thing – often you may end up paying through your nose for the "free" software.
Let's take a closer look - there are 4 main categories of what's advertised as free software (not talking about open source here – that’s a whole other discussion):
- the spyware, adware, virus infested software developed by despicable low forms of life (I have strong opinions as to what should be done with those people but that is a subject of another discussion) – what is clear here is that you are paying a very hefty price for the “free” software;
- free version with limited functionality and no expiration – the intention of the software publisher in those cases is to let you “take a free bite” of that great dish that you could have for a price. The hope is that once you taste it you will not be able to resist paying for the dish. I think this is ethical and great way to lure the customers but is this really free software? Is a great free bike with a missing pedal worth much if to get the missing pedal you have to pay the full price of the bike? You can certainly see how great the bike is, you can even get on it and ride it pedaling with one foot but it does not cut it does it?
- fully functional trial with expiration – the intention of the software publisher in those cases is to let you have a “free lunch” in hopes that you will like it so much that you will want to come eat here everyday despite having to pay for it. Is it ethical – yes, I don’t see anything wrong with it. Is it really free - yes it is – you are getting the benefit of using it for 2 weeks, or whatever the trial period is, with no restrictions. Is it effective? It depends on the type of functionality that the software provides. In case of an infrequent task the potential customer may take the free trial and finish the job now and two months later when he needs it again simply gets another trial version under a different name, different hardware etc. – so it may never turn into a customer.
- free software with no strings attached – the intention of the software publisher in those cases is to build brand awareness and make you a customer albeit a non paying one. An analogy would be that of a grocery store deciding to give the milk out for free – yes there is a possibility that you may forever go to that grocer and get the milk but never purchase anything, but chances are that once you see how professional and courteous they are, how great their service is and how good their other produce is chances are that at some point you will become a paying customer. Is what you are getting in this case really free – yes, absolutely. Is it effective for the software publisher? It really depends on how much patience the vendor has – it will eventually pay off but it may take a long time.
So where do we stand on this? Well, just have a look at our product offering and you will see that we favor the “free with no strings attached” approach:
- our xSQL Object for SQL Server schema comparison and synchronization and our xSQL Data Compare for comparing and synchronizing the data in two SQL Server databases are free with no strings attached for SQL Server Express edition. You take them and use them – no annoying reminders popping up on your screen, you use them free and clear.
- Both of the above products are also completely free for other editions of SQL Server as long as the databases you are working with do not exceed certain number of objects. To continue the milk analogy this translates in something like: “if you don’t need more than 1 gallon of milk per day you can get it free always but if you need more than 1 gallon you will have to pay for it”.
- Our RSS Reporter for SQL Server, a great tool that allows you to get an rss feed with job status information or even have the results of any T-SQL query “fed” to you in the form of an rss feed, is also free with no strings attached for one SQL Server. Same analogy as above applies here.
- xSQL Builder which provides for automating deployment of SQL Server databases is the only tool on our line up where we have gone for the fully functional free trial approach.
- xSQL Script Executor which allows you to execute multiple T-SQL scripts in one big transaction is a completely free tool as is the xSQL Object Search which allows you to search for objects the name and /or definition of which meets some search criteria.
In case you want to check any of those products out the links are on the right panel.
Wednesday, September 26, 2007
Getting a programmer's attention – winning idea gets $1000!
Software programmers, database administrators, systems engineers etc, whatever the title may be, are somewhat different from the rest of the people. One can quickly build a social network of teenagers, college students, professionals etc. but try building such network of programmers and you will see what I mean! Most of the people I know from this group don’t have an account on facebook, linkedin or myspace – they are the people who build such systems but they don’t often participate as users in them. Chit-chatting, sharing feelings or otherwise socializing for the sake of socializing are not something that they enjoy much (I think). They are willing helpers and contributors, readily sharing the knowledge they have despite how much they may have invested to gain that knowledge. Recognition of professionalism and cleverness by peers is more important and enjoyable than any other form of recognition.
Now, of course we could spend years exploring the peculiar characteristics of this group and speculating about it but I would prefer to leave that work to professionals. I am interested in a much more practical matter, that is, how to get the attention of these people when you don’t have gazillions of dollars to “blanket” the relevant web destinations and print publications with advertisements?
Here is the situation in more concrete terms:
- we at xSQL Software have spent years developing a few very helpful SQL Server tools – tools that can save the programmers and database administrators many hours of work and “tons” of frustration;
- our licensing is very generous – we give our products our for free for SQL Server Express and also give them out free for other edition of SQL Server in case the database is within certain size limits. That really translates into the products being free for the majority of SQL Server users.
- the people who do get to use our products love them
So what’s the problem? The problem is we don’t have enough people trying our products.
What I am looking for is an ingenious approach to tell them about our products without annoying them. What do I mean by annoying – here is an example, we once ran an attention getting banner on a popular SQL Server site; we thought the banner was very clever, it used falling blocks from the classic tetris game to get attention and then it conveyed the message that we don’t play games when it comes to our tools, but it backfired – it distracted the visitors from reading what they wanted to read.
It only takes 5 minutes to download, install and try our products but 5 minutes is a lot in today’s World – we may at best get a few seconds of their peripheral attention during which we have to convince them that those 5 minutes we want them to spend with our products will really be worth it.
Email us your ideas at the sales address – our domain is xsqlsoftware.com – the winning idea will get a $1,000 and more… (email us if you want to know what the more part is).