We all know adaptive query feature introduced in Oracle Database Release 1 is a problem. Recently I had the opportunity to review few 12cR1 databases and found that to alleviate the performance problems, the DBA set parameter OPTIMIZER_FEATURES_ENABLE=11.2.0.4 in Oracle Database 12c Release 1 (12.1.0.2). This observation is the catalyst for the blog “Adaptive Query Patches in Oracle Database 12c Release 1” on my Company Blog.  Oracle Support team provided options to turn off the new feature (OPTIMIZER_ADAPTIVE_FEATURES=FALSE) or to fix the issues with a Proactive Bundle Patch or with a one-off patch. Please read the blog to find out the options DBA have to fix the adaptive query optimization problem in Oracle Database 12c Release 1.

There are quite a lot of new features in the 12c database that I like and have discussed and talked about them at various events. On this #ThanksODC day, I would like to take the opportunity to thank Oracle Technology Network (or Oracle Developer Community) and Oracle ACE Program for all the support they provide to the DBA and Developer community to share and gain knowledge.

Two simple addition to the 12c database makes my life much easier on the security front. The requirement was to lock the user accounts that are not logged into the database for consecutive 60 days.

1.  Last Login Time 

In releases prior to Oracle Database 12c 12.1 to find out when a user last successfully logged into the database, we need to enable session auditing, which has some overhead and the DBA needs to set up routines to clean the audit table, etc. In 11g database, I had to enable session auditing (keep the session audit records for at least 61 days) and write a SQL querying DBA_USERS and DBA_AUDIT_SESSION to list out all the active users who did not use the database for 60 days.

In 12.1, Oracle automatically registers the successful login time in SYS.USER$ table and is visible in DBA_USERS. The LAST_LOGIN column of DBA_USERS shows the last login time of the user in the database. In 12.1 database, my requirement is met by writing a simple SQL against DBA_USERS using the LAST_LOGIN column! No auditing required. The result is used to build dynamic SQL to lock each account using ALTER USER ACCOUNT LOCK statement (similar to 11g).

BTW, have you noticed, when you login to the database using SQL*Plus, you will see the last login time displayed as well.

2.  Inactive Account Lock

My requirement got completely automated in 12.2 database. Oracle introduced the INACTIVE_ACCOUNT_TIME parameter for user profiles. The INACTIVE_ACCOUNT_TIME profile parameter locks a user account that has not logged in to the database instance in a specified number of days. The default value for INACTIVE_ACCOUNT_TIME is 35. The minimum setting is 15 and the maximum is 24855.

Thanks, Oracle!

#ThanksOTN

#ThanksODC

And thank you, @OracleBase, for doing the appreciation day again!

A new pre-built VirtualBox image is available for download  from OTN (updated on March 27, 2017).

Once you download, import and configure the VM, you can pretty much do whatever you want. But Roy and Mike have put together a very good lab environment and exercise for you to practice Oracle database upgrade from 11gR2 to 12cR2. The lab includes

  • Manual upgrade of 11.2.0.4 database to 12.2.0.1
  • Attach 12c non-container database as a PDB to existing 12.2.0.1 CDB
  • Upgrade 11.2.0.4 database using Full Transportable Export/Import to 12.1.0.2 as a PDB
  • Upgrade 12.1.0.2 PDB to 12.2.0.1 using unplug / plug method

The pre-built VM comes with Oracle software already installed.

  • 11gR2 11.2.0.4 – /u01/app/oracle/product/11.2.0.4
  • 12cR1 12.1.0.2 – /u01/app/oracle/product/12.1.0.2
  • 12cR2 12.2.0.1 – /u01/app/oracle/product/12.2.0.1

Practice upgrades, new features, patches, PSU, migration using this VirtualBox image.

Thanks to Mike Dietrich and Roy Swonger!

VirtualBox Download

12c Database Image Download

 

%d bloggers like this: