Labels

Apache Hadoop (3) ASP.NET (2) AWS S3 (2) Batch Script (3) BigQuery (21) BlobStorage (1) C# (3) Cloudera (1) Command (2) Data Model (3) Data Science (1) Django (1) Docker (1) ETL (7) Google Cloud (5) GPG (2) Hadoop (2) Hive (3) Luigi (1) MDX (21) Mongo (3) MYSQL (3) Pandas (1) Pentaho Data Integration (5) PentahoAdmin (13) Polybase (1) Postgres (1) PPS 2007 (2) Python (13) R Program (1) Redshift (3) SQL 2016 (2) SQL Error Fix (18) SQL Performance (1) SQL2012 (7) SQOOP (1) SSAS (20) SSH (1) SSIS (42) SSRS (17) T-SQL (75) Talend (3) Vagrant (1) Virtual Machine (2) WinSCP (1)
Showing posts with label SQL Error Fix. Show all posts
Showing posts with label SQL Error Fix. Show all posts

Tuesday, November 4, 2014

SQL CLR Error: .NET Framework is disabled. Enable "clr enabled" configuration option.



Created new SQL Server project in Visual studio, to generate DLL file having SQL function, when we tried to use published function we ended with below error message:

Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option.

To fix the above issue enable CLR in sql server:


sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
RECONFIGURE;
GO

After applying the code we tried to execute the created function, but ended in below error:

A .NET Framework error occurred during execution of user-defined routine or aggregate "<functionname>":
System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host.

The protected resources (only available with full trust) were: All
The demanded resources were: MayLeakOnAbort

System.Security.HostProtectionException:
   at UserDefinedFunctions.<functionname>(SqlDateTime pstTime, String Timezone)


To overcome the above issue, run below commands:

ALTER ASSEMBLY <functionname> WITH PERMISSION_SET = Safe

ALTER DATABASE <DBNAME>
SET TRUSTWORTHY ON


ALTER ASSEMBLY Timezone WITH PERMISSION_SET = UnSafe


Tuesday, December 3, 2013

SSAS Error: No Mapping between Account Names and Security IDs was Done

We may come across the below error mostly while we are deploying SSAS cube in to one server:







It is because of difference in domain between development server and deployment server. In that cases Goto Roles --> Membership tab, and remove non-supportive members from the role.

Friday, August 9, 2013

SSIS Package Runs Fine in Integration Server but Fails From SQL Agent Job

SSIS Package Runs Fine in Integration Server but Fails From SQL Agent Job:

This is the most common issue faced when we deploy packages in 64 bit system. When we create any package with Run64bit set as false, this issue occurs.

In order to overcome the 32\64 bit environment issue, it better we use command line in our job to execute the packages.

Use the below command:

C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\dtexec /DTS "\MSDB\ETLFolder\ETLExtractMaster" /SERVER DW01P /CHECKPOINTING OFF  /REPORTING V

Monday, July 15, 2013

SQL Server Timed Out due to Low Memory Space While SSIS Package was Running

SQL Server Timed Out due to Low Memory Space While SSIS Package was Running:

While I was running my data warehouse job (containing many ETL Master Packges) in SQL SERVER 2008 R2, environment I was frequently facing Timed Out issue and SQL server got disconnected, but when I ran single package manually, it ran without failure.

So I performed the below tasks to monitor the performance of the Job:

1. Monitor performance in Task manager: The CPU usage was more than 90% when the job was running.

2. Tracked job even in EVENT VIEWER when the job failed, and got the below error message:

















3. Executed below query in SQL Server:

SELECT [name] AS [Name]
      ,[configuration_id] AS [Number]
      ,[minimum] AS [Minimum]
      ,[maximum] AS [Maximum]
      ,[is_dynamic] AS [Dynamic]
      ,[is_advanced] AS [Advanced]
      ,[value] AS [ConfigValue]
      ,[value_in_use] AS [RunValue]
      ,[description] AS [Description]
FROM [master].[sys].[configurations]
WHERE NAME IN ('Max server memory (MB)','Min server memory (MB)')

On executing the above query, I found that the server is configured with maximum config value:














4. Executed the below query to trouble shoot the issue:


EXEC sp_configure 'show advanced options', '1'
RECONFIGURE WITH OVERRIDE
EXEC sp_configure 'min server memory', '1024'
RECONFIGURE WITH OVERRIDE
EXEC sp_configure 'max server memory', '6000'
RECONFIGURE WITH OVERRIDE

I set Minimum Allowed Memory to 1 GB and Maximum Allowed Memory to 6 GB and now my data warehouse job runs without any issue and consumes less CPU usage.

Thursday, July 11, 2013

Unable to Restart SQL Agent after restarting SQL Server


When we restart SQLServer, sometimes SQL Agents gets stopped and we may unable to restart the SQLAgent, it remains as Stopped.

In that case execute the below query and try restarting SQL Agent:

EXEC sp_addsrvrolemember 'NT SERVICE\<ServiceName>', 'sysadmin';
GO

You must replace <ServiceName> with SQLServerAgent for the default instance or SQLAgent$InstanceName
for a named instance as below:

EXEC sp_addsrvrolemember 'NT SERVICE\SQLAGENT$BIP1', 'sysadmin';
GO



Thursday, January 17, 2013

DB Connection error while connecting SQL Server Via Excel

I tried to connect SQL Server with excel and faced the below issue:

DBNETLIB ConnectionOpen (Connect()).]SQLServer doesnot exists or access denied.

I was able to overcome this issue by registering SQLVDI.dll through command prompt,


















On successful registration a message box prompting registration successful appears.

Monday, December 17, 2012

ERROR: SSAS Cube has no linked measure groups

When we work on deploying SSAS cubes, we may come across the following error:

Errors in the metadata manager. The cube has no linked measure groups. Errors in the metadata manager. 
An error occurred when loading the ..... cube, from the file, '\\?\C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Data\Sales_sample.0.db\Sales ~.2.cub.xml'.

To resolve this issue perform the below operation:

1. Stop Analysis Service 
2. Navigat to the respective folder where you store Analysis service data "C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Data\".
3. Delete the main folder of the Analysis Service database, e.g., if your analysis service db name is Sales. Then delete the folder named Sales in the path.
4. Also delete Sales.cub.xml file ion the path.
5. Restart the Analysis service.
6.  Deploy the cube.

Thursday, November 1, 2012

To Check SQL Server Status & Blocking Process

-- 1. To check any blocking in SQL server
SELECT CMD, * FROM SYS.SYSPROCESSES WHERE BLOCKED > 0

-- 2. Check the log space in the server
DBCC SQLPERF (LOGSPACE)
GO
  
-- 3. Check any process is running for long time.
SP_WHO2

Tuesday, October 16, 2012

System DSN ODBC Connection Missing While Creating SSIS Connection Manager


We often come across this issue when our working server and source server have different bits 32 or 64.

You might have created System DSN in your system, but when try to create connection manager, the DSN will be missing in ODBC list. To overcome this you need to create DSN connection in appropriate ODBC (32/64).

Perform the followings:

Open command window:
1. Navigate to C:\Windows\Sysos64\Odbacd32.exe












2. ODBC Connection wizard will appear.
3. Create a new system DSN there.
4. Now try creating Connection Manager in SSIS package

Tuesday, August 28, 2012

How to Fix Transaction Manager Connectivity Error in SSIS?


When we set Transaction Option to 'Required' in SSIS containers, often we get an error on Connection Manger
and data connection.
To work around this problem, follow these steps on the computer that Windows Server 2003 or Windows XP SP2 is installed on:
1.       Make sure that the Log On As account for the MSDTC service is the Network Service account. To do this, follow these steps:
a.       Click Start, and then click Run.
b.       In the Run dialog box, type Services.msc, and then click OK.
c.        In the Services window, locate the Distributed Transaction Coordinator service under Name in the right pane.
d.       Under the Log On As column, see whether the Log On As account is Network Service or Local System. 

If the
 Log On As account is Network Service, go to step 2. If the Log On As account is Local Systemaccount, continue with these steps.
e.       Click Start, and then click Run.
f.         In the Run dialog box, type cmd, and then click OK.
g.       At the command prompt, type Net stop msdtc to stop the MSDTC service.
h.       At the command prompt, type Msdtc –uninstall to remove MSDTC.
i.         At the command prompt, type regedit to open Registry Editor.
j.         In Registry Editor, locate the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC
registry key.

Delete this key.
k.       Quit Registry Editor.
l.         At the command prompt, type Msdtc –install to install MSDTC.
m.     At the command prompt, type Net start msdtc to start the MSDTC service.

Note that the
 Log On As account for the MSDTC service is set to Network Service account.
    Enable MSDTC to allow the network transaction. To do this, follow these steps:
 .         Click Start, and then click Run.
a.       In the Run dialog box, type dcomcnfg.exe, and then click OK.
b.       In the Component Services window, expand Component Services, expand Computers, and then expandMy Computer.
c.        Right-click My Computer, and then click Properties.
d.       In the My Computer Properties dialog box, click Security Configuration on the MSDTC tab.
e.       In the Security Configuration dialog box, click to select the Network DTC Access check box.
f.         To allow the distributed transaction to run on this computer from a remote computer, click to select theAllow Inbound check box.
g.       To allow the distributed transaction to run on a remote computer from this computer, click to select theAllow Outbound check box.
h.       Under the Transaction Manager Communication group, click to select the No Authentication Requiredoption. Set No Authentication Required on both the client and the remote systems.
i.         In the Security Configuration dialog box, click OK.
j.         In the My Computer Properties dialog box, click OK.
    Configure Windows Firewall to include the MSDTC program and to include port 135 as an exception. To do this, follow these steps:
 .         Click Start, and then click Run.
a.       In the Run dialog box, type Firewall.cpl, and then click OK
b.       In Control Panel, double-click Windows Firewall.
c.        In the Windows Firewall dialog box, click Add Program on the Exceptions tab.
d.       In the Add a Program dialog box, click the Browse button, and then locate the Msdtc.exe file. By default, the file is stored in the <Installation drive>:\Windows\System32 folder.
e.       In the Add a Program dialog box, click OK.
f.         In the Windows Firewall dialog box, click to select the msdtc option in the Programs and Services list.
g.       Click Add Port on the Exceptions tab.
h.       In the Add a Port dialog box, type 135 in the Port number text box, and then click to select the TCP option.
i.         In the Add a Port dialog box, type a name for the exception in the Name text box, and then click OK.
j.         In the Windows Firewall dialog box, select the name that you used for the exception in step j in thePrograms and Services list, and then click OK.
    Test pinging from the host server to the remote server, and from the remote server to the host server, using the netbios name (server name, without the domain). Microsoft Distributed Transaction Coordinator uses the netbios name, not the fully qualified domain name, to locate servers. If name resolution fails, distributed transactions will fail. If pings using the netbios name fails, refer to the following knowledge base article: