Beruflich Dokumente
Kultur Dokumente
Upgrade Workshop
Lab Workbook 1.5
Efrain Sanchez
Adrian Galindo
Oracle Server Technologies, Platform Technology Solutions
April 2016
Page 2
Disclaimer
Unless explicitly identified as such, the sample code here is not certified or supported by
Oracle; it is intended for educational or testing purposes only. The code samples may be
modified but not redistributed.
This document is intended for attendees of the workshop for their private use. It is not to
be sold, distributed to others, or posted on internal or external web sites without the
written consent of the Oracle Corporation. Copyright 2013, Oracle. All rights reserved.
This documentation contains proprietary information of Oracle Corporation. It is provided
under a license agreement containing restrictions on use and disclosure and is also
protected by copyright law. Reverse engineering of the software is prohibited. If this
documentation is delivered to a U.S. Government Agency of the Department of Defense,
then it is delivered with Restricted Rights and the following legend is applicable:
Restricted Rights Legend
Use, duplication or disclosure by the Government is subject to restrictions for commercial
computer software and shall be deemed to be Restricted Rights software under Federal law,
as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013, Rights in Technical Data and
Computer Software (October 1988).
This material or any portion of it may not be copied in any form or by any means without
the express prior written permission of Oracle Corporation. Any other copying is a violation
of copyright law and may result in civil and/or criminal penalties. If this documentation is
delivered to a U.S. Government Agency not within the Department of Defense, then it is
delivered with Restricted Rights, as defined in FAR 52.227-14, Rights in Data-General,
including Alternate III (June 1987).
The information in this document is subject to change without notice. If you find any
problems in the documentation, please report them to the respective trainers for the
workshop.
Oracle Corporation does not warrant that this document is error-free. Oracle and all
references to Oracle Products are trademarks or registered trademarks of Oracle
Corporation. All other products or company names are used for identification purposes only,
and may be trademarks of their respective owners.
Page 3
Table of Contents
1 Overview ......................................................................................................................... 5
1.1 Workshop Environment Setup ........................................................................................... 5
1.2 Hardware and Software Requirements ................................................................................ 5
1.3 VM Installation ............................................................................................................. 6
1.4 Oracle Virtualbox Installation........................................................................................... 6
1.5 About the VM Image ...................................................................................................... 6
1.6 Database environment in the VM ....................................................................................... 6
1.7 Usernames and Passwords ............................................................................................... 7
1.8 Startup the VM............................................................................................................. 7
1.9 Convetions used ........................................................................................................... 8
2 VM Setup ......................................................................................................................... 9
2.1 Start the Database and Listener ........................................................................................ 9
3 Patch and Updates ............................................................................................................ 10
3.1 Terminology ............................................................................................................... 10
3.2 Oracle Database Security Patch Updates and Patch Set Updates ............................................... 11
3.3 Security Patch Updates are applied only on the base release version ......................................... 11
3.4 One-off Patch Conflict Detection and Resolution ................................................................. 13
3.5 Patch Installation Instructions ........................................................................................ 14
3.6 Patch Post-Installation Instructions .................................................................................. 16
3.7 Applying Conflict Resolution Patches ................................................................................ 16
3.8 Loading Modified SQL Files into the Database ..................................................................... 16
3.9 Upgrade Oracle Recovery Manager Catalog ........................................................................ 17
3.10 Patch Post-Installation Instructions ................................................................................. 17
4 RMAN Database Duplication ................................................................................................. 18
4.1 Overview................................................................................................................... 18
4.2 Steps to ACTIVE database duplication ............................................................................... 19
4.2.1 Preparing the auxiliary instance ................................................................................ 19
4.2.2 Establish Oracle Net Connectivity to the Auxiliary Instance .............................................. 20
4.2.3 Enable Archive Log on db11g ................................................................................... 23
4.2.4 Start RMAN and Connect to the Database Instances ........................................................ 24
4.2.5 Run the DUPLICATE database command : .................................................................... 24
4.3 Drop Enterprise Manager Repository and AWR ...................................................................... 31
4.4 Disable Archive Log ...................................................................................................... 32
5 Database Upgrade ............................................................................................................. 33
5.1 Pre-Upgrade .............................................................................................................. 33
5.2 Configure 12c Listener ................................................................................................. 36
5.3 Database Upgrade Assistant ............................................................................................ 38
5.4 Enterprise Manager Express Configuration ......................................................................... 40
6 Non-CDB to Pluggable Database 12c Conversion ......................................................................... 42
6.1.1 Update Compatible parameter .................................................................................. 42
6.1.2 XML Manifest........................................................................................................ 42
6.2 Merge Data Dictionaries ................................................................................................ 43
6.3 Viewing PDBs Information ............................................................................................. 44
6.4 Renaming a PDB ......................................................................................................... 45
6.5 Renaming and Relocating Online Data Files ......................................................................... 47
7 12c Patch Set Update Apply ................................................................................................. 50
7.1 Clone 12c Home .......................................................................................................... 50
7.2 Update OPatch and apply 12c PSU Jan 2014 ....................................................................... 53
7.3 Create a new CDB ........................................................................................................ 56
7.4 Unplug PDB_APP01 ....................................................................................................... 58
7.5 Plug PDB_APP01 into the new Container ............................................................................ 59
Page 4
Page 5
Overview
The objective of this workshop is to show the upgrade process of a 11g database to 12c
version, you will apply the latest Patch Set Update (PSU), clone the database, upgrade it
and convert the non-container database to a pluggable database.
If you are using Windows 8 Pro, disable Hyper-V by running the following command in a
command prompt with administrator rights:
bcdedit /set hypervisorlaunchtype no
You will need to reboot Windows 8 for the changes to take effect.
1.3 VM Installation
The instructor will supply the Oracle VirtualBox VM image in the class. The VM image is in
the form of an Open Virtualization Archive (OVA) file (db12cvm1.ova). Copy this file to a
Page 6
location on your machine. Ensure that the location has sufficient space to store the OVA file
and also the expanded VMDK files. The OVA archive contains an Open Virtualization Format
(OVF) file and the VMDK files.
Oracle
Oracle
Oracle
Oracle
Page 7
1.7
Page 8
All output from the commands is displayed in the box with a white background (as shown
below). The output will also contain the input, and is shown only when relevant to
illustrate the concept.
$ sqlplus / as SYSDBA
SQL*Plus: Release 12.1.0.1.0 Production on Tue Nov 19 22:59:05 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 64bit
Production With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
SQL> select 1 from dual;
1
---------1
The code font used in the lab is COURIER BOLD for commands and COURIER for output.
Page 9
2 VM Setup
2.1
The Oracle Database processes are not setup to start automatically upon boot time.
Therefore, start the listener and the DB11G database after booting the VM for the first
time, and also at subsequent boots.
1. Double Click the Terminal icon to start a new terminal session.
2. Setup the environment variables prior to starting the listener and the database.
Hint: Type the commands displayed only in bold, make sure to type a space between
the dot and oraenv command:
$ . oraenv
ORACLE_SID = [oracle] ? db11g
The Oracle base remains unchanged with value /u01/app/oracle
4. Startup a SQL*Plus session as the SYS user connected with the SYSDBA role.
$ sqlplus / AS SYSDBA
5. In the SQL*Plus session, start the CDB1 container database using the following
commands.
SQL> startup;
SQL> exit;
Page 10
Page 11
3.2 Oracle Database Security Patch Updates and Patch Set Updates
The Database Security Patch Updates(SPU) or Critical Patch Updates(CPU) and Patch Set
Updates (PSU) are released independently, PSU are released each quarter. However, they
use different patching mechanisms, and Patch Set Updates include both security/critical
and recommended bug fixes.
IMPORTANT: Consider when you are deciding to apply Patch Set Updates instead of Security
Patch Updates, applying a CPU on an installation with an installed PSU is not supported.
3.3 Security Patch Updates are applied only on the base release version
Patch Set Updates can be applied on the base release version or on any earlier Patch Set
Update. For example, 11.1.0.7.2 can be applied on 11.1.0.7.1 and 11.1.0.7.0
Once a Patch Set Update has been applied, the recommended way to obtain future security
content is to apply subsequent Patch Set Updates. Reverting from an applied Patch Set
Update to the Security Patch Update, while technically possible, requires significant time
and effort, and therefore, is not advised. You would need to determine which individual,
non-security patches that are included in the Patch Set Update are pertinent to your
deployment, and then apply them after installing the Security Patch Update.
For more information on Patch Set Updates, see My Oracle Support Note 854428.1, Patch
Set Updates (PSUs) for Oracle Products.
The Patch Set Update and Critical Patch Update January 2014 Availability (Doc ID
1594621.1) recommends the following patches:
Oracle Database 11.2.0.4
Database 11.2.0.4.1 PSU Patch 17478514
Oracle Database 12.1.0.1
Database 12.1.0.1.2 PSU Patch 17552800
GI
12.1.0.1.2 PSU Patch 17735306
Page 12
These PSU files (which contains also Jan-2014 CPU) are already copied into /download
directory for your convenience:
/download
database
11.2
11.2.0.4
PSU_Jan-2014
p17478514_112040_Linux-x86-64.zip
12.1
12.1.0.1
PSU_Jan-2014
p17552800_121010_Linux-x86-64.zip
OPatch
11.2
11.2.0.3.6
p6880880_112000_Linux-x86-64.zip
12.1
12.1.0.1.2
p6880880_112000_Linux-x86-64.zip
Page 13
Is recommended to update OPatch to the latest version, let's check which version is already
installed:
$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
Page 14
Replace OPatch with the latest version, as of February of 2014 is 11.2.0.3.6, the patch file
is already copied into /download directory on the VM.
$ mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.11.2.0.3.4
$ unzip -d $ORACLE_HOME /download/database/OPatch/11.2/11.2.0.3.6/p6880880_112000_Linux-x86-64.zip
$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.6
Determine whether any currently installed one-off patches conflict with the PSU patch,
unzip the PSU (Patch Set Update ) first:
$ mkdir -p /install/11.2/CPU_Jan-2014
$ unzip -d /install/11.2/CPU_Jan-2014 /download/database/11.2/11.2.0.4/CPU_Jan2014/p17478514_112040_Linux-x86-64.zip
$ cd /install/11.2/CPU_Jan-2014/17478514
$ export PATH=$ORACLE_HOME/OPatch:$PATH
$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
The report will indicate the patches that conflict with PSU 17478514 and the patches for
which PSU 17478514 is a superset, check the results and search for the word passed:
Prereq "checkConflictAgainstOHWithDetail" passed.
Set your current directory to the directory where the patch is located and then run the
OPatch utility by entering the following commands, make sure you enter a valid email
structure like name@email.com :
Page 15
$ cd /install/11.2/CPU_Jan-2014/17478514
$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation. All rights reserved.
Oracle Home
: /u01/app/oracle/product/11.2.0.4/db_1
Central Inventory : /u01/app/oraInventory
from
: /u01/app/oracle/product/11.2.0.4/db_1/oraInst.loc
OPatch version
: 11.2.0.3.6
OUI version
: 11.2.0.4.0
Log file location :
/u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/17478514_Jan_29_2014_08_06
_33/apply2014-01-29_08-06-32AM_1.log
Applying interim patch '17478514' to OH '/u01/app/oracle/product/11.2.0.4/db_1'
Verifying environment and performing prerequisite checks...
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name: <<<your email here >>>
Provide your My Oracle Support password to receive security updates via your My
Oracle Support account.
Password (optional): <<<optional>>>
Please shutdown Oracle instances running out of this ORACLE_HOME on the local
system.
(Oracle Home = '/u01/app/oracle/product/11.2.0.4/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
...
Verifying the update...
Patch 17478514 successfully applied
OPatch Session completed with warnings.
Log file location:
/u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/17478514_Jan_29_2014_08_06
_33/apply2014-01-29_08-06-32AM_1.log
OPatch completed with warnings.
Page 16
Connect to the database using SQL*Plus. Connect as SYSDBA and run the catbundle.sql
script as follows:
$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
VERSION
---------11.2.0.4
11.2.0.4
11.2.0.4
COMMENTS
-------------------Patchset 11.2.0.2.0
Patchset 11.2.0.2.0
PSU 11.2.0.4.1
SQL> exit
Page 17
For information about the catbundle.sql script, see My Oracle Support Document 605795.1
Introduction to Oracle Database catbundle.sql.
Check the following log files in $ORACLE_HOME/cfgtoollogs/catbundle or
$ORACLE_BASE/cfgtoollogs/catbundle for any errors:
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log
where TIMESTAMP is of the form YYYYMMMDD_HH_MM_SS.
Page 18
Page 19
Page 20
COMPATIBLE= '11.2.0.4.0'
Page 21
$ vi /etc/oratab
...
db12c:/u01/app/oracle/product/11.2.0.4/db_1:N
$ . oraenv
ORACLE_SID = [cdb1] ? db12c
The Oracle base remains unchanged with value /u01/app/oracle
4. Create the necessary oracle NET connectivity in the listener.ora and the tnsnames.ora
file (In the TARGET and AUXILIARY host, for this workshop is the same server).
Append the SID_LIST_LISTENER on listener.ora file and restart the listener:
$ vi $ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = db12c)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/db_1)
(SID_NAME = db12c)
)
)
$ lsnrctl stop
$ lsnrctl start
$ vi $ORACLE_HOME/network/admin/tnsnames.ora
db11g =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db12cvm1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db11g)
)
)
db12c =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db12cvm1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db12c)
)
)
Confirm the connection to both the target and the auxiliary instance using sqlplus. In this
Page 22
example we are creating the duplicate database in the same server (Auxiliary server).
$ tnsping db11g
$ tnsping db12c
[oracle@db12cvm1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 29-JAN-2014 09:37:27
Copyright (c) 1991, 2013, Oracle.
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db12cvm1.localdomain)(PORT=1521)))
STATUS of the LISTENER
-----------------------Alias
LISTENER
Version
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date
02-FEB-2014 00:36:24
Uptime
0 days 0 hr. 1 min. 42 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/u01/app/oracle/product/11.2.0.4/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/db12cvm1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db12cvm1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "db11g" has 1 instance(s).
Instance "db11g", status READY, has 1 handler(s) for this service...
Service "db11gXDB" has 1 instance(s).
Instance "db11g", status READY, has 1 handler(s) for this service...
Service "db12c" has 2 instance(s).
Instance "db12c", status UNKNOWN, has 1 handler(s) for this service...
Instance "db12c", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
Page 23
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> archive log list
Database log mode
No Archive Mode
Automatic archival
Disabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence
4
Current log sequence
6
SQL> show parameter recovery_file_dest
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------db_recovery_file_dest
string /u01/app/oracle/fast_recovery_
area
db_recovery_file_dest_size
big integer 4182M
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size
2260088 bytes
Variable Size
671089544 bytes
Database Buffers
390070272 bytes
Redo Buffers
5517312 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence
4
Next log sequence to archive
6
Current log sequence
6
SQL> alter system archive log current;
SQL> alter system archive log current;
SQL> exit
Page 24
Page 25
263049216 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2252336
117440976
138412032
4943872
bytes
bytes
bytes
bytes
db_name =
db_unique_name =
263049216 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2252336
117440976
138412032
4943872
bytes
bytes
bytes
bytes
Page 26
Page 27
Page 28
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 29-JAN-14
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 8 is already on disk as file
/u01/app/oracle/product/11.2.0.4/db_1/dbs/arch1_8_832156459.dbf
archived log file
name=/u01/app/oracle/product/11.2.0.4/db_1/dbs/arch1_8_832156459.dbf thread=1
sequence=8
media recovery complete, elapsed time: 00:00:00
Finished recover at 29-JAN-14
Oracle instance started
Total System Global Area
263049216 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2252336
117440976
138412032
4943872
bytes
bytes
bytes
bytes
db_name =
db_unique_name scope=spfile
263049216 bytes
Fixed Size
2252336 bytes
Variable Size
117440976 bytes
Database Buffers
138412032 bytes
Redo Buffers
4943872 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DB12C" RESETLOGS ARCHIVELOG
MAXLOGFILES
16
Page 29
MAXLOGMEMBERS
3
MAXDATAFILES
100
MAXINSTANCES
8
MAXLOGHISTORY
292
LOGFILE
GROUP
1 ( '/u01/app/oracle/oradata/db12c/redo01.log' ) SIZE 50 M
GROUP
2 ( '/u01/app/oracle/oradata/db12c/redo02.log' ) SIZE 50 M
GROUP
3 ( '/u01/app/oracle/oradata/db12c/redo03.log' ) SIZE 50 M
DATAFILE
'/u01/app/oracle/oradata/db12c/system01.dbf'
CHARACTER SET AL32UTF8
REUSE,
REUSE,
REUSE
Page 30
RECID=1 STAMP=838148793
RECID=2 STAMP=838148793
RECID=3 STAMP=838148793
RECID=4 STAMP=838148793
You should see the words Finished Duplicate, now that the duplication is completed, exit
Recovery Manager:
RMAN> exit
Page 31
EXEC
EXEC
drop
drop
drop
drop
drop
sysman.emd_maintenance.remove_em_dbms_jobs;
sysman.setEMUserContext('',5);
user sysman cascade;
role MGMT_USER;
user MGMT_VIEW cascade;
public synonym MGMT_TARGET_BLACKOUTS;
public synonym SETEMVIEWUSERCONTEXT;
Page 32
We need to modify the parameter file and delete all the lines starting with "_", which are
the hidden parameters, sed command is perfect for this task:
$ mv initdb12c.ora initdb12c.bak
$ sed /^_/d initdb12c.bak > initdb12c.ora
Still using vi on file initdb12c.ora, delete the lines containing the following parameters
which are deprecated :
BACKGROUND_DUMP_DEST
USER_DUMP_DEST
Otherwise you will get these errors:
ORA-32006: BACKGROUND_DUMP_DEST initialization parameter has been deprecated
ORA-32006: USER_DUMP_DEST initialization parameter has been deprecated
shutdown immediate;
startup mount
alter database noarchivelog;
alter database open;
archive log list;
exit
$ rm -rf /u01/app/oracle/fast_recovery_area/db12c/arch*.dbf
$ rm -rf $ORACLE_HOME/dbs/arch*.dbf
Page 33
5 Database Upgrade
5.1 Pre-Upgrade
Certain steps are needed for the upgrade, execute the following commands to know which
actions need to be executed before:
$ export ORACLE_SID=db12c
$ cd /u01/app/oracle/product/12.1.0.1/db_1/rdbms/admin
$ sqlplus / as sysdba
$ @preupgrd.sql
Loading Pre-Upgrade Package...
Executing Pre-Upgrade Checks...
Pre-Upgrade Checks Complete.
************************************************************
Results of the checks are located at:
/u01/app/oracle/cfgtoollogs/DB12C/preupgrade/preupgrade.log
Pre-Upgrade Fixup Script (run in source database environment):
/u01/app/oracle/cfgtoollogs/DB12C/preupgrade/preupgrade_fixups.sql
Post-Upgrade Fixup Script (run shortly after upgrade):
/u01/app/oracle/cfgtoollogs/DB12C/preupgrade/postupgrade_fixups.sql
************************************************************
Fixup scripts must be reviewed prior to being executed.
************************************************************
************************************************************
====>> USER ACTION REQUIRED
<<====
************************************************************
The following are *** ERROR LEVEL CONDITIONS *** that must be addressed
prior to attempting your upgrade.
Failure to do so will result in a failed upgrade.
You MUST resolve the above errors prior to upgrade
************************************************************
Execute the fixups script to find out what specific changes need to be done :
SQL> @/u01/app/oracle/cfgtoollogs/DB12C/preupgrade/preupgrade_fixups.sql
Page 34
**********************************************************************
Check Tag:
DEFAULT_PROCESS_COUNT
Check Summary: Verify min process count is not too low
Fix Summary:
Review and increase if needed, your PROCESSES value.
**********************************************************************
Fixup Returned Information:
WARNING: --> Process Count may be too low
Database has a maximum process count of 200 which is lower than the
default value of 300 for this release.
You should update your processes value prior to the upgrade
to a value of at least 300.
For example:
ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE
or update your init.ora file.
**********************************************************************
**********************************************************************
Check Tag:
DBMS_LDAP_DEPENDENCIES_EXIST
Check Summary: Check for dependency on DBMS_LDAP package
Fix Summary:
Network Objects must be reviewed manually.
**********************************************************************
Fixup Returned Information:
WARNING: --> Existing DBMS_LDAP dependent objects
Database contains schemas with objects dependent on DBMS_LDAP package.
Refer to the Upgrade Guide for instructions to configure Network ACLs.
USER APEX_030200 has dependent objects.
**********************************************************************
**********************************************************************
Check Tag:
AMD_EXISTS
Check Summary: Check to see if AMD is present in the database
Fix Summary:
Manually execute ORACLE_HOME/oraolap/admin/catnoamd.sql script to
remove OLAP.
**********************************************************************
Fixup Returned Information:
INFORMATION: --> OLAP Catalog(AMD) exists in database
Starting with Oracle Database 12c, OLAP is desupported.
If you are not using the OLAP Catalog component and want
to remove it, then execute the
ORACLE_HOME/oraolap/admin/catnoamd.sql script before or
after the upgrade.
**********************************************************************
**********************************************************************
[Pre-Upgrade Recommendations]
**********************************************************************
*****************************************
********* Dictionary Statistics *********
*****************************************
Please gather dictionary statistics 24 hours prior to
Page 35
Only for this workshop, and as an example to delete a database option, drop OLAP and
APEX, is recommended to drop all the options that are not in use, this will reduce the total
time needed to execute the upgrade:
SQL> @?/olap/admin/catnoamd.sql
SQL> @?/apex/apxremov.sql
SQL> drop package htmldb_system;
SQL> drop public synonym htmldb_system;
Page 36
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db12cvm1.localdomain)(PORT=1521)))
STATUS of the LISTENER
-----------------------Alias
LISTENER
Version
TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date
30-JAN-2014 00:14:33
Uptime
0 days 0 hr. 2 min. 22 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Page 37
Page 38
db12c
Page 39
Note that this time does not count Post-Upgrade time, selections on Step 4 Upgrade
Options in dbua.
Page 40
Use the PL/SQL procedure DBMS_XDB_CONFIG.SETHTTPSPORT to disable HTPP and set the
HTTPS port for EM Express, this will update the Oracle XML DB Repository and the changes
are immediate.
SQL> exec dbms_xdb_config.sethttpport(0);
SQL> exec dbms_xdb_config.sethttpsport(5555);
The listener is now configured to use port 5555 for https protocol, to display EM Express
port configuration, use the following command:
SQL> select dbms_xdb_config.getHttpsPort() from dual;
exit SQLPLUS
Display the listener configuration and filter the output by tcp using grep command:
$ lsnrctl status | grep tcp
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db12cvm1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=db12cvm1.localdomain)(PORT=5555))(Securi
ty=(my_wallet_directory=/u01/app/oracle/admin/DB12C/xdb_wallet))(Presentation=HTTP)
(Session=RAW))
Page 41
Page 42
Second, shutdown the database instance and open it in read only mode.
SQL> shutdown immediate;
SQL> startup open read only
Page 44
Notice that the query only displays information about db12c pluggable database, reconnect
to container cdb1 and execute the query again.
SQL> conn / as sysdba
SQL> SELECT CON_ID, NAME, OPEN_MODE, RESTRICTED, OPEN_TIME FROM V$PDBS;
NAME
--------------PDB$SEED
PDB11
PDB12
DB12C
OPEN_MODE
---------READ ONLY
MOUNTED
MOUNTED
READ WRITE
RESTRICTED OPEN_TIME
---------- -----------------------------NO
30-JAN-14 06.25.59.041 AM
NO
30-JAN-14 08.30.39.336 AM
Now, all the PDBs on his container are displayed, notice PDB11 and PDB12 are only mounted
which is the default behavior, you can open each pluggable database pdb11 with the
following command:
SQL> alter pluggable database PDB11 open;
Pluggable database altered.
There are several options to open an close one, a list or all PDBs, for more information
review the database documentation library.
Page 45
Change the session to PDB11 and display the container ID and NAME:
SQL> alter session set container=PDB11;
SQL> SHOW CON_ID
CON_ID
-----------------------------3
SQL> SHOW CON_NAME
CON_NAME
-----------------------------PDB11
Rename the PDB. You must be connected to the PDB to rename it.
SQL> alter session set container=db12c;
SQL> alter pluggable database db12c rename global_name to pdb_app01;
SQL> alter pluggable database close immediate;
SQL> alter pluggable database open;
SQL> select name, open_mode from v$pdbs;
NAME
OPEN_MODE
--------------- ---------PDB_APP01
READ WRITE
SQL> exit
Page 46
Enter password:
Last Successful login time: Thu Jan 30 2014 07:41:39 -06:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
Page 47
Modify the tnsnames.ora file in 11gR2 Home and test the connection:
$ . oraenv
ORACLE_SID = [db11g] ? db11g
The Oracle base remains unchanged with value /u01/app/oracle
$ sqlplus system@pdb_app01
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 30 10:14:12 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
I you need to enable client connections from a previous version client, for example Net8,
add the following lines in sqlnet.ora on the server and client accordingly:
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
SQLNET.ALLOWED_LOGON_VERSION_VERSION=8
Page 48
Create the destination directory and move system, sysaux, users and example datafiles,
make sure you have enough space available on the destination directory, the command will
create a new file on the destination before deleting the source datafile.
SQL> !mkdir /u01/app/oracle/oradata/CDB1/PDB_APP01
SQL> ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/db12c/system01.dbf'
TO '/u01/app/oracle/oradata/CDB1/PDB_APP01/system01.dbf';
SQL> ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/db12c/sysaux01.dbf'
TO '/u01/app/oracle/oradata/CDB1/PDB_APP01/sysaux01.dbf';
SQL> ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/db12c/users01.dbf'
TO '/u01/app/oracle/oradata/CDB1/PDB_APP01/users01.dbf';
SQL> ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/db12c/example01.dbf'
TO '/u01/app/oracle/oradata/CDB1/PDB_APP01/example01.dbf';
The ALTER DATABASE MOVE DATAFILE syntax is not available for temporary files, so you need
to create a new temporary tablespace and delete the original temp tablespace.
SQL> CREATE TEMPORARY TABLESPACE pdb_app01_temp
TEMPFILE '/u01/app/oracle/oradata/CDB1/PDB_APP01/pdb_app01_temp01.dbf'
SIZE 30M REUSE EXTENT MANAGEMENT LOCAL UNIFORM;
Tablespace created.
SQL> ALTER DATABASE TEMPFILE
'/u01/app/oracle/oradata/CDB1/PDB_APP01/pdb_app01_temp01.dbf'
AUTOEXTEND ON NEXT 100M;
Database altered.
Page 49
Now you can delete the control files, redo logs and undo datafile remaining from the
upgraded db12c which are no longer needed for a pluggable database.
SQL> !ls -la /u01/app/oracle/oradata/db12c
total 901168
drwxr-xr-x. 2
drwxr-x---. 7
-rw-r-----. 1
-rw-r-----. 1
-rw-r-----. 1
-rw-r-----. 1
-rw-r-----. 1
oracle
oracle
oracle
oracle
oracle
oracle
oracle
oinstall
4096
oinstall
4096
oinstall 10502144
oinstall 52429312
oinstall 52429312
oinstall 52429312
oinstall 754982912
Feb
Feb
Feb
Feb
Feb
Feb
Feb
6
2
6
6
6
6
6
Page 50
22:09
00:28
20:01
19:44
19:59
19:44
20:01
.
..
control01.ctl
redo01.log
redo02.log
redo03.log
undotbs01.dbf
11.2.0.4
PSU_Jan-2014
p17478514_112040_Linux-x86-64.zip
12.1
12.1.0.1
PSU_Jan-2014
p17552800_121010_Linux-x86-64.zip
OPatch
11.2
11.2.0.3.6
p6880880_112000_Linux-x86-64.zip
12.1
12.1.0.1.2
p6880880_121010_Linux-x86-64.zip
Page 51
$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/db_2
$ export PATH=$ORACLE_HOME/bin:/usr/sbin:/usr/sbin:/usr/lib64/qt3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
Page 52
5% Done.
10% Done.
15% Done.
20% Done.
25% Done.
30% Done.
35% Done.
40% Done.
45% Done.
50% Done.
55% Done.
60% Done.
65% Done.
70% Done.
75% Done.
80% Done.
85% Done.
90% Done.
95% Done.
100% Done.
To finish the cloning process, execute the following scripts as root user:
$ su Password:
# /u01/app/oracle/product/12.1.0.1/db_2/root.sh
Check /u01/app/oracle/product/12.1.0.1/db_2/install/root_db12cvm1.localdomain_201402-19_14-22-33.log for the output of root script
At this point, the cloned Oracle home is ready to support a database. You can create a new
database for this Oracle home by running Oracle Database Configuration Assistants or point
an existing database to the new Oracle home.
The following steps can be used to point an existing database to the new Oracle home.
Create a 12c_env2.sh file from 12c_env.sh environment file and modify the path for the
new Oracle Home.
$ cd /home/oracle
$ cp 12c_env 12c_env2
$ vi 12c_env2
PATH=/usr/sbin:/usr/lib64/qt3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/b
in:$HOME/bin
export
export
export
export
export
export
export
export
export
export
export
export
ORACLE_HOSTNAME=db12cvm1.localdomain
ORACLE_UNQNAME=cdb1
ORACLE_BASE=/u01/app/oracle
GRID_HOME=/u01/app/12.1.0.1/grid
DB_HOME=$ORACLE_BASE/product/12.1.0.1/db_2
ORACLE_HOME=$DB_HOME
ORACLE_SID=cdb1
ORACLE_TERM=xterm
BASE_PATH=/usr/sbin:$PATH
PATH=$ORACLE_HOME/bin:$BASE_PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
$ . 12c_env2
$ echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0.1/db_2
Page 53
Replace OPatch with the latest version, as of February of 2014 is 11.2.0.3.6, the patch file
is already copied into /download directory on the VM.
$ mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.12.1.0.1.0
$ unzip -d $ORACLE_HOME /download/database/OPatch/12.1/12.1.0.1.2/p6880880_121010_Linux-x8664.zip
$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.1.0.1.2
OPatch succeeded.
To install the PSU 12.1.0.1.2 patch, the Oracle home must be the 12.1.0.1.0 Database
installed. Subsequent PSU patches can be installed on Oracle Database 12.1.0.1.0 or any
PSU with a lower 5th numeral version than the one being installed.
Determine whether any currently installed one-off patches conflict with the PSU patch,
unzip the PSU (Patch Set Update ) first:
$ mkdir -p /install/12.1/CPU_Jan-2014
$ unzip -d /install/12.1/CPU_Jan-2014 /download/database/12.1/12.1.0.1/CPU_Jan2014/p17552800_121010_Linux-x86-64.zip
$ cd /install/12.1/CPU_Jan-2014/17552800/
$ export PATH=$ORACLE_HOME/OPatch:$PATH
$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home
: /u01/app/oracle/product/12.1.0.1/db_2
Central Inventory : /u01/app/oraInventory
from
: /u01/app/oracle/product/12.1.0.1/db_2/oraInst.loc
Page 54
OPatch version
: 12.1.0.1.2
OUI version
: 12.1.0.1.0
Log file location :
/u01/app/oracle/product/12.1.0.1/db_2/cfgtoollogs/opatch/opatch2014-02-21_10-0209AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
The report will list all the patches that might have a conflict with PSU 17552800 and the
patches for which PSU 17552800 is a superset, note that Oracle pro-actively provides PSU
12.1.0.1.2 one-off patches for common conflicts.
Check the results and search for the word passed:
So far you just passed the Pre-Requirements, follow the next steps to install the patch:
Shut down all instances and listeners associated with the Oracle home that you are
updating. Set your current directory to the directory where the patch is located
(/install/12.1/CPU_Jan-2014/17552800) and then run the OPatch utility by entering the
following commands, make sure you enter a valid email structure like name@email.com :
$ cd /install/12.1/CPU_Jan-2014/17552800
$ opatch apply
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home
: /u01/app/oracle/product/12.1.0.1/db_2
Central Inventory : /u01/app/oraInventory
from
: /u01/app/oracle/product/12.1.0.1/db_2/oraInst.loc
OPatch version
: 12.1.0.1.2
OUI version
: 12.1.0.1.0
Log file location :
/u01/app/oracle/product/12.1.0.1/db_2/cfgtoollogs/opatch/opatch2014-02-21_10-0209AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
[oracle@db12cvm1 17552800]$ cd /install/12.1/CPU_Jan-2014/17552800
[oracle@db12cvm1 17552800]$ opatch apply
Oracle Interim Patch Installer version 12.1.0.1.2
Page 55
Oracle Home
: /u01/app/oracle/product/12.1.0.1/db_2
Central Inventory : /u01/app/oraInventory
from
: /u01/app/oracle/product/12.1.0.1/db_2/oraInst.loc
OPatch version
: 12.1.0.1.2
OUI version
: 12.1.0.1.0
Log file location :
/u01/app/oracle/product/12.1.0.1/db_2/cfgtoollogs/opatch/17552800_Feb_21_2014_10_06
_27/apply2014-02-21_10-06-27AM_1.log
Applying interim patch '17552800' to OH '/u01/app/oracle/product/12.1.0.1/db_2'
Verifying environment and performing prerequisite checks...
Patch 17552800: Optional component(s) missing : [ oracle.network.cman, 12.1.0.1.0 ]
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name: email@oracle.com
Provide your My Oracle Support password to receive security updates via your My
Oracle Support account.
Password (optional):
Please shutdown Oracle instances running out of this ORACLE_HOME on the local
system.
(Oracle Home = '/u01/app/oracle/product/12.1.0.1/db_2')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Patching
Patching
Patching
Patching
Patching
Patching
Patching
Patching
component
component
component
component
component
component
component
component
oracle.network.rsf, 12.1.0.1.0...
oracle.rdbms, 12.1.0.1.0...
oracle.rdbms.rsf, 12.1.0.1.0...
oracle.ldap.rsf, 12.1.0.1.0...
oracle.ldap.rsf.ic, 12.1.0.1.0...
oracle.rdbms.util, 12.1.0.1.0...
oracle.rdbms.dbscripts, 12.1.0.1.0...
oracle.rdbms.rman, 12.1.0.1.0...
Page 56
Now you are ready to run Database Configuration Assistant in response file mode, you must
use the -responseFile flag in combination with either the -silent or -progressOnly flag. In
the silent mode, Database Configuration Assistant uses values that you specify, in the
response file or as command-line options, to create a database.
Create the CDB03 directory and execute dbca
$ mkdir -p /u01/app/oracle/oradata/CDB03
$ dbca -silent -createDatabase -cloneTemplate -responseFile cdb03.rsp
Copying database files
1% complete
3% complete
37% complete
Creating and starting Oracle instance
40% complete
Page 57
45% complete
46% complete
47% complete
52% complete
57% complete
58% complete
59% complete
62% complete
Completing Database Creation
66% complete
70% complete
74% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/CDB03/CDB03.log" for further
details.
Page 58
The unplugging operation makes changes in the PDB data files to record that the PDB was
properly and successfully unplugged. Because the PDB is still part of the CDB, you can back
it up in Oracle Recovery Manager (Oracle RMAN). This backup provides a convenient way to
archive the unplugged PDB. After backing it up, you then remove it from the CDB catalog.
But, of course, you must preserve the data files for the subsequent plugging operation.
Page 59
Create the destination directory for the new data files and then execute the following
command to Plug the PDB into the CDB03 and move the data files to a new location, all in a
single command, make sure lines don't get truncated.
Page 60
Verify the status and open mode of the plugged PDB and list the data files of the plugged
PDB.
SQL> show pdbs;
CON_ID CON_NAME
OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ---------2 PDB$SEED
READ ONLY NO
3 PDB_APP01
MOUNTED
SQL> select name from v$datafile where con_id=3;
NAME
-------------------------------------------------------------------------------/u01/app/oracle/oradata/CDB03/PDB_APP01/system01.dbf
/u01/app/oracle/oradata/CDB03/PDB_APP01/sysaux01.dbf
/u01/app/oracle/oradata/CDB03/PDB_APP01/users01.dbf
/u01/app/oracle/oradata/CDB03/PDB_APP01/example01.dbf
The last step is to update the PDB Data Dictionary using the datapatch utility, this tool will
run the necessary apply scripts to load the modified SQL files into the databases. An entry
will be added to the dba_registry_history and dba_registry_sqlpatch views reflecting the
patch application.
$ cd $ORACLE_HOME/OPatch
$ ./datapatch -verbose
SQL Patching tool version 12.1.0.1.0 on Sat Feb 22 14:57:56 2014
Copyright (c) 2013, Oracle. All rights reserved.
Connecting to database...OK
Page 61
Page 62
Query dba_registry_sqlpatch view, verify that the Status for the PSU APPLY is "SUCCESS".
SQL>
SQL>
SQL>
from
PATCH_ID ACTION
STATUS
SUBSTR(DESCRIPTION,1,10)
---------- --------------- --------------- ---------------------------------------17552800 APPLY
SUCCESS
bundle:PSU
For any other status, refer to the following My Oracle Support note for additional
information and actions: Document 1609718.1 What to do if the status of a datapatch
action was not SUCCESS.
Review the patch history applied:
SQL> column version format A10
SQL> column bundle_series format A10
SQL> column comments format A20
SQL> select to_char(action_time, 'DD-MM-YY') atime, version, comments
from registry$history;
ATIME VERSION
COMMENTS
-------- ------------------------------ -------------------24-05-13 12.1.0.1
Patchset 12.1.0.0.0
22-02-14 12.1.0.1
PSU 12.1.0.1.2
22-02-14 12.1.0.1
PSU 12.1.0.1.2
Page 63
Look that the PSU was applyied to the CDB and PDB as well. In addition, you can check the
log files for catbundle in $ORACLE_HOME/cfgtoollogs/catbundle or
$ORACLE_BASE/cfgtoollogs/catbundle for any errors, where TIMESTAMP is of the form
YYYYMMMDD_HH_MM_SS:
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log
Page 64
Now use the data files of the unplugged PDB to plug the PDB into the CDB and copy the
data files to a new location, but first review the current location of the datafiles from the
XML Manifest, there is a directory named with the guid of the PDB:
$ cat /home/oracle/pdb11.xml| grep path
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
system_98zldmcb_.dbf</path>
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
sysaux_98zldm8q_.dbf</path>
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
temp_98zlg781_.dbf</path>
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
users_98zlgq7b_.dbf</path>
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
soe_98zm1nfb_.dbf</path>
Page 65
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
sh_98znt6cb_.dbf</path>
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
pdb11_us_9hm83w3b_.dbf</path>
<path>/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_
pdb11_te_9hm8dxht_.tmp</path>
Create a simple backup to later restore the files to their original CDB
$ zip -r /home/oracle/pdb11.zip
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A
adding: u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/ (stored 0%)
adding: u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/
(stored 0%)
adding:
u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sysaux_
98zldm8q_.dbf (deflated 79%)
adding:
u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_pdb11_u
s_9hm83w3b_.dbf (deflated 100%)
adding:
u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_soe_98z
m1nfb_.dbf (deflated 78%)
adding:
u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_system_
98zldmcb_.dbf (deflated 82%)
adding:
u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sh_98zn
t6cb_.dbf (deflated 68%)
adding:
u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_users_9
8zlgq7b_.dbf (deflated 100%)
Now that you know where is the source directory located, create the target directory and
connect to CDB03 in order to plug the new PDB_APP02.
$ mkdir /u01/app/oracle/oradata/CDB03/PDB_APP02
$ . oraenv
[enter CDB03 at the prompt]
$ sqlplus / as sysdba
SQL> create pluggable database CDB_APP02 AS CLONE using '/home/oracle/pdb11.xml'
COPY
file_name_convert
=('/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A');
Page 66
ERROR at line 1:
ORA-01276: Cannot add file
/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sy
stem_98zldmcb_.dbf. File has an Oracle Managed Files file name.
Because this PDB was created using managed files you will have to specify each datafile to
move to the new Managed Directory. Since we are not creating a clone, the GUID remains
the same:
SQL> create pluggable database PDB_APP02
using '/home/oracle/pdb11.xml'
NOCOPY ;
SQL>
create pluggable database CDB_APP02
using '/home/oracle/pdb11.xml'
COPY file_name_convert = (
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_system_98zldmcb_.dbf',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_system_98zldmcb_.dbf'
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sysaux_98zldm8q_.dbf',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sysaux_98zldm8q_.dbf',
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_users_98zlgq7b_.dbf',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_users_98zlgq7b_.dbf',
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_soe_98zm1nfb_.dbf',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_soe_98zm1nfb_.dbf',
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sh_98znt6cb_.dbf',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sh_98znt6cb_.dbf',
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_pdb11_us_9hm83w3b_.dbf',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_pdb11_us_9hm83w3b_.dbf',
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_temp_98zlg781_.dbf',
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_temp_98zlg781_.dbf'
);
Page 67
Verify the status and open mode of the plugged PDB and open it.
SQL> show pdbs
CON_ID CON_NAME
OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ---------2 PDB$SEED
READ ONLY NO
3 PDB_APP01
READ WRITE NO
4 PDB_APP02
MOUNTED
List the datafiles, becasue of the NOCOPY clause, all the files still remain in the original
CDB directory, we will move them later.
SQL> alter session set container=PDB_APP02;
Session altered.
SQL> set linesize 100
SQL> select name from v$datafile;
NAME
---------------------------------------------------------------------------------------------------/u01/app/oracle/oradata/CDB03/undotbs01.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_system_98zldmcb_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sysaux_98zldm8q_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_users_98zlgq7b_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_soe_98zm1nfb_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sh_98znt6cb_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_pdb11_us_9hm83w3b_.dbf
SQL> mkdir -p /u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile
SQL> ALTER DATABASE MOVE DATAFILE
'/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_system_98zldmcb_.dbf'
TO
'/u01/app/oracle/oradata/CDB03/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_system_98zldmcb_.dbf';
Create the target directory target directory if it's note already created and move the
datafiles while the PDF is mounted, this will be faster than executing it on read-write
mode.
Page 68
SQL>
SQL> select name from v$datafile where con_id=4;
NAME
---------------------------------------------------------------------------------------------------/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_system_98zldmcb_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sysaux_98zldm8q_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_users_98zlgq7b_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_soe_98zm1nfb_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_sh_98znt6cb_.dbf
/u01/app/oracle/oradata/CDB1/EBCB85864E6B12DCE0430F02000AC14A/datafile/o1_mf_pdb11_us_9hm83w3b_.dbf
Page 69
The datapatch utility executes the necessary apply scripts to load the modified SQL files
into the database. An entry will be added to the dba_registry_history and
dba_registry_sqlpatch views reflecting the patch application. In the dba_registry_sqlpatch
view, verify the Status for the APPLY is "SUCCESS".
For any other status, refer to the following My Oracle Support note for additional
information and actions: Document 1609718.1 What to do if the status of a datapatch
action was not SUCCESS.
Check the following log files in $ORACLE_HOME/sqlpatch/17552800/ for errors:
17552800_apply_<database SID>_<CDB name>_<timestamp>.log
Where database SID is the database SID, CDB name is the name of the multitenant
container database, and timestamp is of the form YYYYMMMDD_HH_MM_SS.
In addition, you can check the log files for catbundle in
$ORACLE_HOME/cfgtoollogs/catbundle or $ORACLE_BASE/cfgtoollogs/catbundle.
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log
NOTE: If you are using the Oracle Recovery Manager, the catalog needs to be upgraded.
Page 70
Page 71