this one is really nasty (Bug 18097476, 12.1.0.1 on Linux x86-64 )

test-case (although slightly different from the description of the bug):

connect / as sysdba
drop user pp cascade;
drop user ppp cascade;
drop user pppp cascade;
create user pp identified by "Welcome1$" default tablespace users temporary tablespace temp quota unlimited on users;
grant create session, create type, create procedure to pp;
connect pp/"Welcome1$"

create or replace package p1 as
  type t1 is record ( a number, b varchar2(10));
  type tt1 is table of t1;
  function pipelined return tt1 pipelined;
end p1;
/

create or replace package body p1 as
function pipelined return tt1 pipelined
as
  l t1;
  lt tt1 := tt1();
begin
  for i in 1..10
  loop
    lt.extend;
    l.a := i;
    l.b := 'aaaa';
    lt(lt.last) := l;
    pipe row(lt(lt.last));
  end loop;
  return;
end pipelined;
end p1;
/
select * from table (p1.pipelined);

connect / as sysdba
select owner,object_name,object_type,object_id from dba_objects where object_name = 'P1';
select owner,object_name,object_type,object_id from dba_objects where object_name like 'SYS_PLSQL%' and owner like 'PP%';

create user ppp identified by "Welcome1$" default tablespace users temporary tablespace temp quota unlimited on users;
grant create session, create type, create procedure to ppp;

create user pppp identified by "Welcome1$" default tablespace users temporary tablespace temp quota unlimited on users;
grant create session, create type, create procedure to pppp;

create or replace directory dir_tmp as '/home/oracle/';

host rm -f /home/oracle/dmp.dmp
host expdp userid="'/ as sysdba'" schemas=pp directory=dir_tmp dumpfile=dmp.dmp logfile=dmp.log
host impdp userid="'/ as sysdba'" remap_schema=pp:ppp directory=dir_tmp dumpfile=dmp.dmp logfile=dmp.log
host impdp userid="'/ as sysdba'" remap_schema=pp:pppp directory=dir_tmp dumpfile=dmp.dmp logfile=dmp.log

select owner,object_name,object_type,object_id from dba_objects where object_name like 'SYS_PLSQL%' and owner like 'PP%';

the last select shoud return something similar to this:

OWNER	  OBJECT_NAME			 OBJECT_TYPE OBJECT_ID
--------- ------------------------------ ----------- ----------
PP	  SYS_PLSQL_62B6CB68_DUMMY_1	 TYPE	          20223
PP	  SYS_PLSQL_62B6CB68_9_1	 TYPE	          20222
PP	  SYS_PLSQL_62B6CB68_24_1	 TYPE		  20224
PPP	  SYS_PLSQL_62B6CB68_DUMMY_1	 TYPE		  20273
PPP	  SYS_PLSQL_62B6CB68_9_1	 TYPE		  20272
PPP	  SYS_PLSQL_62B6CB68_24_1	 TYPE		  20274
PPPP	  SYS_PLSQL_62B6CB68_DUMMY_1	 TYPE		  20301
PPPP	  SYS_PLSQL_62B6CB68_9_1	 TYPE		  20300
PPPP	  SYS_PLSQL_62B6CB68_24_1	 TYPE		  20302

if now, for whatever reason, someone drops one of the “not” dummy_1 types:

drop type SYS_PLSQL_62B6CB68_24_1;

… the result is, that you can not drop or compile the package anymore:

alter package p1 compile;
alter package p1 compile
*
ERROR at line 1:
ORA-04043: object SYS_PLSQL_62B6CB68_24_1 does not exist

or, try to compile the package for the second schema without droppping a type before (does not happen on the third one :) ):

SYS@dbs101> alter package ppp.p1 compile;
alter package ppp.p1 compile
*
ERROR at line 1:
ORA-04043: object SYS_PLSQL_62B6CB68_24_1 does not exist

suprisingly this does not happen with 2 schemas in my case. it starts when a third schema is present.

fyi: oracle creates this SY_PLSQL* as soon as you create a package which contains pipeplined functions which return types defined in the package (bad sentence, I know :) ).

UPDATE 2014-JUL-18:Patch 18097476 is currently available on top of 12.1.0.1 for Linux x86-64.
UPDATE 2015-FEB-05:Same issue reproduces on 12.1.0.2 (with PSU2 applied) on Linux x86-64. No patch available currently
UPDATE 2015-FEB-09:Patch 19504744 is vailable for 12.1.0.2

If you have issues connecting to an APEX instance and firefox responds with:

firex error message

… you probably have the issue that someone told APEX to require https connections but https is not working for any reason. To at least enable the http connections again issue:

ALTER SESSION SET CURRENT_SCHEMA = [APEX_USER];
BEGIN
APEX_INSTANCE_ADMIN.SET_PARAMETER('REQUIRE_HTTPS', 'N');
commit;
end;
/

In may case the reason for https not to work anymore is still under investigation, but it seems to be related to this:

select * from v$wallet;
ERROR:
ORA-03113: end-of-file on communication channel
Process ID: 1100
Session ID: 566 Serial number: 795

Which leads to a nice core dump in the alert-log:

Exception [type: SIGSEGV, SI_KERNEL(general_protection)] [ADDR:0x0] [PC:0x47A1644, __intel_new_memcpy()+52] [flags: 0x0, count: 1]
Errors in file xxxxxxx.trc  (incident=238044):
ORA-07445: exception encountered: core dump [__intel_new_memcpy()+52] [SIGSEGV] [ADDR:0x0] [PC:0x47A1644] [SI_KERNEL(general_protection)] []
Incident details in: xxxxxx.trc

in oracle 12.1 there appeared a column in v$instance which is not documented: v$instance.family

oracle docs

another new column which appeared is: v$instance.edition (which is documented):

EDITION 	VARCHAR2(7) 	The edition of the database.
Possible values include:
    CORE EE
    CORE SE
    EE
    PO
    SE
    XE

I never heard of oracle editions CORE EE, CORE SE and PO. A look at the source of gv$instance lists even more but others are missing:

decode(ksuxsedition,  2, 'PO', 4, 'SE', 8, 'EE', 16, 'XE', 32, 'CS', 40, 'CE', 'UNKNOWN')

Perhaps Oracle Support can put some light on this :) seems to be somehow related to cloud installations, but this is just a guess …

ON NULL?

May 6, 2014 — Leave a comment

and another little new feature of oracle 12c: ON NULL for table columns definitions

SQL> !cat a.sql
CREATE TABLE T1 ( a number
                , b varchar2(5) default on null 'aaaaa' not null );

insert into t1 ( a,b ) values ( 1,'aaaa');
insert into t1 ( a,b ) values ( 1,null);
select * from t1;

	 A B
---------- -----
	 1 aaaa
	 1 aaaaa

on null

timers in sqlplus

April 25, 2014 — Leave a comment

this is one of: after all these years I really didn’t know this

nested timers in sqlplus:

SYS@orcl> timing start a1
SYS@orcl> timing start   a2
SYS@orcl> timing start     a3
SYS@orcl> timing show
timing for: a3
Elapsed: 00:00:03.39
SYS@orcl> timing stop
timing for: a3
Elapsed: 00:00:07.37
SYS@orcl> timing show
timing for: a2
Elapsed: 00:00:16.55
SYS@orcl> timing stop
timing for: a2
Elapsed: 00:00:20.53
SYS@orcl> timing show
timing for: a1
Elapsed: 00:00:33.45
SYS@orcl> timing stop
timing for: a1
Elapsed: 00:00:36.44

good to know for complex scripts …

Rolling Release

Manjaro uses a Rolling Release Development Model, whereby rather than being replaced, the same core system will instead be continually updated and upgraded. As such, it is not – nor will it ever be – necessary to re-install a later release of Manjaro in order to enjoy the very latest and most up-to-date system possible. By virtue of keeping an existing installation updated, it is already the latest release.

another nice features of oracle 12cR1: you may define functions within the sql with clause:

SQL> !cat a.sql
WITH
  FUNCTION f_test ( a NUMBER) RETURN NUMBER
  IS
  BEGIN
    return a * 2;
  END;
select f_test (5) from dual;
/

SQL> @a

 F_TEST(5)
----------
	10

this is particulary useful when you are not allowed to created stored procedures or you are connected to a read only database.

The standard procedure for installing java in the oracle 12cR1 database is:

PERL5LIB=$ORACLE_HOME/rdbms/admin:$PERL5LIB; export PERL5LIB

sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Nov 12 01:25:39 2013

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> !perl /opt/oracle/product/base/12.1.0.1/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b initjvm /opt/oracle/product/base/12.1.0.1/javavm/install/initjvm.sql;
!perl /opt/oracle/product/base/12.1.0.1/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b initxml /opt/oracle/product/base/12.1.0.1/xdk/admin/initxml.sql;
!perl /opt/oracle/product/base/12.1.0.1/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b xmlja /opt/oracle/product/base/12.1.0.1/xdk/admin/xmlja.sql;
!perl /opt/oracle/product/base/12.1.0.1/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b catjava /opt/oracle/product/base/12.1.0.1/rdbms/admin/catjava.sql;
connect "SYS"/oracle as SYSDBA
!perl /opt/oracle/product/base/12.1.0.1/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b catxdbj /opt/oracle/product/base/12.1.0.1/rdbms/admin/catxdbj.sql;

having this done which jvm do we have available?

SQL> r
  1* select comp_name,status,version from dba_registry

COMP_NAME				 STATUS 	VERSION
---------------------------------------- -------------- -----------
Oracle XML Database			 VALID		12.1.0.1.0
Oracle Database Catalog Views		 VALID		12.1.0.1.0
Oracle Database Packages and Types	 VALID		12.1.0.1.0
Oracle Real Application Clusters	 OPTION OFF	12.1.0.1.0
JServer JAVA Virtual Machine		 VALID		12.1.0.1.0
Oracle XDK				 VALID		12.1.0.1.0
Oracle Database Java Packages		 VALID		12.1.0.1.0

create or replace and compile java source named "props" as
public class props {
  public static void show_props() {
    System.getProperties().list(System.out);
  }
}
/
show errors

create or replace procedure java_props
as language java name 'props.show_props()';
/
show errors

set serveroutput on size 10000
exec dbms_java.set_output(10000)

exec java_props

this will print the following output on my 12c instance:

-- listing properties --
oracle.aurora.ncomp.lib.permission=
java.protocol.handler.pkgs=oracle.aurora.rdbms.url
sun.boot.library.path=/opt/oracle/product/base/12.1.0.1/lib
java.vm.version=1.6.0
oracle.aurora.ncomp.lib.component.prefix=jtc
java.vm.vendor=Oracle Corporation
java.vendor.url=http://www.oracle.com/java/
path.separator=:
java.vm.name=JServer VM
file.encoding.pkg=sun.io
java.vm.specification.name=Java Virtual Machine Specification
user.dir=/opt/oracle/product/base/12.1.0.1
java.awt.graphicsenv=oracle.aurora.awt.OracleGraphicsEnvir...
os.arch=x86_64
java.io.tmpdir=/tmp
line.separator=
java.vm.specification.vendor=Sun Microsystems Inc.
java.naming.factory.url.pkgs=com.sun.jndi.url
os.name=Linux
oracle.aurora.ncomp.file.obj.suffix=o
java.library.path=/usr/lib:/opt/oracle/product/base/12....
java.specification.name=Java Platform API Specification
java.class.version=50.0
java.net.preferIPv4Stack=FALSE
oracle.aurora.ncomp.file.dll.suffix=so
java.util.prefs.PreferencesFactory=java.util.prefs.OraclePreferencesFactory
os.version=2.6.39-400.210.2.el6uek.x86_64
user.home=
file.encoding=UTF-8
java.specification.version=1.6
oracle.aurora.ncomp.lib.os.prefix=lib
user.name=
java.class.path=
oracle.aurora.rdbms.SID=dbs300
java.vm.specification.version=1.0
oracle.server.version=12.1.0.1.0
java.home=/opt/oracle/product/base/12.1.0.1/jav...
java.specification.vendor=Sun Microsystems Inc.
user.language=en
oracle.aurora.rdbms.oracle_home=/opt/oracle/product/base/12.1.0.1
awt.toolkit=oracle.aurora.awt.OracleToolkit
oracle.aurora.vm.environment.name=rdbms
java.version=1.6.0
java.vendor=Oracle Corporation
java.awt.headless=true
file.separator=/
sqlj.runtime=sqlj.framework.ide.aurora.rdbms.Oracl...
java.compiler=
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
oracle.jserver.version=12.1.0.1.0
oracle.aurora.system_subdirectory=lib

so the instance is running a version 1.6.0 jvm. and now, new with oracle 12c, there is a way to upgrade the jvm to 1.7.0:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> !perl $ORACLE_HOME/javavm/install/update_javavm_binaries.pl y
Invalid version y ... Valid options are: 6 7 

SQL> !perl $ORACLE_HOME/javavm/install/update_javavm_binaries.pl 7
SQL> startup
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size		    2296576 bytes
Variable Size		  398460160 bytes
Database Buffers	  662700032 bytes
Redo Buffers		    5480448 bytes
Database mounted.
Database opened.
SQL> alter pluggable database all open;

Pluggable database altered.

SQL> !perl -I $ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -b update_jvm $ORACLE_HOME/javavm/install/update_javavm_db.sql

did it really work?

SQL> set serveroutput on size 10000
SQL> exec dbms_java.set_output(10000);

PL/SQL procedure successfully completed.

SQL> exec java_props
BEGIN java_props; END;

*
ERROR at line 1:
ORA-29548: Java system class reported: release of classes.bin in the database does not match that of the oracle executable
ORA-06512: at "SYS.JAVA_PROPS", line 1
ORA-06512: at line 1

ups? looking at the alertlog:

Tue Nov 12 03:32:11 2013
joxcsys: release mismatch 12.1.0.1.0 1.7 in database (classes.bin) vs 12.1.0.1.0 1.6 in executable
Tue Nov 12 03:32:56 2013
joxcsys: release mismatch 12.1.0.1.0 1.7 in database (classes.bin) vs 12.1.0.1.0 1.6 in executable

so, relinking the binaries is not optional, as stated in the documenatation:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
!$ORACLE_HOME/bin/relink all
writing relink log to: /opt/oracle/product/base/12.1.0.1//install/relink.log
startup

here we go:

SQL> set serveroutput on size 10000
SQL> exec dbms_java.set_output(10000);

PL/SQL procedure successfully completed.

SQL> exec java_props
-- listing properties --
oracle.aurora.ncomp.lib.permission=
java.protocol.handler.pkgs=oracle.aurora.rdbms.url
sun.boot.library.path=/opt/oracle/product/base/12.1.0.1/lib
java.vm.version=1.7.0
oracle.aurora.ncomp.lib.component.prefix=jtc
java.vm.vendor=Oracle Corporation
java.vendor.url=http://www.oracle.com/java/
path.separator=:
java.vm.name=JServer VM
file.encoding.pkg=sun.io
java.vm.specification.name=Java Virtual Machine Specification
user.dir=/opt/oracle/product/base/12.1.0.1
java.awt.graphicsenv=oracle.aurora.awt.OracleGraphicsEnvir...
os.arch=x86_64
java.io.tmpdir=/tmp
line.separator=
java.vm.specification.vendor=Sun Microsystems Inc.
java.naming.factory.url.pkgs=com.sun.jndi.url
os.name=Linux
oracle.aurora.ncomp.file.obj.suffix=o
java.library.path=/usr/lib:/opt/oracle/product/base/12....
java.specification.name=Java Platform API Specification
java.class.version=51.0
java.net.preferIPv4Stack=FALSE
oracle.aurora.ncomp.file.dll.suffix=so
java.util.prefs.PreferencesFactory=java.util.prefs.OraclePreferencesFactory
os.version=2.6.39-400.210.2.el6uek.x86_64
user.home=
file.encoding=UTF-8
java.specification.version=1.7
oracle.aurora.ncomp.lib.os.prefix=lib
user.name=
java.class.path=
oracle.aurora.rdbms.SID=dbs300
java.vm.specification.version=1.0
oracle.server.version=12.1.0.1.0
java.home=/opt/oracle/product/base/12.1.0.1/jav...
java.specification.vendor=Sun Microsystems Inc.
user.language=en
oracle.aurora.rdbms.oracle_home=/opt/oracle/product/base/12.1.0.1
awt.toolkit=oracle.aurora.awt.OracleToolkit
oracle.aurora.vm.environment.name=rdbms
java.version=1.7.0
java.vendor=Oracle Corporation
java.awt.headless=true
file.separator=/
sqlj.runtime=sqlj.framework.ide.aurora.rdbms.Oracl...
java.compiler=
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
oracle.jserver.version=12.1.0.1.0
oracle.aurora.system_subdirectory=lib

PL/SQL procedure successfully completed.

oracle uses linux mint

as soon as one wants to use encryption oracle needs a wallet to be created. when using orapki to create the wallet there is an option “-auto_login” that might be used to enable the database to auto open the wallet with each startup. there seems to be a misunderstanding that you might not change this after the wallet was created. let’s see:

orapki wallet create -wallet . -pwd "blabla1234"
Oracle PKI Tool : Version 12.1.0.1
Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.

dbs300@oel6.lcsys.ch lcsdb:/oradata/dbs300/wallet $ ls -la
total 12
drwxr-x---  2 lcsdb lcsi 4096 11. Nov 22:54 ./
drwxr-x--- 12 lcsdb lcsi 4096 11. Nov 16:03 ../
-rw-------  1 lcsdb lcsi 2856 11. Nov 22:54 ewallet.p12
-rw-------  1 lcsdb lcsi    0 11. Nov 22:54 ewallet.p12.lck

this created the wallet without the “-auto_login” option, thus requires us to provide the wallet password with each database restart. letting orapki print its help:

orapki wallet -h
Oracle PKI Tool : Version 12.1.0.1
Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.

Invalid command: -h
wallet:
create [-wallet [wallet]] [[-pwd ] [-auto_login|-auto_login_local]] | [-auto_login_only]
display [-wallet [wallet]]  [-pwd ]
change_pwd [-wallet [wallet]] [-oldpwd ] [-newpwd ]
add [-wallet [wallet]]   
     <-self_signed [-validity [days]] | [-valid_from [mm/dd/yyyy] -valid_until [mm/dd/yyyy]]
                   [-serial_file ] | [-serial_num ]> 
                    
      [-pwd ] | [-auto_login_only]
                   [-sign_alg ]
remove [-wallet [wallet]] [-dn [dn]] [-trusted_cert_all|-trusted_cert|-user_cert|-cert_req]
     [-pwd ] | [-auto_login_only]
export [-wallet [wallet]] [-dn [dn]] [-cert [filename] | -request [filename]] [-pwd ]
export_trust_chain [-wallet [wallet]] [-certchain [filename]] [-dn [user_cert_dn]] [-pwd ]
upload [-wallet [wallet]] [-ldap [host:port]] [-user [user]] [-userpwd [userpwd]] [-pwd ]
download [-wallet [wallet]] [-ldap [host:nonsslport]] [-user [user]] [-userpwd [userpwd]] [-pwd ]
jks_to_pkcs12 [-wallet [wallet]] [-pwd ] [-keystore [keystore]] [-jkspwd [jkspwd]]
     
pkcs12_to_jks [-wallet [wallet]] [-pwd ] [-jksKeyStoreLoc  -jksKeyStorepwd ]
     [-jksTrustStoreLoc  -jksTrustStorepwd ]
p11_add [-wallet [wallet]] [-p11_lib ] [-p11_tokenlabel ]
     [-p11_tokenpw ] [-p11_certlabel ] [-pwd ]
p11_verify [-wallet [wallet]] [-pwd ]
help

it really seems that you can only provide the “-auto_login” option while creating the wallet but not after that point. well, this is an example of misleading syntax as you actually can change the option with “orapki wallet create” without destroying the original wallet:

orapki wallet create -wallet . -pwd "blabla1234" -auto_login
Oracle PKI Tool : Version 12.1.0.1
Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.

dbs300@oel6.lcsys.ch lcsdb:/oradata/dbs300/wallet $ ls -la
total 16
drwxr-x---  2 lcsdb lcsi 4096 11. Nov 22:55 ./
drwxr-x--- 12 lcsdb lcsi 4096 11. Nov 16:03 ../
-rw-------  1 lcsdb lcsi 2901 11. Nov 22:55 cwallet.sso
-rw-------  1 lcsdb lcsi    0 11. Nov 22:55 cwallet.sso.lck
-rw-------  1 lcsdb lcsi 2856 11. Nov 22:54 ewallet.p12
-rw-------  1 lcsdb lcsi    0 11. Nov 22:54 ewallet.p12.lck

a better orapki help or a better syntax might not be too bad :)