Jt. If there is a crack there is a reason for the crack – could be stress – is there any expansion joints in the vicinity? is the ground movement a problem? is the toilet puting stress on the Pvc pipe?. Jt. You could get some handy man to weld the pvc. however there is a reason for the pipe to crack! call in a licensed Plumber
What makes you think the pipe is cracked if its inside an unopened ceiling ??
All advice is given with-out seeing the job, and hence all advice MUST be taken as advice with limited knowledge on the exact situation. NO responsibility can or will be taken. And yes, I am a licensed plumber with my own business in Brisbane Australia
By the top piece do you mean the flange? If so, it is sometimes possible to split it and peel it off the drain pipe, but it should be done by a professional or you may have to replace the entire piece.