In this Document
| Purpose |
| Scope |
| Details |
| Database Upgrade Assistant (DBUA) |
| Upgrade Path / Compatibility Matrix for 12.2 Oracle Database. |
| Requirements and Recommendation for source database. |
| Requirements and Recommendations for Target database |
| Prerequisites for Preparing Oracle Home on Windows |
| Pre-Upgrade |
| Check for Invalid Objects / Components: |
| Gathering Optimizer Statistics to Decrease Oracle Database Downtime |
| Verifying Materialized View Refreshes are Complete Before Upgrade |
| Check of TIMESTAMP WITH TIMEZONE Datatype |
| Ensuring That No Files Are in Backup Mode and no files need media recovery Before Upgrading |
| Purging Recycle Bin before upgrade |
| Starting with Oracle Database 12c release 2 (12.2), you can upgrade the database without disabling Oracle Database Vault. |
| Requirements for Upgrading Databases That Use Oracle Label Security and Oracle Database Vault (For Oracle Database releases earlier than 12.1) |
| Audit Table Preupgrade |
| Running olspreupgrade.sql on Oracle Database Release 11.2 |
| Save OEM DB Control Configuration (For Oracle Database releases earlier than 12.1) |
| Single-instance databases: |
| Oracle Real Application Clusters (Oracle RAC) databases: |
| Removing DB Control with emremove.sql (For Oracle Database releases earlier than 12.1) |
| Desupport of OLAP Catalog (OLAP AMD) (For Oracle Database releases earlier than 12.1) |
| Drop JSON-Enabled Context search Indexes (Only for the upgrade of 12.1 DB to 12.2) |
| Copying Transparent Encryption Oracle Wallets |
| Check the accounts use Case-Insensitive password version |
| About Password Case Sensitivity |
| Requirement for Upgrading Databases that Use Oracle Warehouse Builder (OWB) |
| Invoke DBUA |
| DBUA (Step 1 of 9) |
| DBUA (step 2of 9) |
| DBUA (Step 3 of 9) |
| DBUA (Step 4 of 9) |
| DBUA (Step 5 of 9) |
| DBUA (Step 6 of 9) |
| DBUA (step 7 of 9) |
| DBUA (Step 8 of 9) |
| DBUA Step 9 of 9) |
| Post-Upgrade |
| Known Issues |
The purpose of this article is to perform the upgrade of the pre-12c database using DBUA to 12.2.0.1.
DBA, Support
- Gather dictionary statistics before upgrade.
- Make user tablespaces read only.
- Take RMAN backup before upgrade.
- Restore database backup to rollback upgrade
- Option to execute Custom scripts before and after upgrade
- Has facility to display Alert log and Activitity log to monitor upgrade activity (feature not available in 12.2 --> need to check)
- Option to upgrade existing listener to 12c home or create a new listener in 12.2 target home.
DBUA can upgrade only supported versions of direct upgrade.
Direct Upgrade to 12.2:
| Source Database | Target Database |
| 11.2.0.3 and higher | 12.2.0.x |
| 12.1.0.x (12.1.0.1 - 12.1.0.2) | 12.2.0.x |
Indirect Upgrade to 12.2:
| Source Database | Upgrade Path | Target Database |
| 7.3.3 (lower) | 7.3.4 --> 9.2.0.8 --> 11.2.0.3 or higher | 12.2.0.x |
| 8.0.5 ( or lower ) | 8.0.6 --> 9.2.0.8 --> 11.2.0.3 or higher | 12.2.0.x |
| 8.1.7 ( or lower ) | 8.1.7 --> 9.2.0.8 --> 11.2.0.3 or higher | 12.2.0.x |
| 9.0.1.3 ( or lower ) | 9.0.1.3 --> 9.2.0.8 --> 11.2.0.3 or higher | 12.2.0.x |
| 9.2.0.7 ( or lower ) |
9.2.0.7 --> 11.2.0.3 or higher |
12.2.0.x |
| 10.2.0.4 ( or lower ) | 10.2.0.4 --> 11.2.0.3 or higher | 12.2.0.x |
| 11.1.0.6 | 11.1.0.6 --> 11.2.0.3 or higher | 12.2.0.x |
| 11.2.0.1 | 11.2.0.1 --> 11.2.0.3 or higher | 12.2.0.x |
dbupgdiag.sql script is a set of sql statements intended to provide a user friendly output to diagnose the status of the database either before (or) after upgrade. The script will create a output file called db_upg_diag__.log
Your system must meet these requirements before you can upgrade Oracle Database on Microsoft Windows platforms. For security reasons, different Microsoft Windows user accounts configured as Oracle
home users for different Oracle homes are not allowed to share the same Oracle Base.
FILE|TERMINAL - Use this option to direct script output to a file. Use TERMINAL to direct output to the terminal. If it is not specified then defaultr is FILE.
TEXT - Use this option to specify log should be in Text format. Use TEXT to specify text output. Use XML to specify XML output. If you do not specify an output type, then the default is text.
DIR - Logs will be created under . Directs the output to a specific directory. If you do not specify an output directory with the DIR option, then the output is directed to one of the default locations: If you define ORACLE_BASE environment variable then the generated scripts and log files will be created under $ORACLE_BASE/cfgtoollogs//preupgrade/ location else it will create under $ORACLE_HOME/cfgtoollogs/db_name/preupgrade/.
For example,
source Oracle Home : /u01/app/oracle/product/12.1.0.1/dbgome_1
target Oracle Home : /u01/app/oracle/product/12.2.0.1/dbhome_1
$ export ORACLE_SID=orcl
$ export ORACLE_BASE=/u01/app/oracle
$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/dbhome_1
$ $ORACLE_HOME/jdk/bin/java -jar /u01/app/oracle/product/12.2.0.1/dbhome_1/rdbms/admin/preupgrade.jar FILE TEXT
Preupgrade generated files:
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade.log
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
$
Examine the preupgrade.log file and follow the recommendation.
set pagesize500
set linesize 100
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version from dba_registry order by comp_name;
select substr(object_name,1,40) object_name,substr(owner,1,15) owner,object_type from dba_objects where status='INVALID' order by owner,object_type;
select owner,object_type,count(*) from dba_objects where status='INVALID' group by owner,object_type order by owner,object_type ;
If you find invalid objects and/or database components then try to VALIDATE the invalid objects and/or database components by executing the following steps:
Run $ORACLE_HOME/rdbms/admin/utlrp.sql to validate the invalid objects in the database. You can execute the utlrp.sql scripts multiple times to validate the invalid objects.
$ sqlplus "/ as sysdba"
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
Oracle strongly recommends that you use this procedure to gather statistics before performing Oracle Database upgrades.Oracle recommends that you use the DBMS_STATS.GATHER_DICTIONARY_STATS procedure to gather these statistics. For example, enter the following SQL statement:
Use this procedure to query the system to determine if there are any materialized view refreshes still in progress. Before upgrading Oracle Database, you must wait until all materialized views have
completed refreshing.
The time zone files that are supplied with Oracle Database 12c release 2 (12.2) is version 26.
Case 1 Timezone version of source database is lower or equal 26.
If the source database is using a timezone file lower than version 26 then there is no DST patch to apply in source oracle home or target 12cR2 home.
Case 2 Timezone version of source database is higher than 26.
If the source database uses a Timezone version higher than 26 then BEFORE the upgrade you MUST patch the target 12cR2 $ORACLE_HOME with a timezone data file of the SAME version as the one used in the source release database.
Execute below query to check for the status of the backup:
SQL> SELECT * FROM v$backup WHERE status != 'NOT ACTIVE';
Ensure that no files require media recovery:
SQL> SELECT * FROM v$recover_file;
SQL> PURGE DBA_RECYCLEBIN;
we can purge the recycle bin via DBUA.
Starting with Oracle Database 12c release 2 (12.2), you can upgrade the database without disabling Oracle Database Vault. However, if you disabled Oracle Database Vault, then you must enable it manually after an upgrade.
Starting with Oracle Database 12c release 2 (12.2), if you have Oracle Database Vault enabled, then you can upgrade the Oracle Database without first disabling Oracle Database Vault. After the upgrade, Oracle Database Vault is enabled by default with the enforcement settings that you had in place before the upgrade. If you manually disable Oracle Database Vault before the upgrade, then you must enable Oracle Database Vault manually after the upgrade.
Enable Oracle Database Vault in the upgraded database by using the procedure dvsys.dbms_macadm.enable_dv(). Run this procedure with a user account that is granted either DV_OWNER or DV_ADMIN. After you run the procedure, restart the database instance so that the procedure takes effect.
You must complete these tasks before starting an upgrade with a database using Oracle Label Security or Oracle Database Vault.
Audit Table PreupgradeIf you are upgrading from a database earlier than Oracle Database release 12.1 that uses Oracle Label Security (OLS) and Oracle Database Vault, then you must first run the OLS preprocess script, olspreupgrade.sql, to process the aud$ table contents. The OLS upgrade moves the aud$ table from the SYSTEM schema to the SYS schema. The olspreupgrade.sql script is a preprocessing script required for this move.
Running olspreupgrade.sql on Oracle Database Release 11.2If Oracle Label Security is installed in the earlier release that you are upgrading, then you must run the OLS preprocess olspreupgrade.sql script.
If Oracle Database Vault is not installed with your release 11.2 database, then you can skip steps 2, 3, 6, and 7 in this section.
To run the OLS preprocess script on a release 11.2 database before upgrading:
1. Copy the ORACLE_HOME/rdbms/admin/olspreupgrade.sql script from the newly installed Oracle home to the Oracle home of the database that you want to upgrade.
2. Start SQL*Plus and connect as DVOWNER to the database that you want to upgrade.
3. Run the following statement:
SQL> GRANT DV_PATCH_ADMIN to SYS;
4. At the system prompt, connect SYS as SYSDBA:
CONNECT SYS AS SYSDBA
5. Run the OLS preprocess script:
ORACLE_HOME/rdbms/admin/olspreupgrade.sql
You may continue to run your applications on the database while the OLS preprocess script is running.
6. After the olspreupgrade.sql completes its run successfully, start SQL*Plus and connect to the database as DVOWNER.
7. Run the following SQL statement:
SQL> REVOKE DV_PATCH_ADMIN from SYS;
If you plan to downgrade database after upgrading to 12.2, then before starting the upgrade save the DB Control configuration and data using emdwgrd utility, so that you can restore the files after downgrading.
Steps to Save data:
1. Install the software for the new Oracle Database 12c release.
2. Set ORACLE_HOME to your old Oracle home.
3. Set ORACLE_SID to the SID of the database being upgraded.
4. Set PATH, LD_LIBRARY_PATH, and SHLIB_PATH to point to the upgraded Oracle Database Oracle home.
5. Change directory to the new Oracle Database release Oracle home.
6. Run emdwgrd
emdwgrd[sh|bat] -save -sid old_SID -path save_directory
Oracle Real Application Clusters (Oracle RAC) databases:
Remote copy must be enabled across all cluster member nodes. Use EM_REMCP environment variable, to indicate which remote copy is configured, for example: export EM_REMCP /usr/bin/scp
7. Enter the SYS password for the database that you want to upgrade.
Starting with Oracle Database 12c release 1 (12.1), DB Control is removed as part of the upgrade process.
Stop DB Console:
emctl stop dbconsole
Execute emremove.sql script. The script willbe located in target 12.2 OH/rdbms/admin/.
SQL>SET ECHO ON
SQL>SET SERVEROUTPUT ON
SQL>@emremove.sql >> Script located in new 12c ORACLE_HOME/rdbms/admin
After emremove.sql completes, you must manually remove ORACLE_HOME/HOSTNAME_SID and ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_HOSTNAME_SID directories from your file system.
Starting with Oracle Database 12c, the OLAP Catalog (OLAP AMD) is desupported and will be removed from the database during the database upgrade. This step can be manually performed before the upgrade to reduce downtime. It can be removed by running the SQL script $ORACLE_HOME/olap/admin/catnoamd.sql script. Do not run the script in UPGRADE mode.
If you are upgrading from Oracle Database 12c release 1 (12.1) to 12c release 2 (12.2), then Oracle recommends that you drop the JSON-enabled context index before upgrading.
Oracle recommends that you drop your existing JSON-enabled index.
If you created a JSON search index using Oracle Database 12c Release 1 (12.1.0.2) then Oracle recommends that you drop that index and create a new search index for use with later releases, using CREATE SEARCH INDEX statement. Please refer "Oracle Database JSON Developer’s Guide" for more details.
If you use Oracle wallet with Transparent Data Encryption (TDE), and you use Database Upgrade Assistant (DBUA) to upgrade the database, then copy thesqlnet.ora and wallet file to the new 12.2 Oracle home.
You must copy the sqlnet.ora and the wallet file manually before starting the upgrade.
1. Log in as an authorized user.
2. Manually copy the sqlnet.ora file, and the wallet file, ewallet.p12, to the new release Oracle home.
3. Open the Oracle wallet in mount.
Log in to SQL*Plus as an administrative user, and enter the following SQL query
SELECT USERNAME,PASSWORD_VERSIONS FROM DBA_USERS;
If there are any 10g versions, suggest you to refer Oracle documentation to fix 10g versions, failing to do so, user accounts with LOCKED after upgrade is completed.
Ensure that you do not have the deprecated parameter SEC_CASE_SENSITIVE_LOGON set to FALSE.
OWB releases earlier than release 11.2.0.3 do not work with Oracle Database 12c. OWB is not installed as part of the software for Oracle Database 12c, and OWB components that may exist in earlier releases are not upgraded as part of the Oracle Database upgrade process. However, you can use OWB release 11.2.0.3 with Oracle Database 12c.
run DBUA, once all Prerequisite checks are successful. please make sure that environment variables are pointing to target 12.2 home.
we need to choose the database SID for upgrade to 12.2.0.1. In this case, it is orcl database.
In below screen, DBUA will perform various pre-checks. It will execute the preupgrade script (preupgrade.jar) and return warnings / errors.
once the pre-upgrade warnings has been adressed, next screen will show various options like Enable Parallel Upgrade, Recompile invalid objects in post upgrade phase, upgrading timezone, gather statistics before the upgrade, setting the user tablespaces to read only during upgrade. also, you can provide any SQL scripts before or after the upgrade.
After selecting option, The next screen will show various Recovery options where it will create Guaranteed Restore Point, or Take an RMAN backup or the backup is already taken outside DBUA then "I have my own backup and restore stratege " option can be chosen.
in this screen, we can create a new listener or upgrade the existing listener to 12.2.0.1.
This screen is for configure EM express or register the upgraded database with EM Cloud control.
This is the summary screen before the actual upgrade starts. Click on Finish to proceed with the upgrade.
The DBUA will start the upgrade process of orcl database. It will perform pre-upgrade, database upgrade and post upgrade steps.
DBUA will perform the upgrade of database components like Oracle server, XML etc.
The final screen will show the result of upgrade.
It will show the log file location and the time taken by various steps of upgrade.
Execute dbupgdiag.sql script to verify status of objects and components. If there are invalid objects then run utlrp.sql to recompile the invalid objects as follows:
sql> connect / as sysdba
sql> @?/rdbms/admin/utlrp.sql
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22039464/viewspace-2139059/ ,如需转载,请注明出处,否则将追究法律责任。