Category Archives: Oracle
Sometimes moving a small amount of data in Oracle database requires more work than the actual task you need to complete. DBAs always have their tools (PL/SQL Developer Text Importer is my favorite one) to move a small amount of data between databases.
But when it comes to nested tables this might be a bit challenging. USER_SDO_GEOM_METADATA table (for those of you who are not familiar with it, it is the catalog information of spatial layers in an Oracle database) has no exception to that. Here how it is easy to handle it
The structure of USER_SDO_GEOM_METADATA table has the following structure
SQL> desc user_sdo_geom_metadata Name Null? Type ----------------------------------------- -------- ---------------------------- TABLE_NAME NOT NULL VARCHAR2(32) COLUMN_NAME NOT NULL VARCHAR2(1024) DIMINFO MDSYS.SDO_DIM_ARRAY SRID NUMBER
Obviously DIMINFO column is the problematic part since it is in SDO_DIM_ARRAY type. Now create a temporary table by unfolding this nested table at the source database site.
CREATE TABLE temp_metadata AS SELECT t.table_name, t.column_name, d.*, t.srid FROM user_sdo_geom_metadata t, TABLE(t.diminfo) d;
Once you are done check the structure of temp_metadata table which only contains primitive SQL types for the columns
SQL> desc temp_metadata Name Null? Type ----------------------------------------- -------- ---------------------------- TABLE_NAME VARCHAR2(32) COLUMN_NAME VARCHAR2(1024) SDO_DIMNAME VARCHAR2(64) SDO_LB NUMBER SDO_UB NUMBER SDO_TOLERANCE NUMBER SRID NUMBER
Choose your favorite tool to move this table to the target database since it contains just a few rows. Then as the final step import this data into USER_SDO_GEOM_METADATA table at the target database (Ensure that there is no other record with the same table_name.column_name key on the target USER_SDO_GEOM_METADATA table otherwise trigger on it will warn you)
insert into user_sdo_geom_metadata SELECT m.table_name, m.column_name, CAST(MULTISET(SELECT sdo_dimname,sdo_lb,SDO_UB,sdo_tolerance FROM temp_metadata n WHERE n.table_name = m.table_name and n.column_name = m.column_name) AS SDO_DIM_ARRAY) as diminfo, m.srid FROM (select distinct table_name,column_name,srid from temp_metadata) m; commit;
You are done! Check everything works fine at the application site.
As you all may know, ASMLib is a recommended module for Oracle databases running on Linux platforms and it is an embedded module for UEK (Oracle Unbreakable Kernel) users. Oracle announced that (two years ago or so) they will no longer maintain ASMLib for Red Hat compatible kernel but this does not mean that they abandon the project, rather it is mainly related to the effort they need to put in maintaining the module for multiple kernel versions.
A while ago, Oracle added a new feature to ASMLib allowing ASM devices to choose between physical or logical block sizes in I/O operations. This should be, I believe, a fail-back mechanism for SSD devices used as ASM disks. Many SSD devices use 4K block size however Linux still uses default 512 bytes logical block size for those devices in the same way it does for motor disks. In early releases of ASMLib (
oracleasm-support-2.1.7 and earlier), ASM uses physical block size (4K for SSDs). This is still the default behavior in
oracleasm-support-2.1.8 but now sysadmin can choose between physical and logical blocksize by using
[-b|-p] switches in
- -b|—logical-blocks sets logical blocksize usage
- -p|—physical-blocks set physical blocksize usage
Those switches set
/sys/module/oracleasm/parameters/use_logical_block_size which is default to be
false (use physical blocksize). So that
asmlib module can use the value to decide which block size to use.
I have upgraded one of my Oracle Linux boxes to Oracle Linux Release 5.9 which introduces several new things (Release Notes). Just to mention three of them
- firefox 10 (Although we have discuss to install latest version of it in Oracle Enterprise Linux for Home User: Install Latest Firefox Version )
- uek2 vanilla kernel branched from Linux Kernel Release 3.0.36
- Transparent Huge Pages
Download and update yum repository file
[root@localhost yum.repos.d]$ cd /etc/yum.repos.d [root@localhost yum.repos.d]$ wget http://public-yum.oracle.com/public-yum-el5.repo [root@localhost yum.repos.d]$ mv public-yum-el5.repo.1 public-yum-el5.repo [root@localhost yum.repos.d]$ grep -B 5 enabled=1 public-yum-el5.repo [el5_latest] name=Oracle Linux $releasever Latest ($basearch) baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/latest/$basearch/ gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5 gpgcheck=1 enabled=1 -- [ol5_u9_base] name=Oracle Linux $releasever Update 9 installation media copy ($basearch) baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/9/base/$basearch/ gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5 gpgcheck=1 enabled=1 -- [ol5_UEK_latest] name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch) baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/UEK/latest/$basearch/ gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5 gpgcheck=1 enabled=1
We are ready to upgrade
[root@localhost yum.repos.d]$ yum update
[root@localhost yum.repos.d]$ reboot
Check Oracle Linux Version
[oracle@localhost ~]$ cat /etc/oracle-release Oracle Linux Server release 5.8
Check kernel version
[oracle@localhost ~]$ uname -a Linux localhost.localdomain 2.6.32-300.32.2.el5uek #1 SMP Tue Aug 28 10:15:29 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
Check your memory page size
[oracle@localhost ~]$ getconf PAGESIZE 4096
Once you are done after reboot, check Oracle Linux Version
[oracle@localhost ~]$ cat /etc/oracle-release Oracle Linux Server release 5.9
Check kernel version
[oracle@localhost ~]$ uname -a Linux localhost.localdomain 2.6.39-300.28.1.el5uek #1 SMP Tue Feb 5 10:15:29 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
Check your memory page size
[oracle@localhost ~]$ getconf PAGESIZE 4096
Ooops!!! No change ?
[root@localhost ~]$ cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never
Actually transparent huge page allocation is enabled but it deserves a separate discussion
Login database using
sqlplus / as sysdba
Dump the pfile using existing spfile
SQL> create pfile='/home/oracle/Desktop/init.ora' from spfile; File created.
Oracle will generate implicit parameters defining current sizing of the memory regions in SGA and write them at the top of generated pfile
orcl.__db_cache_size=79691776 orcl.__java_pool_size=4194304 orcl.__large_pool_size=4194304 orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment orcl.__pga_aggregate_target=142606336 orcl.__sga_target=272629760 orcl.__shared_io_pool_size=0 orcl.__shared_pool_size=167772160 orcl.__streams_pool_size=4194304 . . . *.memory_target=414187520 . . .
Edit the file to disable AMM and enable static SGA configuration by simply removing
shared_io_pool_size parameters and doing some make up
*.db_cache_size=79691776 *.java_pool_size=4194304 *.large_pool_size=4194304 *.pga_aggregate_target=142606336 *.sga_target=272629760 *.shared_pool_size=167772160 *.streams_pool_size=4194304 . . .
Rebounce database instance by using modified pfile.
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup pfile='/home/oracle/Desktop/init.ora'; ORACLE instance started. Total System Global Area 271400960 bytes Fixed Size 2227544 bytes Variable Size 180355752 bytes Database Buffers 83886080 bytes Redo Buffers 4931584 bytes Database mounted. Database opened.
Once you ensure that new pfile works, recreate new spfile using this pfile (refer to How to move ASM spfile to a different disk group [ID 1082943.1] if your target is ASM diskgroup)
SQL> create spfile using pfile='/home/oracle/Desktop/init.ora'; File created.
Finally rebounce the database by using new spfile
SQL> startup force; ORACLE instance started. Total System Global Area 271400960 bytes Fixed Size 2227544 bytes Variable Size 180355752 bytes Database Buffers 83886080 bytes Redo Buffers 4931584 bytes Database mounted. Database opened.
I have announced my webinar on Oracle ZFS Storage Appliance for Exadata Backup & Recovery in NYOUG DBA webinar series. You can download webinar slides and voice recod from NYOUG web site
In Friday December 14, 2012 at 12:00 PM -1:00 PM EDT I will be giving a webinar for NYOUG SIG with the following abstract
When it comes to the backup and recovery infrastructure of the Exadata Database Machine, conventional solutions often have only limited performance to keep up with Exadata throughput, whereas Oracle ZFS Storage Appliance can be configured as a very fast, capable, and easy-to-manage backup and recovery solution for any Exadata environment. In this session Husnu Sensoy will describe some of the configuration possibilities of the ZFS Storage Appliance to create a flexible backup and recovery environment for Exadata, as well as various tuning do’s and dont’s to maximize your backup and recovery performance.
Join me to hear more about ZFS Storage Appliance and Exadata.
It is a joy to use Linux for any purpose. Although Oracle Linux is mainly designed for enterprise stack, a stable operating system for a technical user is always a need.
However default configurations and program versions are not suitable for daily use always. One example of this is Firefox 3.0.6 available in Oracle Linux (or Red Hat). Here is how you can upgrade it to 17.0
Download latest Firefox release from Mozilla web page. Then unpack and install it by simply following.
tar -xjvf firefox-17.0.tar.bz2 cp -r firefox /opt/ ln -sf /opt/firefox/firefox /usr/bin/firefox
We are back from OOW 2012 and now it is time to broadcast what we learn in San Francisco. So as a TROUG Founder I will be presenting my Open World Session in Turkey this time. Join me if you wish to hear more about data mining, optimisation,etc. this time in Turkish.
Here are session details:
- What: Veri Madenciligi Veritabaninda Yapilir: Uygulamalariyla Oracle R Enterprise ve Oracle Data Mining Opsiyonu (Database Data Mining: Practical Enterprise R and Oracle Advanced Analytics)
- When: 15th of November 2012 14:20 – 14:50
- Where: Istanbul Kongre Merkezi, Taskisla Caddesi Harbiye 34367, Istanbul/Turkiye
Join me and learn that BI is not about filtering tables, rotating tables, combining and aggregating tables without knowing the actual reason of doing them 🙂
By the way here are other TROUG Sessions in Oracle Day 2012
Here are the slides (System Design for a Million TPS) for my talk in TROUG Day 2012. Many of you also asked for the name of the book I have mentioned. It was
Thank you for joining us in TROUG Day 2012.
Here is my presentation.
Enjoy it !!!