Thursday, 23 February 2012

Manual Standby Database under Oracle 9i Standard Edition

Oracle's Standby technology has been rebranded as DataGuard in recent versions of Oracle. Oracle has added a layer of technology automation on top of the standby technology, making automatic Standby technology seamless. But what about the folks on Standard Edition Oracle? Are they left out in the cold?
Well, it turns out that it is still possible to create a *manual* standby database on Oracle SE. Here's how you do it.
1. First you need to create the initial standby database. Here are the steps to do that:
a. Put the primary database in archivelog mode, if it is not already, and add at least LOG_ARCHIVE_DEST and LOG_ARCHIVE_START to your init.ora.
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP MOUNT
SQL> ALTER SYSTEM ARCHIVE LOG START;
b. Next, create a hotbackup of the primary database. Although you can do this with RMAN, it is probably easiest to just do it manually so you know what is going on. For each tablespace do:
 
alter tablespace SYSTEM begin backup; 
!cp  /OraData/aemedb/DataF/system01.dbf  /OraData/aemedb/Archive/
alter tablespace SYSTEM end backup;
alter tablespace UNDOTBS1 begin backup; 
!cp  /OraData/aemedb/DataF/undotbs01.dbf    /OraData/aemedb/Archive/
alter tablespace UNDOTBS1 end backup;
alter tablespace PORTAL_USERS begin backup; 
!cp  /OraData/aemedb/DataF/portal_users.dbf /OraData/aemedb/Archive/
alter tablespace PORTAL_USERS end backup;
alter tablespace USERS begin backup; 
!cp  /OraData/aemedb/DataF/users.dbf  /OraData/aemedb/Archive/
alter tablespace USERS end backup;
alter tablespace ICMLFQ32 begin backup; 
!cp  /OraData/aemedb/DataF/ICMLFQ32.dbf  /OraData/aemedb/Archive/
alter tablespace ICMLFQ32 end backup;
alter tablespace ICMLNF32 begin backup; 
!cp  /OraData/aemedb/DataF/ICMLNF32.dbf  /OraData/aemedb/Archive/
alter tablespace ICMLNF32 end backup;
alter tablespace ICMVFQ04 begin backup; 
!cp  /OraData/aemedb/DataF/ICMVFQ04.dbf  /OraData/aemedb/Archive/
alter tablespace ICMVFQ04 end backup;
alter tablespace ICMSFQ04 begin backup; 
!cp  /OraData/aemedb/DataF/ICMSFQ04.dbf  /OraData/aemedb/Archive/
alter tablespace ICMSFQ04 end backup;
alter tablespace ICMLSNDX begin backup; 
!cp  /OraData/aemedb/DataF/ICMLSNDX.dbf  /OraData/aemedb/Archive/ 
alter tablespace ICMLSNDX end backup;
alter tablespace CENTWEBPORTAL begin backup; 
!cp  /OraData/aemedb/DataF/centportal.dbf /OraData/aemedb/Archive/
alter tablespace CENTWEBPORTAL end backup;
 
 
In the above example, the '!' symbol tells sqlplus to run the command from the shell, so we're using the Unix 'cp' command to make copies of those files (which are now frozen in backup mode) in another location.
c. Now, create a standby controlfile from primary database:
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/OraData/aemedb/Archive/stb.ctl';
 
d. At this point, you want to copy everything over to the standby server including datafiles, standby controlfile & config files:
$ scp /my/db/backup/*.dbf oracle@192.168.0.10:/export/home/oracle/

e. From the standby machine, edit the standby init.ora file. Use this parameter to tell Oracle where files on the primary database will be located on the standby. For example if you had files in /ora/oracle on primary, and they are moved to /export/home/oracle on standby, this would work for you:
DB_FILE_NAME_CONVERT='/ora/oracle','/export/home/oracle'
Note that you can use MULTIPLE pairs of values here, if you have files in different locations. Alternatively, you can startup and mount the standby database then issue:
SQL> alter database rename file '/ora/oracle/myfile.dbf' to /export/home/oracle/myfile.dbf' as an example.
Now you're also likely to have a new location for your archived redo log files, and that's where the parameter LOG_FILE_NAME_CONVERT comes into play.
Important note, neither of these two parameters work for the ONLINE redolog files. Those you will have to rename yourself. If you do not do so, you will get an error at the time you try to SWITCHOVER your standby database. Such errors are easily remedied by running that command.

f. Now, it's time to start the standby instance and mount it.
SQL> startup nomount pfile=/export/home/oracle/admin/SEAN/pfile/initSEAN.standby
SQL> atler database mount standby database;

g. Almost there. Lastly, we need to recover the standby database using the AUTO option. Note that you should build a simple shell script to startup sqlplus and run these commands. A name like manual_standby.sh would work well. You can then run this periodically, say every half hour, from cron to apply any new archived redolog files that have showed up via move_standby.sh below.
SQL> recover standby database;
AUTO
h. Now, of course, you'll want to test your standby database. You do this by starting up in read-only mode.
SQL> alter database open read only;
i. Don't forget to put it back in standby mode so that when your manual_standby.sh script runs from cron, it won't return errors.
SQL> shutdown immediate;
SQL> startup nomount pfile=/export/home/oracle/admin/SEAN/pfile/initSEAN.standby
SQL> atler database mount standby database;
2. What scripts should run via cron on the primary and standby database?
As we mentioned earlier, a script called manual_standby.sh would work well on the standby database. This script applies new archived redologs that have arrived from the production system. Run it every half hour and see how that works for you. The database must be mounted in standby mode (not read-only) or this script will fail.
You'll also want a script on the production server. Name it move_standby.sh, and run it every thirty minutes to start with. This can use rsync to move redolog files from production to standby. A command like this would work:
$ rsync -e ssh -Pazv /ora/oracle/arch/ oracle@remote:/export/home/oracle/arch/
Note that you may want to adjust options to ssh to your needs. In addition, this presumes you have ssh autologin configured. Read up on the ssh-keygen command. The .ssh directory contains a public key, which is shipped over to the standby machine, and put in the "authorized_keys" file. ssh will then login without a password. Rsync uses ssh as the transport mechanism, so it also executes without a password. Rsync is very smart and only copies blocks and pieces of files that are different, so it is very fast, and also does checksums to guarantee consistency.
3. Is the standby database behind the production database?
Yes, keep in mind we are creating a manual standby database. The standby database will tend to be behind production by about half the size of a redolog file. So if those files are 100M, and you generate 100M of transactions in 30 minutes, then on average standby will be fifteen minutes behind.
4. What types of changes and statements on production will not be automatically applied to standby?
In database parlance, any PHYSICAL changes to the db, plus any commands, issues with the NOLOGGING option. Physical changes include creation of new tablespaces, adding new datafiles, renaming datafiles, autosizing of datafiles, altering redolog files, altering controlfiles and so on. In addition, primary database processes or commands using the UNRECOVERABLE option will not be propagated to the standby database.
There are specific and detailed instructions for making some of these physical changes on the standby db manually, however in many cases recreating the entire standby database per the instructions above, might be the best option.
5. How can we verify that the standby database is up to date?
If you already have the manual_standby.sh script running from cron, disable it.
Then login with sqlplus and issue:
SQL> alter database open read only;
Now that you have the database open read-only, run whatever SQL commands you want to in order to verify some change which you know about on production. When you are done, shutdown, and startup in standby mode again. Don't forget to reenable manual_standby.sh in the crontab.
6. What happens if the standby system restarts?
You could have it automatically start the standby database. In that case, be sure to just check the logfiles. If you want to do it manually in those instances, fire up sqlplus and then issue:
SQL> startup nomount pfile=/export/home/oracle/admin/SEAN/pfile/initSEAN.standby
SQL> alter database mount standby database;
7. What kind of messages can I expect to see in the standby alert.log?
The alert.log is going to have a lot of extra messages since we are repeatedly trying to RECOVER when there may or may not be new transaction logs. When it does this it will say, "looking for archived logfile 1_356.dbf, not found". On the other hand, if it finds it, it will say that it is applying it. You can use unix commands "grep" and "less" to scan through the alert.log file quickly.
8. What other scripts should be put in place?
a. a script to cleanup old archived redo logs on primary.
b. a script to cleanup old archived redo logs on standby
c. a script to rotate and archive the alert.log file when it gets large
d. a script to watch the alert.log file for ORA-xxxxx errors and report them to nagios if it finds any (on both primary and standby)
e. a script to login (via ssh autologin) and check what the latest archived redolog file is, and then also login to the standby and check the alert.log file to verify that those transactions have been applied.
9. How do we switchover in the event of a failure of the primary?
Switchover *can* be done with a script, however I recommend with our manual standby database that you (a) monitor for emergencies on production and (b) manually perform the failover if necessary. This will avoid false positives. Also, it allows you to ship additional redolog data if you have it available from production.
The switchover is a two-step process.
a. Apply remaining redo as we have done before with commands in manual_standby.sh.
b. Startup the database normally, in a read-write mode.
10. What network changes need to happen to failover?
The listener.ora file should be already configured. You can use the same config as primary with a different IP, or you can give this db a different tnsname. For instance, you could call primary SEANA and standby SEANB. Then in your application server configs, when you failover, your database connection configurations need to be updated to point to SEANB. The app servers will probably also need to be restarted at this point.
11. Why can't the primary ship redologs and synchronous changes?
Basically they call it a *manual* standby database for a reason. DataGuard supports options that look like the following:
LOG_ARCHIVE_DEST_3='SERVICE=stby1 LGWR SYNC AFFIRM'
LOG_ARCHIVE_DEST_STATE_3=ENABLE
Again, these are not available in Oracle SE.
12. Once we've failed over, how do we switch back to the primary?
Switching back to the primary database involves these steps:
a. Follow the steps in item 1 above to create a standby database on what was the primary system.
b. If you want to be perfectly clean syncing, do the following:
SQL> shutdown immediate
SQL> startup restrict
SQL> alter system switch logfile
SQL> shutdown immediate
c. Copy over the last archived redolog files
d. Apply them and switchover as described in item 8 above.
13. Are there special init.ora parameters? What makes our standby database special?
The main two things that make it a standby database are:
a. The standby control file (created from primary)
- alter database create standby controlfile as '/my/path/to/standby.ctl
b. The process of mounting as a standby database
- startup nomount pfile=standby.ora
- alter database mount standby database;
There are of course some init.ora parameters which are special for the standby database as well:
DB_FILE_NAME_CONVERT
LOG_FILE_NAME_CONVERT
So if you do a "shutdown immediate" on the standby, you would start again with:
SQL> startup nomount pfile=/export/home/oracle/admin/SEAN/pfile/initSEAN.standby
SQL> alter database mount standby database;

Tuesday, 21 February 2012

Oracle database: Move tables and indexes to another tablespace

This way use to move the data objects to another tablespace. Applicable on 9i onward.

-- Tables
select distinct 'alter table '||owner||'.'||segment_name||' move tablespace STG_TS;'
from dba_extents
where tablespace_name ='STG'
and segment_type in ('TABLE');

-- Tables partitions
select distinct 'alter table '||owner||'.'||segment_name||' move PARTITION '||PARTITION_NAME||' tablespace STG_TS;'
from dba_extents
where tablespace_name ='STG'
and segment_type in ('TABLE PARTITION');

-- Indexes
select distinct 'alter index '||owner||'.'||segment_name||' rebuild tablespace STG_TS;'
from dba_extents
where tablespace_name ='STG'
and segment_type in ('INDEX');

-- LOB's Index
select distinct 'alter table '||a.owner||'.'||b.table_name||'  move LOB('||b.column_name||') store as (tablespace STG_TS);'
from dba_extents a , dba_lobs b
where a.tablespace_name ='STG'
and  a.segment_name = b.index_name
and  segment_type in ('LOBINDEX');

-- Index
select distinct 'alter table '||a.owner||'.'||b.table_name||'  move LOB('||b.column_name||') store as (tablespace STG_TS);'
from dba_extents a , dba_lobs b
where a.tablespace_name ='STG'
and  a.segment_name = b.index_name
and  segment_type in ('LOBSEGMENT');

Tuesday, 14 February 2012

Oracle: Adding Datafile in Standby Database


We are having our DR/Standby database getting sync with Production instance. Whenever we add any datafile to Production we have to manually add datafile in Standby. Yup that's the process and we have to do that, but would like to share with you all what needs to be done step by step.:

1. Add a datafile in Production
CREATE TABLESPACE TEST1 DATAFILE
  '/OraData/amexprd/DataF/test1.dbf' SIZE 1024M AUTOEXTEND ON NEXT 100M MAXSIZE 10240M,
 '/OraData/amexprd/DataF/test2.dbf' SIZE 1024M AUTOEXTEND ON NEXT 100M MAXSIZE 10240M;

2. Wait for log switch or do it.
3. Move the arch file to standby/DR location.
4. Recover standby "recover database using backup controlfile until cancel;"
5. Above step will fail and give you one unamed file#. You can query the tablespace name etc like
select TB.NAME,DF.NAME from v$tablespace TB , v$datafile DF where TB.TS#=DF.TS#  and DF.File# in (33,34);

NAME
--------------------------------------------------------------------------------
/oracle/OraHome9i/dbs/UNNAMED00033
/oracle/OraHome9i/dbs/UNNAMED00034


6. Create datafile in Standby/DR instance with unamed file like
alter database create datafile '/oracle/OraHome9i/dbs/UNNAMED00033'
as '/OraData/amexprd/DataF/test1.dbf';

alter database create datafile '/oracle/OraHome9i/dbs/UNNAMED00034'
as '/OraData/amexprd/DataF/test2.dbf';

It's Done!!

Monday, 13 February 2012

How to Clear Cache in 11i and R12


1. shutdown apache

2. verify ps xuc
if its Linux then use below command

ps xuc|grep http -- should not return any process

if its HP then use below command to check

ps -ef|grep httpd
3)In 11i use the apache start and stop commands and bounce the JVM running on JSERV and clear caches as follows:


To clear the jsp & modplsql caches run this command:
rm -Rf $OA_HTML/_pages/*
rm -Rf $COMMON_TOP/_pages/*
rm -Rf $IAS_ORACLE_HOME/Apache/modplsql/cache/*3. clear cache - move the _pages (mv _pages _pages_bkp)

4. start apache

From user point of view user needs to clear the brower cache
goto IE--> tools--> delete cookes
--> delete files
---> clear History

Tuesday, 17 January 2012

Oracle Apps: Check file version

Check version of the File
Two ways to check version of file.
1. Adident
2. Strings
ADIDENT Utility in ORACLE application is used to find version of any file.
1st Method
Syntax : adident Header filename.
e.g If you want to find out the version of appvndrb.pls
$ cd AP_TOP/patch/115/sql
$ adident Header appvndrb.pls
o/p :
appvndrb.pls:
$Header appvndrb.pls 120.78.12010000.83 2010/04/27 21:00:55 vinaik ship
2nd Method :
Using Strings:
Syntax : strings -a Top_name/location of file/filename | grep ‘$Header’
e.g $ strings -a $AP_TOP/patch/115/sql/appvndrb.pls | grep ‘$Header’
o/p : /* $Header: appvndrb.pls 120.78.12010000.83 2010/04/27 21:00:55 vinaik ship $ */
OR
$ cd $AP_TOP/patch/115/sql
$ strings -a appvndrb.pls | grep ‘$Header’

Sunday, 15 January 2012

Oracle Database Upgrade – 11gR1 (11.1.0.6) to 11gR2 (11.2.0.1)

Oracle Database Upgrade - 11gR1 (11.1.0.6) to 11gR2 (11.2.0.1)

11.1.0.1.0

11 - Major database release number
 1 - Database maintenance release number
 0 - Application server release number
 1 - Component specific release number
 0 - Platform specific release number   

http://www.oracle.com/technology/software/products/database/index.html

1. Make sure the source environment is in stable state:
    11.1.0.6 Startup Database
    Alert log location: $ORACLE_BASE/diag/rdbms/aitmr93w/aitmr93w/trace

2. Download the 11gR2 software into the stage from where it needs to be installed.

3. Oracle Database Pre-installation Requirements

Checking the Hardware Requirements:-

The system must meet the following minimum hardware requirements:

1. Memory Requirements
    1. At least 1 GB of RAM
    # grep MemTotal /proc/meminfo

    2. Determine the size of the configured swap space
    # grep SwapTotal /proc/meminfo

    The following table describes the relationship between installed RAM and the configured swap space requirement:
    |-------------------------------------------------------|
    |RAM                                     |   Swap Space                         |
    |-------------------------------------------------------|
    |Between 1 GB and 2 GB    |   1.5 times the size of RAM |
    |Between 2 GB and 16 GB  |   Equal to the size of RAM  |
    |More than 16 GB                |   16 GB                                   |
    |-------------------------------------------------------|

    3. To determine the available RAM and swap space, enter the following command:
    # free

2. System Architecture
    # uname -m

3. Disk Space Requirements
    1. At least 1 GB of disk space in the /tmp directory
    # df -h /tmp

    If the free disk space available in the /tmp directory is less than what is required,
    then complete one of the following steps:

    a) Delete unnecessary files from the /tmp directory to meet the disk space
    requirement.
    b) Set the TMP and TMPDIR environment variables when setting the oracle
    user’s environment.

    2. To determine the amount of free disk space on the system, enter the following command:
    # df -h

    The following tables describe the disk space requirements for software files,
    and data files for each installation type on Linux x86:

    Installation Type     Requirement for Software Files (GB)
    Enterprise Edition     3.95
    Standard Edition     3.88

    Installation Type     Disk Space for Data Files (GB)
    Enterprise Edition     1.7
    Standard Edition     1.5

Checking the Software Requirements:-

1. Operating System & Kernel Requirements
    Oracle Enterprise Linux 4 Update 7
    Oracle Enterprise Linux 5 Update 2

    To determine the distribution and version of Linux installed, enter the following command:
    # cat /proc/version
    Alternatively, you can also enter the following command on some distributions of Linux:
    # lsb_release -id

    Oracle Enterprise Linux 4, and Red Hat Enterprise Linux 4:
    2.6.9 or later
    Oracle Enterprise Linux 5, and Red Hat Enterprise Linux 5:
    2.6.18 or later

    # uname -r

2. Package Requirements
    On Linux x86: Package Requirements
    rpm -q binutils-2.15.92.0.2
    rpm -q compat-libstdc++-33-3.2.3
    rpm -q elfutils-libelf-0.97
    rpm -q elfutils-libelf-devel-0.97
    rpm -q gcc-3.4.6
    rpm -q gcc-c++-3.4.6
    rpm -q glibc-2.3.4-2.41
    rpm -q glibc-common-2.3.4
    rpm -q glibc-devel-2.3.4
    rpm -q glibc-headers-2.3.4
    rpm -q libaio-devel-0.3.105
    rpm -q libaio-0.3.105
    rpm -q libgcc-3.4.6
    rpm -q libstdc++-3.4.6
    rpm -q libstdc++-devel-3.4.6
    rpm -q make-3.80
    rpm -q numactl-0.6.4.i386
    rpm -q pdksh-5.2.14
    rpm -q sysstat-5.0.5
    rpm -q unixODBC-2.2.11
    rpm -q unixODBC-devel-2.2.11

3. Compiler Requirements
    Linux-PAM Library
    Install the latest Linux-PAM (Pluggable Authentication Modules for Linux) library to
    enable the system administrator to choose how applications authenticate users.

    Setting the ORACLE_HOSTNAME Environment Variable
    In Bourne, Bash, or Korn shell:
    $ ORACLE_HOSTNAME=somehost.us.example.com
    $ export ORACLE_HOSTNAME

4. Install 11gR2 (11.2.0.1) Software only

    4.1 Entry into the "oratab" ...
    /etc/oratab -- <ORACLE_SID>:<ORACLE_BASE>/db/11.1:N

    Note: Kindly use local inventory than central as we wont be having access to use central

    4.2 ./runInstaller -invPtrLoc $ORACLE_HOME/oraInst.loc &
    Where the oraInst.loc should have the below entries
    [ For installation on ems6678 otherwise modify it accordingly]

    inst_group=dba;
    inventory_loc=$ORACLE_BASE/db/oraInventory

    Note: Click on "Ignore All" if there are any swap space failures

    Installation Log: $ORACLE_BASE/db/oraInventory/logs/installActions2010-05-06_11-55-10PM.log

5. Pre-Upgrade steps:

    5.1 Executing Pre-Upgrade Tool:
    Before you start the upgrade process, to identify these checks.
        5.1.1 Copy utlu112i.sql from 11gR2 OH i.e $ORACLE_BASE/db/11.2/rdbms/admin
        to $HOME [ Assuming 11gR2 is Installed $ORACLE_BASE/db/11.2 ]
        5.2.2 Login as SYSDBA
        SQL> SPOOL $HOME/UpgDir/upgrade_info.log
        SQL> @utlu112i.sql
        SQL> SPOOL OFF

    Review the log file and take necesary actions. Then continue with upgrade.

    5.2 Correcting the Warnings [if any] found in above step

        5.2.1 WARNING : Database is using an old time zone file version. After the upgrade,
        patch the database time zone file version using DBMS_DST package to record latest time zone file version.
        Sol: From Webiv Note: 815679.1
        * For 11.1.0.6 and 11.1.0.7, after the upgrade to 11.2.0.1
        use DBSM_DST to update to DSTv11 by following <<Note 977512.1>>
        Updating the RDBMS DST version in 11gR2 (11.2.0.1 and up) using DBMS_DST

        5.2.2 Database contains stale optimizer statistics.
        EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;
        [OR]
        EXEC DBMS_STATS.DELETE_SCHEMA_STATS('SYS');

        5.2.3 WARNING: --> SYSTEM schema default tablespace has been altered.
        .... The SYSTEM schema default tablespace is currently set to TOOLS.
        .... Prior to upgrading your database please reset the
        .... SYSTEM schema default tablespace to SYSTEM  using the command:
        .... ALTER USER SYSTEM DEFAULT TABLESPACE SYSTEM;
        5.2.4. 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.

    5.3 Shutdown 11gR1 Database

    5.4 Configuring 11gR2 Instance
        5.4.1 Source 11gR2 instance
        5.4.2 Copy parameter file form pfile location to 11gR2/dbs
            Change Parameters
            ------------------------
            *.compatible='11.2.0'
            shared_pool_size increase to 298MB [as suggested -- 325058560]
            user_dump_dest        -- REMOVE
            background_dump_dest  -- REMOVE
            core_dump_dest        -- REMOVE

6. Upgrading Database

    6.1 Prepare Upgrade
        6.1.1 cd $ORACLE_HOME/rdbms/admin
        6.1.2 Login as SYSDBA
            sqlplus '/ as sysdba'
            startup upgrade
            SPOOL upgrade.log
            @catupgrd.sql

7. Post-Upgrade steps:

    7.1 Post-Upgrade Tool
    Run utlu112s.sql to display the results of the upgrade:
        SQL> SPOOL $HOME/UpgDir/postupgrade_status.log
        SQL> @utlu112s.sql

        Oracle Database 11.2 Post-Upgrade Status Tool           05-07-2010 01:08:37
        Component                                Status         Version  HH:MM:SS
        Oracle Server                            VALID      11.2.0.1.0  00:14:38
        Oracle Text                              VALID      11.2.0.1.0  00:00:36
        Gathering Statistics                                            00:02:59
        Total Upgrade Time: 00:18:15

    PL/SQL procedure successfully completed.

    7.2 Post-Upgrade Actions
    Run catuppst.sql, located in the ORACLE_HOME/rdbms/admin directory, to
    perform upgrade actions that do not require the database to be in UPGRADE mode:
        SQL> SPOOL $HOME/UpgDir/postupgrade_status.log
        SQL> @catuppst.sql

    7.3 Compiling Invalid Objects:
    Compiling Ivalid objects:
        SQL> SPOOL $HOME/UpgDir/Compile_Invalid.log
        SQL> @utlrp.sql
        SQL> SPOOL OFF

    7.4 Updating the RDBMS DST version in 11gR2 (11.2.0.1 and up) -- Webiv Note 977512.1
    Oracle 11.2.0.1 has by default all RDBMS DST updates from DSTv1 to DSTv11 included in the software installation.
    These files are found in $ORACLE_HOME/oracore/zoneinfo and have a prefix indicating the DST version.

        7.4.1 check current RDBMS DST version and "DST UPGRADE STATUS".
            conn / as sysdba
            SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
            FROM DATABASE_PROPERTIES
            WHERE PROPERTY_NAME LIKE 'DST_%'
            ORDER BY PROPERTY_NAME;

            Check that the output gives

            -- PROPERTY_NAME VALUE
            -- ------------------------------ ------------------------------
            -- DST_PRIMARY_TT_VERSION <the old DST version number>
            -- DST_SECONDARY_TT_VERSION 0
            -- DST_UPGRADE_STATE NONE

            -- DST_PRIMARY_TT_VERSION should match the value found when selecting

        7.4.2 SELECT version FROM v$timezone_file;
            VERSION
            ----------
            4

        7.4.3 Do the actual RDBMS DST version update of the database
            7.4.3.1 Change DB into Upgrade Mode
                conn / as sysdba
                shutdown immediate;
                startup upgrade;
                set serveroutput on
                purge dba_recyclebin;

            7.4.3.2 Clean used tables
                TRUNCATE TABLE SYS.DST$TRIGGER_TABLE;
                TRUNCATE TABLE sys.dst$affected_tables;
                TRUNCATE TABLE sys.dst$error_table;

            7.4.3.3 start upgrade window
                EXEC DBMS_DST.BEGIN_UPGRADE(<the new DST version number>);
                SQL> EXEC DBMS_DST.BEGIN_UPGRADE(11);

                SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
                FROM DATABASE_PROPERTIES
                WHERE PROPERTY_NAME LIKE 'DST_%'
                ORDER BY PROPERTY_NAME;

                SELECT OWNER, TABLE_NAME, UPGRADE_IN_PROGRESS FROM ALL_TSTZ_TABLES where UPGRADE_IN_PROGRESS='YES';

            7.4.3.4 Restart the Database
                shutdown immediate
                startup
                set serveroutput on

            7.4.3.5 Upgrade the tables who need action
                VAR numfail number
                BEGIN
                DBMS_DST.UPGRADE_DATABASE(:numfail,
                parallel => TRUE,
                log_errors => TRUE,
                log_errors_table => 'SYS.DST$ERROR_TABLE',
                log_triggers_table => 'SYS.DST$TRIGGER_TABLE',
                error_on_overlap_time => FALSE,
                error_on_nonexisting_time => FALSE);
                DBMS_OUTPUT.PUT_LINE('Failures:'|| :numfail);
                END;
                /

                VAR fail number
                BEGIN
                DBMS_DST.END_UPGRADE(:fail);
                DBMS_OUTPUT.PUT_LINE('Failures:'|| :fail);
                END;
                /

            7.4.3.6 Verify the Timezone Upgrade
                SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
                FROM DATABASE_PROPERTIES
                WHERE PROPERTY_NAME LIKE 'DST_%'
                ORDER BY PROPERTY_NAME;

                SELECT * FROM v$timezone_file;

8. Miscellaneous Database Checkups
    8.1 Database, Datafile and Backup

        select name,open_mode,log_mode,database_role,force_logging,flashback_on from v$database;
        select * from v$recover_file;
        select distinct status,count(*) from v$datafile group by status;
        select name, RECOVER from v$datafile_header where RECOVER != 'NO';
        select name, ERROR from v$datafile_header where ERROR is NOT NULL;
        select name, ts# from v$datafile where upper(name) like '%MISSING%';
        select NAME, FILE# from v$datafile where status='RECOVER';
        select status,count(*) from v$backup group by status;

    8.2 DBA Registry

        set lines 150 pages 500
        column COMP_NAME format a45
        column version format a15
        column status format a12
        select comp_name,version,status from dba_registry;

    8.3 DBA Registry History

        set lines 150 pages 500
        column action format a15
        column namespace format a15
        column comments format a20  wrap
        column ACTION_TIME format a30
        col BUNDLE_SERIES format a12
        column version format a15
        select * from dba_registry_history;

The above information is with respect to my first DB Upgrade.

Regards,
Raj.

Wednesday, 11 January 2012

Oracle Apps: Enable Arabic for Reports


 Q:   I have Toad for Oracle 9.5  installed on XP professional and have Oracle 10.2.0.3.0. I have Arabian characters in my DB and I need to view the same in Toad data grid. but how can I enable the same? Please suggest me the navigation path also to achieve the same?
Q:  Oracle Repot Builder / SQL Plus / Toad / PL-Sql Developer, Arabic Data is showing as ???????????????
Q:   How to enable Arabic for Oracle EBS R12 Reports?
Q:  How to set NLS_CHARACTERSET at client side for Oracle Apps Reporting?
Answer:
Steps 1:  Set Operating System Regional and Language Options.
From the Start Menu, go to ‘Settings’.
Click on ‘Control Panel’.
Double Click on the “Regional and Language Options” control panel.
go to advanced an right check all arabic languages
and windows will ask you to restart Server
Step 2: Set NLS_LANG Characterset
From the Start Menu, go to ‘Run’.
write regedit and press OK.
HKEY_LOCAL_MACHINE –>SOFTWARE–>ORACLE–>ORACLEHOME
Go to the Registry value from NLS_LANG=

Number of Visitors