Tag Archives: 10g

Wierd Things with Oracle :-)

Few weeks ago one of my clients had met a really wierd thing: there were 2 logfiles with CURRENT status:

SQL> select GROUP#,SEQUENCE#,BYTES,MEMBERS,STATUS from v$log
  2  ;
    GROUP#  SEQUENCE#      BYTES    MEMBERS STATUS
     ———- ———- ———- ———- —————-
         1       5651   52428800          2 INACTIVE
         3       5653   52428800          2 CURRENT
         2       5652   52428800          2 CURRENT
Here is the error from alertlog:
ORA-00600: internal error code, arguments: [3705], [1], [3], [2], [8], [], [], []

We had to perform point-in-time recovery up to 5652 sequence and DB felt much better 🙂

Реклама

Useful scripts: Get DDL for jobs, created by DBMS_JOB…

Here is a script, which is dedicated to generate DDL commands to recreate jobs, created by DBMS_JOB package.

DECLARE
 CURSOR job_list
 IS
 SELECT JOB FROM dba_jobs;
mysql VARCHAR2 (32767);
BEGIN
 FOR job_id IN job_list
 LOOP
 mysql := '';
 DBMS_OUTPUT.put_line ('BEGIN');
 DBMS_OUTPUT.put_line ('DBMS_JOB.REMOVE(' || job_id.job || ');');
 DBMS_JOB.user_export (job_id.job, mysql);
 DBMS_OUTPUT.put_line (mysql);
 DBMS_OUTPUT.put_line ('END;');
 DBMS_OUTPUT.put_line ('/');
 END LOOP;
END;
/

Useful scripts: Log file switch frequency statistsic

Very nice and easy to use query.

SELECT trunc(first_time) "Date",
 to_char(first_time, 'Dy') "Day",
 count(1) "Total",
 SUM(decode(to_char(first_time, 'hh24'), '00', 1, 0)) "h0",
 SUM(decode(to_char(first_time, 'hh24'), '01', 1, 0)) "h1",
 SUM(decode(to_char(first_time, 'hh24'), '02', 1, 0)) "h2",
 SUM(decode(to_char(first_time, 'hh24'), '03', 1, 0)) "h3",
 SUM(decode(to_char(first_time, 'hh24'), '04', 1, 0)) "h4",
 SUM(decode(to_char(first_time, 'hh24'), '05', 1, 0)) "h5",
 SUM(decode(to_char(first_time, 'hh24'), '06', 1, 0)) "h6",
 SUM(decode(to_char(first_time, 'hh24'), '07', 1, 0)) "h7",
 SUM(decode(to_char(first_time, 'hh24'), '08', 1, 0)) "h8",
 SUM(decode(to_char(first_time, 'hh24'), '09', 1, 0)) "h9",
 SUM(decode(to_char(first_time, 'hh24'), '10', 1, 0)) "h10",
 SUM(decode(to_char(first_time, 'hh24'), '11', 1, 0)) "h11",
 SUM(decode(to_char(first_time, 'hh24'), '12', 1, 0)) "h12",
 SUM(decode(to_char(first_time, 'hh24'), '13', 1, 0)) "h13",
 SUM(decode(to_char(first_time, 'hh24'), '14', 1, 0)) "h14",
 SUM(decode(to_char(first_time, 'hh24'), '15', 1, 0)) "h15",
 SUM(decode(to_char(first_time, 'hh24'), '16', 1, 0)) "h16",
 SUM(decode(to_char(first_time, 'hh24'), '17', 1, 0)) "h17",
 SUM(decode(to_char(first_time, 'hh24'), '18', 1, 0)) "h18",
 SUM(decode(to_char(first_time, 'hh24'), '19', 1, 0)) "h19",
 SUM(decode(to_char(first_time, 'hh24'), '20', 1, 0)) "h20",
 SUM(decode(to_char(first_time, 'hh24'), '21', 1, 0)) "h21",
 SUM(decode(to_char(first_time, 'hh24'), '22', 1, 0)) "h22",
 SUM(decode(to_char(first_time, 'hh24'), '23', 1, 0)) "h23",
 round(count(1) / 24, 2) "Avg"
 FROM V$log_history
 group by trunc(first_time), to_char(first_time, 'Dy')
 Order by 1

Useful scripts: Catch a session, causing ‘cursor: pin S wait on X’…

For sure, every network from time to time aborts connection. Especially this commonly could be seen in WANs.

When this happens while a session is fetching data or using some other object through db-link, PMON for some reason (from time to time) is unable to kill this session, so session stucks, leading to ‘cursor: pin S wait on X’ wait event.

It’s quite difficult to find out, which session you need to kill to release memory lock, so here is the query for this:

SELECT *
 FROM v$session
 WHERE sid IN
 (SELECT TO_NUMBER (SUBSTR (TO_CHAR (RAWTOHEX (p2raw)), 1, 8),
 'XXXXXXXX') sid
 FROM v$session
 WHERE event = 'cursor: pin S wait on X')

The following screenshot shows reducing Latch/mutex waits:

Help, my DB is feeling ill: Troubleshooting sequence…

Hello, my friends!

Many times I’d been asked for a reasons, due to which DB could stuck or even be aborted, so I decided to make a little overview. When a DB hangs, stops responding or even doesn’t startup, then a typical behaviour for a novice — running in circle and screaming.

First thing you must to do — just relax, all bad things, that could happen, already have happen. Take a breath, make a cup of coffee and relax: it’s time for diagnostics. We must find out a problem and allow users to work as fast as possible, all analysis  we’ll make afterwards.

My troubleshooting sequence is:

    1. Hardware;
    2. OS;
    3. Instance;
    4. Database;
    5. Network;
    6. Oracle.Net;
  1. Hardware. In most cases this work is for system administrators: if server is down, DBA can’t even connect to shell.  But nevertheless from time to time this part is assigned to DBA:
    1. Check for error messages at hardware monitoring screens, if there is any;
    2. Check OS logs.
  2. OS. The same — this also belongs to SA. But OS environment parameters must be set by DBA:
    1. Check if Oracle parameters ($ORACLE_HOME,$ORACLE_SID,NLS_LANG etc) are set correctly;
    2. Take a look at OS logs for any related errors;
    3. Check, if OS has enough resources for running and maintaining Oracle DB. Poor resources can make new connections impossible.
  3. Instance:
    1. Find out, if it is started and in which mode;
    2. Take a look at alert log and search for ORA errors that prevent instance to start up or open;
    3. Performance issue, that can stuck all activity (this topic I’ll describe in my next article);
    4. Don’t forget about resources: Memory parameters, Flash Recovery Area free space (a common error of young DBA).
  4. Database. If instance can’t open DB, then there could be a quite badly situation with DB files:
    1. Check alert log for ORA errors;
    2. Check for control file loss;
    3. Check for DB files corruptions or loss of log file groups.
  5. Network:
    1. Check, if NIC is up and configured;
    2. Check, if server can reach its default router and vice versa;
    3. Check, if server can be reached by client PC.
  6. Oracle.Net:
    1. Try to tnsping server and analyze an error if any;
    2. Check, if Listener is up and configured;
    3. Check for a list of registered databases;
    4. Check, if naming method at client’s PC is configured correctly;
    5. Take a look at Oracle.Net log files (listener.ora, sqlnet.log).

As you can see, the most frequently mentioned file is alert log. So if server is up and OS is running, alert log is the first place to look at.

Useful scripts: Get a list of objects to be moved for a data file resize

Every DBA from time to time wants to reduce a size of a data file, thinking ‘There is a lot of free space in datafile, why don’t to resize it?’ But the secret is that shrinking tables is not very helpful in this case — datafile least size will be limited to the block, where the last table’s/index’s block resides.

So, the solution is to relocate used blocks to free gaps between blocks.

We can achieve this by several ways:

  • ALTER TABLE …. MOVE or INDEX REDUILD;
  • use DBMS_REDIFINITION package;
  • Export table, purge it and import again with the help of DataPump.

But prior we need to get a list of objects, which need to be relocated to make datafile reduce possible. The following query show such objects:

DECLARE
   V_FILE_ID       NUMBER;
   V_BLOCK_SIZE    NUMBER;
   V_RESIZE_SIZE   NUMBER;
BEGIN
   V_FILE_ID := &FILE_ID;
   V_RESIZE_SIZE := &RESIZE_FILE_TO;
   SELECT BLOCK_SIZE
     INTO V_BLOCK_SIZE
     FROM V$DATAFILE
    WHERE FILE# = V_FILE_ID;

   DBMS_OUTPUT.PUT_LINE ('.');
   DBMS_OUTPUT.PUT_LINE ('.');
   DBMS_OUTPUT.PUT_LINE ('.');
   DBMS_OUTPUT.PUT_LINE (
         'OBJECTS IN FILE '
      || V_FILE_ID
      || ' THAT MUST MOVE IN ORDER TO RESIZE THE FILE TO '
      || V_RESIZE_SIZE
      || ' BYTES');
   DBMS_OUTPUT.PUT_LINE (
      '=======================================================================');
   FOR my_record
      IN (  SELECT DISTINCT
                   (   OWNER
                    || '.'
                    || SEGMENT_NAME
                    || ' - OBJECT TYPE = '
                    || SEGMENT_TYPE)
                      ONAME
              FROM DBA_EXTENTS
             WHERE (block_id + blocks - 1) * V_BLOCK_SIZE > V_RESIZE_SIZE
                   AND FILE_ID = V_FILE_ID
          ORDER BY 1)
   LOOP
      DBMS_OUTPUT.PUT_LINE (my_record.ONAME);
   END LOOP;
END;
/

Useful scripts: Table list with stale statistics

This script is intended for daily use to get tables where percentage of changed records is above 10%:

SELECT DT.OWNER,
       DT.TABLE_NAME,
       ROUND ( (DELETES + UPDATES + INSERTS) / NUM_ROWS * 100) PERCENTAGE
FROM   dba_tables dt, ALL_TAB_MODIFICATIONS atm
WHERE      DT.OWNER = ATM.TABLE_OWNER
       AND DT.TABLE_NAME = ATM.TABLE_NAME
       AND NUM_ROWS > 0
       AND ROUND ( (DELETES + UPDATES + INSERTS) / NUM_ROWS * 100) >= 10
ORDER BY 3 desc

Also you can avoid system schemas by adding:

AND OWNER NOT IN ('SYS','SYSTEM','DBSNMP','OSMMON','PERFSTAT')

DGMGRL: Reinstating ex-Primary to Standby by FlashBack Database feature…

From time to time every of us meets with hardware crashes. That’s why creating disaster recovery configurations by DataGuard is very useful for every DB regardless of its size. But the size of DB defines the tool with which DBA must recreate primary DB and DR configuration.

If DB is quite small — simple cold copy or RMAN duplicate is good enough. But in case of huge warehouses or datamarts this way is too long. That’s why I recommend the following solution: reinstate DR by Flashback Database feature.

For this example I need 2 DBs, configured by DataGuard Manager, something I’ve made earlier in this article.

Work Plan:

  1. Simulate «disaster» at PRM;
  2. Failover to STB;
  3. Convert failed PRM into standby database;
  4. Reinstate PRM in DataGuard configuration;
  5. Switchover to PRM.

1. Simulate «disaster» at PRM:

SQL> select sequence#,archived from v$log;
 SEQUENCE# ARC
---------- ---
         4 YES
         5 NO
         3 YES
SQL> create table test01 as select * from v$log;
Table created.
SQL> shutdown abort;
ORACLE instance shut down.

2. Connect to dgmgrl@STB and failover to STB:

C:\Tools\Oracle\product\11.2.0\db\database>set ORACLE_SID=STB
C:\Tools\Oracle\product\11.2.0\db\database>dgmgrl sys/manager
DGMGRL for 64-bit Windows: Version 11.2.0.1.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dr
Protection Mode: MaxAvailability
 Databases:
 prm - Primary database
 stb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
ORA-16625: cannot reach database "prm"
DGM-17017: unable to determine configuration status
DGMGRL> failover to STB;
Performing failover NOW, please wait...
Failover succeeded, new primary is "stb"

3. Convert failed PRM into standby database:

Here we need to determine SCN, when STB DB has became primary:

SQL> select STANDBY_BECAME_PRIMARY_SCN from v$database;
 STANDBY_BECAME_PRIMARY_SCN
--------------------------
                   1378375

After getting SCN, we need to mount PRM and execute:

C:\Tools\Oracle\product\11.2.0\db\database>set ORACLE_SID=PRM

C:\Tools\Oracle\product\11.2.0\db\database>sqlplus sys/manager as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 14 13:55:35 2012

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

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.
Total System Global Area  810053632 bytes
Fixed Size                  2180104 bytes
Variable Size             532679672 bytes
Database Buffers          268435456 bytes
Redo Buffers                6758400 bytes
Database mounted.
SQL> FLASHBACK DATABASE TO SCN 1378375;
Flashback complete.
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

Database altered.
SQL> SHUTDOWN IMMEDIATE;

ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area  810053632 bytes
Fixed Size                  2180104 bytes
Variable Size             532679672 bytes
Database Buffers          268435456 bytes
Redo Buffers                6758400 bytes
Database mounted.

And now we have at PRM:

SQL> select database_role,open_mode from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY MOUNTED

4. Reinstate PRM in DataGuard configuration;

Connect to DataGuard at STB (as it’s configuration is only valid) and run:

DGMGRL> show configuration
Configuration - dr
  Protection Mode: MaxAvailability
  Databases:
    stb - Primary database
      Warning: ORA-16629: database reports a different protection level from the protection mode
    prm - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated
Fast-Start Failover: DISABLED
Configuration Status:
WARNING
DGMGRL> reinstate database prm;

Reinstating database "prm", please wait...
Reinstatement of database "prm" succeeded
DGMGRL> show configuration
Configuration - dr
  Protection Mode: MaxAvailability
  Databases:
    stb - Primary database
      Warning: ORA-16629: database reports a different protection level from the protection mode
    prm - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
WARNING

5. Switchover to PRM. At last we are ready to switchover back to PRM :

 
C:\Tools\Oracle\product\11.2.0\db\database>dgmgrl sys/manager@stb
DGMGRL for 64-bit Windows: Version 11.2.0.1.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> switchover to PRM;
Performing switchover NOW, please wait...
New primary database "prm" is opening...
Operation requires shutdown of instance "stb" on database "stb"
Shutting down instance "stb"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "stb" on database "stb"
Starting instance "stb"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
        start up and mount instance "stb" of database "stb"

Starting STB as standby DB:

Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 810053632 bytes
Fixed Size 2180104 bytes
Variable Size 478153720 bytes
Database Buffers 322961408 bytes
Redo Buffers 6758400 bytes
SQL> alter database mount standby database;
Database altered.

And at last:

C:\Tools\Oracle\product\11.2.0\db\database>dgmgrl sys/manager
DGMGRL for 64-bit Windows: Version 11.2.0.1.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dr
Protection Mode: MaxAvailability
 Databases:
 prm - Primary database
 stb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

At the end of article all instances are fine, PRM is primary back and all work could be made by users is safe.

Here Oracle Docs I used to write this note.

Enjoy your safety!

Useful scripts: Gather some session statistics…

RDBMS Version: 10g.
Script shows following session statistic values:
  • PGA Memory, in MB;
  • CPU, used by session;
  • Hard Parse, %;
  • Physical read bytes, in MB;
  • Physical write bytes, in MB;
  • Redo size, in MB;
  • Received from client, in MB;
  • Sent to client, in MB.
  SELECT Logon_time,
         (SELECT ROUND (VALUE / 1024 / 1024, 2)
            FROM v$sesstat
           WHERE STATISTIC# = 25 AND v$sesstat.SID = v$session.sid)
            AS "PGA Memory, in MB",
         (SELECT VALUE
            FROM v$sesstat
           WHERE STATISTIC# = 12 AND v$sesstat.SID = v$session.sid)
            AS "CPU, used by session",
         ROUND ( (SELECT VALUE
                    FROM v$sesstat
                   WHERE STATISTIC# = 339 AND v$sesstat.SID = v$session.sid)
                / (SELECT DECODE (VALUE, 0, 1, VALUE)
                     FROM v$sesstat
                    WHERE STATISTIC# = 338 AND v$sesstat.SID = v$session.sid),
                2)
            AS "Hard Parse, %",
         (SELECT ROUND (VALUE / 1024 / 1024, 2)
            FROM v$sesstat
           WHERE STATISTIC# = 58 AND v$sesstat.SID = v$session.sid)
            AS "Physical read bytes, in MB",
         (SELECT ROUND (VALUE / 1024 / 1024, 2)
            FROM v$sesstat
           WHERE STATISTIC# = 66 AND v$sesstat.SID = v$session.sid)
            AS "Physical write bytes, in MB",
         (SELECT ROUND (VALUE / 1024 / 1024, 2)
            FROM v$sesstat
           WHERE STATISTIC# = 139 AND v$sesstat.SID = v$session.sid)
            AS "Redo size, in MB",
         (SELECT ROUND (VALUE / 1024 / 1024, 2)
            FROM v$sesstat
           WHERE STATISTIC# = 344 AND v$sesstat.SID = v$session.sid)
            AS "Received from client, in MB",
         (SELECT ROUND (VALUE / 1024 / 1024, 2)
            FROM v$sesstat
           WHERE STATISTIC# = 343 AND v$sesstat.SID = v$session.sid)
            AS "Sent to client, in MB",
         SID,
         SERIAL#,
         v$session.STATUS,
         PROGRAM,
         USER#,
         USERNAME,
         COMMAND,
         OWNERID,
         OSUSER,
         PROCESS,
         MACHINE,
         OBJECT_NAME
    FROM    v$session
         LEFT OUTER JOIN
            DBA_OBJECTS
         ON v$session.ROW_WAIT_OBJ# = dba_objects.object_ID
   WHERE v$session.LOGON_TIME BETWEEN TRUNC (SYSDATE) AND SYSDATE
         --AND v$session.STATUS = 'ACTIVE'
ORDER BY 5 DESC

Oracle 11g have changed statistac ID’s there for I put the same script for 11g:

SELECT Logon_time,
       (SELECT ROUND (VALUE / 1024 / 1024, 2)
          FROM v$sesstat
         WHERE STATISTIC# = 35 AND v$sesstat.SID = v$session.sid)
          AS "PGA Memory, in MB",
       (SELECT VALUE
          FROM v$sesstat
         WHERE STATISTIC# = 17 AND v$sesstat.SID = v$session.sid)
          AS "CPU, used by session",
       ROUND ( (SELECT VALUE
                  FROM v$sesstat
                 WHERE STATISTIC# = 584 AND v$sesstat.SID = v$session.sid)
              / (SELECT DECODE (VALUE, 0, 1, VALUE)
                   FROM v$sesstat
                  WHERE STATISTIC# = 583 AND v$sesstat.SID = v$session.sid),
              2)
          AS "Hard Parse, %",
       (SELECT ROUND (VALUE / 1024 / 1024, 2)
          FROM v$sesstat
         WHERE STATISTIC# = 83 AND v$sesstat.SID = v$session.sid)
          AS "Physical read bytes, in MB",
       (SELECT ROUND (VALUE / 1024 / 1024, 2)
          FROM v$sesstat
         WHERE STATISTIC# = 96 AND v$sesstat.SID = v$session.sid)
          AS "Physical write bytes, in MB",
       (SELECT ROUND (VALUE / 1024 / 1024, 2)
          FROM v$sesstat
         WHERE STATISTIC# = 185 AND v$sesstat.SID = v$session.sid)
          AS "Redo size, in MB",
       (SELECT ROUND (VALUE / 1024 / 1024, 2)
          FROM v$sesstat
         WHERE STATISTIC# = 590 AND v$sesstat.SID = v$session.sid)
          AS "Received from client, in MB",
       (SELECT ROUND (VALUE / 1024 / 1024, 2)
          FROM v$sesstat
         WHERE STATISTIC# = 589 AND v$sesstat.SID = v$session.sid)
          AS "Sent to client, in MB",
       SID,
       SERIAL#,
       v$session.STATUS,
       PROGRAM,
       USER#,
       USERNAME,
       COMMAND,
       OWNERID,
       OSUSER,
       PROCESS,
       MACHINE,
       OBJECT_NAME
  FROM    v$session
       LEFT OUTER JOIN
          DBA_OBJECTS
       ON v$session.ROW_WAIT_OBJ# = dba_objects.object_ID
 WHERE v$session.LOGON_TIME BETWEEN TRUNC (SYSDATE) AND SYSDATE
       --AND v$session.STATUS = 'ACTIVE'
ORDER BY 5 DESC

‘COMPATIBLE’: as promised, a version upgrade procedure.

As I had promised earlier in my previous post, here is a short step-by-step description of upgrade procedure. I omit overall pre-upgrade checking , my goal is to show — when we need to manually change ‘COMPATIBLE’ parameter.

Requirements:

  • — 10g DB
  • — 11g Oracle home
  • — keg of a beer (just kidding 🙂 )
I’ve got both Oracle homes at one PC.

Run pre-upgrade script utlu112i.sql from 11g Oracle home and analyze output. Here is mine:

SQL> @c:\temp\utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 02-02-2012 13:01:40
.
**********************************************************************
Database:
**********************************************************************
--> name: ORCL10G
--> version: 10.2.0.4.0
--> compatible: 10.2.0.3.0
--> blocksize: 8192
--> platform: Microsoft Windows x86 64-bit
--> timezone file: V4
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 682 MB
.... AUTOEXTEND additional space required: 192 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 462 MB
.... AUTOEXTEND additional space required: 387 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 348 MB
.... AUTOEXTEND additional space required: 78 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 61 MB
.... AUTOEXTEND additional space required: 41 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
--> background_dump_dest 11.1 DEPRECATED replaced by
"diagnostic_dest"
--> user_dump_dest 11.1 DEPRECATED replaced by
"diagnostic_dest"
--> core_dump_dest 11.1 DEPRECATED replaced by
"diagnostic_dest"
.
**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Data Mining [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Database is using a timezone file older than version 11.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 10.2.0.4.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --> Database contains schemas with stale optimizer statistics.
.... Refer to the Upgrade Guide for instructions to update
.... schema statistics prior to upgrading the database.
.... Component Schemas with stale statistics:
.... SYS
.... OLAPSYS
WARNING: --> Database contains schemas with objects dependent on network
packages.
.... Refer to the Upgrade Guide for instructions to configure Network ACLs.
WARNING:--> recycle bin in use.
.... Your recycle bin turned on.
.... It is REQUIRED
.... that the recycle bin is empty prior to upgrading
.... your database.
.... The command: PURGE DBA_RECYCLEBIN
.... must be executed immediately prior to executing your upgrade.
.
PL/SQL procedure successfully completed.

As you can see I need to modify pfile and purge recycle bin, but be careful — my DB is for testing purposes and to avoid all possible errors follow Oracle docs!

Shutdown and startup DB with UPGRADE option:

SQL> startup upgrade;

Then run DBUA from 11g Oracle home!

I won’t post screenshots of Database Upgrade Assistant (dbua), it is very simple, follow on-screen instructions and select required DB 😉

At the end of DBUA execution I’ve got the following:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select NAME,VALUE from v$parameter where NAME in ('db_name','compatible');
NAME                 VALUE
-------------------- --------------------
compatible           10.2.0.3.0
db_name              orcl10g

And only now I must set ‘COMPATIBLE’ to 11.2.0.1.0 (I’ve created pfile and manually set):

Connected to an idle instance.
SQL> startup mount pfile='INITorcl10g.ORA';
ORACLE instance started.
Total System Global Area 1185853440 bytes
Fixed Size 2175168 bytes
Variable Size 436211520 bytes
Database Buffers 738197504 bytes
Redo Buffers 9269248 bytes
Database mounted.
SQL> alter database open;
Database altered.
SQL> create spfile from pfile;
File created.
SQL> select NAME,VALUE from v$parameter where NAME in ('db_name','compatible');
NAME                 VALUE
-------------------- --------------------
compatible           11.2.0.1.0
db_name              orcl10g

And the last test, if database would be available with ‘COMPATIBLE’ immediatly set back to ‘10.2.0.3.0’:

SQL> startup pfile='INITorcl10g.ORA';
ORACLE instance started.
Total System Global Area 1185853440 bytes
Fixed Size 2175168 bytes
Variable Size 436211520 bytes
Database Buffers 738197504 bytes
Redo Buffers 9269248 bytes
ORA-00201: control file version 11.2.0.1.0 incompatible with ORACLE version 10.2.0.3.0
ORA-00202: control file: 'C:\TOOLS\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL10G\CONTROL01.CTL'

That’s it, enjoy compatibility and don’t let anybody confuse you!

%d такие блоггеры, как: