1

I was reading the Oracle 12c concepts manual. Then I realised that something is not "technically" explained. Below is an excerpt of paragraph 13.2.2.2:

When a database is closed as part of a SHUTDOWN with any option other than ABORT, Oracle Database writes data in the SGA to the data files and online redo log files. Next, the database closes online data files and online redo log files...... After the database is closed, Oracle Database unmounts the database to disassociate it from the instance.

I don't technically understand what happens for those two sentences in bold above. Any ideas?

I don't know the whole process but I believe that when a file is closed, the OS or the program takes it off the RAM. I can't quite align that with the bold sentences above.

3

It helps to understand what 'mount mode' means:

Before DB is mounted, instance is up (SGA and other memory structures are allocated but DB and its files etc have not been verified yet. In mount mode, the controlfile will be read, it will make sure all logfiles/datafiles etc are available and ready to go. This is essential maintenance. Then, after mounting, you open the db during which db will do additional checks including to see if any recovery is needed. Once these are done, DB is available for use.

So, during shutdown, once close is issued, Oracle will start stopping processes in a specific order. Then it flushes modifications data to tables, updates column usage metrics, bunch of internal tables, audits etc.

Then DB dismounts, i.e. opposite of mount, it checks for pending disk operations, completes them and then starts closing files, tells ASM to dissociates diskgroup from this instance. After this, archival process, logwriter stops.

So, when file headers are updated, controlfile is updated and file io stops the db is dismounted. All that remains are memory structures. once they are destroyed, DB instance is fully shutdown.

I am fairly certain someone can give you even more gritty details, but this should help you.

  • It does help me. 3rd line from the bottom you said ..file io stops the db is dismounted . So Unmount, among other things, is terminating file io. Cool But what about the 1st sentence in bold in my OP saying "database close online data file" This is also about file io ? – Jason Krs Dec 22 '16 at 13:20
  • It is the same thing @JasonKrs. File IO is for all kind of files, datafiles, redo logfiles, flashback log files (if applicable), controlfiles etc etc. Oracle has to flush all pending IO before it can proceed with closing files. To see all kind of database files query DBA_HIST_IOSTAT_FILETYPE_NAME view. That 3rd line should be, "file IO stops, then db is dismounted". – Raj Dec 22 '16 at 14:08
  • This is something you can see as well, just set 10046 event in your session and then issue shutdown, shutdown immediate and shutdown abort (in separate sessions of course) and check/compare the trace files. Granted they won't tell you everything, but will paint a pretty good picture. – Raj Dec 22 '16 at 14:22
  • Awesome. Very detailed explanation. Thank you. – Jason Krs Dec 22 '16 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.