Wednesday, December 21, 2016

Hi,
Microsoft Dynamics CRM Database can be giant because many reason..
The main reason is files into CRM DB.

Attached to this article two queries.
First query to get database size per table.
Second query to get number of records – filee in Annotation table.

Enjoy,
Rami Heleg

SELECT 
 so.object_id AS ObjectID, 
 so.name AS ObjectName,        
 (CONVERT(decimal(20,4),(SUM (ps.reserved_page_count) * 8))) / 1024 As Reserved_MB, 
 (CONVERT(decimal(20,4),SUM ( 
             CASE 
                   WHEN (ps.index_id < 2) THEN (ps.in_row_data_page_count + ps.lob_used_page_count + ps.row_overflow_used_page_count) 
                   ELSE ps.lob_used_page_count + ps.row_overflow_used_page_count 
             END 
             ) * 8)) / 1024 As Data_MB, 
 (CONVERT(decimal(20,4),(CASE WHEN (SUM(used_page_count)) > 
             (SUM(CASE 
                   WHEN (ps.index_id < 2) THEN (ps.in_row_data_page_count + ps.lob_used_page_count + ps.row_overflow_used_page_count) 
                   ELSE ps.lob_used_page_count + ps.row_overflow_used_page_count 
             END 
             )) THEN (SUM(used_page_count) -           
             (SUM(CASE 
                   WHEN (ps.index_id < 2) THEN (ps.in_row_data_page_count + ps.lob_used_page_count + ps.row_overflow_used_page_count) 
                   ELSE ps.lob_used_page_count + ps.row_overflow_used_page_count 
             END 
             ))) ELSE 0 END) * 8)) / 1024 As Index_MB, 
 (SUM ( 
             CASE 
                   WHEN (ps.index_id < 2) THEN ps.row_count 
                   ELSE 0 
             END 
             )) AS [RowCount] 
 FROM sys.dm_db_partition_stats AS ps 
 INNER JOIN sys.objects AS so ON so.object_id = ps.object_id 
 WHERE so.object_id > 100 
 GROUP BY so.object_id, so.name 
 ORDER BY [Reserved_MB]Desc

=============================================================

SELECT  e.logicalname, e.ObjectTypeCode,COUNT( e.ObjectTypeCode) AS NumberOfRecords 
FROM Annotation a inner join Entity e
on a.ObjectTypeCode = e.ObjectTypeCode
GROUP BY  e.ObjectTypeCode , e.logicalname
order by NumberOfRecords desc

Saturday, December 17, 2016

Dynamic CRM: Change Binding HTTP to HTTPS

Changed CRM binding URL from Http to Https:
Server includes a few organizations.
Sound easy, why should be complex with this definition? Only add 's' to the http and change the port from 5555 to 443
If you need to do it don't forget to start in Development environment then QA and after check all system in Production
The first thing is to arrange the list we all the required changes.
I created my task and I assume your tasks should be the same -/+.
1.    Changing Binding Type in Deployment Tool
2.    Define binding in IIS Microsoft Dynamics CRM site to work Https + add certification.
Create a valid Certificate and don’t forget to remove the http records.
3.    Register: under HLM\SOFTWARE\Microsoft\MSCRM, change manual the ServerUrl to Https
4. Jobs: Change CRM URL in app Config.
5. User Windows Services: I assume app config contains CRM URL change
connections.
6. Custom Website that opens CRM pages for instance invokes CRM pages or requesting CRM SDK: update web.config
7. Update code/configuration file in custom website that CRM call to services from this sites.
Site from binding HTTPS call to service from HTTP binding for instance WCF can be security problem.
Another example calls window.openModalDialog unable to get response to CRM in JS.
8. SSIS update parameters.
9. Java Script: check in all file if use hard coded http.
10. Plugins the same search for hard coded.
11. Configuration file. Almost every CRM implementation contain configuration entity change records if needed
12. Telephone integration or third company which calls to CRM should change the path.
13. Open port in firewall. I assume 443.

This is not easy special if Dynamics CRM exists a few years but can be done. :-)

Thanks, 
Rami Heleg.
+972-52-5695114

Saturday, December 10, 2016

Dynamics CRM: Loading all CRM pages is very slow

Dynamics CRM: Loading all CRM pages is very slow

I started to work with Dynamics CRM on premise or online and all the system works very slowly

Loading pages is very slow, and all the system looks busy.

Dynamics CRM is vanilla then develop reason cannot cause to this bad performance.


One of the options can be Antivirus.

When you work with CRM and open some pages for instance Edit.aspx not only the edit.aspx is downloaded from server many JavaScript + CSS + other linked pages is downloaded too

If antivirus is working check if Antivirus is scanning all the scripts and pages when you request page from CRM.

Disabled scanning CRM pages in Antivirus. I got this critical issue when MCAfee was installed on all client stations.

workaround
http://support.microsoft.com/kb/924341

https://kc.mcafee.com/corporate/index?page=content&id=KB65382&actp=search&viewlocale=en_US&searchid=1278011200919

Thanks,
Rami Heleg.
Eytan computers

+972-52-5695114

Wednesday, November 30, 2016

Houston, we have a problem – Aysnc Service is down.. Unable to restart.


Houston, we have a problem – Aysnc Service is down.. Unable to restart.
After install Framework in CRM Database server and restart we Got a major problem Async Maintaince Service is down and failed to upload..

 
Error message:
  
Host XXX : failed while monitoring asynchronous operations queue. Exception: System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.

at Microsoft.Crm.Asynchronous.JobDataAccess.<>c__DisplayClassc.<RetrieveSqlServerName>b__a(Object[] values)

at Microsoft.Crm.Asynchronous.JobDataAccess.ExecuteSqlOrganizationScopeAndProcessRecords(IDbCommand command, Guid organizationId, RecordProcessor recordProcessor)

at Microsoft.Crm.Asynchronous.JobDataAccess.RetrieveSqlServerName(Guid orgId)

at Microsoft.Crm.Asynchronous.JobDataAccess.UpdateJobTargetServer(AsyncJob job)

at Microsoft.Crm.Asynchronous.JobDataAccess.GetNextJob(IList`1 orgsAvailableForMaintenance, DateTime startCycleTime, Int32 maxJobsToReturn)

at Microsoft.Crm.Asynchronous.JobDataAccess.GetNextJobInAppLock(IList`1 orgsAvailableForMaintenance, DateTime startCycleTime, Int32 maxJobsToReturn)

at Microsoft.Crm.Asynchronous.JobDataAccess.SelectJobs(DateTime startCycleTime, Int32 maxJobsToRetrieve)

at Microsoft.Crm.Asynchronous.JobManager.RetrieveAndQueueJobs()

at Microsoft.Crm.Timers.Timer.InvokeElapsedWithCancellationToken(Object state)

at Microsoft.Crm.Timers.Timer.InvokeElapsed()

at Microsoft.Crm.Timers.Timer.TimerProcessor.ExecuteTimers(Object data)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart(Object obj)


 

 steps to fould the reason:

  1. Use CRM Trace when try to restart the service got the error:

  2. crm 2011 failed while monitoring asynchronous operations queue. Exception: System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.
  3. In CRM we have 3 organization , disabled specific one Async successs to restart.. then I checked MSCRM_Config – organization table looks perfect like all other organization..

  4. Backup problematic organization DB and remove the organization + try to import this organization got the next error message

The instance name must be the same as computer name.

 


The reason for this problem found by running this command @@servername in sql management…



How to solve:
 
 
 
select @@servername - result is NULL (should contain server name)

SP_DROPSERVER "SERVERDBNAME"

SP_ADDSERVER "SERVERDBNAME ", local


 
restart the MSSQLSERVER service



Async Maintanice servce back to life.
 
 
Enjoy,

Rami Heleg

+972-52-5695114
 

Wednesday, October 19, 2016

Failed to create Appointment.. get error: Message: Pointer record exists but referenced record of type 8 not found


ERROR to create Appointment.. get error:


Message: Pointer record exists but referenced record of type 8 not found




In my example get in the error message which guid..
Crm Exception: Message: Pointer record exists but referenced record of type 8 not found: 95d0dd28-6a70-e311-9214-005056be5eb7, ErrorCode: -2147220969





The solution:

Search in resource the record - use Database.


select * from ResourceBase

where Resourceid  = '95d0dd28-6a70-e311-9214-005056be5eb7'

and remove the record.




DELETE FROM ResourceBase WHERE ResourceId='95d0dd28-6a70-e311-9214-005056be5eb7''

problem to fix in online


Enjoy,


Rami Heleg.

Wednesday, September 14, 2016

"SYSTEM user account not found"


Set regarding field and in log get the next message "SYSTEM user account not found"

 

The reason for this message belongs to BU. Be sure in security role read Users with full read. The reason user System belong to the top business Unit and current user belong to a diffident business Unit

 

Enjoy,

Rami Heleg