1- If a Cartier divisor is defined away from a codim 2 closed subset, when can we say that this must be a restriction of a Cartier divisor on the whole scheme?

2- If two Cartier divisor agree away from a codim 2 closed subset, when can we say that they must be the same?