{"id":148,"date":"2012-04-26T07:32:35","date_gmt":"2012-04-26T06:32:35","guid":{"rendered":"http:\/\/www.darrencoupland.com\/blog\/?p=148"},"modified":"2012-08-15T22:09:56","modified_gmt":"2012-08-15T21:09:56","slug":"removing-user-login-data-from-non-production-environments","status":"publish","type":"post","link":"https:\/\/www.darrencoupland.com\/blog\/2012\/04\/removing-user-login-data-from-non-production-environments\/","title":{"rendered":"Removing User Login Data from Non-Production Environments"},"content":{"rendered":"<p>As part of updating your AX 2009 non-production environments I recommend running a script to remove user login data so you can see who is using your environment and it doesn&#8217;t cloud things with it having LIVE login data in there.<\/p>\n<p>This script will delete user log data prior to the database creation date (which should be the restored date of the database if a RESTORE DATABASE WITH REPLACE was used)<\/p>\n<p>The user log data can be viewed in AX2009 via &#8216;Administration &gt; Inquiries &gt; User Log&#8217;<\/p>\n<p>Initially run this query to determine the AX DB creation date:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SELECT create_date\r\nFROM\r\nsys.databases\r\nWHERE\r\nname =  &#039;&lt;Your AX Database Name&gt;&#039;<\/pre>\n<p>Once you&#8217;ve verified the date is okay run the below script:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">\/* Delete User Login Data based upon Database Creation Date *\/\r\nDECLARE @dbcreatedate DATETIME\r\n\r\n\/* Get Database Creation Date *\/\r\nSELECT @dbcreatedate = create_date\r\nfrom\r\nsys.databases\r\nWHERE name = &#039;&lt;Your AX Database Name&gt;&#039;\r\n\r\nSELECT @dbcreatedate AS Database_Creation_Date\r\n\r\n\/* Delete User Login Data *\/\r\nDELETE FROM SysUserLog\r\nWHERE\r\nCREATEDDATETIME &lt; @dbcreatedate<\/pre>\n<p>Download\u00a0<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"http:\/\/www.darrencoupland.com\/blog\/download\/943\/?tmstv=1776634782\" rel=\"nofollow\" id=\"download-link-943\" data-redirect=\"false\" >\n\tDelete-User-Login-Data-using-Database-Creation-Date\t(6544 downloads\t)\n<\/a>\n<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>As part of updating your AX 2009 non-production environments I recommend running a script to remove user login data so you can see who is using your environment and it doesn&#8217;t cloud things with it having LIVE login data in there.<\/p>\n<p>This script in this post will delete user log data prior to the database creation date (e.g. everything prior to your non-prod restore date)<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[29,8,27,25,28],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-dynamics-ax-2009","tag-administration","tag-ax2009","tag-nonproduction","tag-scripts","tag-t-sql"],"_links":{"self":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":1,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":556,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions\/556"}],"wp:attachment":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}