Archiv für die Kategorie TOI

Adaptive Cursor Sharing

I am back in Germany, teaching an 11g Performance Tuning course in Munich. There are several New Features in the 11g version related to Performance Tuning, one of them is Adaptive Cursor Sharing.

It adresses the problem that can occurr in earlier versions if you use bindvariables together with indexes on columns that have skewed values. Typically, you create histograms on skewed columns to notify the optimizer of the skew, so that it can use an index if rare values are asked and make a FTS if values with a low selectivity are used.

Bindvariables used to cross that approach – even Bind Peeking did not always resolve the issue, because the first content of the peeked bindvarible determined all future execution plans.

With 11g, this behaviour has changed. In other words: You can have multiple execution plans now with the same statement that uses bindvariables (with different contents). You may find a very nice explanation of this 11g New Feature from the guys who invented it here.

,

Hinterlasse einen Kommentar

Adding Tablespaces/Datafiles with Logical Standby DB present

Being in Norway this week, I have again the pleasure to teach an 11g Data Guard course. I always try to get a hotel close to the education center to be able to walk over there, but I didn’t get the right direction on the first day and had to use a taxi instead. Fortunately, the Norwegians are friendly and helpful and like to explain to a stranger where to find the next taxi stand 🙂

oracle_norway

One of the student asked how we can handle the situation, if we have a Logical Standby Database and want to add datafiles to the primary, while the Logical Standby DB uses an other directory structure than the Primary. Putting the parameter standby_file_management to auto and also setting db_file_name_convert appropriately is not sufficient in this case, as it is for a Physical Standby Database. Well, I searched through the documentation and found the following remedy:

Connect to the Logical Standby DB as sys and then

create or replace procedure sys.handle_tbs_ddl
(
  old_stmt  in  varchar2,
  stmt_typ  in  varchar2,
  schema    in  varchar2,
  name      in  varchar2,
  xidusn    in  number,
  xidslt    in  number,
  xidsqn    in  number,
  action    out number,
  new_stmt  out varchar2
) as
begin
  new_stmt := replace(old_stmt,
                     '/home/oracle/prima',
                     '/home/oracle/logst');

  action := dbms_logstdby.skip_action_replace;

exception
  when others then
    action := dbms_logstdby.skip_action_error;
    new_stmt := null;
end;
/
--------------------------------------------------------------------
-- LSP has to be stopped before we can do the next step
--------------------------------------------------------------------
alter database stop logical standby apply;
begin
dbms_logstdby.skip (stmt=>'tablespace',proc_name=>'sys.handle_tbs_ddl');
end;
/
alter database start logical standby apply immediate;

You can now create Tablespaces and/or add Datafiles on the Primary and they are automatically created on the Logical Standby as well.

You could also take an reactive approach and let the create tablespace action on the Primary crash the SQl Apply on the Logical Standby and then skip that DDL and create the tablespace manually on the Logical SB. But this approach above seems to be more elegant and leaves you with less administrative tasks to do. Thanks to Cecilie Sander for asking that question!

2 Kommentare

New OU EMEA Newsletter Article: Tablespace Point In Time Recovery

An article that I have posted on my Downloads page got published in the April Oracle University EMEA Newsletter. It is about Tablespace Point In Time Recovery – a technique, useful especially if you host mutliple applications in one Oracle Database, each of them associated with one tablespace and you want to correct a logical mistake for that application. Instead of turning the whole database with all applications into the past – to before the occurence of the logical mistake – you take just one and leave the status of the other applications – respectively their data – untouched.

,

Hinterlasse einen Kommentar