In previous article we covered operating system installation: Installing Oracle Linux 6 and preparing for Oracle Software installations. It is a prerequisite for this tutorial. In this tutorial we will use this OS as a seed for our Oracle Database 12c installation.
Oracle Database 12c introduces a new multi-tenant architecture that makes it easy to deploy and manage database clouds. For more information please visit Oracle Website.
This tutorial is for educational purposes only.
Installation plan:
Let’s roll…
First let’s clone our seed virtual image and create a new server, next we will alter it’s IP address and hostname and eventually we will create virtual disks to simulate ASM storage.
Cloning a host in Oracle VirtualBox is an easy task and involves the fallowing steps:
Automatic Storage Management (ASM) is a feature that has be introduced in Oracle 10g to simplify the storage of Oracle datafiles, controlfiles, logfiles and backups.
We create 3 virtual disks CRSDISK1 (2GB), DATADISK1(50GB) & FRADISK1(50GB). These disk will be dynamically allocated types, which means it will not allocate entire 2/50/50GB of the physical disk space at the moment of creation, but will extend according to virtual host demand.
1. CRSDISK1 (2GB) – for CRSVOL1 asm volume – CRS asm disk group, where Cluster Ready Services (CRS) files are stored. CRS provides many system management services and interacts with the vendor clusterware to coordinate cluster membership information.
2. DATADISK1 (50GB) – disk for DATAVOL1 asm volume – DATA asm disk group. Here database will keep all datafiles, control files, log files …
3. FRADISK1 (50GB) – disk for FRAVOL1 asm volume – FRA asm disk group, for database Fast Recovery Area (FRA) files. For example: database backup files, copy of database control files.
TIP: To power up virtual machine you may use VirtualBox GUI or the following command;
user@host:~$ VBoxManage startvm <VM_NAME> --type headless neo@zion:~$ VBoxManage startvm DB_12c_ZEUS --type headless
Our new OS has seed’s IP (192.168.2.130) and hostname (demo) settings. Let’s alter it.
#Change HOSTNAME NETWORKING=yes HOSTNAME=zeus GATEWAY=192.168.2.1
Make sure that hosts file have right entries (remove or comment out lines with ipv6), make sure there is correct IP and hostname, edit /etc/hosts as root:
127.0.0.1 localhost.localdomain localhost 192.168.2.120 zeus.zion.local zeus
TYPE=Ethernet BOOTPROTO=none #HWADDR=00:33:E1:44:FA:D8# comment out or remove this line IPADDR=192.168.2.120 PREFIX=24 GATEWAY=192.168.2.1 DNS1=198.43.12.22 DEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME=eth0 ONBOOT=yes
Reboot the server to apply changes.
[neo@zion ~]$ su – oracle [oracle@zion ~]$ cp ~/.bash_profile ~/.bash_profile_bkp [oracle@zion ~]$ echo > ~/.bash_profile [oracle@zion ~]$ vi ~/.bash_profile
# --------------------------------------------------- # .bash_profile # --------------------------------------------------- # OS User: oracle # Application: Oracle Database Software Owner # Version: Oracle 12c Release 1 # --------------------------------------------------- # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # --------------------------------------------------- # ORACLE_SID # --------------------------------------------------- # Specifies the Oracle system identifier (SID) ORACLE_SID=ZIONDB; export ORACLE_SID # --------------------------------------------------- # ORACLE_UNQNAME # --------------------------------------------------- # Set ORACLE_UNQNAME equal to the database unique # name. # --------------------------------------------------- ORACLE_UNQNAME=ZIONDB; export ORACLE_UNQNAME # --------------------------------------------------- # JAVA_HOME # --------------------------------------------------- JAVA_HOME=/usr/bin/java; export JAVA_HOME # --------------------------------------------------- # ORACLE_BASE # --------------------------------------------------- # Specifies the base of the Oracle directory structure # for Optimal Flexible Architecture (OFA) compliant # database software installations. # --------------------------------------------------- ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE # --------------------------------------------------- # ORACLE_HOME # --------------------------------------------------- # Directory containing the Oracle Database software. # --------------------------------------------------- ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1; export ORACLE_HOME # --------------------------------------------------- # ORACLE_TERM # --------------------------------------------------- # Defines a terminal definition. If not set, it # defaults to the value of your TERM environment # variable. Used by all character mode products. # --------------------------------------------------- ORACLE_TERM=xterm; export ORACLE_TERM # --------------------------------------------------- # NLS_DATE_FORMAT # --------------------------------------------------- NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS" export NLS_DATE_FORMAT # --------------------------------------------------- # TNS_ADMIN # --------------------------------------------------- # Specifies the directory containing the Oracle Net # Services configuration files like listener.ora, # tnsnames.ora, and sqlnet.ora. # --------------------------------------------------- TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN # --------------------------------------------------- # PATH # --------------------------------------------------- # Used by the shell to locate executable programs; # must include the $ORACLE_HOME/bin directory. # --------------------------------------------------- PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin PATH=${PATH}:/usr/bin:/bin:/usr/local/bin export PATH # --------------------------------------------------- # LD_LIBRARY_PATH # --------------------------------------------------- # Specifies the list of directories that the shared # library loader searches to locate shared object # libraries at runtime. # --------------------------------------------------- LD_LIBRARY_PATH=$ORACLE_HOME/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib export LD_LIBRARY_PATH # --------------------------------------------------- # CLASSPATH # --------------------------------------------------- # Specifies the directory or list of directories that # contain compiled Java classes. # --------------------------------------------------- CLASSPATH=$ORACLE_HOME/JRE CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib export CLASSPATH # --------------------------------------------------- # THREADS_FLAG # --------------------------------------------------- # All the tools in the JDK use green threads as a # default. To specify that native threads should be # used, set the THREADS_FLAG environment variable to # "native". You can revert to the use of green # threads by setting THREADS_FLAG to the value # "green". # --------------------------------------------------- THREADS_FLAG=native; export THREADS_FLAG # --------------------------------------------------- # TEMP, TMP, and TMPDIR # --------------------------------------------------- export TEMP=/tmp export TMPDIR=/tmp # --------------------------------------------------- # UMASK # --------------------------------------------------- # Set the default file mode creation mask # (umask) to 022 to ensure that the user performing # the Oracle software installation creates files # with 644 permissions. # --------------------------------------------------- umask 022
[oracle@zeus ~]$ logout [neo@zeus ~]$ sudo su - grid [sudo] password for neo: [grid@zeus ~]$ cp ~/.bash_profile ~/.bash_profile_bkp [grid@zeus ~]$ echo > ~/.bash_profile [grid@zeus ~]$ vi ~/.bash_profile
# --------------------------------------------------- # .bash_profile # --------------------------------------------------- # OS User: grid # Application: Oracle Grid Infrastructure # Version: Oracle 12c Release 1 # --------------------------------------------------- # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # --------------------------------------------------- # ORACLE_SID # --------------------------------------------------- # Specifies the Oracle system identifier (SID) # for the Automatic Storage Management (ASM)instance # running on this node. # --------------------------------------------------- ORACLE_SID=+ASM; export ORACLE_SID # --------------------------------------------------- # JAVA_HOME # --------------------------------------------------- # Specifies the directory of the Java SDK and Runtime # Environment. # --------------------------------------------------- JAVA_HOME=/usr/bin/java; export JAVA_HOME # --------------------------------------------------- # ORACLE_BASE # --------------------------------------------------- # Specifies the base of the Oracle directory structure # for Optimal Flexible Architecture (OFA) compliant # installations. The Oracle base directory for the # grid installation owner is the location where # diagnostic and administrative logs, and other logs # associated with Oracle ASM and Oracle Clusterware # are stored. # --------------------------------------------------- ORACLE_BASE=/u01/app/grid; export ORACLE_BASE # --------------------------------------------------- # ORACLE_HOME # --------------------------------------------------- # Specifies the directory containing the Oracle # Grid Infrastructure software. For grid # infrastructure for a cluster installations, the Grid # home must not be placed under one of the Oracle base # directories, or under Oracle home directories of # Oracle Database installation owners, or in the home # directory of an installation owner. During # installation, ownership of the path to the Grid # home is changed to root. This change causes # permission errors for other installations. # --------------------------------------------------- ORACLE_HOME=/u01/app/12.1.0/grid; export ORACLE_HOME # --------------------------------------------------- # ORACLE_TERM # --------------------------------------------------- ORACLE_TERM=xterm; export ORACLE_TERM # --------------------------------------------------- # TNS_ADMIN # --------------------------------------------------- # Specifies the directory containing the Oracle Net # Services configuration files like listener.ora, # tnsnames.ora, and sqlnet.ora. # --------------------------------------------------- TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN # --------------------------------------------------- # PATH # --------------------------------------------------- PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin PATH=${PATH}:/usr/bin:/bin:/usr/local/bin export PATH # --------------------------------------------------- # TEMP, TMP, and TMPDIR export TEMP=/tmp export TMPDIR=/tmp # --------------------------------------------------- # UMASK # --------------------------------------------------- umask 022
[root@zion ~]# mkdir -p /u01/app/oracle mkdir -p /u01/app/grid mkdir -p /u01/app/12.1.0/grid chown -R grid:oinstall /u01 chown oracle:oinstall /u01/app/oracle chmod -R 775 /u01
Set Resource Limits for the Oracle Software Installation Users
To improve the performance of the software on Linux systems, you must increase the following resource limits for the Oracle software owner users ( grid). For oracle user it has been automatically setup by the oracle-rdbms-server-11gR2-preinstall package. To apply these settings, run the following as root:
#as root [root@test-host ~]# cat >> /etc/security/limits.conf <<EOF grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 EOF
[root@test-host ~]# cat >> /etc/pam.d/login <<EOF session required pam_limits.so EOF
Depending on your shell environment, make the following changes to the default shell startup file, to change ulimit setting for all Oracle installation owners (note that these examples show the users oracle and grid):
[root@test-host ~]# cat >> /etc/profile <<EOF if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then if [ \$SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi EOF
[root@test-host ~]# cat >> /etc/csh.login <<EOF if ( \$USER == "oracle" || \$USER == "grid" ) then limit maxproc 16384 limit descriptors 65536 endif EOF
Oracle Linux is up and running. Now we check whether oracleasm package is installed:
[root@zeus ~]# rpm -qa | grep oracleasm oracleasm-support-2.1.8-1.el6.x86_64 [root@zeus ~]#
As we see, oracleasm-support package has been installed when we were building our seed OS Linux 6.
Getting Oracle ASMLib via the Unbreakable Linux Network (Subscription required)
Non-subscribers are free to use the similar package built for RHEL on their Enterprise Linux machines.
Go to Oracle Technology Network and download oracleasmlib package for RHEL6 (64bit)
[root@zeus ~]# rpm -Uvh /tmp/oracleasmlib-2.0.4-1.el6.x86_64.rpm warning: oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ########################################### [100%] 1:oracleasmlib ########################################### [100%]
[root@zeus ~]# oracleasm configure -i Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface []: grid Default group to own the driver interface []: asmadmin Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration: done [root@zeus ~]#
The script completes the following tasks:
Enter the following command to load the oracleasm kernel module:
[root@zeus ~]# /usr/sbin/oracleasm init Creating /dev/oracleasm mount point: /dev/oracleasm Loading module "oracleasm": oracleasm Configuring "oracleasm" to use device physical block size Mounting ASMlib driver filesystem: /dev/oracleasm [root@zeus ~]#
Let’s check the available disks in OS (remember, we have created three additional disks for ASM in our virtual system)
[root@zeus ~]# fdisk -l | grep "Disk /dev/sd" Disk /dev/sda: 32.2 GB, 32212254720 bytes ##This is our system disk Disk /dev/sdb: 2147 MB, 2147483648 bytes Disk /dev/sdc: 53.7 GB, 53687091200 bytes Disk /dev/sdd: 53.7 GB, 53687091200 bytes [root@zeus ~]#
We see three disks available for ASM disks:
First, new partitions have to be created to be able to use those disks as ASM disks;
[root@zeus ~]# fdisk /dev/sdb Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-261, default 1): <ENTER> Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261): <ENTER> Using default value 261 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
[root@zeus ~]# fdisk /dev/sdc Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-6527, default 1): <ENTER> Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527): <ENTER> Using default value 6527 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
System restart is not required, however after so many changes we may reboot it .
Here is the final output:
[root@zeus ~]# fdisk -l | grep "/dev/s" Disk /dev/sda: 32.2 GB, 32212254720 bytes # SYSTEM DISK /dev/sda1 * 1 64 512000 83 Linux /dev/sda2 64 3917 30944256 8e Linux LVM Disk /dev/sdb: 2147 MB, 2147483648 bytes /dev/sdb1 1 261 2096451 83 Linux Disk /dev/sdc: 53.7 GB, 53687091200 bytes /dev/sdc1 1 6527 52428096 83 Linux Disk /dev/sdd: 53.7 GB, 53687091200 bytes /dev/sdd1 1 6527 52428096 83 Linux
We observe new partitions:
Creating ASM disks:
[root@zeus ~]# oracleasm createdisk CRSVOL1 /dev/sdb1 Writing disk header: done Instantiating disk: done [root@zeus ~]# oracleasm createdisk DATAVOL1 /dev/sdc1 Writing disk header: done Instantiating disk: done [root@zeus ~]# oracleasm createdisk FRAVOL1 /dev/sdd1 Writing disk header: done Instantiating disk: done #Listing ASM disks: [root@zeus ~]# oracleasm listdisks CRSVOL1 DATAVOL1 FRAVOL1 [root@zeus ~]#
[root@zeus ~]# oracleasm-discover Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)] Discovered disk: ORCL:CRSVOL1 [4192902 blocks (2146765824 bytes), maxio 256] Discovered disk: ORCL:DATAVOL1 [104856192 blocks (53686370304 bytes), maxio 256] Discovered disk: ORCL:FRAVOL1 [104856192 blocks (53686370304 bytes), maxio 256] [root@zeus ~]#
You would have to download Oracle Database 12c Release 1 Grid Infrastructure (12.1.0.1.0) for Linux x86-64 – here
NOTE: At this point we have to switch to “grid” account to run grid installation. However password still remains unknown. We use sudo command to switch from a regular account (neo) to grid, and then xauth command to set our session cookies for X11 forwarding to work, here is how:
[neo@zeus ~]$ xauth list zeus.zion.local/unix:10 MIT-MAGIC-COOKIE-1 879d14bbe3076bc698ec35a1b40cf710 [neo@zeus ~]$ sudo su - grid [sudo] password for neo: #Add magic cookie to our grid session [grid@zeus ~]$ xauth add zeus.zion.local/unix:10 MIT-MAGIC-COOKIE-1 879d14bbe3076bc698ec35a1b40cf710 xauth: creating new authority file /home/grid/.Xauthority [grid@zeus ~]$ export DISPLAY=localhost:10.0 [grid@zeus ~]$
[grid@zeus ~]$ for i in /tmp/linuxamd64_12c_grid_*.zip; do unzip $i -d /home/grid/stage; done [grid@zeus ~]$ cd /home/grid/stage/grid [grid@zeus]$ ./runInstaller Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 21921 MB Passed Checking swap space: must be greater than 150 MB. Actual 3967 MB Passed Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2099-01-12_10-39-91PM. Please wait ...
Oracle Universal Installer is starting…
[grid@zeus ~]$ ps -ef | grep grid grid 4444 1 0 Mar12 ? 00:00:00 /u01/app/12.1.0/grid/bin/tns. grid 4598 1 0 Mar12 ? 00:00:50 /u01/app/12.1.0/grid/bin/css. grid 4612 1 0 Mar12 ? 00:00:08 /u01/app/12.1.0/grid/bin/o.. grid 4728 1 0 Mar12 ? 00:00:20 asm_pmon_+ASM grid 4730 1 0 Mar12 ? 00:00:15 asm_psp0_+ASM grid 4732 1 4 Mar12 ? 00:32:06 asm_vktm_+ASM grid 4736 1 0 Mar12 ? 00:00:03 asm_gen0_+ASM grid 4738 1 0 Mar12 ? 00:00:02 asm_mman_+ASM grid 4742 1 0 Mar12 ? 00:00:05 asm_diag_+ASM grid 4744 1 0 Mar12 ? 00:00:59 asm_dia0_+ASM grid 4746 1 0 Mar12 ? 00:00:02 asm_dbw0_+ASM grid 4748 1 0 Mar12 ? 00:00:02 asm_lgwr_+ASM grid 4750 1 0 Mar12 ? 00:00:06 asm_ckpt_+ASM grid 4752 1 0 Mar12 ? 00:00:02 asm_smon_+ASM grid 4754 1 0 Mar12 ? 00:00:02 asm_lreg_+ASM grid 4756 1 0 Mar12 ? 00:00:11 asm_rbal_+ASM grid 4758 1 0 Mar12 ? 00:00:19 asm_gmon_+ASM grid 4760 1 0 Mar12 ? 00:00:08 asm_mmon_+ASM grid 4762 1 0 Mar12 ? 00:00:14 asm_mmnl_+ASM grid 4775 1 0 Mar12 ? 00:00:00 oracle+ASM (DESCRIPTION= grid 25183 1 0 Mar12 ? 00:01:40 /u01/app/12.1.0/grid/bin... grid 25288 1 0 Mar12 ? 00:07:12 /u01/app/12.1.0/grid/bin... grid 25300 1 0 Mar12 ? 00:00:02 /u01/app/12.1.0/grid/bin... grid 25327 25300 0 Mar12 ? 00:00:00 /u01/app/12.1.0/grid/bin/ev
[grid@zeus ~]$ crsctl status resource -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.CRS.dg ONLINE ONLINE zeus STABLE ora.DATA.dg ONLINE ONLINE zeus STABLE ora.FRA.dg ONLINE ONLINE zeus STABLE ora.LISTENER.lsnr ONLINE ONLINE zeus STABLE ora.asm ONLINE ONLINE zeus Started,STABLE ora.ons OFFLINE OFFLINE zeus STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE zeus STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.evmd 1 ONLINE ONLINE zeus STABLE ora.ziondb.db 1 ONLINE ONLINE zeus Open,STABLE -------------------------------------------------------------------------------- [grid@zeus ~]$
Next we create ASM disk groups for Oracle Database (later seen as +DATA and +FRA).
[grid@zeus ~]$ asmca &
ASM Configuration Assistant is starting…
At this point, we are ready to get started with Oracle Database installation. First we are going to install Oracle Database software only.
Download Oracle Database software installation packages from Oracle Technology Network
Oracle Database 12c Release 1 (12.1.0.1.0) for Linux x86-64
Copy zip files to oracle server /tmp directory and login to server as a regular user, switch to an oracle account and set magic cookies for your session:
[neo@zeus ~]$ xauth list zeus.zion.local/unix:10 MIT-MAGIC-COOKIE-1 a8ca3289a167d700f1cc2877fa63fd81 [neo@zeus ~]$ sudo su - oracle [sudo] password for neo: [oracle@zeus ~]$ xauth add zeus.zion.local/unix:10 MIT-MAGIC-COOKIE-1 a8ca3289a167d700f1cc2877fa63fd81 xauth: creating new authority file /home/oracle/.Xauthority [oracle@zeus ~]$ xauth list zeus.zion.local/unix:10 MIT-MAGIC-COOKIE-1 a8ca3289a167d700f1cc2877fa63fd81 [oracle@zeus ~]$ export DISPLAY=localhost:10.0 [oracle@zeus ~]$
[oracle@zeus ~]$ for i in /tmp/linuxamd64_12c_database_*.zip; do unzip $i -d /home/oracle/stage; done [oracle@zeus ~]$ cd /home/oracle/stage/database/ [oracle@zeus database]$ ./runInstaller Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 16180 MB Passed Checking swap space: must be greater than 150 MB. Actual 3966 MB Passed Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2044-33-21_11-81-55AM. Please wait ...
[oracle@zeus ~]$ netca &
[oracle@zeus ]$ dbca &
Hint: Place control files on ASM disks +DATA and +FRA. Initialization parameters section.
("+DATA/{DB_UNIQUE_NAME}/control01.ctl", "+FRA/{DB_UNIQUE_NAME}/control02.ctl")
Our database is up and running!
We have just created our multitenant container database (CDB) – ZIONDB and first pluggable database (PDB): PDB01
We can now login to Enterprise Manager Database Express 12c
If you are facing error: “Security token does not match. You must login again…”
You may try using Internet Explorer or Firefox, should work.
More information – intro to Oracle Database 12c: EM Database Express:
http://www.oracle.com/technetwork/database/manageability/emx-intro-1965965.html
[neo@zeus ~]$ sudo su - oracle [sudo] password for neo: [oracle@zeus ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Fri Mar 14 17:32:42 2014 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, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> select name from v$database; NAME --------- ZIONDB --Switching between containers SQL> COLUMN name FORMAT A25 SQL> SELECT name, pdb FROM v$services ORDER BY name; NAME PDB ------------------------- ------------------------------ SYS$BACKGROUND CDB$ROOT SYS$USERS CDB$ROOT ZIONDBXDB CDB$ROOT pdb01.zion.local PDB01 ziondb.zion.local CDB$ROOT SQL> SHOW CON_NAME CON_NAME ------------------------------ CDB$ROOT SQL> ALTER SESSION SET container = PDB01; Session altered. SQL> show con_name CON_NAME ------------------------------ PDB01 SQL> exit;
Tutorial: Managing Pluggable Databases (PDBs) Oracle SQL Developer
Prerequisites:
As root user:
rpm -Uvh /u01/app/stage/java/jdk-7u51-linux-x64.rpm
If Oracle is running with ASM copy new version of OPatch to ORACLE_HOME of grid and oracle users.
We will run commands as a grid and root user, we apply GRID INFRASTRUCTURE SYSTEM PATCH 12.1.0.1.2.
Patch 17735306: GRID INFRASTRUCTURE SYSTEM PATCH 12.1.0.1.2 – This patch will patch your grid and database homes.
Patch 17552800: DATABASE PATCH SET UPDATE 12.1.0.1.2
Let’s patch:
export JAVA_HOME=/usr/java/latest/ cd $ORACLE_HOME/OPatch/ocm/bin/ ./emocmrsp -no_banner -output /u01/app/oraInventory/ocm.rsp
[oracle@zeus ~]$ sqlplus / as sysdba SQL> alter pluggable database all close;
$ unzip p17735306_121010_Linux-x86-64.zip -d /u01/app/stage
The Opatch utility has automated the patch application for the Oracle Grid Infrastructure (GI) home and the Oracle RAC database homes. It operates by querying existing configurations and automating the steps required for patching each Oracle RAC database home of same version and the GI home.
The utility must be executed by an operating system (OS) user with root privileges, and it must be executed on each node in the cluster if the GI home or Oracle RAC database home is in non-shared storage.
$ sudo su - # export PATH=$PATH:/u01/app/12.1.0/grid/OPatch # opatchauto apply /u01/app/stage/17735306 -ocmrf /u01/app/oraInventory/ocm.rsp OPatch Automation Tool Copyright (c) 2013, Oracle Corporation. All rights reserved. OPatchauto version : 12.1.0.1.2 OUI version : 12.1.0.1.0 Running from : /u01/app/12.1.0/grid opatchauto log file: /u01/app/12.1.0/grid/cfgtoollogs/opatchauto/17735306/opatch_gi_2066-01-01_00-54-38_deploy.log Parameter Validation: Successful ... Apply Summary: Following patch(es) are successfully installed: GI Home: /u01/app/12.1.0/grid: 17077442, 17303297, 17552800 RAC Home: /u01/app/oracle/product/12.1.0/db_1: 17077442, 17552800 opatchauto succeeded.
[oracle@zeus OPatch]$ sqlplus / as sysdba SQL> alter pluggable database all open;
UPDATE:
Download Patch from Oracle Support and upload on database host.
$ unzip p18705901_121010_Linux-x86-64.zip -d /u01/app/stage
$ opatchauto apply /u01/app/stage/18705901/ -ocmrf /u01/app/oraInventory/ocm.rsp -analyze
If there is no one-off patches which needs to be rollback, continue and apply the patch.
$ sudo su - [root@zeus stage]$ export PATH=$PATH:/u01/app/12.1.0/grid/OPatch [root@zeus stage]$ opatchauto apply /u01/app/stage/18705901/ -ocmrf /u01/app/oraInventory/ocm.rsp OPatch Automation Tool Copyright (c) 2013, Oracle Corporation. All rights reserved. OPatchauto version : 12.1.0.1.2 OUI version : 12.1.0.1.0 Running from : /u01/app/12.1.0/grid ... Parameter Validation: Successful Grid Infrastructure home: /u01/app/12.1.0/grid RAC home(s): /u01/app/oracle/product/12.1.0/db_1 Configuration Validation: Successful Patch Location: /u01/app/stage/18705901 Grid Infrastructure Patch(es): 17077442 17303297 18522516 RAC Patch(es): 17077442 18522516 Patch Validation: Successful Stopping RAC (/u01/app/oracle/product/12.1.0/db_1) ... Successful Following database(s) were stopped and will be restarted later during the session: ziondb Applying patch(es) to "/u01/app/oracle/product/12.1.0/db_1" ... Patch "/u01/app/stage/18705901/17077442" applied to "/u01/app/oracle/product/12.1.0/db_1" with warning. Patch "/u01/app/stage/18705901/18522516" applied to "/u01/app/oracle/product/12.1.0/db_1" with warning. Stopping CRS ... Successful Applying patch(es) to "/u01/app/12.1.0/grid" ... Patch "/u01/app/stage/18705901/17077442" applied to "/u01/app/12.1.0/grid" with warning. Patch "/u01/app/stage/18705901/17303297" applied to "/u01/app/12.1.0/grid" with warning. Patch "/u01/app/stage/18705901/18522516" applied to "/u01/app/12.1.0/grid" with warning. Starting CRS ... Successful Starting RAC (/u01/app/oracle/product/12.1.0/db_1) ... Successful Apply Summary: opatchauto ran into some warnings during patch installation (Please see log file for details): GI Home: /u01/app/12.1.0/grid: 17077442, 17303297, 18522516 RAC Home: /u01/app/oracle/product/12.1.0/db_1: 17077442, 18522516 opatchauto succeeded.
NOTE: It is recommended the Post Install step be run on all pluggable databases; however, the following command (SQL> alter pluggable database PDB_NAME open ) could be substituted to only open certain PDBs in the multitenant database. Doing so will result in the Post Install step only being run on the CDB and opened PDB’s. To update a pluggable database at a later date (skipped or newly plugged in), open the database using the alter pluggable database command mentioned previously and rerun the datapatch utility.
[oracle@zeus ~]$ sqlplus / as sysdba SQL> alter pluggable database all open; SQL> quit
[oracle@zeus ~]$ cd $ORACLE_HOME/OPatch [oracle@zeus OPatch]$ ./datapatch -verbose SQL Patching tool version 12.1.0.1.0 on Thu Jul 31 11:20:07 2014 Copyright (c) 2014, Oracle. All rights reserved. Connecting to database...OK Determining current state... Currently installed SQL Patches: PDB CDB$ROOT: PDB PDB$SEED: PDB PDB01: Currently installed C Patches: 18522516 Adding patches to installation queue and performing prereq checks... Installation queue: For the following PDBs: CDB$ROOT PDB$SEED PDB01 Nothing to roll back The following patches will be applied: 18522516 Installing patches... ... ... SQL Patching tool complete ...
Patching complete.
You may also like:
Cheers!!