Is there any fastest way to delete the data from User (sys_user) table ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 12:42 AM
Hi All,
I was trying to delete User [sys_user] table data from our DEV instance which has around 20K records.
Version: Istanbul
1) I have tried initially using Back Ground script (forgot to include setWorkflow(false); statement), it had taken 2.30 hrs time for 15K records.
var gtd = new GlideRecord('sys_user');
gtd.query();
gs.print("No. of records in the table = " +gtd.getRowCount());
gtd.deleteMultiple();
gs.print("Deleted " + gtd.getRowCount() + " records from 'sys_user' table");
2) Later I have tried using the below schedule job (On Demand) but didn't see any much improvement.
var gtd = new GlideRecord('sys_user');
gtd.addQuery('active', false);
gtd.setWorkflow(false);
gtd.query();
gs.log("No. of records in the table = " +gtd.getRowCount());
gtd.deleteMultiple();
gs.log("Deleted " + gtd.getRowCount() + " records from 'sys_user' table");
Please provide if there are any best and fastest way to delete the bulk data.
Regards,
Vijay
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 01:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 02:53 AM
Hi Rajshekhar,
Thanks for your response. Did you ever try this option ? If so, how much time it had taken to remove the data ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 03:01 AM
Hi Vijay,
I had a chance long back to do such work. It might take 4-5 hours to clear out the data from your instance.
Also you can refer to this below helpful community article:
Remove Demo Data from your Instance without submitting an Incident
Hope this helps.
Please hit Like or mark Helpful or Correct based on the impact.
Thanks,
Rajshekhar Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 03:09 AM
Hi Rajashekar,
Thanks for providing the info. I think this process/HI support request is to remove only Demo data.
But I am looking to remove the data which we have loaded earlier in the system and as part of correction, wanted to delete the old one and load Fresh data.
Is this self-service request will do such kind of removals ?
Regards,
Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 03:22 AM
Hi Vijay,
Okay, I got your point.
I find no other way than to use a background script to achieve this.
It's a time consuming thing. Some times, I also need to delete CI's, and I also follow the same technique which actually takes time to get accomplished.
You can refer to this links once:
Background Scripts — ServiceNow Elite
http://wiki.servicenow.com/index.php?title=Remove_All_Data_from_a_Table#gsc.tab=0
Hope this helps.
Please hit Like or mark Helpful or Correct based on the impact.
Thanks,
Rajshekhar Paul
