d365collaborative / d365fo.tools

Tools used for Dynamics 365 Finance and Operations
MIT License
246 stars 101 forks source link

Clear-D365TableDataFromBacpac not clearing tables #469

Closed fwilkinson closed 3 years ago

fwilkinson commented 3 years ago

I am trying to clear 5 tables in a bacpac file using Clear-D365TableDataFromBacpac. To test, I used the exact example in the get-help to try it out: Clear-D365TableDataFromBacpac -Path "C:\Users\User0c594f2f797\Downloads\idcc_testbackup.bacpac" -TableName "dbo.BATCHHISTORY","BATCHJOBHISTORY" -OutputPath c:\temp\ford.bacpac

When I go into the ford.bacpac, there are the same number of files (1200) in the BATCHHISTORY folder in the ford.backpac zip.

Is that normal?

Splaxi commented 3 years ago

Hi @fwilkinson,

Not at all. We are running this for several customers, every day. So I'll dig into one of their files to see if I can spot some difference.

What source environment is the bacpac file originating from? Tier1 or Tier2, if Tier2 then Self-service?

Splaxi commented 3 years ago

Hi Ford,

Just did some testing and it works for me.

Running the command (with a measure, just to see how much it spends): image

It gives me a new bacpac file, which is just a zip. Note the difference in size. image

Comparing the 2 files, where the left hand side is the original bacpac file and the right hand side is the bacpac file where we deleted the mentioned tables from: image

My source environment was a Tier2, Self-Service, 10.0.11 which was data refresh yesterday and exported today. I downloaded the file from LCS onto my local machine.

Could you share more about your environment? If you want, you know how to reach me on mail and we can share some more details.

fwilkinson commented 3 years ago

I think it was the Tier1 MS managed VM that I was running the command on. The bacpac file came from a Tier2 self-hosted. I had other issues with the D365FO.TOOLS module after trying to drop those tables out of the bacpac.

That was my first time running it. When I ran it on my internal VM it looks like it removed that tables directory from the zip file? Or does it just get rid of the contents of that directory?

Sorry for the false alarm. I should know better than to trust a MS managed Tier 1 VM for anything. On top of the fact that it is woefully underpowered and not enough disk space to do a normal restore of my clients DB. I have to split the SQL data files between 4 drives to make it fit 😊.

Thanks again Motz! Hope you have been well,

Ford Wilkinson Phone: (970) 300-2428 | fwilkinson@soprissystems.commailto:fwilkinson@soprissystems.com [A close up of a sign Description automatically generated]

Upcoming PTO: 10/10/2020 – 10/17/2020

From: Mötz Jensen notifications@github.com Sent: Friday, October 2, 2020 7:00 AM To: d365collaborative/d365fo.tools d365fo.tools@noreply.github.com Cc: Ford Wilkinson fwilkinson@soprissystems.com; Mention mention@noreply.github.com Subject: Re: [d365collaborative/d365fo.tools] Clear-D365TableDataFromBacpac not clearing tables (#469)

Hi Ford,

Just did some testing and it works for me.

Running the command (with a measure, just to see how much it spends): [image]https://user-images.githubusercontent.com/8750181/94920553-d3dd8080-04b6-11eb-9a6b-239123ebc35f.png

It gives me a new bacpac file, which is just a zip. Note the difference in size. [image]https://user-images.githubusercontent.com/8750181/94920687-0be4c380-04b7-11eb-878c-37262ca60cbd.png

Comparing the 2 files, where the left hand side is the original bacpac file and the right hand side is the bacpac file where we deleted the mentioned tables from: [image]https://user-images.githubusercontent.com/8750181/94920820-5403e600-04b7-11eb-876e-302511a5117a.png

My source environment was a Tier2, Self-Service, 10.0.11 which was data refresh yesterday and exported today. I downloaded the file from LCS onto my local machine.

Could you share more about your environment? If you want, you know how to reach me on mail and we can share some more details.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/d365collaborative/d365fo.tools/issues/469#issuecomment-702694164, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKU4PD43TZUMQUGGQW6T5JLSIW6DZANCNFSM4R7W7G4A. CAUTION: This email originated outside of Sopris. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Splaxi commented 3 years ago

Yes we remove the directory / folder entirely.

The way the bacpac is structured internally, all folders indicate that there is data for the tabel. So we need to remove it, so stuff doesn't break down the road.