We have a component that needs to be removed but there are almost 100+ pages referencing the component, what is the best way to remove the component references from all those pages?
From querydebug all the paths of pages containing component reference can be fetched, Below is the sample query-
Create a servlet/scheduler
-hit the path
-get the resource
-iterate over its nodes
-delete the component node
-save the session.
By creating a servlet using JCR_SQL2. The servlet will query all the pages for any pages that have the existing component's "sling:resourceType", and delete the node using the session object. Please vigorously test this in Dev, QA, Staging, before calling from Prod.