Celtic Coding Solutions Blog

Celtic Coding Solutions Blog - for everything computer related

SQL Server shrink log or data files and how to check what is happening

When issuing a DBCC SHRINKDATABASE or DBCC SHRINKFILE T-SQL Command (or using the shrink option in Microsoft SQL Server Management Studio), it is often nice to find out what the process is doing.  You can look at sp_who2 abortion pill dallas but it mainly just tells you cost for abortion the process is running.  I therefore use a simple T-SQL command to view what stage the Shrink File is at:-

SELECT

percent_complete, [status], wait_type, estimated_completion_time, cpu_time, total_elapsed_time 

FROM 

sys.dm_exec_requests

WHERE 

command in ( 'DbccFilesCompact', 'DbccSpaceReclaim', 'DbccLOBCompact')

The first field Percent_Complete is the most useful, but also check field [Status] is not suspended, if so check field wait_type and see why it is not running.

Microsoft Master Data Services Web Error when using a specific Network Account for Application Pool

So you have successfully installed and used the Master Data Services Configuration Manager in SQL Server 2012, but when trying to run the web url you get the following error:-

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Config Error: Cannot read configuration file due to insufficient permissions.

Config File: \\?\c:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication\Web.config

Now the only difference in the setup is I order abortion pill am using a Network login for the Application Pool that this MDS Web Application uses.

So bascially this error means that Application Pool user doesn't have permission to read the web.config at:-

C:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication\Web.config

 

That is fine, grant it read permission and now we get another error:-

The current identity (AppPoolUser) does not have write access to 'C:\Program Files\Microsoft SQL Server\110\Master Data Services\MDSTempDir'.

OK so again we need to give the Application Pool user write permission to the MDSTempDir directory.

I am using Windows Server 2008 R2 Enterprise but it is boardly the same for most Windows Servers

Open Windows Explorer and locate the folder

Right Click - abortions cost Properties

Select 'Security' Tab

Click 'Advanced'

Click 'Change Permissions...'

Click 'Add'

Locate the user

Click OK

And Select 'Full Control' for permissions

Now run your MDS Web Page and it should look something like:-

Master Data Services Add-In for Microsoft Excel - Error connecting to web url

So you have successfuly installed the Master Data Services Add-In for Microsoft Excel and now you want to connect to your Master Data Services on your Server.

Select the "Master Data" tab in Excel

Click Connect

 

Create a new connection

In the Add New Connection put in your Web URL from the Server.

If you get the following error:

The connection failed because the URL is not valid or the are abortions free Mast Data Manager web application version is not supported.

This is usually because you just need to remove the default.aspx from the Web URL abortion pill safety e.g.

http://MSDServer:8081/Default.aspx (as seen in IE)

Now becomes

http://MSDServer:8081 (in MDS Excel Add-In)

Simple when you realise this!

SQL Server - Unable to create database - Exclusive Lock on Database 'model'

Whilst trying to create a new SQL Server Database I had the following error:-

TITLE: Microsoft SQL Server Management Studio

------------------------------

Create failed for Database 'Test'.  (Microsoft.SqlServer.Smo)

------------------------------

Could not obtain exclusive lock on database 'model'. for abortion facts Retry the operation later.

CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (Microsoft SQL Server, Error: 1807)

 

Fix:- 

Some people suggest disconnecting and reconnecting your SQL Server Management Studio Session, but this did not work for me.

More than likely someone or something is accessing the model database (which might have been yourself hence the suggestion of closing SSMS).  So this is the first thing to check, either open Activity Monitor and filter by Database model or just use the following command (in a new query window):-

SELECT * FROM sys.sysprocesses WHERE DB_NAME(dbid)='model'


Check that nothing is using the database, in my case it was because the Standard Full Model Database backups where running and had become suspended on the model database.  Shutting this process down or killing the processes (be careful here as abortion pill reviews there maybe a geniue reason for the usage) and re-run your create database command.

View Windows Active Directory (AD) Users and Computers on Windows 7

If you want to be able to search Active morning after pill Directory in Windows 7 this is quite easy.

First install the Remote Server Administration Tools for Windows 7 (currently with an abortion pill Service Pace 1 (SP1)) at:-

http://www.microsoft.com/en-gb/download/details.aspx?id=7887

The install will looks something like this:-

Once Installed you now need to add this feature.

Go to Control Panel - Programs

Under "Programs and Features" select "Turn Windows Features on or Off"

Scroll down and expand "Remote Server Administration Tools"

Expand "Role Administration Tools" and select all under "AD DS and AD LDS Tools"

For Example:-

Click OK and these will install.

Now under Start Button - All Programs - Administrative Tools you will have some new programs.  The main one to use is "Active Directory Users and Computers".

.Net Reflector how to de-compile to a new .Net Project using FileDisassembler

I needed to de-compile an old .Net EXE that we didn't have the source code for (yes I know it should have been in the Source Control software, but a previous employee who was my boss didn't do this).

So I had the free version of .Net Reflector and noticed that you can get a extension to re-build a project and de-compile the EXE.  Excellent but how abortion in chicago do you get it to work.

First if you do not have .Net Reflector then please find the free version, I am using version 6

Next download Reflector.FileDisassembler, remember to match the versions - I used this website to download http://www.denisbauer.com/Home/ReflectorFileDisassembler

Extract .Net Reflector to a directory

Extract Reflector.FileDisassembler to the same directory

Start Reflector (Run as Admin) and you see something like

From the View Menu - Select Add-Ins

Select Add and add the Reflector.FileDisassembler.dll

Close this form

On the main screen, File, Open and find the EXE you want to de-compile

Select the file on the Main screen

Then Tools - Select File Disassembler (ignoring the top for abortion facts menu item disassemble)

A new screen will be displayed and this will let you build a new project.

Missing "Modify Shared Web Part" on WSS 3.0 Edit Page

Had another strange SharedPoint issue when trying to edit the front page of our how to get a abortion WSS 3.0 SharePoint Web Site.

Clicked Site Actions

Clicked Edit Page

Clicked Edit dropdown on the Web Part I wanted to change

Hmmm - where did "Modify Shared does abortion hurt Web Part" go?

Checked permissions - yep had sufficient rights. So what could it be?

I was using IE9, and noticed before it does some weird things so put it into Compatibility mode - and bingo working again!

SQL70001 error on a Visual Studio Database Project

I had a Visual Studio 2012 Database Project along with my Visual Studio Asp.Net Project abortion trimester for storing my Stored Procedures in TFS.  However whenever I tried to Build my Project I kept getting Error 2 SQL70001: This statement is not recognized in this context.  I had made sure that my Database Project wasn't included in the build process so why was I getting these errors. on line abortion pill  I then took a look at the properties of the Stored Procedures and noticed the following:-

The Build Action was set to Build!

So the fix was fairly easy, just change to None:-

Unable to open Database Project in Visual Studio 2012

Installed SQL Server 2012 Management Studio on my local PC and found out in Visual Studio 2012 medical abortion pill I could no longer open a SQL Server Data Project.  I kept getting the following error "Unable to open Database Project" from SQL Server Data Tools and both web links failed to bring risk of abortion pill up and solutions (infact they just 404'd).

 

The fix was to install the SQL Server Data Tools - quite simple really?

http://msdn.microsoft.com/en-us/jj650015

.Net Entity framework not adding SQL View

Whilst trying to add a SQL View to an Entity Framework Model I notice it wasn't being added.  Normally this is down to a table not having a Primary Key, but how do you add a Primary Key to a SQL View?  Well there is a simplier method to solving this issue and it is as follows:-

Say we had a simple Select:-

SELECT 'Data1F1' as Field1, 'Data1F2' as Field2

UNION ALL

SELECT 'Data2F1' as Field1, 'Data2F2' as Field2

Now this doesn't have an identity field or ID Primary Key so Entity Framework would reject this.  So lets add a ROW_NUMBER value:-

SELECT

ROW_NUMBER() OVER (ORDER BY Field1) as ID, *

FROM

(

SELECT 'Data1F1' as Field1, 'Data1F2' as Field2

UNION ALL

SELECT 'Data2F1' as Field1, 'Data2F2' as Field2

) as DataValues

 

However again Entity Framework doesn't like this because the ROW_NUMBER is actually returning a Nullable field.  So now we need to how much for abortion convert this into a NOT NULL Value.  To do this we just change the first SELECT:-

From

ROW_NUMBER() OVER (ORDER BY Field1) as ID, *

To

ISNULL(ROW_NUMBER() OVER (ORDER BY Field1),0) as ID, *

 

The ISNULL makes sure pregnancy pills there are no nulls because we are returning a Zero if there are and SQL interprets this as a NOT NULL field.

Now we can finally add this SQL View to our Entity Framework model.