Error 3241 in SQL Server

(This is a guest blog post by Daniel Jones (li | t | fb). Daniel is a SQL Server DBA and contributor at SQL Tech Tips. Having 2 + years of experience in SQL recovery and system infrastructure.)

Microsoft SQL Server Backup Error Code 3241 Restore Headeronly

Sometimes, the users of MS SQL server faced an error when they try to restore SQL database from the backup file in the SQL server. This error is known as SQL server error 3241 and it generates the below-mentioned error message.

Error 3241 SQL Server

Due to this error message, the users cannot restore the data from the backup file into SQL Server database. Therefore, in this post, we are going to discuss the reason for the occurrence of error 3241 and the relevant solutions to resolve the error.

Causes Behind the Occurrence Of the SQL Server Backup Error 3241

There are various reasons behind this error message. Some of them are described as below:

  • When a user of MS SQL Server tries to restore the data from the backup file that was created on the MS SQL Server 2014 to the SQL Server 2008 then the error message arise. This is the main cause behind the occurrence of this error.
  • The SQL error code 3241 may also occur if SQL Backup Agent Service does not have necessary access permission. To restore the database from backup file into the SQL server, the SQL Backup Agent Service should have read permission to access the folder, which contains the backup file.
  • There is also a possibility that the backup file, which was used for restoring the SQL database, is corrupted. The backup file can be corrupted if it was loaded using FTP Text Mode.

Solutions To Resolve the MS SQL Error 3241 Restore Headeronly

In this section, we are going to discuss some solution to troubleshoot the backup error 3241. These solutions are described as follows:

  • Before starting the process to restore a database from the backup file, we should check the version of SQL server. If the version of SQL server is same as that of the version in which the backup file was created then start the restore process, otherwise upgrade the SQL server database to the same or higher version.

Note: By running the command ‘SELECT @@Version’ in the SQL query window, you can check the version of SQL server.

  • There is a need for access permission to restore data from backup file using SQL Backup Agent Service. The user account, which was used to log on the SQL backup Agent service, should be specified while installing SQL server components on the server instance. SQL Backup Agent Service can get a permission to access some specific folder, where a backup file is saved from the sysadmin.
  • If the backup file was corrupted because of uploading using FTP text mode, then again restore the backup file using FTP in binary mode. If this method fails to repair the corrupted backup file then you can also take the help of SQL BAK file recovery, a third-party utility to recover backup file.

Note: To avoid the Microsoft SQL Server error code 3241, the version of SQL server should be same as that of SQL server version in which backup file is created. SQL Backup Agent Service should have necessary access permission to restore data from backup file and backup file should be upload using FTP in binary mode.

Conclusion

When the users try to restore the database from the backup file then sometimes they are unable to do that because of SQL server error 3241. There are various reasons behind the occurrence of this error such as older version of SQL server, backup file is uploaded using FTP binary mode, etc. Therefore, in this post, we have described the causes of the error and the possible solutions to fix the backup error code 3241.

What Should My Salary Be?

What Should My Salary Be?

There are two questions that you just don’t ask people. It can create animosity and can even cause relationships to break. One of those questions is, “how much do you make?”

(If you’re wondering what the other question is, it’s, “Who are you going to vote for?” Not a great idea to get into politics with people.)

At any rate, the problem with asking someone “how much do you make” is not just because that’s a personal/private question. It can create a judgmental atmosphere. Have you ever worked with someone who was less technical than you but somehow you found out how much they were making? And it happened to be more than you? How did you feel? How did your attitude towards that person change once you found out?

That’s why you stay away from that information. The issue arises when negotiating salary. It’s somewhat important to know what your “worth” is. How much should you ask for. Is what I am asking for possibly going to remove me from consideration?

Recently, Brent Ozar published a blog titled, “Tell Us What You Make: The 2017 Data Professional Salary Survey“. In that blog, there was a link to a quick little survey that collected information like salary, location, years of experience, etc. Of course it was all anonymous.

To my surprise, over 2000 people took the survey. Of course, the more people that take the survey, the better the information. But the flip side to that is people can fool around and enter a bunch of garbage. For example, there are a few people making over MILLION dollars as a SQL Server Analyst and Manager (see below)

What Should My Salary Be

Really? 1.45 million? I highly doubt that.

Aside from the “Who Wants to Marry a SQL Server Millionaire Analyst”, there are a couple pieces of information that we can derive from this survey:

  • Having a 4-year college degree does NOT guarantee a higher salary
  • Any one technology (SQL Server vs Oracle vs Amazon) does NOT mean a higher salary
  • Job title does not guarantee a higher salary over another, i.e. DBA vs Analyst vs Engineer
  • Number of years of experience does NOT guarantee a higher salary
  • Certifications do NOT guarantee higher salary

So you might be thinking, “what the heck does guarantee a higher salary?” Well, it depends. It all comes down to what you feel comfortable with? The trap that we should not fall into is comparing ourselves to others based on salary/income. My view is, follow your passion (whatever that is) and learn it inside out. The money will follow. Don’t get greedy and think you can ask for 200k when you just got out of college with zero years of real-world experience. Everything within reason.

Speaking about passion; I love SQL Server and just started playing around with Power BI. I will use the data in this excel document to create some interesting charts/graphs and update this post once I do!

Until then, keep learning!

FREE Microsoft eBooks!

Sometimes the best stuff is FREE!

I recently came across this Microsoft site when I was searching for whitepapers. It’s part of the Microsoft Virtual Academy. They not only have free ebooks, but they also have free virtual courses.

They offer virtual courses and free ebooks on some of the newest technology out there. There are ebooks on SQL Server 2016, Windows Server 2016, and Microsoft Azure.

I highly recommend checking them out at: https://mva.microsoft.com/ebooks

How To Study Smarter Not Harder

How To Study Smarter Not Harder

One of my “New Year resolutions” is to increase my knowledge. As an IT professional, it is crucial to stay abreast with the constant changes in technology. The new replaces the old and by the time you get around to learning the new, that becomes old. As someone who works closely with SQL Server, I find it extraordinarily cumbersome to stay abreast of the new trends and technologies. Just SQL Serve 2016 alone has so many cool new features. Imagine the constant updates with Microsoft Azure. All that can be demotivating.

According to a Forbes article, more than 40% of people make a “New Year’s resolution” and only 8% keep them. People fall victim to a lack of motivation, will power, patience, etc. etc.

I came across a video lecture on Youtube that absolutely changed my outlook on studying/learning. What I grew up thinking as “studying” was not even close. Psychology professor Dr. Marty Lobdell’s lecture is called, “Study Less, Study Smart”, and has absolutely opened my eyes to what I’ve been doing wrong my entire academic life. I have summed up his points below, but I highly recommend checking out his entire lecture here (or watch it below).

Facts vs Concepts – Dr Lobdell says that anyone can lookup facts, but concepts last a life time. Understanding concepts is most important because “googling” for facts is easy.

Recognition vs Recollection – According to Dr Lobdell, people tend to confuse “recognition” and “recollection.” Below is the definition of each:

Defintion of Recognition

VS

Definition of Recollection

Note the second bullet for “recognition”, you need a previous encounter or knowledge to recognize something. But for “recollection”, it’s a memory. For example, kids think they are “recalling” something from memory, but in fact they are not. They are recognizing from some mental trigger. Which is why they end up not remembering it during an exam.

Sleep – Everyone needs adequate sleep. It’s only when we reach our REM state  when what we’ve studied starts to get “imprinted” into our long term memory. There has been many studies on this. Sleep is huge!

Note Taking – I used to take copious notes. Some times I would copy the entire lecture slides, but when  I got home and looked back at my notes, I was totally confused. Dr Lobdell says to take notes and then immediately after class go back and “flesh out” the notes. Add more to it since it’s fresh in your memory. If you don’t remember, you can ask a classmate or the teacher. This will help you study better at home.

Teach it / Active Recitation – When you learn something, the best way to test whether you truly understand it is to teach someone else. Find your roommate, sibling, or parent. If you live alone, Dr Lobdell says teach it to an empty chair. Just the act of speaking it out loud will help!

Mnemonics – When you need to memorize facts, use “mnemonics.” The meaning of mnemonics = anything that facilitates learning/recalling. Dr Lobdell mentions three ways: 1. Acronyms (Roy G Bv, colors of the rainbow). 2. Coined Sayings (12 Cranial Nerves). 3. Interacting Images (the weirder the image the higher  chance you will remember the subject)

SQ3R – Stands for Survey, Question, Read, Recite, Review – This is huge. Usually people tend to open the book when they are looking for an answer. Dr Lobdell says when you first get the book, open it and “survey / question” it. Meaning, skim the the pages, ask yourself questions, see the pictures, bold headers/words, get familiar with it. You are training your brain to look for answers. Then you read it. Recite it (try to teach it to someone else). If you do this thoroughly, then by exam time all you have to do is Review and you’re ready to ace it!

On to a successful 2017!

How To Decrypt Stored Procedure In SQL Server

I recently had to view the code behind a couple stored procedures in SQL Server. Usually that’s a very simple thing to do. Just right click the stored procedure, click Modify OR script-as “Create New” and it spits the entire stored procedure in a query window. Unfortunately for me, the stored procedures were encrypted so the usual method mentioned above did not work.

There are a couple blogs online that mention logging in your SQL Server via the DAC and running some scripts to see the code, but that can get daunting and time-consuming..especially to a novice.

I came across a very neat piece of software called dbForge SQL Decrypter by Devart. It’s absolutely free and easy to setup. I tried it out and it works like a charm! Check it out below:

How To Decrypt Stored Procedure In SQL Server

After installing dbForge SQL Decrypter, double click the icon and the “Connect to Server” opens:

dbForge SQL Decryptor Screenshot 1

***Note: I expanded the “Show Advanced Settings” to show that you can choose to log into your server via the DAC (Dedicated Administrator Connection). It’s not required to choose it, but I wanted to show it to you anyway.

Once you log in, you’ll notice it resembles SQL Server Management Studio’s Object Explorer. Go ahead and navigate to the stored procedure: Databases –> MyDB –> Procedures. I created a dummy encrypted stored procedure called testProcWithEncryption for demo purposes.

dbForge SQL Decryptor Screenshot 2

When you right-click the encrypted stored procedure you get the following options:

dbForge SQL Decryptor Screenshot 3

When you click on “Show DDL script“, the software decrypts the stored procedure and spits the code in the right-pane window:

dbForge SQL Decryptor Screenshot 4

Done! Wasn’t that easy?

What Else Can dbForge SQL Decrypter Do?

It has more neat features which makes it absolutely convenient to use. Below are a couple features that make is stand  even more:

Batch Decryption Wizard – If you have multiple stored procedures, functions etc, you can decrypt them all at once and save it to a new T-SQL script file.

Syntax Highlighting – People usually underestimate how annoying it is when there is no syntax highlighting. This feature makes it easy for readability and helps in easily finding what you’re looking for.

Saving Definition to a File – This is super convenient. Instead of cutting and pasting into another text file, etc.

The Best Feature of them all …

The best thing about Devart’s dbForge SQL Decrypter is that it’s absolutely free! I’ve already added it to my arsenal of must-have DBA tools. Feel free to download it yourself and try it out!

It will save TONS of time on trying to decrypt a Stored Procedure, Triggers, Views, or Function yourself.

Your 5 Favorite Blog Posts of 2016

Here are the top 5 blog posts of 2016:

1. How to Find Last Login Date of a SQL Server Login? – This was by far the most clicked on blog. It looks like a lot of people need to secure their SQL Server environments :)

2. How to Request a DoD Server Certificate – Working in the DC area, I have a lot of experience working with DISA STIGS, securing and hardening SQL Server.

3. Perfmon Create New Data Collector Set Grayed Out (FIX) – Apparently a lot of people have this issue. The good sign is that people are searching on how to FIX it!

4. How to Read SQL Server Error Log Using sp_readerrorlog – A blog on how to read through the SQL Server error log a lot faster and neater.

5. How to Create SSL Certificate for SQL Server – This goes with #2 above. The process of creating an SSL Certificate for SQL Server can be daunting. I have outlined how to do it here.