Quantcast
Channel: SQL Server Blog
Viewing all 2304 articles
Browse latest View live

The Future of the DBA

$
0
0

I’ve written before about how databases are like a car engine, and DBAs are like a car mechanic. That’s been the traditional view for production DBAs for, well, forever I think. And that analogy may have been true at one time, and may still be true for some DBAs. But the...

The post The Future of the DBA appeared first on Thomas LaRock.

If you liked this post then consider subscribing to the IS [NOT] NULL newsletter: http://thomaslarock.com/is-not-null-newsletter/


SQL SERVER – How to Find the In-Memory OLTP Tables Memory Usage on the Server

$
0
0

When I presented at the SQLPASS this year there were several learning that I found it interesting. Every year, this presentation preparation is something I take it seriously. I know many them turn up to learn some new tricks every single year. Hence, I invest considerable amount of time to prepare. This year I showcased several tips and tricks involving SQL Server In-Memory OLTP capability. I personally feel this feature is lesser known and never appreciated. As I was doing the session, one of the DBA asked how to find out the memory utilization of various In-Memory OLTP tables.

During the break session, I showed how the DMVs can be used to collect this important information. These have been around for a while, but not known. Here is a simple script to show the same:

SELECT object_name(object_id) AS Name, *  
FROM sys.dm_db_xtp_table_memory_stats
GO

As you can see, this is run against the database and the script will list all the tables and their memory utilization on the server. The output will look like below:

SQL SERVER - How to Find the In-Memory OLTP Tables Memory Usage on the Server adworks_InMemory-Steps-01-800x275

You will need to add the memory used by the table and the memory allocated for indexes to get a clear idea on what the overall memory utilization is for the given table.

As I try to wrap up this simple blog, please let me know how you are using In-Memory OLTP features? What is the largest table on your production environments using this feature? Do let us know via comments and share your experience with all on using this feature.

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – How to Find the In-Memory OLTP Tables Memory Usage on the Server

SQL SERVER – Log Shipping Copy Job Failure – The Password for This Account Has Expired

$
0
0

Working as freelancer gives an opportunity to see various kinds of error and having fun to fix them. Recently, one of my blog readers sent an email and asked assistance on the log shipping issue. He said that log shipping copy job is failing.

As usual, I asked him error message and he shared below piece from copy job history.

Message
2016-09-27 17:22:23.33  *** Error: The password for this account has expired.
(mscorlib) ***
2016-09-27 17:22:24.01  *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***

The error message was descriptive enough. I asked him to follow below blog and share the output. SQL SERVER – How to Find Out When Your SQL Login Will Expire?

As expected, the password was expired. I asked him to put the right password for the service account for Agent because SQL Agent is used to perform the copy operation.

Once he put the right password the issue was resolved, but as a follow-up he asked me ways to avoid this in future.

SOLUTION/WORKAROUND

  1. Put the right password for the service account for SQL Agent on secondary.
  2. Make sure below property is checked so that it is not expired next time.

SQL SERVER - Log Shipping Copy Job Failure - The Password for This Account Has Expired ls-copy-01

Have you encountered the same issue in production?

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – Log Shipping Copy Job Failure – The Password for This Account Has Expired

SQL Server – Playing With Trace Flags

$
0
0
Trace flags are used to temporarily set specific server characteristics or to switch off a particular behavior. They are usually scoped to a global level or a session only level. For this blog post I thought it would be handy … Continue reading

Azure pricing

$
0
0
Not a technical post today (not that I am technical) but still an important one. I have been using Azure for 1.5 years now and I am still fascinated by the ever-changing technology. Talking of ever-changing, I had a nice … Continue reading

SQL SERVER – Fix Connection Error – [Microsoft][ODBC SQL Server Driver][DBNETLIB][ConnectionOpen(Connect())

$
0
0

 As a part of my quick consultancy, I was contacted by a client who was having trouble where the application was not able to connect to SQL Server. We all joined the call and desktop sharing to learn more about the issue. We looked into the application and found that the SQL connection from the client application were constantly failing with the following connection error:

[Microsoft][ODBC SQL Server Driver][DBNETLIB][ConnectionOpen(Connect())

We tried below steps to narrow down the issue.

  1. SQL Server instance which we were trying to connect was a named instance, which was listening on non-default port 2433.
  2. SQL Browser was running.
  3. Ping was working fine and we could get the response.
  4. Telnet to port 2433 was working fine.
  5. If we connect using SQLMACHINE\INSTANCE_NAME then it fails.
  6. If we connect using SQLMACHINE,2433 then it works.

At this point we anticipated the UDP port is FILTERED for some reason and hence we are not able to get the instance names mapped to the port numbers.

SOLUTION / WORKAROUND

As a workaround, we went ahead and created the SQL alias for the TCP/IP protocol. Once the alias were created, we could connect to the SQL server successfully using SQLMACHINE\INSTANCE_NAME.

The ideal solution was to make sure the firewall is configured correctly as mentioned in books online Configure the Windows Firewall to Allow SQL Server Access

There could be many other issues of client connectivity and it all depends on error message. Have you encountered a similar error? If yes, what was the solution in your case?

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – Fix Connection Error – [Microsoft][ODBC SQL Server Driver][DBNETLIB][ConnectionOpen(Connect())

I use Elastic database pools – for now

$
0
0
When you have many SQL databases that are required to run your environments and  they show signs of specific usage patterns and some of the databases requires different performance levels then how can you ensure that the all the databases … Continue reading

SQL SERVER – FIX Error – Cluster Network Name showing NETBIOS status as “The system cannot find the file specified”

$
0
0

Over a period, I have learned that fixing an issue is easier if we know which log we should look at and what we should search on google.  Here is the situation which I was into few days back. In this blog post we will learn how to fix the error Cluster Network Name showing NETBIOS status as “The system cannot find the file specified”.

I was at client site for performance tuning exercise and they asked me if I know Windows Clustering. Of course, I can’t call myself as an expert but I at least know whatever is needed for AlwaysOn availability groups. So, I asked them the issue. They told that they are seeing Cluster Network Name in failed state as below.

SQL SERVER - FIX Error - Cluster Network Name showing NETBIOS status as "The system cannot find the file specified" cluster-core-01

We tried to move the cluster group between the nodes and tried bringing CNO online but it failed. In the CNO parameters we see the NETBIOS status as “The system cannot find the file specified”. So, I asked them to capture cluster logs.

SQL SERVER – Steps to Generate Windows Cluster Log?

Here is the snippet from the error log.

548020 000022c8.00004208::2016/10/08-10:38:29.991 ERR [RES] Network Name: Agent: InitializeModule, Trying to initialize Module(fb729fe4-79ea-4a0d-857e-411636879e67,Identity) when there is one already in Initialized/Idle state
548064 000022c8.00000368::2016/10/08-10:38:29.991 ERR [RES] Network Name: [NNLIB] Unable to add server name WindowsCluster to transport \Device\NetBt_If1, status 2
548083 000022c8.000038b8::2016/10/08-10:38:29.991 ERR [RES] Network Name : Online thread Failed: ERROR_SUCCESS(0)’ because of ‘Initializing netname configuration for Cluster Name failed with error 2.’
548088 000022c8.000038b8::2016/10/08-10:38:29.991 ERR [RHS] Online for resource Cluster Name failed.
548102 00001cac.00002f94::2016/10/08-10:38:29.991 ERR [RCM] rcm::RcmResource::HandleFailure: (Cluster Name)

As seen above, status 2 indicates: The system cannot find the file specified”. My search for “NetBt” was pointing to issue with “NetBIOS over TCPIP” setting. When I verified the network adapters, I noticed under WINS section NETBIOS over TCP/IP has been disabled.

WORKAROUND/SOLUTION

Here is the screen where I changed the settings.

SQL SERVER - FIX Error - Cluster Network Name showing NETBIOS status as "The system cannot find the file specified" cluster-core-02

We have changed it to default and issue was resolved and we were able to bring the resource online.

Have you found any solution using cluster log?

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – FIX Error – Cluster Network Name showing NETBIOS status as “The system cannot find the file specified”


DMV to Replace DBCC INPUTBUFFER Command – Interview Question of the Week #100

$
0
0

Question: Is there any way to replace DBCC INPUTBUFFER Command?

Answer: In a recent interview, I heard this question and it caught me off guard. Honestly, when I heard this question being asked to interview candidates. Honestly the candidate did not know the answer and I had decided that I will write about it when I return home. When I was back home, I noticed there is SQL Server 2016 SP1 released.

DMV to Replace DBCC INPUTBUFFER Command - Interview Question of the Week #100 100thquestion-800x418

I have always seen that new releases bring new functionalities and that is an awesome opportunity for us to learn something new. Having said that, when SQL Server 2016 SP1 got released, I personally felt this was no ordinary release. There were several interesting features and enhancements (though small) were getting added. Many look trivial and sometimes makes us think why this was not there before? Why didn’t Microsoft not add these capabilities into the product? Those questions are beyond the scope of this blog. I am happy and glad that this is happening. The new Microsoft is agile and has a fresh perspective. One such big thing is “SQL on Linux”. I do want to play and blog about it, this discussion is for some other time.

Coming back to core content for this blog. When things go wrong in SQL Server, one of the things that I have seen DBA’s do is to query the sp_who, sp_locks etc and find which connection is waiting or blocking state. Then given the connection number, they also use the DBCC INPUTBUFFER command to find what statements are running for that session. I have always found this two-step process less convoluted.

Welcome SQL Server 2016 SP1, we now have an interesting DMV added (dm_exec_input_buffer). The usage of it would look like:

SELECT es.session_id, ib.event_info
FROM sys.dm_exec_sessions AS es
CROSS APPLY sys.dm_exec_input_buffer(es.session_id, NULL) AS ib
WHERE es.session_id > 50
GO

The output looks like this:

DMV to Replace DBCC INPUTBUFFER Command - Interview Question of the Week #100 dbcc-inputbuffer-dmv-01-800x323

This command as you see is functionally equivalent to DBCC INPUTBUFFER. Having said that there are advantages over DBCC INPUTBUFFER tough. Some to mention, this command directly returns a rowset, it can be conveniently used with sys.dm_exec_sessions or sys.dm_exec_requests by doing a CROSS APPLY as shown in the example above and finally, it can use a simple query to retrieve input buffer of multiple sessions without the need for a script and temp table.

Do let me know how useful this would be for you. Will you be using this DMV in the future? What innovative ways will you use them? Let me know via comments below.

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on DMV to Replace DBCC INPUTBUFFER Command – Interview Question of the Week #100

Migrating reports between SSRS report servers simplified with new PowerShell commands

$
0
0
I recently needed to replicate all of the reports on one report server to a different server.  I started downloading each report one at a time to a file system folder, moving them to the other machine and then uploading each RDL file.  Needless to say, that’s a slow and painful process.  Since a new … Continue reading

SQL SERVER – Errors When Disk Space is the Reason

$
0
0

In the past, I have written a number of blogs when it comes to working with errors pertinent to disk space running out. In this blog, I try to consolidate the common messages you are going to see in the Error logs when the database engine is not able to get the space that it needs from the disk subsystem. One of the common scenario’s where these are seen is while recovery operation (when SQL is restarted).

SQL SERVER - Errors When Disk Space is the Reason diskspaceissue-800x321

During recovery, the SQL Server Database Engine might require additional disk space for data files. When an operation lacks sufficient disk space, the Database Engine issues an 1101 or 1105 errors (depending on whether it is unable to allocate space for an extent or an object, respectively). If the disk fills while the database is online, the database remains online, but the data cannot be inserted. If the disk fills during recovery, the Database Engine marks the database as “resource pending.” In either case, user action is required to make disk space available.

Typical errors reported are listed here:

Error 1101:

Could not allocate a new page for database ‘%.*ls’ because of insufficient disk space in filegroup ‘%.*ls’. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

Error 1105:

Could not allocate space for object ‘%.*ls’%.*ls in database ‘%.*ls’ because the ‘%.*ls’ filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

Error 9002:

The transaction log for database ‘%.*ls’ is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

One of the following actions might make space available to the filegroup:

  • Free disk space on the full disk.
  • Move data files to another disk.
  • Add files on a different disk.
  • Enable autogrow or check if fixed size has been set.
  • If using SQL Express Edition, check if it exceeds the database size limits.

I am sure you have seen some of these, do let me know if I missed a scenario from the above list.

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – Errors When Disk Space is the Reason

#0396 – SQL Server – SSIS – Move and rename a file – “Could not find part of the path.” File System Task error

$
0
0
If a file has to be renamed and moved to a different folder, one cannot use the "Move File" operation in a File System Task. One should use the "Rename File" Task.

Monday Coffee 2016-12-05

$
0
0

You are the DBA your company makes you. Aren’t you?

SQL Server has such a wide range of features that no DBA role will implement all of them. So, you use a certain subset in each role that you occupy throughout your career. What those features are depends on the role.

However your job as a DBA is to (at the very least) be aware of the features that SQL Server has to offer. That way when you’re presented with an issue from your business you can suggest ideas based on your knowledge of those features.

Need an efficient archiving solution? Partitioning and stretched databases will help you out.
Need your systems to have 99.999% uptime? Always On availability groups are there.
Need a cold standby in your disaster recovery environment? Take a look at transaction log shipping.

The list goes on.

What the absolute best thing about working with SQL Server is, is the amazing community that has built up around it. Online communities like SQL Server Central, Stack Exchange and the #sqlhelp tag on twitter are brilliant resources filled with people who dedicate no small part of their free time to helping other data professionals out.

In addition to those resources there’s also a tonne of free training events on offer. In person events such as SQL Saturdays and online events such as the Pass Virtual Chapters.

Technology is always evolving and SQL Server is no exception. Just look at all the new features that have become available in the last month alone! It can feel like keeping up-to-date with everything that going on is impossible but with such great resources available to your average DBA, it needn’t be so taxing.

Thanks for reading.


December: A two-line play.

$
0
0

“Wow! A family, a marathon, and two businesses! So how do you keep up with it all?” asked Twitter. “Work-life balance,” she replied, glancing furtively at her sparsely populated blog. Fin   (P.S. The latest blog on MinionWare.net, at least, is What Really Causes Performance Problems?)  

The post December: A two-line play. appeared first on The MidnightDBA Star-Times.

SQL SERVER – Speed Up Performance Without Code Change

$
0
0

In this blog post we are going to leave about how to Speed Up Performance Without Code Change or Configuration Change in SQL Server. This blog post is going to be a fun and quick read.

Please make sure that you read this blog post till the end to learn the secret how I improved query performance from 40 seconds to just 12 seconds.

SQL SERVER - Speed Up Performance Without Code Change nitrocover-800x450

Behind the Scene

If you are a living independent consultant’s life you know that month of December is an amazing month for you. Most of the organization’s have year ending in December and they usually have some budget left from their yearly spending. Most of the organizations save their budget till the last month as they want to make sure that if something urgent comes up they have enough money to cover it. Well, this is blessings for independent consultants, when organizations have not figured out where to spend money till the end of the month.

When organizations have budget left over, they usually look for the opportunity to spend it constructively. In the most cases, if they do not spend money they lose that portion of the budget and the next year they get lesser budget. It is very common practice.

Opportunity for Consultants

Now no one wants slow performance for their business application. Everyone wants amazing performance of their front-end application and back-end database. This is when the organizations usually look outside for consultants who can help them speed up their application’s performance. Every year in the month of December I get lots of requests for helping them to tune their system’s performance. My most popular service is Index Tuning and Strategy Guidance (99 minutes). In this I help organizations to tune their system with the help of Indexing. It is very powerful and it gives an instant performance improvement. Once the tuning is over, organizations have to test their system to make sure it is giving optimal performance. This service requires that DBA with whom I work have administrator rights to the database.

However, in the month of December, the most popular request is not about Index Tuning but rather a very strange request. I believe this is because the December month is a financial year ending as well as month of festivals. Not everyone has time to test their system as well do various code changes in the month of December.

Here is the most popular request I often hear in the month of December.

“Help us to Speed Up our application’s performance without changing any code or configuration in SQL Server.”

Now think about it for a moment. The request is indeed very strange. They want to improve the performance of their system without allowing me to touch any settings or code in SQL Server. Well, though it sounds strange, it is not as strange as you think.

Network Bandwidth Optimizations

I know the request is very strange, but there has to be a solution for every problem. Fortunately, this is when my formal education as Master of Science in Computer Network (from University of Southern California, USC, Los Angeles, California) helps me. Not many people know that when send data packets on a network, we are not fully optimizing the network packets as well as lots of bandwidth goes to waste. When I am not allowed to touch code or computer system, I always look at the network optimization.

I did intensive research to find a good Network Bandwith Optimization product on the internet and finally landed upon NitroAccelerator. I did quite a lot of performance tests with this product and I figured out it indeed helps improving SQL Server Performance without Code Change.

Speed Up Performance Without Code Change

Here is a quick video where you can see how we can improve performance with the help of NitroAccelerator and improve performance of our query. Please note that I am on my fastest possible gigabit network and my network traffic is absolutely near to nothing. Even though in this case, I have got amazing performance gain.

My query which was earlier running for 40 seconds is now running for 12 seconds.

Think about it, in my fastest possible network, I have gained over 300% times query performance gain. How much performance can you gain in your environment where the network is heavily congested?

Update 1: Many asked details about the software I used in the video. You can download NitroAccelerator for free.

Update 2: If you try this software out and it does not speed up your system without code change, there can be two reasons 1) Incorrect Settings of software 2) Query Not Qualifying for Performance. In either case you can reach out to me for further help. Contact me at pinal @ sqlauthority.com

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – Speed Up Performance Without Code Change


Checking your Wait Stats via Power BI

$
0
0
Wait stats is my go to thing, however I do get bored just querying it via a  table so I decided to broaden my horizons and see how “analytical” I could get with it via Power BI. What I usually … Continue reading

SQL SERVER – FIX – Error: 26023 – TCP Port is Already in Use

$
0
0

One of my clients approach me that after patching of SQL instances, database mirroring stopped working. As usual, I asked them to share ERRORLOG file SQL SERVER – Where is ERRORLOG? Various Ways to Find ERRORLOG Location.  In this blog post we will learn about how to fix error 26023 TCP Port is Already in Use.

Here are the interesting messages in ERRORLOG file

2016-11-03 22:11:04.32 spid24s The Service Broker protocol transport is disabled or not configured.
2016-11-03 22:11:04.33 spid18s Database mirroring has been enabled on this instance of SQL Server.
2016-11-03 22:11:04.32 spid24s Error: 26023, Severity: 16, State: 1.
2016-11-03 22:11:04.32 spid24s Server TCP provider failed to listen on [ ‘any’ 5022]. Tcp port is already in use.
2016-11-03 22:11:04.50 spid24s Error: 9692, Severity: 16, State: 1.
2016-11-03 22:11:04.50 spid24s The Database Mirroring protocol transport cannot listen on port 5022 because it is in use by another process.

I asked them if they have multiple instances of SQL and other are also using port 5022? They told that they have other instances, but they are not using mirroring. To be doubly sure, I suggested to run from command prompt.

netstat -aon | find /I "5022"

Here is the output.

SQL SERVER - FIX - Error: 26023 - TCP Port is Already in Use tcp-in-use-01-800x164

As we can see above that port 5022 is already in use by PID 1452 (last column)

SOLUTION/WORKAROUND

We found that PID 1452 was for another instance and it was having an endpoint created on the same port but they were not using Database mirroring. I have asked them to either remove the endpoint from the other instance or if they want to use mirroring, use a different port of an endpoint.

Once we deleted the endpoint from another instance of SQL Server and restarted the endpoints here, database mirroring came back to life again.

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – FIX – Error: 26023 – TCP Port is Already in Use

Linux – How to Change Group and User Ownership of a Directory – using chown & chgrp

$
0
0
In this post, let’s learn how to use chgrp and chown commands to change group and user ownership of a directory On a Linux server, by default, the group owner of a file or directory is the primary group of the user who created the file directory. And it is highly likely in most cases […]

TDE Recovery

$
0
0
This week’s TSQL Tuesday is being held by the mighty Kenneth Fisher – Backup and Recovery- see this link, how can I not get involved with this one? I have been blogging for about a year now and have covered … Continue reading

SQL SERVER Management Studio – Taking DB Offline Made Easier

$
0
0

I have an appetite to observe and learn from what happens around me more. These are the best ways we realize how life has been gifted to us. Since I have been traveling lately like mad with families where there has been enough vacation filled with some work sporadically, I got to see how my family enjoys the moment they have in hand. I know it is difficult to get the fee time, but it is a great break from the norm. In my recent Europe trip with my family, I was to travel in a train for close to 3+ hours and I was wondering what I am going to do. Obviously, I had some books to kill my time, but I chose not to do that because my daughter was around. As we boarded the train and started our journey, the initial excitement moved to become “What next?”. As I started to think, I saw my daughter quickly jump into her grandfather’s seat and started to say something and they both got busy watching the sky. Getting curious, I was trying to figure out what both were up to. Interestingly, my daughter made-up a game to create shapes and characters from the moving clouds. And both got busy. Let us learn in this blog post how we can take a database offline.

This scene is still fresh and has etched into my memories to how the small things in life can still be made enjoyable. The boredom of sitting alone was absorbed by doing something that has been already around you. Well, the story must be experienced as the words don’t do justice to what happened.

This brings to one of the tips that I had presented at the Europe tour in one of the sessions. I was playing around with SQL Server Management Studio 2016 and when I was about to take the database to offline mode, I was presented with a neat checkbox to “Drop All Active Connections” as part of the dialog box. Also by side of it is the number of active connections currently that is stopping us from taking the database Offline.

SQL SERVER Management Studio - Taking DB Offline Made Easier ssms-2016-take-offline-enhancement-01

If there are no active connections to a database, then the message box would look like as shown below:

SQL SERVER Management Studio - Taking DB Offline Made Easier ssms-2016-take-offline-enhancement-02

As you can see, this is a neat addition to the dialog box and the small pleasures of life of something already existing and we never taking notice. I was pleasantly surprised to see this in the SSMS for the first time. Do let me know if you ever encountered such gems hidden inside our tooling that we use every other day.

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER Management Studio – Taking DB Offline Made Easier

Viewing all 2304 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>