For how long could the plant generate $\ce{O2}$ from its own $\ce{CO2}$, produced during night?
Plants do not generate $\ce{O2}$ from $\ce{CO2}$.
Photosynthesis consists of two general steps, one that requires light and one that does not. The first step occurs in the thylakoid membrane, and splits water into oxygen, hydrogen ions, and energy. The second step is the carbon fixation step, which occurs in the chloroplasts and uses energy to convert the carbon dioxide into carbohydrates.
Step 1: $\ce{2 H2O + light → 2 H+ + O2 + energy}$
Step 2: $\ce{3 CO2 + 6 H+ + energy → C3H6O3-P + 3 H2O}$
The more detailed chemical equations can be found on the Wikipedia Photosynthesis page.
Since the first step which produced oxygen is light-dependent, it occurs mostly during the daytime. To keep growing during the night, the plants break down the carbohydrates they produced and stored during the day. This cellular respiration uses up oxygen and generates carbon dioxide just as animals do.
Will the plant eventually run out of oxygen at night?
As mentioned, plants require oxygen for cellular respiration, which occurs both at day and night. The difference is that during the night, they are not producing oxygen via photosynthesis. Assuming the plant is in sufficient light and temperature conditions during the day, the plant will not run out of oxygen at night. Plants can survive in sealed environments for very long times. A fun example is a reportedly 53 year-old bottle garden. In a bottle garden, which is essentially the system you are creating, the only difference from a plant out in the environment is that the same oxygen, carbon, and hydrogen molecules are constantly being recycled via photosynthesis and cellular respiration.