Friday, September 28, 2018

Extended Data Type in Oracle 12c

Extended Data Type in Oracle 12c

Oracle 12c introduced extended data types, in which, VARCHAR2, NVARCHAR2, and RAW data types can store more data. Before 12c, there was a restriction as 4000 bytes for the VARCHAR2 and NVARCHAR2 data types, and 2000 bytes for the RAW data type.

Now, this size limitation increased by 32767 bytes for the VARCHAR2, NVARCHAR2, and RAW data types.

Steps to enable Extended Data Type

Step 1: Close PDB
Step 2: Open PDB in Upgrade mode
Step 3: Change init parameter max_string_size to “extended”
Step 4: Run utl32k.sql script to make data dictionary changes at system level
Step 5: Close PDB
Step 6: Open PDB in read write mode



Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> alter session set container=DB12C;

Session altered.

SQL> show parameter max_string_size

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
max_string_size                      string      STANDARD
SQL>
SQL>
SQL>
SQL> create table char_test(c1 varchar2(32767));
create table char_test(c1 varchar2(32767))
                                   *
ERROR at line 1:
ORA-00910: specified length too long for its datatype
SQL>
 

 max_string_size default value is standard, hence one cannot crate table with varchar2(32767).

Let's change max_string_size to extended by following above steps.

Step 1: Close PDB

SQL> ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
Pluggable database altered.

Step 2: Open PDB in Upgrade mode

SQL> ALTER PLUGGABLE DATABASE OPEN UPGRADE;
Pluggable database altered.

Step 3: Change init parameter max_string_size to “extended”

SQL> ALTER SYSTEM SET max_string_size=extended;
System altered.

Step 4: Run utl32k.sql script to make data dictionary changes at system level

SQL> @?/rdbms/admin/utl32k
SP2-0042: unknown command "aRem" - rest of line ignored.

Session altered.

DOC>#######################################################################
DOC>#######################################################################
DOC>   The following statement will cause an "ORA-01722: invalid number"
DOC>   error if the database has not been opened for UPGRADE.
DOC>
DOC>   Perform a "SHUTDOWN ABORT"  and
DOC>   restart using UPGRADE.
DOC>#######################################################################
DOC>#######################################################################
DOC>#

no rows selected

DOC>#######################################################################
DOC>#######################################################################
DOC>   The following statement will cause an "ORA-01722: invalid number"
DOC>   error if the database does not have compatible >= 12.0.0
DOC>
DOC>   Set compatible >= 12.0.0 and retry.
DOC>#######################################################################
DOC>#######################################################################
DOC>#

PL/SQL procedure successfully completed.
Session altered.
0 rows updated.
Commit complete.
System altered.
PL/SQL procedure successfully completed.
Commit complete.
System altered.
Session altered.
Session altered.
Table created.
Table created.
Table created.
Table truncated.
0 rows created.
PL/SQL procedure successfully completed.

STARTTIME
--------------------------------------------------------------------------------
09/25/2018 16:01:44.423000000

PL/SQL procedure successfully completed.
No errors.

PL/SQL procedure successfully completed.
Session altered.
Session altered.
0 rows created.
no rows selected
no rows selected

DOC>#######################################################################
DOC>#######################################################################
DOC>   The following statement will cause an "ORA-01722: invalid number"
DOC>   error if we encountered an error while modifying a column to
DOC>   account for data type length change as a result of enabling or
DOC>   disabling 32k types.
DOC>
DOC>   Contact Oracle support for assistance.
DOC>#######################################################################
DOC>#######################################################################
DOC>#

PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Commit complete.
Package altered.
Package altered.

Step 5: Close PDB

SQL> ALTER PLUGGABLE DATABASE CLOSE;
Pluggable database altered.

Step 6: Open PDB in read write mode

SQL> ALTER PLUGGABLE DATABASE OPEN;
Pluggable database altered.


Let's check parameter and create table with VARCHAR2(32767)

SQL> show parameter max_string_size
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
max_string_size                      string      EXTENDED
SQL>
SQL> create table char_test(c1 varchar2(32767));
Table created.

SQL>
SQL> desc char_test;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 C1                                                 VARCHAR2(32767)




That's it...
You can now use extended data type.


Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert

Thursday, July 26, 2018

My Journey in ODevC Yatra - 2018, Part 3, Pune and Mumbai

My Journey in ODevC Yatra - 2018, Part 3, Pune and Mumbai

After completing Yatra in Ahmedabad, ODevC Yatra continued to Hyderabad city on 11-Jul-2018. Hyderabad was our next destination. Unfortunately I was not able to attend Hyderabad ODevC Yatra.

Pune was the fifth destination of ODevC Yatra. It was on 13-Jul-2018.

...Pune Memories...


Opening session in Pune

Thank you all for attending ODevC Yatra on working day





 
We volunteers with Sandesh Rao and Basheer Khan, Thank you Sandesh for beautiful Selfie


Selfie time and Group Photo

Road Trip from Pune to Mumbai

Awesome Road Trip from Pune to Mumbai

Mumbai team was ready to host ODevC Yatra. Here are my Mumbai Memories.


...Mumbai Memories...



All Speakers sharing their story in ODevC Yatra



Picture of the year, This is called enthusiasm of learning



I always be having fun time with Mumbai Team. Thank you guys..




Selfie time and Group Photo

From Mumbai, next destination was Gurgram (Noida) but my journey of ODevC Yatra was ends in Mumbai.

I am very much thankful to Sai Penumuru and AIOUG team, who gives me such opportunity where I have traveled to five cities in ODevC Yatra and given my little contribution to such a great community.


Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert

My Journey in ODevC Yatra - 2018, Part 2, Ahmedabad

My Journey in ODevC Yatra - 2018, Part 2, Ahmedabad

Ahmedabad was the third destination of our ODevC Yatra. It was the first time ODevC Yatra came in Ahmedabad. Everyone was excited for this event; we were waiting for the 13-Jul-2018 and were counting days and time for this event.
Many Thanks to Sai Penumuru and AIOUG team for giving such opportunity to Gujarat people.

We, volunteers were working very hard organizing and preparing of each part of this event. I am very glad to be a part of volunteer team in AIOUG Ahmedabad.


Here are some memories from Ahmedabad, ODevC Yatra-2018.

Early morning, last moment preparation


We were ready at Registration Desk

Ahmedabad's warm welcome of Speakers

Thank you Sandesh for your Guidance

We appreciate your presence on working day


Sandesh Rao and Connor McDonald were sitting with audience


Sai Penumuru in action

Bjoern Rost in action

Basheer Khan
Raj Rathee

Connor McDonald

Veeratteshwaran Sridhar

Kamran Aghayev


Selfie Time

We all Volunteers with Our Awesome Speakers


ODevC Yatra ends here in Ahmedabad and everyone was getting ready to travel our next destination i.e. Hyderabad.



Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert

My Journey in ODevC Yatra - 2018, Part 1, Chennai & Bengaluru

My Journey in ODevC Yatra - 2018, Part 1, Chennai and Bengaluru

ODevC Yatra (formally known as OTN Yathra) is one of the biggest event of AIOUG. Oracle ACE /ACE Directors/Oracle Gurus/ Oracle User Group Evangelists in the region are organizing this event.
This Yatra/Tour is a series of seven events across seven major cities in a time period of 9 days.

It was the first time, I was part of the ODevC Yatra - 2018  in five major cities i.e. Chennai, Bengaluru, Ahmedabad, Pune and Mumbai.

I have delivered session on “Query Optimization, who influence and how it works” in Chennai & Bengaluru. I have covered all internal things about optimizer and explain how it works and who influences optimizer chooses good plan or bad plan. Also explain capabilities of optimizer and new optimizer techniques which helps to improve query performances.

It was a privilege to share the stage with the Oracle Experts/Gurus; Sandesh Rao, Gurmeet Goindi, Basheer Khan, Raj Rathee, Sai Penumuru, Bjoern Rost, Chetan Vithlani, Kamran Aghayev,  Hariharaputran, Pradeep Vattem, Veera Sridhar in Chennai and Bengaluru, addressing the audience about the Oracle ACE program and importance of the User group.

Here are my memories with speakers and audience in Chennai and Bengaluru

...Chennai Memories...

Sandesh Rao, Gurmeet Goindi, Basheer Khan, Raj Rathee, Sai Penumuru, Bjoern Rost, Chetan Vithlani, Kamran Aghayev,  Hariharaputran, Pradeep Vattem, Veera Sridhar


It was my privilege to share stage with Oracle Gurus














Live Demo on Autonomous Database

Live Demo on Cloud


Presenting my session on "Query Optimizer"

Thank you Chennai for attending my session

Little relax time in Chennai Event



Closing Event Group Photo
We all were ready to go our next destination Bengaluru


...Bengaluru Memories...




















Presenting my session on "Query Optimizer"

Thank you Bengaluru for attending my session

First time in ODevC Yatra, AIOUG has organized Kidtronics for participant's children


Children and Speakers; closing event moments

Selfie time and Group Photo



Thanks & Regards,
Chandan Tanwani
Oracle Performance Tuning Certified Expert