My blog has moved!

You should be automatically redirected in 5 seconds. If not, visit
http://www.oraexplorer.com
and update your bookmarks.

Showing posts with label 11g. Show all posts
Showing posts with label 11g. Show all posts

Thursday, December 18, 2008

11g OCP upgrade exam

I just passed the 11g OCP upgrade after many excuses to postpone it.

I have to admit I was nervous a little bit because the last Oracle exam I've taken was more than one year ago. I was struggling a little bit at first. I tend to read too quickly (= careless). So at the beginning I missed couple phrases in question especially those saying please select two (or more) answers. I just answered one and then clicked Next. Note that system won't prompt you if you answer less than what it is looking for, but it will prompt if your answer more. :-(  After about 30 minutes, I realized something was not right. Fortunately I still had just enough time to go back and fix it. Whew!

Sunday, December 14, 2008

See initialization parameters from memory

One of Oracle 11g's new features is an ease of capturing the initialization parameter values currently in memory into a file.

select pfile from memory;
select spfile from memory;
select pfile='/tmp/cur_pfile.ora' from memory;

This comes in handy when you'd like to quickly verify changes especially after executing "alter system set" with scope=memory.

It also lets you see the current values of memory allocation in the Automatic Memory Management (AMM). Note that those values are at the top of the list prefixing with "__" (double underscores).

In addition to that it allows you peek into the current values of some hidden parameters too. This is a good alternative to having to run a query like below; Sample below is looking for a value of the "_b_tree_bitmap_plans" parameter. I got this code from Coskan's blog.

col name format a20
col value format a7
col deflt format a7
col description format a10
select a.ksppinm name,
b.ksppstvl value,
b.ksppstdf deflt,
decode
(a.ksppity, 1,
'boolean', 2,
'string', 3,
'number', 4,
'file', a.ksppity) type,
a.ksppdesc description
from
sys.x$ksppi a,
sys.x$ksppcv b
where
a.indx = b.indx
and a.ksppinm like '\_%' escape '\'
and a.ksppinm='_b_tree_bitmap_plans'
order by name
NAME                 VALUE   DEFLT   TYPE    DESCRIPTIO
-------------------- ------- ------- ------- ----------
_b_tree_bitmap_plans TRUE    TRUE    boolean enable the
                                              use of bi
                                             tmap plans
                                              for table
                                             s w. only
                                             B-tree ind
                                             exes

Note that the output of "select pfile from memory" does not show all initialization values - just those currently in memory. If you're interested in finding out, the orafaq web site has the complete list of all initialization parameters including hidden ones of all versions as early as version 7.3.4.

Friday, December 12, 2008

First Error with OLE 5

I just have time to install Oracle Enterprise Linux (OLE) on VMWare. The first error I encountered after trying to login into the 11g (11.1.0.6) database is this -

[oracle@oralnx1 ~]$ sqlplus / as sysdba

sqlplus: error while loading shared libraries:

/opt/oracle/product/11.1.0/db_1/lib/libnnz11.so:

cannot restore segment prot after reloc:

Permission denied.


Well, I guess this is not a new error. I googled for it and found the answer on Ravi's blog (Thanks!!!). As Metalink note 454196.1 says, it is a bug due to more aggressive way that SELinux policies are enforced in RHEL 5 and OEL 5. The fix is to make SELinux is running in "Permissive" mode instead of its default "enforcing" mode. The syntax is provided in Metalink document.

[root@oralnx1 ~]# setenforce 0

[oracle@oralnx1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Dec 12 08:14:32 2008

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

Connected to an idle instance.

Saturday, December 6, 2008

A new extended partition syntax in 11g

A new extended partition syntax can be used to designate a partition without knowing its name. The syntax must refer to a possible value for the partition. This syntax works for all cases when you have to reference a partition, whether it be range, list, interval, or hash. It supports all operations such as drop, merge, split, and so on.

Some samples are shown below -

create table SALES (
  id              number,
  order_date      date
)
partition by range (order_date)
(
  partition p1 values less than
  (to_date('01/01/2008','mm/dd/yyyy')),
  partition p2 values less than
  (to_date('02/01/2008','mm/dd/yyyy')),
  partition p3 values less than
  (to_date('03/01/2008','mm/dd/yyyy'))
);

Generally when you want to merge partitions, the syntax will have to refer to the partition names.

alter table SALES merge partitions
p2, p3
into partition p2_3; 

However, in 11g, the same can be accomplished by referring to a possible value for the partition with use of "for" syntax.

alter table SALES merge partitions
for(to_date('01/12/2008','mm/dd/yyyy')),
for(to_date('02/15/2008','mm/dd/yyyy'))
into partition p2_3;
SQL> select table_name, partition_name, high_value
from user_tab_partitions
where table_name = 'SALES';
TABLE_NAME PARTITION_ HIGH_VALUE
---------- ---------- ------------------------------
SALES      P1         TO_DATE(' 2008-01-01 00:00:00'
                      , 'SYYYY-MM-DD HH24:MI:SS', 'N
                      LS_CALENDAR=GREGORIA
SALES      P2_3       TO_DATE(' 2008-03-01 00:00:00'
                      , 'SYYYY-MM-DD HH24:MI:SS', 'N
                      LS_CALENDAR=GREGORIA

Or with dropping a partition -

SQL> alter table SALES drop partition
for(to_date('02/15/2008','mm/dd/yyyy'));
Table altered.
SQL> select table_name, partition_name, high_value
from user_tab_partitions
where table_name = 'SALES';   
TABLE_NAME PARTITION_ HIGH_VALUE
---------- ---------- ------------------------------
SALES      P1         TO_DATE(' 2008-01-01 00:00:00'
                      , 'SYYYY-MM-DD HH24:MI:SS', 'N
                      LS_CALENDAR=GREGORIA

Wednesday, November 14, 2007

Oracle APEX in 11g Installation

Today I installed Oracle 11g (11.1.0.6) on my machine. I did not realize that Oracle APEX is a part of the standard database components.



So after the 11g installation, I just follow simple steps (shown later below) for the post-installation. In order to access the APEX application, either the embedded PL/SQL gateway or Oracle HTTP server with mod_plsql is needed. For simplicity, I've decided to go with the former. By using the embedded PL/SQL gateway, it will run using the Oracle XML DB HTTP server which is already in Oracle database, so there is no need to install a separate HTTP server. The Oracle's document here explains about this as well as provides the detailed information on the post-installation.

To configure the embedded PL/SQL gateway:

1. Go to the $ORACLE_HOME/apex directory.

2. Use SQL/Plus to connect as SYS to 11g database where APEX is installed.


SYS AS SYSDBA@db11r1> @apxconf

PORT
----------
8080

Enter values below for the XDB HTTP listener port and the password for the Application Express ADMIN user.
Default values are in brackets [ ].
Press Enter to accept the default value.


Enter a password for the ADMIN user []admin_password
Enter a port for the XDB HTTP listener [ 8080]
...changing HTTP Port

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

Session altered.

...changing password for ADMIN

PL/SQL procedure successfully completed.

Commit complete.
3. Unlock the ANONYMOUS account.
SYS AS SYSDBA@db11r1> ALTER USER ANONYMOUS ACCOUNT UNLOCK;

User altered.
4. Enable Oracle XML DB HTTP server
SYS AS SYSDBA@db11r1> EXEC DBMS_XDB.SETHTTPPORT(8080);

PL/SQL procedure successfully completed.

SYS AS SYSDBA@db11r1> COMMIT;

Commit complete.
5. We're now ready to access APEX.

http://host:port/apex
http://host:port/apex/apex_admin -- for admin page

Port in this case is 8080 which is the default.






















Note that the format of URL is a little bit different from when using HTTP server with mod_plsql -

http://host:port/pls/apex
http://host:port/pls/apex/apex_admin -- for admin page


Also the SQL Developer 1.1.3 is included under "sqldeveloper" directory of ORACLE HOME. So just double-click at sqldeveloper.exe to launch application.