Advertisements

Archive

Archive for the ‘Uncategorized’ Category

DACPAC – Could not deploy package, the database platform service with type Sql130DatabaseSchemaProvider is not valid


 
So, today while deploying a DACPAC file by using SqlPackage.exe utility I faced an error:

*** Could not deploy package
Internal error. The database platform service with type Microsoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service.

For few minutes I was wondering why this error was coming, but when I saw the version number in above error message it became clear. The version number 130 highlighted above belongs to SQL Server 2016, and the database where I need to deploy DACPAC was SQL Server 2012. So, its clear that the DACPAC was built in Visual Studio with SQL Server 2016 setting.

So I went back to Visual Studio – Project Settings and changed the version to SQL Server 2012, and re-build the Project, and got the correct DACPAC file.


Advertisements
Categories: Uncategorized

SQL Error – The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE


 
Today after setting up a new Database environment I ran into a small issue. While running a Stored Procedure I was getting following error:
 

Sql Severity : 16
Sql Message ID : 10314

Message
Executed as user: XYZdomain\XYZaccount. An error occurred in the Microsoft .NET Framework while trying to load assembly id 65536. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: System.IO.FileLoadException: Could not load file or assembly ‘XYZAssemblyName, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A) System.IO.FileLoadException: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) [SQLSTATE 42000] (Error 10314). The step failed.

 

I checked online and found that after restoring the Databases on DEV from PROD environment, the Stored Procedure that I was executing on DEV was CLR enabled thus it has the external_access or unsafe permission set from the database. And the login that was use to create the database on PROD was not same as in the instance of DEV DB. Thus it was not allowing to execute the CLR SP and resulting into error due to safety concerns.
 

Thus you can either use the Windows login or the SQL Server login which is common on both the environments (PROD & DEV, in my case), so:

1. First Enable Trustworthy database property

2. And change the database owner to ‘sa’

ALTER DATABASE [DatabaseName] SET TRUSTWORTHY ON;
GO

USE [DatabaseName]
GO

EXEC sp_changedbowner 'sa'
GO

 

This issue could also occur when you are Creating a new Assembly that has the external_access or unsafe permission set in the same database.

Server: Msg 10327, Level 14, State 1, Line 1
CREATE ASSEMBLY for assembly ‘XYZAssemblyName’ failed because assembly ‘XYZAssemblyName’ is not authorized for PERMISSION_SET = EXTERNAL_ACCESS. The assembly is authorized when either of the following is true: the database owner (DBO) has EXTERNAL ACCESS ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission.


A very Happy SQL-licious & SQL-s-tastic Valentines day to all of you !!!

February 14, 2016 2 comments

Wish you all a very happy Valentines day !

Here is a love Query for you all:

SELECT NCHAR(10084)

Execute it and share it with your valentine 😂
 

… and now a special SQL Joke on this day!

--// Valentines special SQL query: for Guys

Select * from [Earth] 
where [Girl] = 'Single' 
and [status] = 'Available';

-- (0 row(s) affected)




--// Valentines special SQL query: for Girls

Select * from [Earth] 
where [Boy]  = 'Single' 
and [status] = 'Available';

-- System.outOfMemory.exception 
-- Too many rows to handle

 

For more jokes on SQL check here.
 

Subscribe my YouTube channel for more updates on SQL.


Categories: Uncategorized Tags:

Start a Blog | Why, What, How, Where

August 5, 2014 Leave a comment

I started Blogging almost 5 years back (early 2009). That time I didn’t thought to blog publicly, but just created a blog site in Google’s Blogger.com to create and track a library of technical articles that I can access anywhere. Suddenly I started getting hits on my posts and people started asking questions and suggestions. Then I thought to give my blog a professional look and add some quality content.

I was quiet impressed with WordPress.com so moved my blog to this new hosting site and SQLwithManoj.wordpress.com came into life.

Last week I thought to port my blog to a dedicated Domain name, so I upgraded my account in WordPress only rather than going with other domain registering sites. Now the blog’s new address is SQLwithManoj.com, which is maintained by WordPress only.

Lot of people ask me about Blogging, like: how to start blogging, what platform they should use, what content they should put, domain name, space, themes, etc. Here through this blog post I’m trying to answer some of the FAQs.
 

–> Main points to consider:

1. What do I blog:
– Think on a topic or subject you are passionate about, where you have deep/sound knowledge and can write about it very frequently, like Technology (All, or any Particular like SQL, .net, Java, etc.), Photography, Travel, Fashion, Politics, etc.
– Some people also blog to promote their own business/products/companies, etc.
– Make sure the content you put is genuine and will help people in reality.

2. How do I setup my blog:
– You can start with any of the free Blog Hosting sites, like WordPress, Google’s Blogger, Tumblr, etc.
– Or can go with Paid options for these site or other Hosts like GoDaddy, where you will get your own custom URL (Domain name) with more control.

3. How frequent should I blog: Depends upon the Topic, Time and your Passion.
– If it is current affairs and/or trending stuff, then daily, but you should have ample time.
– If automobiles/movies or similar then you should be the first and best (or amongst them) to blog them whenever they are launched.
– If its Technology then it could be daily/weekly/monthly, but at least one/two blog(s) per month to keep your readers connected with you.

4. Some Do’s & Don’ts:
– Do not copy other people’s blog posts.
– You can write about same topics what others have already posted, but make sure to give your post a different title.
– Its Ok to take tips from other Blogs, but the content should be genuinely written by you and should make a difference when compared by others.
– Use Widgets to provide more information and ease of access to your users to navigate on your blog site.
– Use Themes to beautify your blog, and can tweak CSS to give it a different look.
– Don’t forget to put a Disclaimer on the blog so that you do not come under any issues.
– Associate your blog URL or site map with Search Engines, like Bing, Google, etc. for SEO, so that you get max traffic/hits.
– Use inbuilt or third-party Stat counter, Comments, PingBacks, Rating systems/widgets to know the influence & popularity of your blog.
– Popularize your blog with Social media like a Facebook Page, LinkedIn, Twitter, etc.
 

Let me know if you have any questions or need clarifications on these points.

Happy Blogging !!!


Programming is like a Dream… by Lisa


This post is different from my other previous posts as it does not talks about SQL or anything near to it. But it talks about the Progmmers who code not only in SQL but other programming languages too.

I stumbled into Lisa’s post which talks about Programming as a Dream. I liked this article very much and the illustration given by her really fits in each and every scenario in one’s day today life and specially in dreams.

An excerpt from her post:

“If you think about programming like dreaming, you’ll realize that programmers remember more if you interrupt them gently than if you barrage them. If someone wakes you out of bed and starts shouting a long list of things at you to remember, you’ll almost certainly forget what you were dreaming. However, if someone shakes you gently and gives you a few seconds to open your eyes and look around before they start talking, it’s a lot easier to remember the dream for later. The same works for programmers. If you just walk into their office and start talking, one of two things will happen: they’ll completely forget what they were coding, or they won’t really be paying attention to you. However, if you quietly walk up to them and let them know you are there but say nothing until they are ready, the programmer can come to the end of the thought they are on. Once they’ve finished their thought, it will be easier for them to pick up next time and still pay attention to what you have to say.”

To read the whole post here is the link for you to go thru: http://www.independentdeveloper.com/archive/2009/03/17/programming-is-like-a-dream