Está en la página 1de 85

Oracle Database 12c Upgrade

Hands-on-Lab Workshop
Contents
The Workshop ......................................................................................................................................................... 3

The Environment................................................................................................................................................. 3

1. In-place Upgrade of 10.2.0.5 to DB12c ........................................................................................................... 4

2. PLUGIN A NON-CDB 12C DATABASE INTO A CDB ......................................................................................... 16

a. Optional: Remove the redundant dictionary data from PDB1 .................................................................. 18

3. Full Transportable Export/Import ................................................................................................................. 20

4. CREATE AND TEST A NEW PDB ..................................................................................................................... 24

5. Zero Downtime Upgrade .............................................................................................................................. 28

Installing the software ...................................................................................................................................... 28

Setting Up Golden Gate Environment .............................................................................................................. 40

Configuring GoldenGate ................................................................................................................................... 43

Configure Golden Gate for Data Replication (11g to 12c)................................................................................ 57

Verify the extract processes (Optional) ............................................................................................................ 59

Managing the Oracle GoldenGate environment .............................................................................................. 65

Configuring bidirectional support (optional) .................................................................................................... 70

Summary ........................................................................................................................................................... 78

6 Cross-Platform Transportable Tablespaces (xTTS) ............................................................................................ 79

7 Conclusions ................................................................................................................................................... 85

Oracle Page 2
The Workshop
The Environment
A virtual box VM image is provided along with this workbook to each attendee with a recommended laptop
having at least 100 GB of disk space and 8 GB of RAM.

OS Logons

Username Password

oracle oracle

root oracle

Oracle Installations

Oracle SID Version Oracle Home

V102 10.2.0.5 /u01/app/oracle/product/10.2.0

V112 11.2.0.3 /u01/app/oracle/product/11.2.0

CDB12 12.1.0.1 /u01/app/oracle/product/12.1.0

Oracle Page 3
1. In-place Upgrade of 10.2.0.5 to DB12c
This exercise will run through a simple in-place upgrade using the new catctl.pl script. The scenario will also
demonstrate how to roll back following an upgrade if required. The V102 database currently on 10gR2 will be
upgraded to 12c. The new Parallel Upgrade script, namely catctl.pl results in up to 40% faster upgrades. The
pre-upgrade script preupgrd.sql also generates automated fixup scripts that are ready to be run.

oracle@localhost:~$ . db10
[V102] oracle@localhost:~
$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Tue Mar 4 03:25:44 2014

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing
options

SYS:V102>@/u01/app/oracle/product/12.1.0/rdbms/admin/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/V102/preupgrade/preupgrade.log

Pre-Upgrade Fixup Script (run in source database environment):


/u01/app/oracle/cfgtoollogs/V102/preupgrade/preupgrade_fixups.sql

Post-Upgrade Fixup Script (run shortly after upgrade):


/u01/app/oracle/cfgtoollogs/V102/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.

1) Check Tag: COMPATIBLE_PARAMETER


Check Summary: Verify compatible parameter value is valid
Fixup Summary:
""compatible" parameter must be increased manually prior to upgrade."
+++ Source Database Manual Action Required +++

You MUST resolve the above error prior to upgrade

************************************************************
SYS:V102>

Oracle Page 4
Open a new terminal window to look at the contents of the pre-upgrade log.

oracle@localhost:~$ more
/u01/app/oracle/cfgtoollogs/V102/preupgrade/preupgrade.log

Oracle Database Pre-Upgrade Information Tool 03-04-2014 03:29:15


Script Version: 12.1.0.1.0 Build: 006
**********************************************************************
Database Name: V102
Version: 10.2.0.5.0
Compatible: 10.2.0.5.0
Blocksize: 8192
Platform: Linux x86 64-bit
Timezone file: V4
**********************************************************************
[Renamed Parameters]
[No Renamed Parameters in use]
**********************************************************************
**********************************************************************
[Obsolete/Deprecated Parameters]
--> background_dump_dest 11.1 DESUPPORTED replaced by "diagnostic_dest"
--> user_dump_dest 11.1 DESUPPORTED replaced by "diagnostic_dest"

[Changes required in Oracle Database init.ora or spfile]


:
:
:
:
:
^^^ MANUAL ACTION SUGGESTED ^^^

**********************************************************************
************ Summary ************

1 ERROR exist that must be addressed prior to performing your upgrade.


3 WARNINGS that Oracle suggests are addressed to improve database performance.
1 INFORMATIONAL message that should be reviewed prior to your upgrade.

After your database is upgraded and open in normal mode you must run
rdbms/admin/catuppst.sql which executes several required tasks and completes
the upgrade process.

You should follow that with the execution of rdbms/admin/utlrp.sql, and a


comparison of invalid objects before and after the upgrade using
rdbms/admin/utluiobj.sql

If needed you may want to upgrade your timezone data using the process
described in My Oracle Support note 977512.1
***********************************

oracle@localhost:~$

Now let us prepare the spfile for the 12c upgrade according to the recommendations from preupgrade.log.

Run the following commands from the first terminal window with sqlplus session.

SYS:V102> create pfile from spfile;


SYS:V102> alter system reset background_dump_dest scope=spfile sid='*';
SYS:V102> alter system reset core_dump_dest scope=spfile sid='*';
SYS:V102> alter system reset user_dump_dest scope=spfile sid='*';

Oracle Page 5
SYS:V102> alter system set processes=300 scope=spfile;
SYS:V102> alter system set COMPATIBLE='12.1.0' scope=spfile;
SYS:V102> EXECUTE dbms_stats.gather_dictionary_stats;
SYS:V102>

Execute the preupgrade_fixups.sql created by the pre-upgrade script.

SYS:V102>
@/u01/app/oracle/cfgtoollogs/V102/preupgrade/preupgrade_fixups.sql
Pre-Upgrade Fixup Script Generated on 2014-03-04 03:29:14 Version: 12.1.0.1 Build: 006
Beginning Pre-Upgrade Fixups...

**********************************************************************
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 75 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: COMPATIBLE_PARAMETER
Check Summary: Verify compatible parameter value is valid
Fix Summary: "compatible" parameter must be increased manually prior to upgrade.
**********************************************************************
Fixup Returned Information:
ERROR: --> Compatible set too low

"compatible" currently set at 10.2.0.5.0 and must


be set to at least 11.0.0 prior to upgrading the database.
Do not make this change until you are ready to upgrade
because a downgrade back to 10.2 is not possible once compatible
has been raised.

Update your init.ora or spfile to make this change.


**********************************************************************

**********************************************************************
Check Tag: OCM_USER_PRESENT
Check Summary: Check for OCM schema
Fix Summary: Drop the ORACLE_OCM user.
**********************************************************************
Fixup Succeeded
**********************************************************************

**********************************************************************
[Pre-Upgrade Recommendations]
**********************************************************************

*****************************************
********* Dictionary Statistics *********
*****************************************

Please gather dictionary statistics 24 hours prior to


upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;

Oracle Page 6
^^^ MANUAL ACTION SUGGESTED ^^^

**************************************************
************* Fixup Summary ************

1 fixup routine was successful.


1 fixup routine returned INFORMATIONAL text that should be reviewed.
1 ERROR LEVEL check returned INFORMATION that must be acted on prior to upgrade.

************************************************************
====>> USER ACTION REQUIRED <<====
************************************************************

1) Check Tag: COMPATIBLE_PARAMETER failed.


Check Summary: Verify compatible parameter value is valid
Fixup Summary:
""compatible" parameter must be increased manually prior to upgrade."
^^^ MANUAL ACTION REQUIRED ^^^

**************************************************
You MUST resolve the above error prior to upgrade
**************************************************

**************** Pre-Upgrade Fixup Script Complete *********************


SYS:V102>

SYS:ORCL>

Please note that the preupgrade_fixups.sql script still complains about COMPATIBLE and PROCESSES both set too low. This
is ok as the current parameter file the database has been started with does have COMPATIBLE=10.2.0.5 and PROCESSES
lower than 300. We have just changed the information in the spfile to copy the spfile into the new Oracle 12c Home.

Shutdown the V102 database:.

SYS:V102> shutdown immediate


Database closed.
Database dismounted.
ORACLE instance shut down.

SYS:V102> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[V102] oracle@localhost:~

Copy the new spfile and your password file into the Oracle 12c home’s dbs directory.

$ cp /u01/app/oracle/product/10.2.0/dbs/spfileV102.ora
/u01/app/oracle/product/12.1.0/dbs/
[V102] oracle@localhost:~
$ cp /u01/app/oracle/product/10.2.0/dbs/orapwV102
/u01/app/oracle/product/12.1.0/dbs/
[V102] oracle@localhost:~

Oracle Page 7
$

Now we will upgrade the V102 Database to Oracle Database 12c using the new parallel upgrade scripts.
Furthermore we will recompile and check for invalid objects before/after the upgrade.

Switch the environment to Oracle 12c with ORACLE_SID=V102

$ . db10c
[V102] oracle@localhost:~
$ env |grep ORA
ORACLE_SID=V102
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0
[V102] oracle@localhost:~

$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Mar 4 04:28:46 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SYS:V102> startup upgrade


ORACLE instance started.

Total System Global Area 730714112 bytes


Fixed Size 2292672 bytes
Variable Size 213910592 bytes
Database Buffers 507510784 bytes
Redo Buffers 7000064 bytes
Database mounted.
Database opened.
SYS:V102> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application
Testing options
[V102] oracle@localhost:~
$

Start the new parallel upgrade – it will be driven by a PERL script catctl.pl outside of SQL*Plus and execute in 4
parallel threads. At a maximum 8 parallel threads can be used by specifying the parameter option -n 8

$ cd $ORACLE_HOME/rdbms/admin
[V102] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$ $ORACLE_HOME/perl/bin/perl catctl.pl catupgrd.sql
Analyzing file catupgrd.sql

Oracle Page 8
14 scripts found in file catupgrd.sql
Next path: catalog.sql
32 scripts found in file catalog.sql
Next path: catproc.sql
37 scripts found in file catproc.sql
Next path: catptabs.sql
61 scripts found in file catptabs.sql
Next path: catpdbms.sql
205 scripts found in file catpdbms.sql
Next path: catpdeps.sql
77 scripts found in file catpdeps.sql
Next path: catpprvt.sql
260 scripts found in file catpprvt.sql
Next path: catpexec.sql
26 scripts found in file catpexec.sql
Next path: cmpupgrd.sql
16 scripts found in file cmpupgrg.sql
:
:
:
:
:
:
:
:
Restart Phase #:39 Files: 1 Time: 1s
Parallel Phase #:40 Files: 10 Time: 24s
Restart Phase #:41 Files: 1 Time: 0s
Serial Phase #:42 Files: 1 Time: 10s
Restart Phase #:43 Files: 1 Time: 0s
Serial Phase #:44 Files: 1 Time: 57s
Serial Phase #:45 Files: 1 Time: 1s
Restart Phase #:46 Files: 1 Time: 0s
Serial Phase #:47 Files: 2 Time: 511s
Restart Phase #:48 Files: 1 Time: 1s
Serial Phase #:49 Files: 2 Time: 283s
Restart Phase #:50 Files: 1 Time: 1s
Serial Phase #:51 Files: 2 Time: 11s
Restart Phase #:52 Files: 1 Time: 0s
Serial Phase #:53 Files: 1 Time: 4s
Serial Phase #:54 Files: 1 Time: 329s
Serial Phase #:55 Files: 1 Time: 216s
Serial Phase #:56 Files: 1 Time: 36s
Grand Total Time: 2374s
[V102] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$

56 phases will be listed – some can act in parallel, other require serial execution. This will take up to 20
minutes – so you may take either a break and come back in about 15 minutes OR read on about Oracle
Multitenant (Pluggable Databases) in the presentation on your VBox image’s desktop beginning from slide
280. If you wonder about the RESTART phases: those happen if timing dependencies make it necessary to
rerun a certain script.The logfiles will be written by default into the directory catctl.pl started from – that’s
$ORACLE_HOME/rdbms/admin in this case. Once the upgrade is finished it will shutdown the database and in
the next phase you’ll restart it in normal mode.

Oracle Page 9
Post Upgrade Actions

Remove the dump parameters (background_dump_dest, user_dump_dest) and add the following:

$ . db10c
[V102] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Mar 4 05:25:19 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SYS:V102> startup
ORACLE instance started.

Total System Global Area 730714112 bytes


Fixed Size 2292672 bytes
Variable Size 339739712 bytes
Database Buffers 381681664 bytes
Redo Buffers 7000064 bytes
Database mounted.
Database opened.
SYS:V102> @?/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2014-03-04 05:26:02

DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid


DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

ERRORS DURING RECOMPILATION

Oracle Page 10
---------------------------
0

Function created.

PL/SQL procedure successfully completed.

Function dropped.

PL/SQL procedure successfully completed.

SYS:V102>

Execute the Post upgrade fix up script.

SYS:V102>
@/u01/app/oracle/cfgtoollogs/V102/preupgrade/postupgrade_fixups.sql
Post Upgrade Fixup Script Generated on 2014-03-04 03:29:14 Version: 12.1.0.1 Build: 006
Beginning Post-Upgrade Fixups...

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

**********************************************************************
Check Tag: INVALID_OBJECTS_EXIST
Check Summary: Check for invalid objects
Fix Summary: Invalid objects are displayed and must be reviewed.
**********************************************************************
Fixup Returned Information:
WARNING: --> Database contains INVALID objects prior to upgrade

The list of invalid SYS/SYSTEM objects was written to


registry$sys_inv_objs.
The list of non-SYS/SYSTEM objects was written to
registry$nonsys_inv_objs unless there were over 5000.
Use utluiobj.sql after the upgrade to identify any new invalid
objects due to the upgrade.
**********************************************************************

PL/SQL procedure successfully completed.

**********************************************************************
Check Tag: OLD_TIME_ZONES_EXIST
Check Summary: Check for use of older timezone data file
Fix Summary: Update the timezone using the DBMS_DST package after upgrade is complete.
**********************************************************************
Fixup Returned Information:
INFORMATION: --> Older Timezone in use

Database is using a time zone file older than version 18.


After the upgrade, it is recommended that DBMS_DST package
be used to upgrade the 12.1.0.1.0 database time zone version
to the latest version which comes with the new release.
Please refer to My Oracle Support note number 977512.1 for details.
**********************************************************************

PL/SQL procedure successfully completed.

**********************************************************************
[Post-Upgrade Recommendations]
**********************************************************************

Oracle Page 11
PL/SQL procedure successfully completed.

*****************************************
******** Fixed Object Statistics ********
*****************************************

Please create stats on fixed objects two weeks


after the upgrade using the command:
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

^^^ MANUAL ACTION SUGGESTED ^^^

PL/SQL procedure successfully completed.

**************************************************
************* Fixup Summary ************

2 fixup routines generated INFORMATIONAL messages that should be reviewed.

PL/SQL procedure successfully completed.

*************** Post Upgrade Fixup Script Complete ********************

PL/SQL procedure successfully completed.

SYS:V102>
$

Adjust Time Zone settings – you may look into these scripts taken from MOS before executing them:

SYS:V102> @/home/oracle/DST/DST_prepare.sql
Connected.

PROPERTY_NAME
VALUE
----------------------------------------------------------------------------------------------------------------
---------------- -----------------------------------------------------------------------------------------------
-------------------------
DST_PRIMARY_TT_VERSION
4
DST_SECONDARY_TT_VERSION
0
DST_UPGRADE_STATE
NONE

VERSION
----------
4

Connected.

Session altered.

Session altered.

PL/SQL procedure successfully completed.

PROPERTY_NAME
VALUE
----------------------------------------------------------------------------------------------------------------
---------------- -----------------------------------------------------------------------------------------------
-------------------------

Oracle Page 12
DST_PRIMARY_TT_VERSION
4
DST_SECONDARY_TT_VERSION
18
DST_UPGRADE_STATE
PREPARE

Table truncated.

Table truncated.

Table truncated.

PL/SQL procedure successfully completed.

no rows selected

no rows selected

no rows selected

no rows selected

no rows selected

A prepare window has been successfully ended.

PL/SQL procedure successfully completed.

PROPERTY_NAME
VALUE
----------------------------------------------------------------------------------------------------------------
---------------- -----------------------------------------------------------------------------------------------
-------------------------
DST_PRIMARY_TT_VERSION
4
DST_SECONDARY_TT_VERSION
0
DST_UPGRADE_STATE
NONE

SYS:V102> @/home/oracle/DST/DST_adjust.sql
Connected.
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.

Total System Global Area 730714112 bytes


Fixed Size 2292672 bytes
Variable Size 423625792 bytes
Database Buffers 297795584 bytes
Redo Buffers 7000064 bytes
Database mounted.
Database opened.

PROPERTY_NAME
VALUE
----------------------------------------------------------------------------------------------------------------
---------------- -----------------------------------------------------------------------------------------------
-------------------------
DST_PRIMARY_TT_VERSION
4
DST_SECONDARY_TT_VERSION
0

Oracle Page 13
DST_UPGRADE_STATE
NONE

DBA Recyclebin purged.

Table truncated.

Table truncated.

Table truncated.

Session altered.

Session altered.

An upgrade window has been successfully started.

PL/SQL procedure successfully completed.

PROPERTY_NAME
VALUE
----------------------------------------------------------------------------------------------------------------
---------------- -----------------------------------------------------------------------------------------------
-------------------------
DST_PRIMARY_TT_VERSION
18
DST_SECONDARY_TT_VERSION
4
DST_UPGRADE_STATE
UPGRADE

OWNER
TABLE_NAME
UPG
----------------------------------------------------------------------------------------------------------------
---------------- -----------------------------------------------------------------------------------------------
--------------------------------- ---
GSMADMIN_INTERNAL
AQ$_CHANGE_LOG_QUEUE_TABLE_L
YES
GSMADMIN_INTERNAL
AQ$_CHANGE_LOG_QUEUE_TABLE_S
YES

Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.

Total System Global Area 730714112 bytes


Fixed Size 2292672 bytes
Variable Size 423625792 bytes
Database Buffers 297795584 bytes
Redo Buffers 7000064 bytes
Database mounted.
Database opened.

Session altered.

Session altered.

Table list: "GSMADMIN_INTERNAL"."AQ$_CHANGE_LOG_QUEUE_TABLE_S"


Number of failures: 0
Table list: "GSMADMIN_INTERNAL"."AQ$_CHANGE_LOG_QUEUE_TABLE_L"
Number of failures: 0
Failures:0

PL/SQL procedure successfully completed.

Oracle Page 14
An upgrade window has been successfully ended.
Failures:0

PL/SQL procedure successfully completed.

PROPERTY_NAME
VALUE
----------------------------------------------------------------------------------------------------------------
---------------- -----------------------------------------------------------------------------------------------
-------------------------
DST_PRIMARY_TT_VERSION
18
DST_SECONDARY_TT_VERSION
0
DST_UPGRADE_STATE
NONE

FILENAME VERSION CON_ID


-------------------- ---------- ----------
timezlrg_18.dat 18 0

TZ_VERSION
----------
4

1 row updated.

Commit complete.

oracle@localhost:~$

Congratulations ! V102 database is now upgraded from Oracle Database 10.2.0.5 to


Oracle Database 12.1.0.1. You have completed the first part of the hands-on-lab.

Oracle Page 15
2. PLUGIN A NON-CDB 12C DATABASE INTO A CDB
Now Plug-in the V102 database we have upgraded into the existing CDB12 container database.

Database with SID: V112 is located in: /oradata/V112


Container Database with SID: CDB12 is located in: /oradata/CDB12
Pluggable Database PDB2 will be placed into: /oradata/CDB12/pdb2

Switch to the Oracle 12c V102 environment. Generate the XML description file – this file will contain the information
describing the database structure. To create it the database has to be in read only mode. Then Shut the database down.

oracle@localhost:~$ . db10c

oracle@localhost:~$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Mar 4 22:41:58 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, OLAP, Advanced Analytics and Real Application
Testing options

SYS:V102> shutdown immediate


Database closed.
Database dismounted.
ORACLE instance shut down.
SYS:V102> startup open read only;
ORACLE instance started.

Total System Global Area 730714112 bytes


Fixed Size 2292672 bytes
Variable Size 423625792 bytes
Database Buffers 297795584 bytes
Redo Buffers 7000064 bytes
Database mounted.
Database opened.
SYS:V102> exec DBMS_PDB.DESCRIBE('/tmp/pdb1.xml');
PL/SQL procedure successfully completed.

SYS:V102> shutdown immediate


Database closed.
Database dismounted.
ORACLE instance shut down.
SYS:V102> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SYS:ORCL>

Oracle Page 16
Switch to the Oracle 12c CBD12 environment

$ . db12c
[CDB12] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Mar 4 22:48:30 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SYS:CDB12> startup
ORACLE instance started.

Total System Global Area 1252663296 bytes


Fixed Size 2287864 bytes
Variable Size 452986632 bytes
Database Buffers 788529152 bytes
Redo Buffers 8859648 bytes
Database mounted.
Database opened.
SYS:CDB12>

SYS:CDB12>

Now plug in the database with its new name PDB1 – from this point there’s no V102 database anymore. In a real world
environment you would have a backup or use a backup/copy to plug in. In our lab the database V102 will stay in place and
become PDB1 inside the CDB12:
– Please use this name as the TNS setup has been already done
– Use the NOCOPY option for the lab – other options may be possible but would requiring extending VBox image files,
which could cause issues for other labs using the same systems.

SYS:CDB12> create pluggable database PDB1 using '/tmp/pdb1.xml' nocopy


tempfile reuse;

Pluggable database created.


SYS:CDB12> alter session set container=PDB1;

Session altered.

SYS:CDB12> startup

Warning: PDB altered with errors.

Pluggable Database opened.

SYS:CDB12>
SYS:CDB12>

Oracle Page 17
a. Optional: Remove the redundant dictionary data from PDB1

The reason for the error message is that there are sanity operations required inside the PDB to
connect the PDB with the CDB correctly. Therefore run the script noncdb_to_pdb.sql – this may take a approx 10-
20 minutes to complete due to recompilations. This is optional but is required for production migrations.

SYS:CDB12> @?/rdbms/admin/noncdb_to_pdb.sql
SYS:CDB12> SET SERVEROUTPUT ON
SYS:CDB12> SET FEEDBACK 1
SYS:CDB12> SET NUMWIDTH 10
SYS:CDB12> SET LINESIZE 80
SYS:CDB12> SET TRIMSPOOL ON
SYS:CDB12> SET TAB OFF
SYS:CDB12> SET PAGESIZE 100
SYS:CDB12>
SYS:CDB12> WHENEVER SQLERROR EXIT;
SYS:CDB12>
SYS:CDB12> DOC
DOC>#######################################################################
DOC>#######################################################################
DOC> The following statement will cause an "ORA-01403: no data found"
DOC> error if we're not in a PDB.
DOC> This script is intended to be run right after plugin of a PDB,
DOC> while inside the PDB.
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SYS:CDB12>
SYS:CDB12> VARIABLE cdbname VARCHAR2(128)
SYS:CDB12> VARIABLE pdbname VARCHAR2(128)
SYS:CDB12> BEGIN
2 SELECT sys_context('USERENV', 'CDB_NAME')
3 INTO :cdbname
4 FROM dual
5 WHERE sys_context('USERENV', 'CDB_NAME') is not null;
6 SELECT sys_context('USERENV', 'CON_NAME')
7 INTO :pdbname
8 FROM dual
9 WHERE sys_context('USERENV', 'CON_NAME') <> 'CDB$ROOT';
10 END;
11 /
:
:
:
:
7 RAISE;
8 END IF;
9 END;
10 END;
11 /

PL/SQL procedure successfully completed.

SYS:CDB12>
SYS:CDB12> WHENEVER SQLERROR CONTINUE;
SYS:CDB12>
SYS:CDB12>

Now our database is plugged in – but still opened in restricted mode. We will need to shut it down and start it up again.

Oracle Page 18
SYS:CDB12> shutdown immediate
Pluggable Database closed.
SYS:CDB12> startup
Pluggable Database opened.
SYS:CDB12> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 PDB1 READ WRITE NO
SYS:CDB12>

Well Done, you have now plugged in a non-container database into an existing container database !! You can
look at this visually through SQL Developer or using Oracle Enterprise Manager.

Oracle Page 19
3. Full Transportable Export/Import

Full Transportable Export/Import is a new Oracle Database 12c upgrade and migration feature combining
Transportable Tablespaces with Data Pump taking care on all objects which are not transportable.

Your task in this HOL Part 3 will be to use Full Transportable Export/Import to migrate the existing V112
database into a new PDB2 which will belong to the container database CDB12. Please stay with the proposed
names (PDB2) as the TNS setup has been set up already to allow connections.

Database locations are:


Database with SID: V112 is located in: /oradata/V112
Container Database with SID: CDB12 is located in: /oradata/CDB12
Pluggable Database PDB2 will be placed into: /oradata/CDB12/pdb2
CLONE AND PREPARE A PDB2 FROM PDB$SEED
The first task in the lab will be to provide an empty database – something we would do for a full import or for
transportable tablespaces as well. But in this specific case we want to consolidate, and therefore pre-create an
empty PDB2 (a Pluggable Database) inside the already existing CDB12 (the Container Database). The easiest
way to create an empty PDB is to clone it from the template PDB called PDB$SEED which exists in every
container database. The location to create it is defined by the init parameter PDB_FILE_NAME_CONVERT. It is
already set in CDB12 to have the new and empty PDB2 created in /oradata/CDB12/pdb2 directory

Create an empty PDB by cloning the PDB$SEED. This will take 1-2 minutes.
$ . db12c
[CDB12] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Mar 5 00:28:14 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, OLAP, Advanced Analytics and Real Application Testing options

SYS:CDB12> alter session set container=PDB1;


Session altered.

SYS:CDB12> shutdown;
Pluggable Database closed.
SYS:CDB12> alter session set container=CDB$ROOT;
Session altered.

SYS:CDB12> show parameter db_file;

NAME TYPE VALUE


------------------------------------ ----------- -------------------------
-----
db_file_multiblock_read_count integer 128
db_file_name_convert string

Oracle Page 20
db_files integer 200
pdb_file_name_convert string /oradata/CDB12/pdbseed,
/orada
ta/CDB12/pdb2

SYS:CDB12> create pluggable database PDB2 admin user adm identified by adm;
Pluggable database created.
SYS:CDB12>

Start the new pluggable database PDB2 and create a directory object inside PDB2 to be used in the full
transport operation.

SYS:CDB12> alter session set container=PDB2;


Session altered.

SYS:CDB12> startup
Pluggable Database opened.
SYS:CDB12> create directory mydir as '/oradata/CDB12/mydir';
Directory created.

SYS:CDB12> grant read,write on directory mydir to system;


Grant succeeded.

SYS:CDB12> create public database link SOURCEDB connect to system


identified by oracle using 'V112';
Database link created.

SYS:CDB12> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[CDB12] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$
SYS:CDB12>

SET THE TABLESPACE USERS IN V112 READ ONLY


In order to run the full transportable operation we’ll have to place all data tablespaces into read-only mode –
same procedure as we would do for a regular transportable tablespace operation. Once the tablespace (in this
case it is just the USERS tablespace) is in read-only mode we can copy the file(s) to the target location:
Start the new pluggable database PDB2 and create a directory object inside PDB2 to be used in the full
transport operation.

Connect to 11g database and perform the following operations.

Oracle Page 21
$ . db11
[V112] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 5 00:45:59 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 626327552 bytes


Fixed Size 2255832 bytes
Variable Size 243270696 bytes
Database Buffers 373293056 bytes
Redo Buffers 7507968 bytes
Database mounted.
Database opened.

SQL> alter tablespace users read only;

Tablespace altered.

SQL> !cp /oradata/V112/users01.dbf /oradata/CDB12/pdb2/

SQL> SQL> !ls -al /oradata/CDB12/pdb2/users01.dbf


-rw-r----- 1 oracle oinstall 5251072 Mar 5 00:47 /oradata/CDB12/pdb2/users01.dbf

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options
[V112] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$

IMPORT INTO THE PDB2


The Data Pump import will be run through the database link you created earlier – thus no need for an export
or a dumpfile. Data Pump will take care of everything (currently except XDB and AWR) you need from the
system tablepaces and move views, synonyms, trigger etc over to the target database (in our case: PDB2).
Data Pump can do this beginning from Oracle 11.2.0.3 on the source side but will require an Oracle 12c
database as target. This will work cross platform as well by using RMAN backups and convert them if
necessary.

$ . db12c
[CDB12] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$ impdp system/oracle@pdb2 network_link=sourcedb version=12 full=y
transportable=always metrics=y exclude=statistics logfile=mydir:pdb2.log
transport_datafiles='/oradata/CDB12/pdb2/users01.dbf'
Import: Release 12.1.0.1.0 - Production on Wed Mar 5 00:54:07 2014

Oracle Page 22
Copyright (c) 1982, 2013, Oracle and/or its affiliates. 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
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/********@pdb2 network_link=sourcedb version=12 full=y
transportable=always metrics=y exclude=statistics logfile=mydir:pdb2.log
transport_datafiles=/oradata/CDB12/pdb2/users01.dbf

Startup took 6 seconds


Estimate in progress using BLOCKS method...
Processing object type DATABASE_EXPORT/PLUGTS_FULL/FULL/PLUGTS_TABLESPACE
Processing object type DATABASE_EXPORT/PLUGTS_FULL/PLUGTS_BLK
Completed 1 PLUGTS_BLK objects in 1 seconds
Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
Estimated 1 TABLE_DATA objects in 8 seconds
Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA
Estimated 32 TABLE_DATA objects in 2 seconds
Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
Estimated 5 TABLE_DATA objects in 5 seconds
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
Estimated 0 TABLE_DATA objects in 10 seconds
Total estimation using BLOCKS method: 960 KB
:
:
:
Completed 2 USER objects in 0 seconds
ORA-31684: Object type ROLE:"JAVASYSPRIV" already exists
ORA-31684: Object type ROLE:"JAVADEBUGPRIV" already exists
ORA-31684: Object type ROLE:"EJBCLIENT" already exists
ORA-31684: Object type ROLE:"JMXSERVER" already exists
ORA-31684: Object type ROLE:"JAVA_ADMIN" already exists
ORA-31684: Object type ROLE:"JAVA_DEPLOY" already exists
ORA-31684: Object type ROLE:"XDBADMIN" already exists
ORA-31684: Object type RO
Completed 4 DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA objects in 23 seconds
Completed 0 DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA objects in 0 seconds
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 47 error(s) at Wed Mar 5 01:00:38 2014 elapsed 0 00:06:15

[CDB12] oracle@localhost:/u01/app/oracle/product/12.1.0/rdbms/admin
$

Oracle Page 23
4. CREATE AND TEST A NEW PDB

Creating a new PDB is a simple task. It will be created using the PDB$SEED which acts as a blueprint scheme.
The dynamic parameter PDB_FILE_NAME_CONVERT=’string1’,’string2’ will define where the new PDB3 will be
created. In your environment the directory /oradata/CDB12/pdb3 is already created. We will reuse this
directory to create a new PDB3.

You need to re-point the PDB_FILE_NAME_CONVERT parameter and create the database.

oracle@localhost:~$ . db12c

[CDB12] oracle@localhost:~
$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Mar 5 03:18:54 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, OLAP, Advanced Analytics and Real Application Testing options

SYS:CDB12> alter session set


pdb_file_name_convert='/oradata/CDB12/pdbseed','/oradata/CDB12/pdb3';
Session altered.

SYS:CDB12> create pluggable database PDB3 admin user adm identified by


adm;
Pluggable database created.

SYS:CDB12> alter session set container=pdb3;


Session altered.

SYS:CDB12> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED


---------- ------------------------------ ---------- ----------
5 PDB3 MOUNTED
SYS:CDB12> startup
Pluggable Database opened.
SYS:CDB12> create table test3 (col1 number);
Table created.

SYS:CDB12> insert into test3 values (1);


1 row created.

SYS:CDB12> commit;

Oracle Page 24
Commit complete.

Now connect to the ROOT container, it shows information about each PDB. The CDB$ROOT has information
about the object created earlier.

SYS:CDB12> alter session set container=cdb$root;


Session altered.

SYS:CDB12> show pdbs


CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 READ WRITE NO
5 PDB3 READ WRITE NO
SYS:CDB12> select owner, con_id from CDB_OBJECTS where
object_name=’TEST3’;
OWNER
--------------------------------------------------------------------------------
CON_ID
----------
SYS
5
SYS: CDB12>

You can also look at the PDBs visually using SQL Developer, OEM or EM Express.

Oracle Page 25
Using the new EM Express

You can set/change the port for the CDB12 and for every PDB you want to monitor with EM Express:

SYS:CDB12> exec DBMS_XDB.SETHTTPPORT('5501');


PL/SQL procedure successfully completed.

SYS:CDB12> alter user APEX_PUBLIC_USER account unlock;

User altered.

SYS:CDB12> alter user apex_040200 identified by no1_pwd;

Oracle Page 26
Now Open the browser (Mozilla Firefox) from your desktop and connect to http://localhost:5501/em to check
out the EM Express functionality. If you get an error message “Security Token does not match, please login
again” - typically a RELOAD of the EM page will allow to login with the 2nd attempt. This is a known EM
Express issue which may be happen in relation with the Firefox browser or the version used in this VM only.

Oracle Page 27
5. Zero Downtime Upgrade
These exercises will run from two different console windows. One console will be connected to an 11g
instance, the other will be connected to a 12c instance.

Installing the software

Install the software for both 11g and 12c.

Choose /oradata/ogg/oracle/product/12.1.0 and /oradata/ogg/oracle/product/11.2.0 as the OGG Homes for


12c and 11g respectively.

Console 1

oracle@localhost:~/ogg$ cd
/oradata/software/fbo_ggs_Linux_x64_shiphome/Disk1

oracle@localhost:~/ogg$ ./runInstaller

Oracle Page 28
Oracle Page 29
Oracle Page 30
Oracle Page 31
Oracle Page 32
Similarly, install the software for the target, ie OGG 12.1.0 for DB12c.

oracle@localhost:/oradata/ogg/oracle$ cd
/oradata/software/fbo_ggs_Linux_x64_shiphome/Disk1

oracle@localhost:/oradata/ogg/11g$ ./runInstaller

Oracle Page 33
Oracle Page 34
Oracle Page 35
Oracle Page 36
Oracle Page 37
Oracle Page 38
Oracle Page 39
Setting Up Golden Gate Environment
The steps below will setup the environment for GoldenGate to share Oracle Libraries.

Console 1
oracle@localhost:/oradata/ogg/11g$ . oraenv
ORACLE_SID = [V112] ? V112
The Oracle base remains unchanged with value /u01/app/oracle
oracle@localhost:/oradata/ogg/11g$ cd /oradata/ogg/oracle/product/11.2.0
oracle@localhost$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle


Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Sep 25 2013 00:31:13
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights
reserved.

GGSCI (localhost.localdomain) 1> create subdirs

Creating subdirectories under current directory


/oradata/ogg/oracle/product/11.2.0

Parameter files /oradata/ogg/oracle/product/11.2.0/dirprm:


already exists
Report files /oradata/ogg/oracle/product/11.2.0/dirrpt:
already exists
Checkpoint files /oradata/ogg/oracle/product/11.2.0/dirchk:
already exists
Process status files /oradata/ogg/oracle/product/11.2.0/dirpcs:
already exists
SQL script files /oradata/ogg/oracle/product/11.2.0/dirsql:
already exists
Database definitions files /oradata/ogg/oracle/product/11.2.0/dirdef:
already exists
Extract data files /oradata/ogg/oracle/product/11.2.0/dirdat:
already exists
Temporary files /oradata/ogg/oracle/product/11.2.0/dirtmp:
already exists
Credential store files /oradata/ogg/oracle/product/11.2.0/dircrd:
already exists
Masterkey wallet files /oradata/ogg/oracle/product/11.2.0/dirwlt:

Oracle Page 40
already exists
Dump files /oradata/ogg/oracle/product/11.2.0/dirdmp:
already exists

GGSCI (localhost.localdomain) 2> exit


oracle@localhost$

oracle@localhost: $ cd /oradata/ogg/oracle/product/11.2.0
oracle@localhost: $ cp /oradata/ogg/backup/11g_GLOBALS.txt ./GLOBALS
oracle@localhost: $ cp /oradata/ogg/backup/11g_startup.oby ./startup.oby
oracle@localhost: $ cd dirprm
oracle@localhost: $ cp /oradata/ogg/backup/eora01.prm .
oracle@localhost: $ cp /oradata/ogg/backup/epmp01.prm .
oracle@localhost: $ cp /oradata/ogg/backup/rora02.prm .

Console 2
oracle@localhost:/oradata/ogg/product/12.1.0$ cd
/oradata/ogg/oracle/product/12.1.0
oracle@localhost$ . oraenv
ORACLE_SID = [CDB12] ? CDB12
The Oracle base remains unchanged with value
oracle@localhost:/oradata/ogg/product/12.1.0$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle


Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:33:54
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights
reserved.

GGSCI (localhost.localdomain) 1>

GGSCI (localhost.localdomain) 2> create subdirs


Creating subdirectories under current directory
/oradata/ogg/oracle/product/12.1.0

Parameter files /oradata/ogg/oracle/product/12.1.0/dirprm:


already exists
Report files /oradata/ogg/oracle/product/12.1.0/dirrpt:
already exists
Checkpoint files /oradata/ogg/oracle/product/12.1.0/dirchk:
already exists

Oracle Page 41
Process status files /oradata/ogg/oracle/product/12.1.0/dirpcs:
already exists
SQL script files /oradata/ogg/oracle/product/12.1.0/dirsql:
already exists
Database definitions files /oradata/ogg/oracle/product/12.1.0/dirdef:
already exists
Extract data files /oradata/ogg/oracle/product/12.1.0/dirdat:
already exists
Temporary files /oradata/ogg/oracle/product/12.1.0/dirtmp:
already exists
Credential store files /oradata/ogg/oracle/product/12.1.0/dircrd:
already exists
Masterkey wallet files /oradata/ogg/oracle/product/12.1.0/dirwlt:
already exists
Dump files /oradata/ogg/oracle/product/12.1.0/dirdmp:
already exists

GGSCI (localhost.localdomain) 3> exit


oracle@localhost: $ cd /oradata/ogg/oracle/product/12.1.0
oracle@localhost: $ cp /oradata/ogg/backup/12c_GLOBALS.txt ./GLOBALS
oracle@localhost: $ cp /oradata/ogg/backup/12c_startup.oby ./startup.oby
oracle@localhost: $ cd dirprm
oracle@localhost: $ cp /oradata/ogg/backup/eora02.prm .
oracle@localhost: $ cp /oradata/ogg/backup/epmp02.prm .
oracle@localhost: $ cp /oradata/ogg/backup/rora01.prm .

Oracle Page 42
Configuring GoldenGate
Now that the software has been installed, the next stage is to configure GoldenGate to run the bi-directional
replication.

Open two additional console windows with the 10g and 11g instance and login as sysdba. Follow the below
steps to enable the databases for data capture.

Console 3
oracle@localhost:~$ . oraenv
ORACLE_SID = [oracle] ? V112
The Oracle base remains unchanged with value
oracle@localhost:~$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Mar 11 04:39:31 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options

SQL>
SQL> alter database add supplemental log data;

Database altered.

SQL> alter database force logging;

Database altered.

SQL> create user gguser identified by welcome1;

User created.

SQL> grant dba to gguser;

Grant succeeded.

SQL> alter system set enable_goldengate_replication=true scope=both;

System altered.

SQL>

Oracle Page 43
Console 4
oracle@localhost:~$ . oraenv
ORACLE_SID = [oracle] ? CDB12
The Oracle base remains unchanged with value
/u01/app/oracleoracle@localhost:~/ogg/gg11$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 22 10:16:36 2013

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit
Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options

SYS:CDB2> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

Database altered.

SYS:V112> alter database force logging;

Database altered.
SYS:CDB12> alter session set container=pdb1;

Session altered.

SYS:CDB12> startup

...

SYS:CDB12> create user gguser identified by welcome1;


User created.

SYS:CDB12> grant dba to gguser;

Grant succeeded.

Check the connectivity between both databases, and verify the configuration in tnsnames.ora.

Console 1
oracle@localhost:/oradata/ogg/11g$ cp
/u01/app/oracle/product/12.1.0/network/admin/tnsnames.ora
/u01/app/oracle/product/11.2.0/network/admin/

oracle@localhost:/oradata/ogg/11g$ tnsping CDB12

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 11-MAR-2014

Oracle Page 44
23:23:49

Copyright (c) 1997, 2013, Oracle. All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias


Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
localhost.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = CDB12)))
OK (0 msec)
oracle@localhost:/oradata/ogg/11g$

Console 2
oracle@localhost:/oradata/ogg/product/12.1.0$ cat
$ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

V112 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =
1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = V112)
)
)

CDB12 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =
1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = CDB12)
)
)

V102 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =
1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = V102)
)

Oracle Page 45
)

PDB3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =
1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PDB3)
)
)

PDB2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =
1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PDB2)
)
)

PDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =
1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PDB1)
)
)

##LISTENER_CDB12 =
##(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =
1521))
LISTENER_CDB12=
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521
))(CONNECT_DATA=(SERVICE_NAME=CDB12)(SERVER=DEDICATED)))

oracle@localhost:/oradata/ogg/product/12.1.0$ tnsping V112

TNS Ping Utility for Linux: Version 12.1.0.1.0 - Production on 11-MAR-2014


23:26:05

Copyright (c) 1997, 2013, Oracle. All rights reserved.

Used parameter files:


/u01/app/oracle/product/12.1.0/network/admin/sqlnet.ora

Oracle Page 46
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
localhost.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = V112)))
OK (260 msec)
oracle@localhost:/oradata/ogg/product/12.1.0$

To create the startup files and manager, you must have copied the pre-configured parameter files into the
GoldenGate subdirectories previously. Verify GLOBALS file.

Console 1

oracle@localhost $ cd /oradata/ogg/oracle/product/11.2.0
oracle@localhost $ cat GLOBALS
CHECKPOINTTABLE gguser.ggschkpt

Do the same in the second console with the OGG for 12c.

Console 2

oracle@localhost $ cd /oradata/ogg/oracle/product/12.1.0

oracle@localhost:~/ogg/gg11$ cat GLOBALS


CHECKPOINTTABLE gguser.ggschkpt
oracle@localhost $

Oracle Page 47
Create HR schema in 11g database and populate it.

Note: When you run “@hr_main.sql” below you will be asked for the sys password. The password is “oracle”.

Console 3
oracle@localhost $ cd /oradata/samples

oracle@localhost:~/ogg/gg11$ sqlplus / as sysdba


oracle@localhost $ SQL*Plus: Release 11.2.0.4.0 Production on Sat Apr 5
06:25:04 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options

SQL> drop user hr cascade;

User dropped.

SQL> create user hr identified by hr;

User created.

SQL> create directory exp_dir as '/home/oracle';

Directory created.

SQL> grant read,write on directory exp_dir to public;

Grant succeeded.

SQL> alter tablespace users read write;


...

SQL> @hr_main.sql
Enter @sys_password: oracle
:
:

1 row created.

Oracle Page 48
Table altered.

Commit complete.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options
oracle@localhost $ expdp hr/hr dumpfile=hr.11g.dmp logfile=exp.hr11g.log
directory=exp_dir
Export: Release 11.2.0.4.0 - Production on Sat Apr 5 06:45:00 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "HR"."SYS_EXPORT_SCHEMA_01": hr/******** dumpfile=hr.11g.dmp
logfile=exp.hr11g.log directory=exp_dir
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 448 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . exported "HR"."COUNTRIES" 6.367 KB 25 rows
. . exported "HR"."DEPARTMENTS" 7.007 KB 27 rows
. . exported "HR"."EMPLOYEES" 16.79 KB 107 rows
. . exported "HR"."JOBS" 6.984 KB 19 rows
. . exported "HR"."JOB_HISTORY" 7.054 KB 10 rows
. . exported "HR"."LOCATIONS" 8.273 KB 23 rows
. . exported "HR"."REGIONS" 5.476 KB 4 rows
Master table "HR"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for HR.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/hr.11g.dmp
Job "HR"."SYS_EXPORT_SCHEMA_01" successfully completed at Sat Apr 5 06:45:51 2014 elapsed
0 00:00:50

oracle@localhost:/oradata/samples$

Oracle Page 49
Import hr schema into 12c database – PDB1 and populate it.

Console 4
oracle@localhost $ cd /oradata/samples
oracle@localhost $ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sat Apr 5 06:27:26 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, OLAP, Advanced Analytics and Real Application
Testing options

SYS:CDB12> alter session set container=pdb1;

Session altered.
SYS:CDB12> create directory imp_dir as '/home/oracle';

Directory created.

SYS:CDB12> grant read,write on directory imp_dir to public;

Grant succeeded.

SYS:CDB12> CREATE USER HR IDENTIFIED BY hr;

...

SYS:CDB12> ALTER USER HR DEFAULT TABLESPACE users QUOTA UNLIMITED ON


users;

...

SYS:CDB12> ALTER USER HR TEMPORARY TABLESPACE temp;

...

SYS:CDB12> GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE


SEQUENCE TO HR;

Grant succeeded.

SYS:CDB12> GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE TO HR;

Grant succeeded.

Oracle Page 50
SYS:CDB12>exit

oracle@localhost $ impdp system/oracle@pdb1 directory=imp_dir


dumpfile=hr.11g.dmp logfile=hr.imp.12c.log

Import: Release 12.1.0.1.0 - Production on Sat Apr 5 08:17:30 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates. 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
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/********@pdb1
directory=imp_dir dumpfile=hr.11g.dmp logfile=hr.imp.12c.log
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "HR"."COUNTRIES" 6.367 KB 25
rows
. . imported "HR"."DEPARTMENTS" 7.007 KB 27
rows
. . imported "HR"."EMPLOYEES" 16.79 KB 107
rows
. . imported "HR"."JOBS" 6.984 KB 19
rows
. . imported "HR"."JOB_HISTORY" 7.054 KB 10
rows
. . imported "HR"."LOCATIONS" 8.273 KB 23
rows
. . imported "HR"."REGIONS" 5.476 KB 4
rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type
SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Sat Apr 5
08:18:07 2014 elapsed 0 00:00:18

oracle@localhost:/oradata/samples$

Oracle Page 51
Oracle Page 52
Issue the commands below to start the GoldenGate command interpreter.

Console 1
oracle@localhost$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle


Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Sep 25 2013 00:31:13
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights
reserved.

GGSCI (localhost.localdomain) 1> set editor gedit


GGSCI (localhost.localdomain) 2> view params startup.oby
dblogin UserID gguser, Password welcome1
Start Mgr
Info Mgr
Info CheckpointTable
GGSCI (localhost.localdomain) 3> obey startup.oby
GGSCI (localhost.localdomain) 4> dblogin UserID gguser, Password welcome1

Successfully logged into database.

GGSCI (localhost.localdomain) 5> Start Mgr

MGR is already running.

GGSCI (localhost.localdomain) 6> Info Mgr

Manager is running (IP port localhost.localdomain.7809).

GGSCI (localhost.localdomain) 7> Info CheckpointTable


No checkpoint table specified. Using GLOBALS specification
(gguser.ggschkpt)...

Checkpoint table gguser.ggschkpt does not exist.

GGSCI (localhost.localdomain) 6> Set Editor gedit

GGSCI (localhost.localdomain) 1> view params mgr


PORT 7809

Oracle Page 53
GGSCI (localhost.localdomain) 12> add checkpointtable

No checkpoint table specified, using GLOBALS specification


(gguser.ggschkpt)...

Successfully created checkpoint table gguser.ggschkpt.

GGSCI (localhost.localdomain) 13> add trandata hr.employees

Logging of supplemental redo data enabled for table HR.EMPLOYEES


TRANDATA for scheduling columns has been added on table 'HR.EMPLOYEES'.

Create the common user in the multitent database

Console 4
oracle@localhost:~$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Mar 12 02:39:31 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, OLAP, Advanced Analytics and Real Application
Testing options

SYS:CDB12> create user c##gguser identified by welcome1;


User Created.
SYS:CDB12> grant dba to c##gguser;

Grant succeeded.

SYS:CDB12> alter session set container=pdb1;

Session altered.

SYS:CDB12> grant dba to c##gguser;

Grant succeeded.

SYS:CDB12>

Oracle Page 54
Repeat the manager configuration process in the second console.

Console 2
oracle@localhost:/oradata/ogg/product/12.1.0$ cd
/oradata/ogg/oracle/product/12.1.0

oracle@localhost$ cat startup.oby


dblogin UserID c##gguser, Password welcome1
Start Mgr
Info Mgr
Info CheckpointTable
set Editor gedit
view params mgr

oracle@localhost$ cat GLOBALS


CHECKPOINTTABLE pdb1.c##gguser.ggschkpt

oracle@localhost $ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle


Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:33:54
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights
reserved.

GGSCI (localhost.localdomain) 1> obey startup.oby

GGSCI (localhost.localdomain) 2> dblogin UserID c##gguser, Password


welcome1

Successfully logged into database CDB$ROOT.

GGSCI (localhost.localdomain) 3> Start Mgr

MGR is already running.

GGSCI (localhost.localdomain) 4> Info Mgr

Manager is running (IP port localhost.localdomain.7809, Process ID 11622).

GGSCI (localhost.localdomain) 5> Info CheckpointTable

Oracle Page 55
No checkpoint table specified. Using GLOBALS specification
(pdb1.c##gguser.ggschkpt)...

Checkpoint table pdb1.c##gguser.ggschkpt does not exist.


GGSCI (localhost.localdomain) 6> set Editor gedit

GGSCI (localhost.localdomain) 7> view params mgr

GGSCI (localhost.localdomain) 8> add checkpointtable

No checkpoint table specified. Using GLOBALS specification


(pdb1.c##gguser.ggschkpt)...

Successfully created checkpoint table pdb1.c##gguser.ggschkpt.


GGSCI (localhost.localdomain) 9> add trandata pdb1.hr.employees

Logging of supplemental redo data enabled for table PDB1.HR.EMPLOYEES.


TRANDATA for scheduling columns has been added on table
'PDB1.HR.EMPLOYEES'.
GGSCI (localhost.localdomain) 10>

Oracle Page 56
Configure Golden Gate for Data Replication (11g to 12c)
Data capture, also known as extract is done on the source side. A primary extract is required; a secondary
extract known as a data pump is optional but highly recommended. To configure data capture, perform the
following steps:

Console 1
oracle@localhost $ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle


Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Sep 25 2013 00:31:13
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights
reserved.

# if this file does not exist, please setup eora01.prm under dirprm.
GGSCI (localhost.localdomain) 13> view param eora01
extract eora01

userid gguser, password welcome1

exttrail ./dirdat/aa

table hr.employees;

GGSCI (localhost.localdomain) 14> add extract eora01, tranlog, begin now


EXTRACT added.

GGSCI (localhost.localdomain) 15> add exttrail ./dirdat/aa, extract


eora01, megabytes 5
EXTTRAIL added.

Oracle Page 57
The primary extract has now been created and configured, but not started. Leave GGSCI running for the next
step to configure data pump.

Console 1
GGSCI (localhost.localdomain) 16> view param epmp01
extract epmp01
passthru
rmthost localhost, mgrport 7810
rmttrail ./dirdat/ab
table hr.employees;

GGSCI (localhost.localdomain) 14> add extract epmp01, exttrailsource


./dirdat/aa
EXTRACT added.

GGSCI (localhost.localdomain) 15> add rmttrail ./dirdat/ab, extract


epmp01, megabytes 5
RMTTRAIL added.

The data pump reads from the local trail file aa and writes to the remote trail file ab. The remote trail file that
will be created will be named dirdat/ab000000, then when that one fills up the next will be dirdat/ab000001,
then dirdat/ab000002, and so on. The different file name is chosen just to illustrate that the
parameter RmtTrail is creating a different trail file.

The secondary Extract has now been created and configured, but not started. Leave GGSCI running for the
next step.

Oracle Page 58
Verify the extract processes (Optional)
Make sure the Extract processes were created and registered correctly.

Console 1

GGSCI (localhost.localdomain) 11> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT STOPPED EORA01 00:00:00 00:09:37
EXTRACT STOPPED EPMP01 00:00:00 00:04:34

GGSCI (localhost.localdomain) 12> info exttrail *

Extract Trail: ./dirdat/aa


Extract: EORA01
Seqno: 0
RBA: 0
File Size: 5M

Extract Trail: ./dirdat/ab


Extract: EPMP01
Seqno: 0
RBA: 0
File Size: 5M

GGSCI (localhost.localdomain) 13>

Data delivery, also known as Replicat is done at the target side. To configure data delivery and verify, perform
the following steps:

Console 2

GGSCI (localhost.localdomain) 11> view param rora01


replicat rora01
userid c##gguser@pdb1, password welcome1
assumetargetdefs
discardfile ./dirrpt/rora01.dsc, purge
map hr.employees, target pdb1.hr.employees;
GGSCI (localhost.localdomain) 11> add replicat rora01, exttrail
./dirdat/ab
REPLICAT added.

Oracle Page 59
GGSCI (localhost.localdomain) 12> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
REPLICAT STOPPED RORA01 00:00:00 00:00:44

The Map statement can be simple (as shown here), or very complex, transforming columns and fields. For
example, you could combine three source columns first_name, middle_init, last_name into a single target
column full_name.

Start and verify all Extract processes on the source.

Console 1

GGSCI (localhost.localdomain) 11> start extract *

Sending START request to MANAGER ...


EXTRACT EORA01 starting

Sending START request to MANAGER ...


EXTRACT EPMP01 starting

GGSCI (localhost.localdomain) 14> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT RUNNING EORA01 00:00:00 00:00:06
EXTRACT RUNNING EPMP01 00:00:00 00:00:01

GGSCI (localhost.localdomain) 15> info extract *

EXTRACT EORA01 Last Started 2013-09-22 11:41 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:03 ago)
Log Read Checkpoint Oracle Redo Logs
2013-09-22 11:48:29 Seqno 33, RBA 5843456
SCN 0.652935 (652935)

EXTRACT EPMP01 Last Started 2013-09-22 11:41 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:06 ago)

Oracle Page 60
Log Read Checkpoint File ./dirdat/aa000000
First Record RBA 1029

Start all Replicat processes on the target.

Console 2
GGSCI (localhost.localdomain) 8> view param rora01
replicat rora01
userid c##gguser@pdb1, password welcome1
assumetargetdefs
discardfile ./dirrpt/rora01.dsc, purge
map hr.employees, target pdb1.hr.employees;

GGSCI (localhost.localdomain) 13> start replicat *

Sending START request to MANAGER ...


REPLICAT RORA01 starting

GGSCI (localhost.localdomain) 14> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
REPLICAT RUNNING RORA01 00:00:00 00:00:02

GGSCI (localhost.localdomain) 16> info rora01, detail

REPLICAT RORA01 Last Started 2014-03-12 06:17 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:06 ago)
Process ID 22937
Log Read Checkpoint File ./dirdat/ab000000
First Record RBA 0

Current Log BSN value: (requires database login)

Extract Source Begin End

./dirdat/ab000000 * Initialized * First Record


./dirdat/ab000000 * Initialized * First Record

Oracle Page 61
Current directory /oradata/ogg/product/12.1.0

Report file /oradata/ogg/product/12.1.0/dirrpt/RORA01.rpt


Parameter file /oradata/ogg/product/12.1.0/dirprm/rora01.prm
Checkpoint file /oradata/ogg/product/12.1.0/dirchk/RORA01.cpr
Checkpoint table pdb1.c##gguser.ggschkpt
Process file /oradata/ogg/product/12.1.0/dirpcs/RORA01.pcr
Error log /oradata/ogg/product/12.1.0/ggserr.log

GGSCI (localhost.localdomain) 9>

Everything should show a status of RUNNING. No data has flowed yet, nothing has replicated yet.

You can issue any update/insert statements on source and can observe the data replicated to the target
environment. Start a separate terminal and login into V112 oracle environment.

Console 3
oracle@localhost:~$ . oraenv
ORACLE_SID = [oracle] ? V112
The Oracle base remains unchanged with value /u01/app/oracle
oracle@localhost:~$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 12 06:27:55 2014

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options

SQL>

SQL> select employee_id, first_name, last_name, salary from hr.employees


where employee_id=100;

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY


----------- -------------------- ------------------------- ----------
100 Steven King 24000

Oracle Page 62
SQL> update hr.employees set salary=98765 where employee_id=100;

1 row updated.

SQL> commit;

Commit complete.

SQL> select employee_id, first_name, last_name, salary from hr.employees


where employee_id=100;

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY


----------- -------------------- ------------------------- ----------
100 Steven King 98765

SQL> insert into hr.employees (employee_id, first_name, last_name, email,


phone_number, hire_date,job_id, salary) values (996, 'Michael', 'Clarke',
'm.clarke@m.com', '',sysdate,'AD_VP',101000);

1 row created.

SQL> commit;

Commit complete.

SQL> select employee_id, first_name, last_name, salary from hr.employees


where employee_id=996;

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY


----------- -------------------- ------------------------- ----------
999 Michael Clarke 101000

Oracle Page 63
You can observe now that data has started replicating to the 11g database environment. Startup a new
session and login into CDB12 Oracle database environment.

Console 4
oracle@localhost:~$ . oraenv
ORACLE_SID = [oracle] ? CDB12
The Oracle base remains unchanged with value /u01/app/oracle
oracle@localhost:~$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Mar 12 06:37:12 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, OLAP, Advanced Analytics and Real Application
Testing options

SYS:CDB12> SYS:CDB12> alter session set container=pdb1;

Session altered.
SYS:CDB12> select employee_id, first_name, last_name, salary from
hr.employees where employee_id=100;

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY


----------- -------------------- ------------------------- ----------
100 Steven King 98765

SYS:CDB12> select employee_id, first_name, last_name, salary from


hr.employees where employee_id=996;

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY


----------- -------------------- ------------------------- ----------
999 Michael Clarke 101000
Congratulations !! You have configured Golden Gate to replicate data from an Oracle 11g database to a
pluggable database on Oracle 12c container database.

Oracle Page 64
Managing the Oracle GoldenGate environment

For running various adminstritative reports, you can test the following commands.

Console 1

GGSCI (localhost.localdomain) 16> send extract eora01, report

Sending REPORT request to EXTRACT EORA01 ...


Request processed.

GGSCI (localhost.localdomain) 17> View Report eora01


***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:42:16

Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights
reserved.

Starting at 2014-03-12 05:25:56


***********************************************************************

Operating System Version:


Linux
Version #1 SMP Fri Jul 6 08:01:33 EDT 2012, Release 2.6.39-200.29.1.el5uek
Node: localhost.localdomain
Machine: x86_64
soft limit hard limit
Address Space Size : unlimited unlimited
Heap Size : unlimited unlimited
File Size : unlimited unlimited
CPU Time : unlimited unlimited

Process id: 21779

Description:
:
:
:
***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************

Oracle Page 65
Report at 2014-03-12 06:43:15 (activity since 2014-03-12 06:31:42)

Output to ./dirdat/aa:

From Table HR.EMPLOYEES:


# inserts: 1
# updates: 1
# deletes: 0
# discards: 0

***********************************************************************
** Run Time Warnings **
***********************************************************************

GGSCI (localhost.localdomain) 18>

View the process reports for the target.

Console 2
GGSCI (localhost.localdomain) 17> send replicat rora01, report

Sending REPORT request to REPLICAT RORA01 ...


Request processed.

GGSCI (localhost.localdomain) 18> view report rora01


***********************************************************************
Oracle GoldenGate Delivery for Oracle
Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:54:11

Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights
reserved.

Starting at 2014-03-12 06:17:24


***********************************************************************

Operating System Version:


Linux
Version #1 SMP Fri Jul 6 08:01:33 EDT 2012, Release 2.6.39-200.29.1.el5uek
Node: localhost.localdomain
Machine: x86_64
soft limit hard limit
Address Space Size : unlimited unlimited
Heap Size : unlimited unlimited
File Size : unlimited unlimited

Oracle Page 66
:
:
:
Continued : N (x00) RecCount : 1 (x01)

2014-03-12 06:35:26.064665 Insert Len 167 RBA 1240


Name: HR.EMPLOYEES
___________________________________________________________________

Reading ./dirdat/ab000000, current RBA 1521, 2 records

Report at 2014-03-12 06:44:48 (activity since 2014-03-12 06:31:50)

From Table HR.EMPLOYEES to PDB1.HR.EMPLOYEES:


# inserts: 1
# updates: 1
# deletes: 0
# discards: 0

***********************************************************************
** Run Time Warnings **
***********************************************************************

The count of inserts/updates/deletes for the Replicat should match the number for the Extract. If there were
any discards, they should be examined for the reason why they were discarded.

Reports are generated when you ask for a report to be sent (as you just did), or when a process stops. Reports
are named/numbered processname.rpt for the most current one, and then
processname0.rpt, processname1.rpt, processname2.rpt for the most recent, up to processname9.rpt for the oldest. As
each new report is created, all the old reports "move down one" getting renamed/renumbered until the
oldest is discarded. No more than 11 (the most recent with no number and the previous 0-9) are kept at a
time.

Oracle Page 67
You can also view the number of rows inserted and other statistics with the following commands:

Console 1
GGSCI (localhost.localdomain) 18> send extract eora01, stats

ending STATS request to EXTRACT EORA01 ...

Start of Statistics at 2014-03-12 06:46:14.

Output to ./dirdat/aa:

Extracting from HR.EMPLOYEES to HR.EMPLOYEES:

*** Total statistics since 2014-03-12 06:31:42 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

*** Daily statistics since 2014-03-12 06:31:42 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

*** Hourly statistics since 2014-03-12 06:31:42 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

*** Latest statistics since 2014-03-12 06:31:42 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

End of Statistics.

GGSCI (localhost.localdomain) 9>

GGSCI (localhost.localdomain) 19>

Oracle Page 68
Similarly, you can run a statistics report on the target replicat process.

Console 2
GGSCI (localhost.localdomain) 11> send replicat rora01, stats

Sending STATS request to REPLICAT RORA01 ...

Start of Statistics at 2014-03-12 06:49:48.

Replicating from HR.EMPLOYEES to PDB1.HR.EMPLOYEES:

*** Total statistics since 2014-03-12 06:31:50 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

*** Daily statistics since 2014-03-12 06:31:50 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

*** Hourly statistics since 2014-03-12 06:31:50 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

*** Latest statistics since 2014-03-12 06:31:50 ***


Total inserts 1.00
Total updates 1.00
Total deletes 0.00
Total discards 0.00
Total operations 2.00

End of Statistics.

GGSCI (localhost.localdomain) 12>

Oracle Page 69
Configuring bidirectional support (optional)
To configure bidirectional replication support, perform the following steps. Create the extract group and the
local Extract trail file.

Console 2
GGSCI (localhost.localdomain) 14> obey startup.oby
GGSCI (localhost.localdomain) 15> dblogin UserID c##gguser, Password welcome1

Successfully logged into database CDB$ROOT.

GGSCI (localhost.localdomain) 16> Start Mgr

MGR is already running.

GGSCI (localhost.localdomain) 17> Info Mgr

Manager is running (IP port localhost.localdomain.7810, Process ID 4059).

GGSCI (localhost.localdomain) 18> Info CheckpointTable

No checkpoint table specified. Using GLOBALS specification (pdb1.c##gguser.ggschkpt)...

Checkpoint table pdb1.c##gguser.ggschkpt created 2014-03-26 03:45:26.

GGSCI (localhost.localdomain) 6> set Editor gedit

GGSCI (localhost.localdomain) 7> view param mgr

port 7810

GGSCI (localhost.localdomain) 4> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
REPLICAT RUNNING RORA01 00:00:00 00:00:03

GGSCI (localhost.localdomain) 5> view param eora02

extract eora02
setenv (ORACLE_SID='CDB12')
SOURCECATALOG pdb1
userid c##gguser@cdb12, password welcome1
LOGALLSUPCOLS
exttrail ./dirdat/bb
sequence hr.employees_seq;
table hr.employees;

GGSCI (localhost.localdomain) 5> stop replicat rora01

Oracle Page 70
Place the 12c database in archivelog mode using SQL Plus.

Console 4
oracle@localhost:~$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Mar 13 03:47:45 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, OLAP, Advanced Analytics and Real Application
Testing options

SYS:CDB12> alter pluggable database all close;


...

SYS:CDB12> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.

SYS:CDB12> alter database archivelog;

Database altered.

Startup mount xxx

SYS:CDB12> alter database open;

Database altered.

SYS:CDB12> alter session set container=cdb$root;

Session altered.

SYS:CDB12> alter database add supplemental log data;

Database altered.

SYS:CDB12> alter system switch logfile;

System altered.

SYS:CDB12> select supplemental_log_data_min, force_logging from


v$database;

Oracle Page 71
SUPPLEME FORCE_LOGGING
-------- ---------------------------------------
YES YES

SYS:CDB12>

Login into CDB12 again from GGSCI and start the manager.

Console 2
GGSCI (localhost.localdomain) 26> stop mgr
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)?y

Sending STOP request to MANAGER ...


Request processed.
Manager stopped.

GGSCI (localhost.localdomain) 19> obey startup.oby


GGSCI (localhost.localdomain) 20> dblogin UserID c##gguser, Password welcome1

Successfully logged into database CDB$ROOT.

GGSCI (localhost.localdomain) 21> Start Mgr

Manager started.

GGSCI (localhost.localdomain) 30> Info Mgr

Manager is running (IP port localhost.localdomain.7810, Process ID 31389).

GGSCI (localhost.localdomain) 31> Info CheckpointTable

No checkpoint table specified. Using GLOBALS specification (pdb1.c##gguser.ggschkpt)...

Checkpoint table pdb1.c##gguser.ggschkpt created 2014-03-12 02:47:32.

GGSCI (localhost.localdomain) 32> set Editor gedit

GGSCI (localhost.localdomain) 7> view param mgr

port 7810

Create the Extract and data pump processes.

Console 2

GGSCI (localhost.localdomain) 25> add extract eora02,integrated tranlog


begin now
EXTRACT added.

Oracle Page 72
GGSCI (localhost.localdomain) 38> add exttrail ./dirdat/bb, extract
eora02, megabytes 5
EXTTRAIL added.

GGSCI (localhost.localdomain) 36> register extract eora02 database


container(pdb1)
Extract EORA02 successfully registered with database at SCN 2090670.

GGSCI (localhost.localdomain) 13> view params epmp02

extract epmp02
passthru
rmthost localhost, mgrport 7809
rmttrail ./dirdat/ba
sequence hr.employees_seq;
table hr.employees;

GGSCI (localhost.localdomain) 29> add extract epmp02, exttrailsource


./dirdat/bb
EXTRACT added.

GGSCI (localhost.localdomain) 30> add rmttrail ./dirdat/ba, extract epmp02,


megabytes 5
RMTTRAIL added.

GGSCI (localhost.localdomain) 12> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT STOPPED EORA02 00:00:00 00:01:43
EXTRACT STOPPED EPMP02 00:00:00 00:00:20
REPLICAT RUNNING RORA01 00:00:00 00:00:00

On 11g source, create the Replicat parameter file and start the replicat process on 11g database.

Console 1
GGSCI (localhost.localdomain) 20> view params rora02
replicat rora02
REPERROR (-1403, IGNORE);
userid gguser, password welcome1
assumetargetdefs
discardfile ./dirrpt/rora02.dsc, purge
map pdb1.hr.employees, target hr.employees;

GGSCI (localhost.localdomain) 21> add replicat rora02, exttrail

Oracle Page 73
./dirdat/ba
REPLICAT added.

GGSCI (localhost.localdomain) 23> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT RUNNING EORA01 00:00:00 00:00:08
EXTRACT RUNNING EPMP01 00:00:00 00:00:08
REPLICAT STOPPED RORA02 00:00:00 00:01:19

GGSCI (localhost.localdomain) 24> start *


EXTRACT EORA01 is already running.
EXTRACT EPMP01 is already running.

Sending START request to MANAGER ...


REPLICAT RORA02 starting

GGSCI (localhost.localdomain) 25> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT RUNNING EORA01 00:00:00 00:00:02
EXTRACT RUNNING EPMP01 00:00:00 00:00:05
REPLICAT RUNNING RORA02 00:00:00 00:00:03

GGSCI (localhost.localdomain) 26>

Start the extraction process on 12c database.

Console 2
GGSCI (localhost.localdomain) 13> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT STOPPED EORA02 00:00:00 00:16:25
EXTRACT STOPPED EPMP02 00:00:00 00:11:39

Oracle Page 74
REPLICAT RUNNING RORA01 00:00:00 00:00:02

GGSCI (localhost.localdomain) 14> start *

Sending START request to MANAGER ...


EXTRACT EORA02 starting

Sending START request to MANAGER ...


EXTRACT EPMP02 starting
REPLICAT RORA01 is already running.

GGSCI (localhost.localdomain) 76> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT RUNNING EORA02 00:17:17 00:00:07
EXTRACT RUNNING EPMP02 00:00:00 00:00:03
REPLICAT RUNNING RORA01 00:00:00 00:00:00

GGSCI (localhost.localdomain) 16>

All Extract and Replicat processes are configured and started from 12c to 11g. The earlier Extract and replicat
from 11g to 12c are still running.

Insert a row on 11g database:

Console 4
SYS:CDB12> alter session set container=pdb1;

Session altered.
SYS:CDB12> insert into hr.employees (employee_id, first_name,
last_name, email, phone_number, hire_date,job_id, salary) values
(998, 'Shane', 'Watson', 's.watson@s.com',
'',sysdate,'AD_VP',99500);

1 row created.

SYS:CDB12> commit;

Commit complete.

SYS:CDB12> select employee_id, first_name, last_name, salary from


hr.employees where employee_id=998;

Oracle Page 75
EMPLOYEE_ID FIRST_NAME LAST_NAME
SALARY
----------- -------------------- ------------------------- ---------
-
998 Shane Watson
99500

Verify the data on the 11g database

Console 3
SYS:V102> select employee_id, first_name, last_name, salary from
hr.employees where employee_id=998;

EMPLOYEE_ID FIRST_NAME LAST_NAME


SALARY
----------- -------------------- ------------------------- ---------
-
998 Shane Watson
99500

You can do some further updates on data to make sure the bidirectional replication is working.

Optionally shutdown both 11g and 12c databases to conserve resources and if you completed the exercise
successfully.

Console 3
SYS:V102> update hr.employees set salary=192165 where
employee_id=998;

1 row updated.

SYS:V102> commit;

Commit complete.

SYS:V102> select employee_id, first_name, last_name, salary from


hr.employees where employee_id=998;

EMPLOYEE_ID FIRST_NAME LAST_NAME


SALARY
----------- -------------------- ------------------------- ---------
-
998 Shane Watson

Oracle Page 76
192165

SYS:V102> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.

Console 4
SYS:V112> select employee_id, first_name, last_name, salary from
hr.employees where employee_id=998;

EMPLOYEE_ID FIRST_NAME LAST_NAME


SALARY
----------- -------------------- ------------------------- ---------
-
998 Shane Watson
192165

SYS:V112> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.

Both 11g and 12c databases should have the same rows. This does not take into account the possibility of
collision detection and resolution (CDR), which is beyond the scope of this exercise.

Optionally stop GG processes by using GGSCI.

Console 1
GGSCI (localhost.localdomain) 30> stop mgr
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)? y

Sending STOP request to MANAGER ...


Request processed.
Manager stopped.

GGSCI (localhost.localdomain) 31> stop *


EXTRACT EORA01 is already stopped.

Sending STOP request to EXTRACT EPMP01 ...


Request processed.
REPLICAT RORA02 is already stopped.

GGSCI (localhost.localdomain) 32> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER STOPPED

Oracle Page 77
EXTRACT ABENDED EORA01 00:00:00 00:01:41
EXTRACT STOPPED EPMP01 00:00:00 00:00:04
REPLICAT ABENDED RORA02 00:00:00 00:01:55

GGSCI (localhost.localdomain) 33>

Console 2
GGSCI (localhost.localdomain) 34> stop mgr
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)? y

Sending STOP request to MANAGER ...


Request processed.
Manager stopped.

GGSCI (localhost.localdomain) 32> stop *


EXTRACT EORA02 is already stopped.

Sending STOP request to EXTRACT EPMP02 ...


Request processed.
REPLICAT RORA01 is already stopped.

GGSCI (localhost.localdomain) 33> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING
EXTRACT ABENDED EORA02 00:00:00 00:01:28
EXTRACT STOPPED EPMP02 00:00:00 00:00:03
REPLICAT ABENDED RORA01 00:00:00 00:01:33

Summary
In this Hands-On-Lab, you have learned how to:

 Install and configure the Oracle GoldenGate software

 Configure and start Extract, Data Pump, and Replicat processes

 Generate sample data and test the validity of the replication

 Manage the reports produced by the processes

Oracle Page 78
6 Cross-Platform Transportable Tablespaces (xTTS)
In this exercise, we will transport a tablespace from a 11g database from a Solaris 64 bit machine (Big Endian
format) to DB12c. The source data contains a table created with data from dba_objects (hr.test_objects) . The
source tablespace has been turned read-only and the export dump containing a metadata information of the
tablespace has been generated and placed in /oradata/xtts directory. We will import them into the PDB1
pluggable database on CDB12. This is a simple scenario of a self-contained tablespace being migrated to a
different Endian format. If there are non-segmented user objects (such as triggers, sequences,packages etc)
they have to be dealt with separately using another export dump or alternatively fully transportable
expdp/impdp.

The tablespace UPGTEST has been turned read only on production and the copy of the datafiles have also
been copied to /oradata/xtts directory.

Following was the method used to generate read only datafile from 11g ORCL2 database environment on
Solaris 64 bit (SPARC T4-4).

FOR INFORMATION ONLY NO NEED TO NOT EXECUTE


oracle@t4-4-01:~$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 6 15:58:45 2014

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> select file_name from dba_data_files where tablespace_name='UPGTEST';

FILE_NAME
--------------------------------------------------------------------------
------
+DATA/ora11g/datafile/upgtest.292.844181453
SQL> create table hr.test_objects tablespace upgtest as select * from
dba_objects;

Table created.

SQL> alter tablespace upgtest read only;

Tablespace altered.

SQL> exit

Oracle Page 79
Disconnected from Oracle Database 11g Enterprise Edition Release
11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

oracle@t4-4-01:~$ expdp system/oracle dumpfile=upgtest.11g.dmp


directory=exp_dir logfile=exp.upgtest.log TRANSPORT_TABLESPACES=upgtest

Export: Release 11.2.0.1.0 - Production on Sun Apr 6 15:07:34 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights
reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -


64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01": system/********
dumpfile=upgtest.11g.dmp directory=exp_dir logfile=exp.upgtest.log
TRANSPORT_TABLESPACES=upgtest
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully
loaded/unloaded
**************************************************************************
****
Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:
/export/home/oracle/upgtest.11g.dmp
**************************************************************************
****
Datafiles required for transportable tablespace UPGTEST:
+DATA/ora11g/datafile/upgtest.292.844181453
Job "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at
15:08:28

grid@t4-4-01:~$ . oraenv
ORACLE_SID = [+ASM] ? +ASM
The Oracle base has been set to /u01/app/grid
grid@t4-4-01:~$ whoami
grid
grid@t4-4-01:~$ asmcmd
ASMCMD> cp +DATA/ora11g/datafile/upgtest.292.844181453 /tmp
copying +DATA/ora11g/datafile/upgtest.292.844181453 ->
/tmp/upgtest.292.844181453
ASMCMD>

oracle@t4-4-01:~$ ls -lrt
total 204
drwxr-xr-x 3 oracle oinstall 3 Apr 1 18:22 oradiag_oracle

Oracle Page 80
drwxr-xr-x 2 oracle oinstall 9 Apr 6 15:05 old
-rw-r--r-- 1 oracle dba 1208 Apr 6 15:08 exp.upgtest.log
-rw-r----- 1 oracle dba 98304 Apr 6 15:08 upgtest.11g.dmp

oracle@t4-4-01:~$ ls -al /tmp/upgtest*


-rw-r----- 1 grid oinstall 11542528 Apr 6 15:03
/tmp/upgtest.292.844181453

Now start the RMAN conversion of the copies of the Big-Endian format datafiles to the Linux Little Endian
format.

oracle@localhost:~$ . oraenv
ORACLE_SID = [CDB12] ?
The Oracle base remains unchanged with value /u01/app/oracle
oracle@localhost:~$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Apr 6 06:06:21 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, OLAP, Advanced Analytics and Real Application
Testing options

SYS:CDB12> alter session set container=pdb1;

Session altered.

SYS:CDB12> create or replace directory xtts as '/oradata/xtts';

Directory created.

SYS:CDB12> grant read,write on directory xtts to public;

Grant succeeded.
SYS:CDB12> exit

oracle@localhost: $ cd /oradata/xtts

oracle@localhost: $ rman target /

Oracle Page 81
RMAN> @3_convert.rcv

RMAN> convert datafile '/oradata/xtts/upg/upgtest.292.844181453'


2> DB_FILE_NAME_CONVERT
3> '/oradata/xtts/upg', '/oradata/CDB12/pdb1'
4> PARALLELISM 2
5> FROM PLATFORM 'Solaris[tm] OE (64-bit)';
Starting conversion at target at 06-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=343 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=24 device type=DISK
channel ORA_DISK_1: starting datafile conversion
input file name=/oradata/xtts/upg/upgtest.292.844181453
converted datafile=/oradata/CDB12/pdb1/upgtest.292.844181453
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:02
Finished conversion at target at 06-APR-14

RMAN> **end-of-file**

RMAN> quit

Recovery Manager complete.

At this point of time, the datafiles from the Big Endian source system (ASM format) have been converted to
the Linux O/S format (Non-ASM) . Now we will import 1) metadata of the datafiles into the target database. If
we had non-segmented user objects (sequences, triggers, etc), we would need to run another import with
those objects from the soruce. Run the following pre-prepared impdp shell scripts.

oracle@localhost:/oradata/xtts$ cat impdp.sh


impdp \"sys/oracle@pdb1 as sysdba\" directory=xtts
dumpfile=upgtest.11g.dmp
transport_datafiles='/oradata/CDB12/pdb1/upgtest.292.844181453'
nologfile=Y

oracle@localhost:/oradata/xtts$ ./impdp.sh

Import: Release 12.1.0.1.0 - Production on Sun Apr 6 05:36:58 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights
reserved.

Oracle Page 82
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
Master table "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully
loaded/unloaded
Source TSTZ version is 11 and target TSTZ version is 18.
Starting "SYS"."SYS_IMPORT_TRANSPORTABLE_01": "sys/********@pdb1 AS
SYSDBA" directory=xtts dumpfile=upgtest.11g.dmp
transport_datafiles=/oradata/CDB12/pdb1/upgtest.292.844181453 nologfile=Y
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at Sun Apr
6 05:37:27 2014 elapsed 0 00:00:17

oracle@localhost:~/xtts$

Now the tablespace UPGTEST, along with all the contained object is now part of the target PDB1 pluggable
database. Make sure the HR schema exists in the database (if not create it), and if necessary, set UPGTEST as
the default tablespace for HR, recompile objects to remove errors and verify the results.

oracle@localhost:/oradata/xtts$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Apr 6 06:16:05 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, OLAP, Advanced Analytics and Real Application
Testing options

SYS:CDB12> alter session set container=pdb1;

Session altered.

SYS:CDB12> select count(*) from dba_objects where owner='HR';

COUNT(*)
----------
20

Oracle Page 83
SYS:CDB12> select count(*) from hr.test_objects;

COUNT(*)
----------
72627

SYS:CDB12> alter user hr default tablespace upgtest;

User altered.

SYS:ORCL2>

Well Done !!! You have transported a self-contained tablespace from a Big Endian format Operating System
(Solaris) to a Little Endian Operating System.

You could do any further verifications if needed.

Oracle Page 84
7 Conclusions

In this Hands-on Session you have performed hands on upgrade of databases with various scenarios. For
further information, you can visit : http://blogs.oracle.com/upgrade. You can also check My Oracle Support for
the latest Patching and Release information.

Lastly, do not hesitate to get in touch with your Oracle accounts team for any further help !!

Thank You !!

Oracle Page 85

También podría gustarte