The Oracle Multitenant option (licensable) introduced in Oracle 12c helps you consolidate databases into a standardized database version that can be deployed on shared cloud infrastructure.
Features include:
- Better Resource Utilization: Background processes/SGA can be shared
- Shared Resource Management: Using the resource manager, one can enable a CDB-level plan to manage resources amongst PDBs
- Enhanced Security: Data security is maintained at a granular level
- Agility: PDBs can be plugged or unplugged easily for patching, upgrades or migrations
- Cloning: Multiple clones of a pluggable database can be quickly created
- Many as One: CDB with many PDBs can be managed as a single database
#Install S/W
Meet the package and Operating System requirements by running the following yum command (as root):
yum install oracle-rdbms-server-12cR1-preinstall
## repository doesn't exist on default EC2 image ##
[root@test1 ~]# cd /etc/yum.repos.d
[root@test1 yum.repos.d]# ls -lrt
total 16
-rw-r--r--. 1 root root 529 Jan 29 2013 rhel-source.repo
-rw-r--r--. 1 root root 2193 Aug 20 04:24 redhat-rhui.repo
-rw-r--r--. 1 root root 80 Aug 20 04:24 rhui-load-balancers.conf
-rw-r--r--. 1 root root 567 Aug 20 04:24 redhat-rhui-client-config.repo
[root@test1 yum.repos.d]# wget https://public-yum.oracle.com/public-yum-ol6.repo
--2013-08-20 10:03:07-- https://public-yum.oracle.com/public-yum-ol6.repo
Resolving public-yum.oracle.com... 137.254.56.43
Connecting to public-yum.oracle.com|137.254.56.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2778 (2.7K) [text/plain]
Saving to: âpublic-yum-ol6.repoâ
100%[=============================================================================================================================================================================================>] 2,778 --.-K
2013-08-20 10:03:08 (13.4 MB/s) - âpublic-yum-ol6.repoâ
[root@test1 yum.repos.d]# ls -lrt
total 20
-rw-r--r--. 1 root root 529 Jan 29 2013 rhel-source.repo
-rw-r--r--. 1 root root 2778 Jul 19 13:28 public-yum-ol6.repo
-rw-r--r--. 1 root root 2193 Aug 20 04:24 redhat-rhui.repo
-rw-r--r--. 1 root root 80 Aug 20 04:24 rhui-load-balancers.conf
-rw-r--r--. 1 root root 567 Aug 20 04:24 redhat-rhui-client-config.repo
[root@test1 yum.repos.d]# yum install oracle-rdbms-server-12cR1-preinstall -y
Loaded plugins: amazon-id, rhui-lb, security
ol6_UEK_latest | 1.2
ol6_UEK_latest/primary 16% [==============- ] 278 kB/s | 1.5 ol6_UEK_latest/primary | 9.4 MB 00:25
ol6_UEK_latest 211/211
ol6_latest | 1.4 kB 00:00
ol6_latest/primary | 31 MB 01:09
ol6_latest 21988/21988
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-8.el6 will be installed
--> Processing Dependency: xorg-x11-utils for package: oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
--> Processing Dependency: kernel-uek for package: oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
--> Running transaction check
---> Package kernel-uek.x86_64 0:2.6.39-400.109.5.el6uek will be installed
--> Processing Dependency: kernel-uek-firmware = 2.6.39-400.109.5.el6uek for package: kernel-uek-2.6.39-400.109.5.el6uek.x86_64
---> Package xorg-x11-utils.x86_64 0:7.5-6.el6 will be installed
--> Processing Dependency: libXxf86misc.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
--> Processing Dependency: libdmx.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
--> Processing Dependency: libXxf86dga.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
--> Running transaction check
---> Package kernel-uek-firmware.noarch 0:2.6.39-400.109.5.el6uek will be installed
---> Package libXxf86dga.x86_64 0:1.1.3-2.el6 will be installed
---> Package libXxf86misc.x86_64 0:1.0.3-4.el6 will be installed
---> Package libdmx.x86_64 0:1.1.2-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================================================================================
Installing:
oracle-rdbms-server-12cR1-preinstall x86_64 1.0-8.el6 ol6_latest 15 k
Installing for dependencies:
kernel-uek x86_64 2.6.39-400.109.5.el6uek ol6_UEK_latest 27 M
kernel-uek-firmware noarch 2.6.39-400.109.5.el6uek ol6_UEK_latest 3.6 M
libXxf86dga x86_64 1.1.3-2.el6 ol6_latest 24 k
libXxf86misc x86_64 1.0.3-4.el6 ol6_latest 17 k
libdmx x86_64 1.1.2-2.el6 ol6_latest 20 k
xorg-x11-utils x86_64 7.5-6.el6 ol6_latest 94 k
Transaction Summary
======================================================================================================================================================================================================================
Install 7 Package(s)
Total download size: 31 M
Installed size: 107 M
Downloading Packages:
(1/7): kernel-uek-2.6.39-400.109.5.el6uek.x86_64.rpm | 27 MB 01:09
(2/7): kernel-uek-firmware-2.6.39-400.109.5.el6uek.noarch.rpm | 3.6 MB 00:09
(3/7): libXxf86dga-1.1.3-2.el6.x86_64.rpm | 24 kB 00:00
(4/7): libXxf86misc-1.0.3-4.el6.x86_64.rpm | 17 kB 00:00
(5/7): libdmx-1.1.2-2.el6.x86_64.rpm | 20 kB 00:00
(6/7): oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm | 15 kB 00:00
(7/7): xorg-x11-utils-7.5-6.el6.x86_64.rpm | 94 kB 00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 383 kB/s | 31 MB 01:23
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
#make sure the /etc/hosts file has fully qualified entry:
10.10.10.10 test1.yourserver.com test1
#copy the linuxamd64_12c_database_1of2.zip and linuxamd64_12c_database_2of2.zip to /u01/app/oracle/software
unzip linuxamd64_12c_database_1of2.zip -d /u01/app/oracle/software/12C unzip linuxamd64_12c_database_2of2.zip -d /u01/app/oracle/software/12C
#start the install:
/u01/app/oracle/software/12C/database/runInstaller
## ERROR ##
ID: oracle.install.commons.util.exception.DefaultErrorAdvisor:384
oracle.cluster.verification.PreReqNotSupportedException: Reference data is not available for verifying prerequisites on this operating system distribution
Metalink NOte - RHEL6: 12c CVU Fails: Reference data is not available for verifying prerequisites on this operating(1567127.1)
$ cat /etc/*release
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Red Hat Enterprise Linux Server release 6.4 (Santiago)
Red Hat Enterprise Linux Server release 6.4 (Santiago)
$ rpm -qa | grep redhat-release
redhat-release-server-6Server-6.4.0.4.el6.x86_64
The bug is fixed in 12.1.0.1 GI PSU1, 12.1.0.2
The workaround is to obtain the following rpm from Redhat and install:
# rpm -ivh redhat-release-6Server-1.noarch.rpm
Preparing... ########################################### [100%]
1:redhat-release
## ERROR 2 ##
ID: oracle.install.commons.util.exception.DefaultErrorAdvisor:37
oracle.cluster.verification.VerificationException: PRVF-0002 : Could not retrieve local nodename
at oracle.cluster.verification.ClusterVerification.<init>(ClusterVerification.java:306)
at oracle.cluster.verification.ClusterVerification.getInstance(ClusterVerification.java:409)
at oracle.install.driver.oui.OUIInstallDriver.load(OUIInstallDriver.java:376)
at oracle.install.ivw.db.driver.DBSetupDriver.load(DBSetupDriver.java:223)
at oracle.install.commons.base.driver.common.Installer.run(Installer.java:306)
at oracle.install.ivw.common.util.OracleInstaller.run(OracleInstaller.java:106)
at oracle.install.ivw.db.driver.DBInstaller.run(DBInstaller.java:142)
at oracle.install.commons.util.Application.startup(Application.java:921)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:165)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:182)
at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:355)
at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:130)
at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:161)
PRVF-0002 : Could not retrieve local nodename
If you see this error it’s because the OUI tries to perform a reverse lookup of your hostname.
#corrected /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
10.10.10.10 test1.yourserver.com test1
#Once the GUI starts, respond as follows:
- Configure Security Updates
- Uncheck ‘I wish to receive security updates via My Oracle Support’
- Next
- Confirm with ‘Yes’
- Download Software Updates
- Skip software updates
- Next
- Installation Option
- Install database software only (you can opt to create a database instance at the same time)
- Next
- Grid Installation Options
- Single instance database installation
- Next
- Product Languages
- Select any additional required languages and move across, otherwise leave just the default ‘English’ selected
- Next
- Database Edition
- Enterprise Edition (6.4GB) (…or as appropriate)
- Next
- Installation Location
- Oracle Base: /u01/app/oracle
- Software Location: /u01/app/oracle/product/12.1.0/db_1
- Next
- Create Inventory (first Oracle installation only)
- Inventory Directory: /u01/app/oraInventory
- oraInventory Group Name: oinstall
- Next
- Operating System Groups
- Database Administrator (OSDBA) group: dba
- Database Operator (OSOPER) group (Optional): dba
- Leave all the other memberships as the default ‘dba’ group too.
- Next
- Prerequisites Checks
- All prerequisite checks should complete successfully here, if not, then obviously they will need addressing before proceeding. Assuming all database validation checks are successful, you shouldn’t actually see this page as the installer will automatically move onto the next screen.
- Summary
- Check everything is correct!
- Click Install
#When prompted, run the following as root:
login as: root
root@10.10.10.10's password:
Last login: Tue Aug 20 10:32:02 2013 from ip-10-1-5-21.eu-west-1.compute.internal
[root@test1 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@test1 ~]# /u01/app/oracle/product/12.1.0/db_1/root.sh
Performing root user operation for Oracle 12c
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.1.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
[root@test1 ~]#
##Create Database
Open an X-Windows session to the server as the ‘oracle’ user. Export your DISPLAY variable to your PC ip address.
Set your ORACLE_HOME environment variable appropriately, then start the assistant by running the following:
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
$ORACLE_HOME/bin/dbca
Once the GUI starts, respond as follows:
- Database Operation
- Create Database
- Next
- Creation Mode
- Tick ‘Advanced Mode’
- Next
- Database Template
- General Purpose or Transaction Processing.
- Next
- Database Identification
- Global Database Name: dbd12c
- SID: dbd12c
- Tick ‘Create as Container Database’
- Select ‘Create a Container Database with one or more PDBs’
- PDB Name: PDB12C
- Next
- Management Options
- Leave Both options un-checked - will register later with OMS
- Next
- Database Credentials
- Select ‘Use the Same Administrative Password for All Accounts’ (unless you want to separate them out of course)
- Password: ******
- Confirm Password: ******
- Next
- Network Configuration
- If you don’t have any existing listener services running, tick ‘Select’ to create a new listener
- Name: LISTENER
- Port: 1521
- Otherwise, select an existing listener service as appropriate
- Next
- Storage Locations
- Storage Type: File System
- Select ‘Use Common Location for All Database Files’
- Database File Locations: /u02/app/oracle/DATA/dbd12c
- Tick ‘Specify Fast Recovery Area’
- Fast Recovery Area: /u01/app/oracle/fast_recovery_area/dbd12c
- Tick Enable Archiving
- Click on ‘Edit Archive Mode Parameters’
- Archive Log File Format: %t_%s_%r.arc (change extension to .arc)
- Location: /u04/app/oracle/ARCH/dbd12c
- Next
- Database Options
- Optionally, check ‘Sample Schemas’ (this will create an ‘EXAMPLE’ tablespace and some sample schemas). I recommend leaving this unticked if this is to become a live environment.
- Next
- Initialization Parameters
- Use ‘Typical Settings’
- Ensure ‘Use Automatic Memory Management’ is ticked
- Change the ‘Memory Size’ value accordingly (or leave default as 40% of total machine memory)
- Review any additional parameters by clicking ‘All Initialization Parameters’
- Next
- Creation Options
- Leave ‘Create Database’ ticked
- Optionally tick ‘Generate Database Creation Scripts’ if you prefer to keep it for future reference.
- Check the ‘Customize Storage Locations’ settings and update accordingly if required
- Next
- Pre Requisite Checks
- Assuming all database validation checks are successful, you shouldn’t actually see this page as the installer will automatically move onto the next screen.
- Summary
- Check the ‘Create Database – Summary’ details are as you’d expect.
- Finish
## ERRORS ##
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x5] [PC:0xB71F161, qervwRowProcedure()+113] [flags: 0x0, count: 1]
Errors in file /u01/app/oracle/diag/rdbms/dbd12c/dbd12c/trace/dbd12c_s002_5292.trc (incident=12657):
ORA-07445: exception encountered: core dump [qervwRowProcedure()+113] [SIGSEGV] [ADDR:0x5] [PC:0xB71F161] [Address not mapped to object] []
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Wed Aug 21 11:11:49 2013
Sweep [inc][12657]: completed
Wed Aug 21 11:11:55 2013
found dead shared server 'S002', pid = (82, 18)
#This is related to DB Express 12c doesn't support container databases, so these errors are a known problem.
##Setup Environment
oracle 12c Cloud DB RDBMS: vi setdb_dbd12c.sh
#####
export SID=dbd12c
export ORA_USER_ID=oracle
export LISTENERS=LISTENER
export ORACLE_BASE=/u01/app/oracle/
export ADR_BASE=$ORACLE_BASE/diag
export ORACLE_SID=$SID
export ORAENV_ASK=NO
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0/db_1/lib
export PATH=$ORACLE_HOME/perl/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/bin:$GG_HOME:$PATH
if [ "$#" = "0" ]
then
SMSO=$(tput smso)
RMSO=$(tput rmso)
export PS1="`id -un` 12c Cloud DB RDBMS: "
exec `basename $SHELL`
else
exec $*
fi
##Manage Database
#On 10.10.10.10
oracle 12c Cloud DB RDBMS: setdb_dbd12c.sh
oracle 12c Cloud DB RDBMS: sqlplus / as sysdba
#check plugable databases
SQL> COLUMN pdb_name FORMAT A20
SELECT pdb_name, status FROM dba_pdbs ORDER BY pdb_name;
PDB_NAME STATUS
-------------------- -------------
PDB$SEED NORMAL
PDB12C NORMAL
#check status
SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB12C MOUNTED
#open read/write
SQL> ALTER PLUGGABLE DATABASE PDB12C open read write;
Pluggable database altered.
SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB12C READ WRITE
#check files created
oracle 12c Cloud DB RDBMS: pwd
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C
oracle 12c Cloud DB RDBMS: ls -lrt
total 1375480
-rw-r-----. 1 oracle oinstall 91234304 Aug 22 06:01 PDB12C_temp01.dbf
-rw-r-----. 1 oracle oinstall 374874112 Aug 22 14:18 example01.dbf
-rw-r-----. 1 oracle oinstall 5251072 Aug 22 14:18 SAMPLE_SCHEMA_users01.dbf
-rw-r-----. 1 oracle oinstall 293609472 Aug 22 14:23 system01.dbf
-rw-r-----. 1 oracle oinstall 734011392 Aug 22 14:23 sysaux01.dbf
oracle 12c Cloud DB RDBMS: alias s='sqlplus / as sysdba'
oracle 12c Cloud DB RDBMS: s
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 14:30:30 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> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB12C READ WRITE NO
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u02/app/oracle/DATA/dbd12c/dbd12c/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/undotbs01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/users01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/SAMPLE_SCHEMA_users01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/example01.dbf
10 rows selected.
SQL> sho parameter servic
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string dbd12c
#check listener
SQL> !lsnrctl stat
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 22-AUG-2013 14:32:28
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test1.yourserver.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 22-AUG-2013 11:32:34
Uptime 0 days 2 hr. 59 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/test1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test1.yourserver.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=test1.yourserver.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/dbd12c/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "dbd12c" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
Service "dbd12cXDB" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
Service "pdb12c" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
The command completed successfully
SQL> alter session set container=PDB12C;
Session altered.
SQL> create user test identified by test container=current;
User created.
SQL> grant create session to test;
Grant succeeded.
SQL> grant alter session to test;
Grant succeeded
oracle 12c Cloud DB RDBMS: sqlplus test/test@test1.yourserver.com:1521/pdb12c
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 14:40:50 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>
pdb12C =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb12c)
)
)
U:\>tnsping pdb12c
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 22-AUG-2
013 14:42:33
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\app\newdb1\product\11.2.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdb12c)))
OK (50 msec)
#create a new pluggable database as copy
U:\>sqlplus test/test@pdb12c
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 22 14:42:44 2013
Copyright (c) 1982, 2010, 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> !mkdir /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1
SQL> alter pluggable database pdb12c close;
Pluggable database altered.
SQL> alter pluggable database pdb12c open read only;
Pluggable database altered.
SQL> create pluggable database newdb1 from pdb12c file_name_convert=('/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C','/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1');
Pluggable database created.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB12C READ ONLY NO
4 newdb1 MOUNTED
SQL> alter pluggable database newdb1 open read write;
Pluggable database altered.
SQL> alter pluggable database pdb12c close;
Pluggable database altered.
SQL> alter pluggable database pdb12c open read write;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB12C READ WRITE NO
4 newdb1 READ WRITE NO
#create a new pluggable database command line
SQL> conn / as sysdba
Connected.
SQL> !mkdir /u02/app/oracle/DATA/dbd12c/dbd12c/newdb2
SQL> CREATE PLUGGABLE DATABASE newdb2
ADMIN USER newdb2 IDENTIFIED BY newdb2
ROLES = (dba)
DEFAULT TABLESPACE newdb2tbs
DATAFILE '/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/newdb2tbs.dbf' SIZE 500M ONLINE
file_name_convert=('/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed','/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2');
SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
newdb1 READ WRITE
newdb2 MOUNTED
PDB$SEED READ ONLY
PDB12C READ WRITE
SQL> alter pluggable database newdb2 open read write;
Pluggable database altered.
SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
newdb1 READ WRITE
newdb2 READ WRITE
PDB$SEED READ ONLY
PDB12C READ WRITE
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u02/app/oracle/DATA/dbd12c/dbd12c/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/undotbs01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/users01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/SAMPLE_SCHEMA_users01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/example01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/SAMPLE_SCHEMA_users01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/example01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/system01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/sysaux01.dbf
/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/newdb2tbs.dbf
#check listener services
oracle 12c Cloud DB RDBMS: lsnrctl reload
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 22-AUG-2013 15:00:08
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test1.yourserver.com)(PORT=1521)))
The command completed successfully
oracle 12c Cloud DB RDBMS: lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 22-AUG-2013 15:00:11
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test1.yourserver.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 22-AUG-2013 11:32:34
Uptime 0 days 3 hr. 27 min. 37 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/test1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test1.yourserver.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=test1.yourserver.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/dbd12c/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "dbd12c" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
Service "dbd12cXDB" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
Service "newdb1" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
Service "newdb2" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
Service "pdb12c" has 1 instance(s).
Instance "dbd12c", status READY, has 1 handler(s) for this service...
The command completed successfully
oracle 12c Cloud DB RDBMS: sqlplus newdb2/newdb2@test1.yourserver.com:1521/newdb2
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 15:01:01 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> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 newdb2 READ WRITE NO
SQL>exit
#drop pluggable database
oracle 12c Cloud DB RDBMS: sqlplus /as sysdba
SQL> alter pluggable database newdb1 close;
Pluggable database altered.
SQL> drop pluggable database newdb1 including datafiles;
Pluggable database dropped.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB12C READ WRITE NO
5 newdb2 READ WRITE NO
SQL>CREATE PLUGGABLE DATABASE newdb1
ADMIN USER newdb1 IDENTIFIED BY newdb1
ROLES = (dba)
DEFAULT TABLESPACE newdb1tbs
DATAFILE '/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/newdb1tbs.dbf' SIZE 500M ONLINE
file_name_convert=('/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed','/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1');
SQL> alter pluggable database newdb1 open read write;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB12C READ WRITE NO
4 newdb1 READ WRITE NO
5 newdb2 READ WRITE NO
newdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test1.yourserver.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newdb1)
)
)
oracle 12c Cloud DB RDBMS: sqlplus newdb1/newdb1@newdb1
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 15:14:33 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> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 newdb1 READ WRITE NO
#Create Users
oracle 12c Cloud DB RDBMS: sqlplus newdb1/newdb1@newdb1
SQL> create user demo identified by demo ;
User created.
SQL> grant create session to demo;
Grant succeeded.
SQL> exit
oracle 12c Cloud DB RDBMS: sqlplus demo/demo@newdb1
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 15:19:30 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> exit
oracle 12c Cloud DB RDBMS: sqlplus newdb2/newdb2@newdb2
SQL> create user demo identified by demo ;
User created.
SQL> grant create session to demo;
Grant succeeded.
SQL> exit
oracle 12c Cloud DB RDBMS: sqlplus demo/demo@newdb2
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 15:20:00 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> exit
## Rman
#create some data
oracle 12c Cloud DB RDBMS: sqlplus newdb1/newdb1@newdb1
SQL*Plus: Release 12.1.0.1.0 Production on Fri Aug 23 11:32:46 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Thu Aug 22 2013 15:18:58 +01: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
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
newdb1TBS
SQL> create table newdb1.test(ID number) tablespace newdb1TBS;
Table created.
SQL> alter user newdb1 quota unlimited on newdb1TBS;
User altered.
SQL> insert into newdb1.test values (1);
1 row created.
SQL> commit;
Commit complete.
SQL> exit
oracle 12c Cloud DB RDBMS: rman target / nocatalog
Recovery Manager: Release 12.1.0.1.0 - Production on Fri Aug 23 11:41:08 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
connected to target database: dbd12c (DBID=1832476899)
using target database control file instead of recovery catalog
RMAN> backup as compressed backupset database format '/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_%U';
Starting backup at 23-AUG-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=130 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u02/app/oracle/DATA/dbd12c/dbd12c/sysaux01.dbf
input datafile file number=00001 name=/u02/app/oracle/DATA/dbd12c/dbd12c/system01.dbf
input datafile file number=00004 name=/u02/app/oracle/DATA/dbd12c/dbd12c/undotbs01.dbf
input datafile file number=00006 name=/u02/app/oracle/DATA/dbd12c/dbd12c/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-AUG-13
channel ORA_DISK_1: finished piece 1 at 23-AUG-13
piece handle=/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_06oi0u8d_1_1 tag=TAG20130823T114205 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00017 name=/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/sysaux01.dbf
input datafile file number=00018 name=/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/newdb2tbs.dbf
input datafile file number=00016 name=/u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/system01.dbf
channel ORA_DISK_1: starting piece 1 at 23-AUG-13
channel ORA_DISK_1: finished piece 1 at 23-AUG-13
piece handle=/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_07oi0uae_1_1 tag=TAG20130823T114205 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00020 name=/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/sysaux01.dbf
input datafile file number=00021 name=/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/newdb1tbs.dbf
input datafile file number=00019 name=/u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/system01.dbf
channel ORA_DISK_1: starting piece 1 at 23-AUG-13
channel ORA_DISK_1: finished piece 1 at 23-AUG-13
piece handle=/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_08oi0ubr_1_1 tag=TAG20130823T114205 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/sysaux01.dbf
input datafile file number=00011 name=/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/example01.dbf
input datafile file number=00008 name=/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/system01.dbf
input datafile file number=00010 name=/u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/SAMPLE_SCHEMA_users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-AUG-13
channel ORA_DISK_1: finished piece 1 at 23-AUG-13
piece handle=/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_09oi0ud8_1_1 tag=TAG20130823T114205 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/sysaux01.dbf
input datafile file number=00005 name=/u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/system01.dbf
channel ORA_DISK_1: starting piece 1 at 23-AUG-13
channel ORA_DISK_1: finished piece 1 at 23-AUG-13
piece handle=/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_0aoi0uel_1_1 tag=TAG20130823T114205 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
Finished backup at 23-AUG-13
Starting Control File and SPFILE Autobackup at 23-AUG-13
piece handle=/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/2013_08_23/o1_mf_s_824211971_91ghcmo2_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 23-AUG-13
RMAN> report schema;
Report of database schema for database with db_unique_name dbd12c
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 790 SYSTEM *** /u02/app/oracle/DATA/dbd12c/dbd12c/system01.dbf
3 840 SYSAUX *** /u02/app/oracle/DATA/dbd12c/dbd12c/sysaux01.dbf
4 350 UNDOTBS1 *** /u02/app/oracle/DATA/dbd12c/dbd12c/undotbs01.dbf
5 260 PDB$SEED:SYSTEM *** /u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/system01.dbf
6 5 USERS *** /u02/app/oracle/DATA/dbd12c/dbd12c/users01.dbf
7 640 PDB$SEED:SYSAUX *** /u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/sysaux01.dbf
8 280 PDB12C:SYSTEM *** /u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/system01.dbf
9 700 PDB12C:SYSAUX *** /u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/sysaux01.dbf
10 5 PDB12C:USERS *** /u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/SAMPLE_SCHEMA_users01.dbf
11 357 PDB12C:EXAMPLE *** /u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/example01.dbf
16 270 newdb2:SYSTEM *** /u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/system01.dbf
17 680 newdb2:SYSAUX *** /u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/sysaux01.dbf
18 500 newdb2:newdb2TBS *** /u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/newdb2tbs.dbf
19 270 newdb1:SYSTEM *** /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/system01.dbf
20 680 newdb1:SYSAUX *** /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/sysaux01.dbf
21 500 newdb1:newdb1TBS *** /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/newdb1tbs.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 88 TEMP 32767 /u02/app/oracle/DATA/dbd12c/dbd12c/temp01.dbf
2 87 PDB$SEED:TEMP 32767 /u02/app/oracle/DATA/dbd12c/dbd12c/pdbseed/pdbseed_temp01.dbf
3 87 PDB12C:TEMP 32767 /u02/app/oracle/DATA/dbd12c/dbd12c/PDB12C/PDB12C_temp01.dbf
4 20 newdb1:TEMP 32767 /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/pdbseed_temp01.dbf
5 20 newdb2:TEMP 32767 /u02/app/oracle/DATA/dbd12c/dbd12c/newdb2/pdbseed_temp01.dbf
RMAN> exit
oracle 12c Cloud DB RDBMS: sqlplus '/as sysdba'
SQL*Plus: Release 12.1.0.1.0 Production on Fri Aug 23 11:47:55 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> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB12C READ WRITE NO
4 newdb1 READ WRITE NO
5 newdb2 READ WRITE NO
SQL> alter pluggable database newdb1 close;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB12C READ WRITE NO
4 newdb1 MOUNTED
5 newdb2 READ WRITE NO
oracle 12c Cloud DB RDBMS: rman
Recovery Manager: Release 12.1.0.1.0 - Production on Fri Aug 23 11:49:33 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
RMAN> connect target "sys as sysbackup";
target database Password:
connected to target database: dbd12c (DBID=1832476899)
RMAN> restore pluggable database newdb1;
Starting restore at 23-AUG-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=130 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00019 to /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/system01.dbf
channel ORA_DISK_1: restoring datafile 00020 to /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00021 to /u02/app/oracle/DATA/dbd12c/dbd12c/newdb1/newdb1tbs.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_08oi0ubr_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/dbd12c/dbd12c/autobackup/dbd12c_db_08oi0ubr_1_1 tag=TAG20130823T114205
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 23-AUG-13
RMAN> recover pluggable database newdb1;
Starting recover at 23-AUG-13
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 23-AUG-13
RMAN> alter pluggable database newdb1 open;
Statement processed
RMAN> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
CON_ID DBID NAME OPEN_MODE
---------- ---------- ------------------------------ ----------
2 4066632809 PDB$SEED READ ONLY
3 476145852 PDB12C READ WRITE
4 1690033603 newdb1 READ WRITE
5 3906966392 newdb2 READ WRITE
RMAN> exit
Recovery Manager complete.
oracle 12c Cloud DB RDBMS: sqlplus newdb1/newdb1@newdb1
SQL*Plus: Release 12.1.0.1.0 Production on Fri Aug 23 11:53:26 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Fri Aug 23 2013 11:32:46 +01: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
SQL> select * from test;
ID
----------
1
SQL> exit