Tuesday, October 11, 2016

OTN Appreciation Day: Oracle Database 12c (12.1.0.2.0) Multi-tenant New Features with Real Application Clusters (RAC)


OTN Appreciation is really an great idea by Tim Hall especially for bloggers, being blogger i really love to add my post 
i.e on Oracle Database 12c (12.1.0.2.0) has released some of the new features related to Multi-tenant Databases.

I have already wrote full article on this new feature and here is the URL for full article
http://www.toadworld.com/platforms/oracle/w/wiki/11437.oracle-database-12c-12-1-0-2-0-multitenant-
new-features-with-real-application-clusters-rac

Introduction:
 

Oracle Database 12c (12.1.0.2.0) has released some of the new features related to Multi-tenant Databases.
 
1. Faster Pluggable Database (PDB) Startups
2. Metadata Only Clone using Pluggable Database (PDB)
3. Pluggable Database (PDB) Logging Clause
4. Cross-Pluggable Database (PDB) Queries
5. Pluggable Database (PDB) Remote Clone: Non-CDB Adopt to CDB as a PDB using Database Link (dblink)
6. Modifying Initialization Parameters for CDB level and PDB level
7. Ability to open or close a set of PDBs on a set of RAC instances
8. Ability to relocate a PDB (close it on one node and open it on another)
9. Creating, Configuring, Relocating service for a Pluggable Database (PDB) in RAC environment
10. In-Memory and Multitenant with Real Application Clusters (RAC) with pluggable databases (PDBs) using Resource Manager

Thursday, July 28, 2016

Creating database with "oakcli" command in Oracle Database Appliance (ODA)


[oracle@server01 ~]$ sudo su -

[sudo] password for oracle:
[ root@server01 : Thu Jul 28, 09:20 AM : /root ]

$ oakcli create database -db contdb -oh OraDb11204_home1

INFO: 2016-07-28 09:20:31: Please check the logfile  '/opt/oracle/oak/log/server01/tools/12.1.2.7.0
/createdb_contdb_45344.log'  for more details
INFO: 2016-07-28 09:20:32: Database parameter file is not provided. Will be using default parameters for DB creation

Please enter the 'SYSASM'  password : (During deployment we set the SYSASM password to 'welcome1'):
Please re-enter the 'SYSASM' password:
Please select one of the following for Database type  [1 .. 2] :
1    => OLTP
2    => DSS
1
The selected value is : OLTP
Please select one of the following for Database Deployment  [1 .. 3] :
1    => EE : Enterprise Edition
2    => RACONE
3    => RAC
1
The selected value is : EE
Please select one of the following for Node Number  [1 .. 2] :
1    => server01
2    => server02
2

The selected value is : server02
...
Specify the  Database Class (1. odb-01 '1 core, 8 GB memory'   2. Others) [1] : 1
The selected value is : odb-01 '1 core, 8 GB memory'

Do you want to setup the EM DB Console for this database [ Y | N ] ? : N
INFO   : Logging all actions in the file /opt/oracle/oak/log/server01/patch/12.1.2.7.0/server01-20160728093352.log and 
traces in  the file /opt/oracle/oak/log/server01/patch/12.1.2.7.0/server01-20160728093352.trc
INFO   : Loading the configuration file /opt/oracle/oak/onecmd/create_database.params...
INFO   : Creating the node list files...
INFO   : Setting up ssh for root...
INFO   : Setting up SSH across the Private Network...
...INFO   : Running as root: /usr/bin/ssh -l root 192.168.16.24 /root/DoAllcmds.sh
INFO   : Running as root: /usr/bin/ssh -l root 192.168.16.25 /root/DoAllcmds.sh
INFO   : Background process 80671 (node: 192.168.16.24) gets done with the exit code 0
INFO   : Background process 80694 (node: 192.168.16.25) gets done with the exit code 0
INFO   : Setting up SSH completed successfully
INFO   : Running the command /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.16.25:/opt/oracle/oak/onecmd 
--exclude=*zip --exclude=*gz --exclude=*log --exclude=*trc --exclude=*rpm to sync directory 
on node <192.168.16.25>

SUCCESS: Ran /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.16.25:/opt/oracle/oak/onecmd 
--exclude=*zip --exclude=*gz --exclude=*log --exclude=*trc --exclude=*rpm and it returned: RC=0

...INFO   : Did not do scp for node : server01
INFO   : Running as root: /usr/bin/ssh -l root server01 /root/DoAllcmds.sh
INFO   : Running as root: /usr/bin/ssh -l root server02 /root/DoAllcmds.sh
INFO   : Background process 81640 (node: server01) gets done with the exit code 0
INFO   : Background process 81667 (node: server02) gets done with the exit code 0
INFO   : Did not do scp for node : server01
INFO   : Running as root: /usr/bin/ssh -l root server01 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20160728093433.sh
INFO   : Running as root: /usr/bin/ssh -l root server02 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20160728093433.sh
INFO   : Background process 81713 (node: server01) gets done with the exit code 0
INFO   : Background process 81736 (node: server02) gets done with the exit code 0
INFO   : Setting up SSH for user oracle...
...INFO   : checking nodes in /opt/oracle/oak/onecmd/tmp/db_nodes...
...
SUCCESS: All nodes in /opt/oracle/oak/onecmd/tmp/db_nodes are pingable and alive.
INFO   : Checking SSH setup for user (oracle) on nodes in /opt/oracle/oak/onecmd/tmp/db_nodes...
INFO   : Did not do scp for node : server01
INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle server01 /opt/oracle/oak
/onecmd/tmp/DoAllcmds-20160728093452.sh
INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/DoAllcmds-20160728093452.sh
INFO   : Background process 82624 (node: server01) gets done with the exit code 0
INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle server02 /opt/oracle/oak
/onecmd/tmp/DoAllcmds-20160728093452.sh
INFO   : Background process 82649 (node: server02) gets done with the exit code 0
INFO   : Setting up ACFS storage
INFO   : Did not do scp for node : server01
INFO   : Running as root: /usr/bin/ssh -l root server01 /opt/oracle/oak/onecmd/tmp/acfsm_45344.sh
INFO   : Running as root: /usr/bin/ssh -l root server02 /opt/oracle/oak/onecmd/tmp/acfsm_45344.sh
INFO   : Background process 82768 (node: server01) gets done with the exit code 0
INFO   : Background process 82791 (node: server02) gets done with the exit code 0
INFO: 2016-07-28 09:35:05: Successfully setup the storage structure for the database 'contdb'
SUCCESS: Successfully setup ACFS storage for the database contdb
INFO   : Creating Database using DBCA...
INFO   : Did not do scp for node : server01
INFO   : Running as root: /usr/bin/ssh -l root server01 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20160728093505.sh
INFO   : Running as root: /usr/bin/ssh -l root server02 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20160728093505.sh
INFO   : Background process 84414 (node: server01) gets done with the exit code 0
INFO   : Background process 84439 (node: server02) gets done with the exit code 0
INFO   : Running DBCA using /opt/oracle/oak/onecmd/tmp/dbca-contdb.sh on server02 as oracle...
INFO   : Check output in /opt/oracle/oak/onecmd/tmp/dbca-contdb-20160728093352.log on server02
...
INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle server02 /opt/oracle/oak
/onecmd/tmp/dbca-contdb.sh
         Instance contdb is running on node server02
INFO   : One or more Instances running on the cluster nodes.
INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1;/u01/app/oracle/product/11.2.0.4/
dbhome_1/bin/srvctl setenv database -d contdb -t 'TZ=America/New_York' to set DB timezone
INFO   : Running the command /u01/app/12.1.0.2/grid/bin/crsctl stat resource ora.contdb.db -p
...
INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle server02 /opt/oracle/oak
/onecmd/tmp/dbupdates-contdb.sh
INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1;/u01/app/oracle/product/11.2.0.4/
dbhome_1/bin/srvctl stop database -d contdb
INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1;/u01/app/oracle/product/11.2.0.4/
dbhome_1/bin/srvctl start database -d contdb
INFO: 2016-07-28 09:42:41: Successfully set the RMAN SNAPSHOT control file
SUCCESS: 2016-07-28 09:42:45: Successfully created the Database : contdb
[ root@server01 : Thu Jul 28, 09:42 AM : /root ]
$
[ root@server01 : Thu Jul 28, 09:44 AM : /root ]
$

Saturday, June 4, 2016

Oracle Active Data Guard and Oracle GoldenGate


Oracle Active Data Guard and Oracle GoldenGate
http://www.oracle.com/technetwork/database/features/availability/dataguardgoldengate-096557.html

Uni-Directional Replication b/n Oracle 11g and Oracle 12c Using Oracle GoldenGate


Source Database:

Operating System:  Oracle Enterprise Linux 5.8 (x86-64)
Oracle Database:  Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit
Oracle GoldenGate:  Oracle GoldenGate for Oracle - 11.2.1.0.0

Target Database:

Operating System:  Oracle Enterprise Linux 5.8 (x86-64)
Oracle Database:  Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit
Oracle GoldenGate:  Oracle GoldenGate for Oracle - 12.1.2.0.0

Note-1: No need to set the parameter "enable_goldengate_replication"

Note-2: If target database version in Oracle 12c (12.1.0.2.0) then we have to set TRUE for the following parameter 
        otherwise Replicat Process (rorcl) will not start and you can find the error in ggserr.log 

SQL> alter system set enable_goldengate_replication=TRUE scope=both;
System altered.

SQL> sho parameter enable_

NAME                                   TYPE         VALUE
------------------------------------------  -----------  -----------
enable_goldengate_replication                 boolean      TRUE

Thursday, June 2, 2016

Creating Pluggable Database (PDB) and import data to PDB


Creating PDB and Import Data

[oracle@localhost ~]$ ps -ef | grep pmon
oracle    1756     1  0 23:16 ?        00:00:00 ora_pmon_cdb1
oracle    2538     1  0 23:19 ?        00:00:00 ora_pmon_cdb2
oracle    2970  2945  0 23:37 pts/1    00:00:00 grep pmon

[oracle@localhost ~]$ cd /u01/app/oracle/oradata/cdb2
[oracle@localhost cdb2]$ ls -lrth
[oracle@localhost cdb2]$ mkdir pdb3

[oracle@localhost cdb2]$ . oraenv
ORACLE_SID = [oracle] ? cdb2
The Oracle base has been set to /u01/app/oracle

[oracle@localhost cdb2]$ sqlplus /nolog

SQL> connect sys/oracle@192.168.56.101:1521/cdb2 as sysdba
Connected.

SQL> CREATE PLUGGABLE DATABASE pdb3
ADMIN USER pdb3_admin
IDENTIFIED BY pdb3 ROLES=(CONNECT)
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb2/pdbseed', '/u01/app/oracle/oradata/cdb2/pdb3'); 

Pluggable database created.

(OR) - > If it is OMF format check the below script

SQL> connect sys/oracle@192.168.56.101:1521/cdb3 as sysdba
Connected.

SQL> CREATE PLUGGABLE DATABASE pdb3
ADMIN USER pdb3_admin
IDENTIFIED BY pdb3 ROLES=(CONNECT)
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/CDB3/datafile', '/u01/app/oracle/oradata/CDB3/pdb3/datafile/');
  2    3    4  CREATE PLUGGABLE DATABASE pdb3
*
ERROR at line 1:
ORA-01276: Cannot add file
/u01/app/oracle/oradata/CDB3/pdb3/datafile//o1_mf_system_b7chl7yq_.dbf.  File
has an Oracle Managed Files file name.

SQL> CREATE PLUGGABLE DATABASE pdb3
  2  ADMIN USER pdb3_admin
  3  IDENTIFIED BY pdb3 ROLES=(CONNECT)
  4  FILE_NAME_CONVERT=('/u01/app/oracle/oradata/CDB3/datafile/pdbseed_temp01.dbf', 
                        '/u01/app/oracle/oradata/CDB3/pdb3/datafile/temp01.dbf',
  5  '/u01/app/oracle/oradata/CDB3/datafile/o1_mf_system_b7chl7yq_.dbf', 
     '/u01/app/oracle/oradata/CDB3/pdb3/datafile/system01.dbf',
  6  '/u01/app/oracle/oradata/CDB3/datafile/o1_mf_sysaux_b7chl7xy_.dbf', 
     '/u01/app/oracle/oradata/CDB3/pdb3/datafile/sysaux01.dbf');

Pluggable database created.

SQL> !
[oracle@localhost datafile]$ cd /u01/app/oracle/oradata/CDB3/pdb3/datafile/
[oracle@localhost datafile]$ ls -lrth
total 841M
-rw-r-----. 1 oracle oinstall  21M Nov 26 14:12 temp01.dbf
-rw-r-----. 1 oracle oinstall 251M Nov 26 14:12 system01.dbf
-rw-r-----. 1 oracle oinstall 591M Nov 26 14:12 sysaux01.dbf

[oracle@localhost datafile]$

Check the open mode of PDB3 in CDB2:
====================================

SQL> select CON_ID, NAME, OPEN_MODE from v$pdbs;

    CON_ID NAME                           OPEN_MODE
---------- ------------------------------ ----------
         2 PDB$SEED                        READ ONLY
         3 PDB1                            MOUNTED
         4 PDB2                            MOUNTED
         5 PDB3                            MOUNTED

SQL> alter pluggable database pdb3 open;
Pluggable database altered.

SQL> exit

Note: Add the entries in tnsnames.ora for the database ‘PDB3’

[oracle@localhost cdb2]$ cd /u01/app/oracle/product/12.1.0/dbhome_1/network/admin
[oracle@localhost admin]$ ls -lrth
[oracle@localhost admin]$ vi tnsnames.ora
[oracle@localhost admin]$ exit

SQL> !lsnrctl services

Connect to PDB3 under the pdb3_admin user
=========================================
SQL> connect pdb3_admin/pdb3@pdb3
Connected.

List the datafiles created
===========================
SQL> !ls /u01/app/oracle/oradata/cdb2/pdb3
pdbseed_temp01.dbf  sysaux01.dbf  system01.dbf

Before importing data into pdb3 & Create the directory on the filesystem.
=========================================================================
SQL> !mkdir /u01/app/oracle/oradata/cdb2/pdb3/dump
SQL> !ls /u01/app/oracle/oradata/cdb2/pdb3/dump
SQL> exit

Create a directory in noncdb
=============================
[oracle@localhost cdb2]$ . oraenv
ORACLE_SID = [cdb2] ? noncdb
[oracle@localhost cdb2]$ sqlplus /nolog
SQL> connect sys/oracle as sysdba
SQL> startup;
SQL> exit

[oracle@localhost cdb2]$ sqlplus /nolog
SQL> connect system/oracle@192.168.56.101:1521/noncdb
Connected.

SQL> create directory dpdump_pdb1 as '/u01/app/oracle/oradata/cdb2/pdb3/dump';
Directory created.

SQL> grant read, write on directory dpdump_pdb1 to PUBLIC;
Grant succeeded.

SQL> connect sys/oracle@192.168.56.101:1521/pdb3 as sysdba
Connected.

SQL> create directory dpdump_pdb1 as '/u01/app/oracle/oradata/cdb2/pdb3/dump';
Directory created.

SQL> grant read, write on directory dpdump_pdb1 to PUBLIC;
Grant succeeded.

SQL> create user SOE identified by soe;
User created.

SQL> grant dba to SOE;
Grant succeeded.

SQL> GRANT EXECUTE on DBMS_LOCK to PUBLIC;
Grant succeeded.

SQL> connect system/oracle@192.168.56.101:1521/noncdb
Connected.

SQL> create user SOE identified by soe;
User created.

SQL> grant dba to SOE;
Grant succeeded.

SQL> connect sys/oracle@192.168.56.101:1521/noncdb as sysdba
Connected.

SQL> GRANT EXECUTE on DBMS_LOCK to PUBLIC;
Grant succeeded.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/noncdb/system01.dbf
/u01/app/oracle/oradata/noncdb/sysaux01.dbf
/u01/app/oracle/oradata/noncdb/undotbs01.dbf
/u01/app/oracle/oradata/noncdb/users01.dbf
/u01/app/oracle/oradata/noncdb/example01.dbf
/u01/app/oracle/oradata/noncdb/sh_001.dbf
/u01/app/oracle/oradata/noncdb/sh_index_001.dbf
/u01/app/oracle/oradata/noncdb/ilmtbs1.dbf
/u01/app/oracle/oradata/noncdb/lowcoststore1.dbf

9 rows selected.

SQL> alter tablespace example read only;
Tablespace altered.

SQL> exit

[oracle@localhost cdb2]$ . oraenv
ORACLE_SID = [noncdb] ? noncdb
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@localhost cdb2]$ expdp system/oracle DIRECTORY= dpdump_pdb1 DUMPFILE=tts_mydump TRANSPORT_TABLESPACES=EXAMPLE TRANSPORT_FULL_CHECK=YES

Starting "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01":  system/******** directory= DUMPFILE=tts_mydump TRANSPORT_TABLESPACES=EXAMPLE TRANSPORT_FULL_CHECK=YES
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TYPE/TYPE_SPEC
Processing object type TRANSPORTABLE_EXPORT/TYPE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TRANSPORTABLE_EXPORT/TYPE/TYPE_BODY
Processing object type TRANSPORTABLE_EXPORT/PROCACT_INSTANCE
Processing object type TRANSPORTABLE_EXPORT/XMLSCHEMA/XMLSCHEMA
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
Processing object type TRANSPORTABLE_EXPORT/INDEX/FUNCTIONAL_INDEX/INDEX
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/COMMENT
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/TRIGGER
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PROCACT_INSTANCE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PROCDEPOBJ
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:
  /u01/app/oracle/oradata/cdb2/pdb3/dump/tts_mydump.dmp
******************************************************************************
Datafiles required for transportable tablespace EXAMPLE:
  /u01/app/oracle/oradata/noncdb/example01.dbf
Job "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at Wed Nov 12 04:21:44 2014 elapsed 0 00:01:37

Note: Before importing the tablespace, copy the datafile from noncbd to pdb3 directory

[oracle@localhost cdb2]$ . oraenv
ORACLE_SID = [noncdb] ? cdb2

[oracle@localhost cdb2]$ cp /u01/app/oracle/oradata/noncdb/example01.dbf /u01/app/oracle/oradata/cdb2/pdb3/example01.dbf

[oracle@localhost cdb2]$ sqlplus /nolog

SQL> connect sys/oracle@192.168.56.101:1521/pdb3 as sysdba
Connected.

SQL> create user hr identified by oracle;
User created.

SQL> grant dba to hr;
Grant succeeded.

SQL> GRANT EXECUTE on DBMS_LOCK to PUBLIC;
Grant succeeded.

SQL> grant connect,resource to hr;
Grant succeeded.

SQL> create user pm identified by oracle;
SQL> create user oe identified by oracle;
SQL> create user ix identified by oracle;
SQL> exit

[oracle@localhost cdb2]$ . oraenv
ORACLE_SID = [cdb2] ? cdb2
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@localhost cdb2]$ impdp system/oracle@PDB3 DIRECTORY=dpdump_pdb1 DUMPFILE=tts_mydump TRANSPORT_DATAFILES='/u01/app/oracle/oradata/cdb2/pdb3/example01.dbf'

Import: Release 12.1.0.1.0 - Production on Wed Nov 12 04:31:49 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_TRANSPORTABLE_01" successfully loaded/unloaded
Source timezone version is +00:00 and target timezone version is -07:00.
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":  system/********@PDB3 DIRECTORY=dpdump_pdb1 DUMPFILE=tts_mydump TRANSPORT_DATAFILES=/u01/app/oracle/oradata/cdb2/pdb3/example01.dbf
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TYPE/TYPE_SPEC
Processing object type TRANSPORTABLE_EXPORT/TYPE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TRANSPORTABLE_EXPORT/TYPE/TYPE_BODY
Processing object type TRANSPORTABLE_EXPORT/PROCACT_INSTANCE
Processing object type TRANSPORTABLE_EXPORT/XMLSCHEMA/XMLSCHEMA
Processing object type TRANSPORTABLE_EXPORT/TABLE
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" completed with 33 error(s) at Wed Nov 12 04:32:55 2014 elapsed 0 00:01:04

[oracle@localhost cdb2]$ sqlplus /nolog

SQL> connect sys/oracle@192.168.56.101:1521/pdb3 as sysdba
Connected.

SQL> connect hr/oracle@pdb3
Connected.
SQL> select table_name from user_tables ;

TABLE_NAME
--------------------------------------------------------------------------------
JOB_HISTORY
EMPLOYEES
DEPARTMENTS
LOCATIONS
REGIONS
JOBS
COUNTRIES

7 rows selected.

SQL> connect sys/oracle@192.168.56.101:1521/noncdb as sysdba
Connected.

SQL> connect hr/hr@noncdb
Connected.

SQL> select table_name from user_tables;

TABLE_NAME
--------------------------------------------------------------------------------
COUNTRIES
JOB_HISTORY
EMPLOYEES
JOBS
DEPARTMENTS
LOCATIONS
REGIONS
EMP_TEMP

8 rows selected.

SQL> connect sys/oracle@192.168.56.101:1521/noncdb as sysdba
Connected.

SQL> alter tablespace example read write;
Tablespace altered.

Cheers !!!!!!

Thursday, May 26, 2016

Optimizer with Parameters


Oracle 11g Parameters for Optimizer

SQL> show parameter optimizer_

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
optimizer_capture_sql_plan_baselines boolean     FALSE
optimizer_dynamic_sampling           integer     2
optimizer_features_enable            string      11.2.0.3
optimizer_index_caching              integer     0
optimizer_index_cost_adj             integer     100
optimizer_mode                       string      ALL_ROWS
optimizer_secure_view_merging        boolean     TRUE
optimizer_use_invisible_indexes      boolean     FALSE
optimizer_use_pending_statistics     boolean     FALSE
optimizer_use_sql_plan_baselines     boolean     TRUE
SQL>

In Oracle 12c, two new initialization parameters added to Optimizer

1. optimizer_adaptive_features
2. optimizer_adaptive_reporting_only


Wednesday, May 25, 2016

Oracle Exadata Hybrid Columnar Compression (EHCC) Levels


SQL> connect sh/oracle@orcl
Connected.

Creating a HCC Table Compressed for Query High
==============================================
SQL> create table sales_queryhigh (
empname                 varchar2(30),
empno            number,
empdescr                varchar2(100),
hire_date               date
) tablespace users compress for query high;

Table created.

SQL> select table_name,compression,compress_for from user_tables where table_name='SALES_QUERYHIGH';

TABLE_NAME                     COMPRESS COMPRESS_FOR
------------------------------ -------- ------------
SALES_QUERYHIGH                ENABLED  QUERY HIGH

Creating a HCC Table with HCC Partitions
========================================
SQL> create table orders (
  2  cid number,
  3  pid number,
  4  sid number,
  5  price number(5,2),
  6  discount number(3,2),
  7  odate date)
  8  partition by range (cid)
  9  (partition p1 values less than (100000) nocompress,
 10   partition p2 values less than (200000) compress for archive low,
 11   partition p3 values less than (300000) compress for query high,
 12   partition p4 values less than (maxvalue) compress for query low)
 13  enable row movement
 14  ;

Table created.

SQL> select table_name,compression,compress_for from user_tab_partitions where table_name='ORDERS';

TABLE_NAME                     COMPRESS COMPRESS_FOR
------------------------------ -------- ------------
ORDERS                         DISABLED
ORDERS                         ENABLED  ARCHIVE LOW
ORDERS                         ENABLED  QUERY HIGH
ORDERS                         ENABLED  QUERY LOW

Compression attributes for Tablespace
=====================================

SQL> connect sys/oracle@orcl as sysdba
Connected.

SQL> create bigfile tablespace bigtbs
datafile '+DATA' size 1G
autoextend on next 1m
extent management local autoallocate
segment space management auto
default compress for query low;

Tablespace created.

SQL> select tablespace_name, def_tab_compression, nvl(compress_for,'NONE') compress_for
from dba_tablespaces;
where tablespace_name='BIGTBS';

TABLESPACE_NAME                DEF_TAB_ COMPRESS_FOR
------------------------------ -------- ------------
SYSTEM                         DISABLED NONE
SYSAUX                         DISABLED NONE
UNDOTBS1                       DISABLED NONE
TEMP                           DISABLED NONE
USERS                          DISABLED NONE
EXAMPLE                        DISABLED NONE
BIGTBS                         ENABLED  QUERY LOW

7 rows selected.

SQL>

Tuesday, May 24, 2016

Oracle GoldenGate 12.2 New Features


Oracle GoldenGate 12.2 New Features

1. Replicat environment 
=======================
Note: No need specify No SOURCEDEFS! & No ASSUMETARGETDEFS!

REPLICAT rorcl
USERIDALIAS ggs_admin
DDL include all
MAP scott.*, TARGET scott.*;

2. Automatic Heartbeat Table
============================
a. Automatically discovers Database Replication Topology
b. Execute GGSCI command ADD HEARTBEATTABLE at each database 
c. Monitoring Lag using GG_LAG View

3. Parameter Validation
=======================
a. New standalone utility checkprm for validation 
b. New INFO PARAM GGSCI command to obtain definitions of parameters

4. Transparent Integration with Oracle Clusterware (OCS)
========================================================
a. Achieve GoldenGate high availability in a cluster configuration.
b. GoldenGate is managed/monitored by Oracle Clusterware.
c. Add parameter “XAG_ENABLE” to GLOBALS to enable this feature

5. Fetching from Oracle Active Data Guard (ADG)
===============================================
a. Need source database for startup validations, registration and some metadata lookups
b. Enable with FETCH_USER_ID ggadmin@adg password oracle or FETCHUSERIDALIAS ggadmin_adg