How can I delete the contacts that are not a part of Data Extensions or Journey Builder in marketing cloud? I don't wanna delete any of the Data Extensions or Salesforce Data Extensions that are being used for journeys or sends
The Contact Builder deletion method would work fine. You need to:
1- Enable Contact Delete in Contact Builder by going to Contact Builder > Contacts Configuration and clickEnabled in Contact Delete section.
Put 0 in the length of the suppression period in days if you want the contacts to be deleted quickly. The default value is 14 days.
Don't forget to delete these contacts from Sales/Service Cloud if you're using the SFMC Connector.
2- You need to populate these contacts into a list or a Data extension. Then select this list/DE as your deletion source:
Make sure at this step that all contacts in this Data extension/List are not included in your Journey Builder's data sources by using SQL or Data Filter depending on your Data Model.
3- Keep in mind that the deletion process work only on sendable data extensions. Data stored in non-sendable data extensions will not be deleted.
One thing you could do is making SQL statements that JOIN the data extensions from which you want to delete old contacts with the _Subscribers data view.
So for example, the following query gives you the contacts that are in your Subscribers list but not in data extension Contacts1 or Contacts2:
SELECT SubscriberKey FROM _Subscribers LEFT JOIN Contacts1 ON _Subscribers.SubscriberKey = Contacts1.Email LEFT JOIN Contacts2 ON _Subscribers.SubscriberKey = Contacts2.Email WHERE Contacts1.Email IS NULL AND Contacts2.Email IS NULL
Note there are tools out there like DESelect.io that help you do this very easily. With these tools you could build this query and schedule it on a regular base to keep your data clean.