Friday, September 14, 2012

Renaming multiple files using script in linux/windows

------- in windows

setlocal ENABLEDELAYEDEXPANSION
cd d:
cd D:\kettle_exmples\repot_sample
set count=1
for %%a in (test3*.csv) do (
echo !count!
set /A count=!count!+1
echo "file name %%a  is renaming to sample!count!.csv"
ren "%%a" "sample!count!.csv"
)
endlocal

--------- in linux

echo "begining of script"
cd /home/app/oracle/table_exam/
nooff=`ls -l|wc -l`
echo "there are $nooff files to rename"

j=1
for i in *sample*
do

echo "renaming file $i to sample$j "
mv "$i" sample$j
j=`expr $j + 1`

done

Wednesday, August 15, 2012

Sending Oracle Errors Messages in Alert Log to Mail


A) Using oracle database to send error message

1) CREATE DIRECTORY ALERT_DIR AS '/home/app/oracle/diag/rdbms/test/TEST/trace';


2)

CREATE TABLE ALERTLOG_CONTENT
(
text_line varchar2(255)
)
ORGANIZATION EXTERNAL
(
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY  ALERT_DIR
    ACCESS PARAMETERS
    (
        records delimited by newline
        fields
        REJECT ROWS WITH ALL NULL FIELDS
    )
    LOCATION
    (
        'alert_TEST.log'
    )
)
REJECT LIMIT unlimited

3)

CREATE TABLE  ALERT_LOG_ERRORS (
ID NUMBER(8),
TIMEID VARCHAR2(200),
ERROR_MSG VARCHAR2(4000),
CREATE_DATE DATE,
IS_MAILED VARCHAR2(2));

4)


CREATE OR REPLACE PROCEDURE SYS.SEND_MAIL IS
    mailhost   VARCHAR2(64) := '127.0.0.1';
    sender     VARCHAR2(64) := 'krishnasatya.121@gmail.com';
    recipient  VARCHAR2(64) := 'radhakrishna.kommuri@gmail.com';
    mail_conn  utl_smtp.connection;
    EXCPT_ERROR VARCHAR2(300);
    ALERT_ERR VARCHAR2(4000):=NULL;
    IDD NUMBER(10);
BEGIN

  
INSERT INTO ALERT_LOG_ERRORS
SELECT * FROM (
select rownum RWNUM,CASE WHEN TIMEID NOT LIKE '___ ___ __ __:__:__ 20__' THEN NULL ELSE TIMEID END TIMEID,text_line,SYSDATE AS CREATE_DATE,NULL AS IS_MAILED 
from (
select  text_line ,lag(text_line,1) over(order by 1)
  timeid from ALERTLOG_CONTENT
where
text_line like '___ ___ __ __:__:__ 20__' or text_line like 'Shutting down instance (%' or text_line like 'ORA-%' or text_line like 'Starting ORACLE instance %'
     )     
     where text_line like 'Shutting down instance (%' or text_line like 'ORA-%' or text_line like 'Starting ORACLE instance %')
          WHERE NOT EXISTS (SELECT 1 FROM ALERT_LOG_ERRORS WHERE ID=RWNUM);
         
          COMMIT;

FOR RC IN (SELECT ID AS IDD,TIMEID,ERROR_MSG FROM ALERT_LOG_ERRORS WHERE NVL(IS_MAILED,'N')!='Y') LOOP

IF NVL(LENGTH(ALERT_ERR),0)<=4000 THEN
ALERT_ERR:=ALERT_ERR||','||RC.IDD||' -- '||RC.TIMEID||' -- '||RC.ERROR_MSG||',';
IDD:=RC.IDD;

END IF;

END LOOP;

IF ALERT_ERR IS NOT NULL THEN

    mail_conn := utl_smtp.open_connection (mailhost, 25);
    utl_smtp.helo (mail_conn, mailhost);
    utl_smtp.mail (mail_conn, sender);
    utl_smtp.rcpt (mail_conn, recipient);
    utl_smtp.open_data (mail_conn);
    utl_smtp.write_data (mail_conn, 'Oracle Test Server got following Error Message # '||ALERT_ERR || chr(13));
    utl_smtp.close_data (mail_conn);
    utl_smtp.quit (mail_conn);

END IF;

FOR RC IN (SELECT ID AS IDD,TIMEID,ERROR_MSG FROM ALERT_LOG_ERRORS WHERE NVL(IS_MAILED,'N')!='Y') LOOP

    UPDATE ALERT_LOG_ERRORS SET IS_MAILED='Y' WHERE ID=RC.IDD AND RC.IDD<=IDD;
    COMMIT;

END LOOP;

EXCEPTION
WHEN OTHERS THEN
EXCPT_ERROR:=SUBSTR(SQLERRM,1,200);
DBMS_OUTPUT.PUT_LINE(EXCPT_ERROR);
END;
/


5)

BEGIN
  DBMS_SCHEDULER.create_job (
    job_name        => 'SEND_MAIL_ERROR_MSG',
    job_type        => 'STORED_PROCEDURE',
    job_action      => 'SEND_MAIL',
    start_date      => SYSTIMESTAMP,
    repeat_interval => 'freq=MINUTELY;INTERVAL=15',
    end_date        => NULL,
    enabled         => TRUE,
    comments        => 'SENDING ORACLE ERRORS TO MAIL FROM ALERT LOG');
END;
/


B ) Using shell script to send ORA errors to mail


#grep -A 2 -B 2 -n "ORA-" alert_vsftrac1.log > test_err.txt

if [ ! -e lines.txt ]
then
prev_n=0
pres_n=`cat test_err.txt|wc -l`
else
prev_n=`cat lines.txt`
pres_n=`cat test_err.txt|wc -l`
echo "prev_n = $prev_n , pres_n=$pres_n "
fi


if [ $prev_n -eq 0 ] ; then

tail -n 10 test_err.txt | mail -s "alert log errors "  abcd@gmail.com

echo $pres_n > lines.txt

elif [ $prev_n -lt $pres_n ]; then

sed -n "$prev_n,${pres_n}p" test_err.txt |mail -s "alert log erros" abcd@gmail.com

echo $pres_n > lines.txt

else

echo "nothing to display"

fi



Monday, July 23, 2012

Root Causes for Oracle RAC Nodes Rebooting

1) OCSSD Reboots and 11g RAC

The main cause of node reboots in the case of the Oracle Cluster Synchronization
Daemon (OCSSD) is due to network failures or latency issues between the cluster
nodes for an Oracle 11g RAC configuration. This problem usually manifests itself
with the OCSSD process in terms of what is called a missed checkin condition.
For instance, it may take at least 30 consecutive missed checkins to cause a node
reboot within the cluster where heartbeats are issued once per second within the
Oracle 11g RAC environment. How do we find out whether or not we have these
missed checkin conditions? Easy, the solution lies in the logs for the CSS processing.
Whenever missed checkins occur with OCSSD within the Oracle 11g Clusterware,
they will appear in the log files. Next is an example of this condition from the CSS
logfile with Oracle 11g RAC and LINUX:

WARNING: clssnmPollingThread: node (1) at 50% heartbeat fatal,
eviction in 29.100 seconds

In addition, you should also review the LINUX or UNIX system messages file
to determine the root cause for these OCSSD failures with your Oracle RAC
configuration. We provide the following guidelines to help you understand why
node reboots occur in terms of missed checkins and OCSSD operations for the
Oracle 11g Clusterware:

• If the messages file reboot time is less than the missed checkin time, then the
node eviction was likely not due to these missed checkins

• If the messages file reboot time is greater than the missed checkin time, then
the node eviction was likely a result of the missed checkins

The previous formula will help you to understand why node evictions occur with
missed checkins and the OCSSD failure conditions for the Oracle 11g Clusterware
stack. Another reason why node reboots occur lies in problems when the
Clusterware daemon OCSSD cannot read or write to or from the voting disk. We can
find out whether or not this is indeed the case by a quick review of the CSS logfiles.
The following example from the Oracle 11g CSS log file shows the problem of failed
access to the voting disks:

ERROR: clssnmDiskPingMonitorThread: voting device access hanging (160008
miliseconds)


2) OPROCD failure and node reboots

The following are four primary conditions that will cause the Oracle Process
Daemon (OPROCD) to fail within the Oracle 11g RAC environment:

• An OS scheduler problem
• The OS is getting locked up in a driver or hardware issue
• Excessive amounts of load on the machine, thus preventing the scheduler
from behaving reasonably
• An Oracle bug such as Bug 5015469

An OS scheduler issue is solved by correctly setting the operating system scheduler
so that the ntpd daemon is in sync with the Oracle 11g Clusterware, in particular
with the OPROCD process on LINUX. To verify that ntpd is synchronized with
Clusterware, you can check the logs for ntpd and the Clusterware logs. The ntp
logfiles live under the /var/log directory structure for Linux and most UNIX
platforms. Configuration for ntp is carried out by editing the ntpd.conf file located
under the /etc directory for Linux and most UNIX platforms.

If the OS is getting locked up in a driver or there is a hardware issue which is
dependent on the operating system, storage device, and hardware configuration,
by working with the vendor and Oracle support this issue can be resolved when
OS conditions cause a node reboot.

If there is an excessive amount of load on the machine, this issue could be caused by
improper system design for the Oracle 11g RAC environment. Adequate memory,
shared storage, and network capacity are required to prevent and avoid scheduler
failures with the Oracle 11g Clusterware.

An Oracle software bug might be the root cause of the OPROCD failure that results
in a node reboot condition for the cluster, which will occur depending on the
environment. Now let's review some node reboot conditions that are linked
directly to the operation of the OCLSOMON daemon process within the
Oracle 11g Clusterware.

3) OCLSOMON-RAC node reboot

There are several root causes that will cause a node reboot to occur if the OCLSOMON
daemon process fails within the Unix and Linux environments for the Oracle 11g
Clusterware. These can be summarized as follows:

• Hung threads within the CSS daemon
• OS scheduler problems
• Excessive amounts of load on the machine
• Oracle software bugs with Clusterware and database

When the OCLSOMON process fails, it results in a node reboot condition with
Oracle 11g RAC environments. Unix and Linux operating systems are multithreaded
operating system platforms that use shared memory. Whenever threads are unable
to be accessed by the Clusterware to allocate resources for the operating system
scheduler, node reboots occur.

The next condition that may cause a node reboot is related to architecture and system
implementation for the hardware, shared storage, and network configuration in
terms of placing excessive load on the systems within the Oracle 11g RAC ecosystem.
Proper planning will prevent this issue.

The last condition is due to software bugs that may exist within the Oracle 11g
Clusterware software. By consulting with Oracle support and opening a support
escalation ticket—for example, iTar or service request—a patch can be generated to
provide resolution on account of a bug that may be the root cause of the node reboot
with the OCLSOMON process within the Oracle 11g Clusterware. Now that we have
discussed the primary causes and solutions to node reboots within the Oracle 11g
Clusterware, we will discuss how to address issues that arise with the Clusterware as
a result of system and network conditions.

Tuesday, June 12, 2012

Sql script is not executing in crontab


------------------------- crontab entry  contains following

* * * * * /home/app/oracle/sample/sqlcron.sh


------------------------------ sqlcron.sh  contains following

/home/app/oracle/sample/sqlconn.sh > /home/app/oracle/sample/sqlslog_$datevar.log


------------------------------ sqlconn.sh  contains following


echo "script starting"
date
sqlplus MIS_USER/MIS123 @/home/app/oracle/sample/sqlscr.sh
date
echo "script ending"

------------------------------ sqlscr.sh  contains following

analyze table MIS_DIM_CATEGORY compute statistics;
select TO_CHAR(sysdate,'DD-MON-YYYY HH24:MI:SS') as datee  from dual;
insert into samp1 values(sysdate);
commit;
exit;

----------------

when i executes  sqlcron.sh manually i getting proper out put. But  if add sqlcron.sh to crontab file then i am getting following out put only. only  bash commands are executing. sql commands are not executing.



script starting
Tue Jun 12 15:51:01 IST 2012
Tue Jun 12 15:51:01 IST 2012
script ending

-----------------------------------------------------------------

What about environment? As cron is not using user's environment, try set important environment variables  (ORACLE_HOME,ORACLE_SID,PATH) in your shell script.
Or change the command in crontab to this (assume that you are using "oracle" user):

30 12 * * * /bin/su - oracle -c  /home/app/oracle/sample/sqlconn.sh > /home/app/oracle/sample/sqlslog_$datevar.log

i have included environment vars in sqlconn.sh file  which are

echo "script starting"
date
export ORACLE_HOME=/home/app/oracle/product/11.2.0/db_1
export ORACLE_SID=ORCL
export PATH=$ORACLE_HOME/bin:$PATH
sqlplus MIS_USER/MIS123 @/home/app/oracle/sample/sqlscr.sh
date
echo "script ending"

then i get correct out put as follows

-----------------------------------------------------------------

script starting
Tue Jun 12 15:58:01 IST 2012

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 12 15:58:01 2012

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


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


Table analyzed.


DATEE
--------------------
12-JUN-2012 15:58:01


1 row created.


Commit complete.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Tue Jun 12 15:58:01 IST 2012
script ending

-------------------------------------------------------------------------------------------------


Tuesday, May 8, 2012

STATS PACK Configuring And Report Generating

SQL> connect sys/manager as SYSDBA

SQL>CREATE TABLESPACE TBS_STSPCK DATAFILE '/opt/app/oracle/oradata/orcl/stats01.dbf' size 500m autoextend on
maxsize unlimited;

SQL> @spcreate

here it will ask for username and defalut tablespace for this username

SELECT Snap_Level FROM STATS$STATSPACK_PARAMETER

EXECUTE STATSPACK.MODIFY_STATSPACK_PARAMETER –
(i_snap_level=>5, i_buffer_gets_th=>100000, -
i_modify_parameter=>'true');

Level    Description

0–4    General performance statistics on all memory areas, latches, pools, and
          events, and segment statistics, such as rollback and undo segments.

5       Same statistics from the lower levels, plus the most resource-intensive
         SQL statements.

6       Introduced in Oracle 9.0.1, level 6 includes the level 5 results plus
         SQL plans.

7–9    Introduced in Oracle 10g, level 7 includes level 6 results plus additional
          Segment Level statistics, including logical reads, physical reads/writes,
         global cache cr/current served and buffer busy, ITL, and row lock waits.

10      and greater Same statistics from level 6 plus parent/child latch data.




to create snapshot

execute STATSPACK.SNAP;

to create statspack report


@ORACLE_HOME/rdbms/admin/spreport

AWR Reports Generation

Snapshots

By default snapshots of the relevant data are taken every hour and retained for 7 days. The default values for these settings can be altered using the following procedure.

    BEGIN
      DBMS_WORKLOAD_REPOSITORY.modify_snapshot_settings(
        retention => 43200,        -- Minutes (= 30 Days). Current value retained if NULL.
        interval  => 30);          -- Minutes. Current value retained if NULL.
    END;
    /

Extra snapshots can be taken and existing snapshots can be removed, as shown below.

    EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;

    BEGIN
      DBMS_WORKLOAD_REPOSITORY.drop_snapshot_range (
        low_snap_id  => 22,
        high_snap_id => 32);
    END;
    /
   
Baselines

A baseline is a pair of snapshots that represents a specific period of usage. Once baselines are defined they can be used to compare current performance against similar periods in the past. You may wish to create baseline to represent a period of batch processing.

    BEGIN
      DBMS_WORKLOAD_REPOSITORY.create_baseline (
        start_snap_id => 210,
        end_snap_id   => 220,
        baseline_name => 'batch baseline');
    END;
    /

The pair of snapshots associated with a baseline are retained until the baseline is explicitly deleted.

    BEGIN
      DBMS_WORKLOAD_REPOSITORY.drop_baseline (
        baseline_name => 'batch baseline',
        cascade       => FALSE); -- Deletes associated snapshots if TRUE.
    END;
    /


Workload Repository Reports

Oracle provide two scripts to produce workload repository reports (awrrpt.sql and awrrpti.sql). They are similar in format to the statspack reports and give the option of HTML or plain text formats. The two reports give essential the same output but the awrrpti.sql allows you to select a single instance. The reports can be generated as follows.

    @$ORACLE_HOME/rdbms/admin/awrrpt.sql
    @$ORACLE_HOME/rdbms/admin/awrrpti.sql


awrblmig.sql
awrddinp.sql
awrddrpi.sql
awrddrpt.sql  *
awrextr.sql 
awrgdinp.sql
awrgdrpi.sql
awrgdrpt.sql
awrginp.sql 
awrgrpti.sql
awrgrpt.sql 
awrinfo.sql 
awrinpnm.sql
awrinput.sql
awrload.sql 
awrrpti.sql 
awrrpt.sql  *
awrsqrpi.sql 
awrsqrpt.sql  *

Thursday, April 19, 2012

Years_Months_Days_Hours_Days

SELECT ID,REQUEST_REGISTERED_ON,RECTIFIED_ON,
TRUNC(MONTHS_BETWEEN(RECTIFIED_ON,REQUEST_REGISTERED_ON)/12) AS YEARS,
MOD(TRUNC(MONTHS_BETWEEN(RECTIFIED_ON,REQUEST_REGISTERED_ON)),12) AS MONTHS,
TRUNC(RECTIFIED_ON-ADD_MONTHS(REQUEST_REGISTERED_ON,TRUNC(MONTHS_BETWEEN(RECTIFIED_ON,REQUEST_REGISTERED_ON)))) AS DAYS,
trunc(RECTIFIED_ON - REQUEST_REGISTERED_ON)  as TOTAL_days,
trunc(((RECTIFIED_ON - REQUEST_REGISTERED_ON)-trunc(RECTIFIED_ON - REQUEST_REGISTERED_ON))*24)     AS "DIFF_IN_HOURS",
TRUNC(((((RECTIFIED_ON - REQUEST_REGISTERED_ON)-trunc(RECTIFIED_ON - REQUEST_REGISTERED_ON))*24)-
(trunc(((RECTIFIED_ON - REQUEST_REGISTERED_ON)-trunc(RECTIFIED_ON - REQUEST_REGISTERED_ON))*24)))*60)
 as DIFF_IN_MNTS
FROM NSC_USER.REQUEST_T  WHERE ID = ID AND RECORD_STATUS=1 ;

Friday, April 13, 2012

ORA-01591: lock held by in-doubt distributed transaction

SQL> select local_tran_id from dba_2pc_pending;

LOCAL_TRAN_ID
------------------------------------------------------------------
7.55.64129

SQL> rollback force '7.55.64129';

Rollback complete.

SQL> exec dbms_transaction.purge_lost_db_entry('7.55.64129');

PL/SQL procedure successfully completed.

SQL> select local_tran_id from dba_2pc_pending;

no rows selected

Tuesday, April 3, 2012

RAC Commands

RAC Specific  init.ora parameters

The following are important initialization parameters that must have the same values
across all the instances of an RAC database:

• CLUSTER_DATABASE
• CONTROL_FILES
• DB_BLOCK_SIZE
• COMPATIBLE
• DB_NAME
• ACTIVE_INSTANCE_COUNT
• UNDO_MANAGEMENT
• RESULT_CACHE_MAX_SIZE
• DB_UNIQUE_NAME
• CLUSTER_DATABASE_INSTANCES
• INSTANCE_TYPE
• REMOTE_LOGIN_PASSWORDFILE
• DB_RECOVERY_FILE_DEST
• DB_RECOVERY_FILE_DEST_SIZE

The following are important initialization parameters that must have a unique value
across all instances of an RAC database:

• INSTANCE_NAME
• INSTANCE_NUMBER
• UNDO_TABLESPACE
• THREAD

Srvctl commands

-- Add

 srvctl add database -d MIS -o /app/oracle/product/10.2.0/RACDB

 srvctl add instance -d MIS -i MIS1 -n rac1

 Config

 srvctl config
 srvclt config -v
 srvctl config database -d MIS
 srvctl config database -d MIS -a
 srvctl config nodeapps -a -g -s -i -n rac1
 srvctl config listener -n rac1
 srvctl config service -d MIS
 srvctl config service MIS -s MIS_RAC -a

--Start/Stop

srvctl stop database -d MIS -o immediate
srvctl stop instance -i MIS1 -d MIS -o immediate
srvctl stop asm +ASM1 -n oracls1
srvctl stop asm +ASM2 -n oracls2
srvctl stop listener
srvctl stop nodeapps -n oracls1
srvctl stop nodeapps -n oracls2
./crsctl stop crs

--Status

srvctl status database -d MIS
srvctl status instance -i MIS1 -d MIS
srvctl statsu nodeapps -n oracls1

CRS Tracing

export ORA_CRSDEBUG_ALL=1 to 5

see metalink note 357808 for details

Srvctl Tracing

export SRVM_TRACE=true

 Backup Voting Disks

  dd if=/dev/raw/raw11 of=/home/oracle/votingdsk.bkp

 OCR Commands

ocrconfig -export /tmp/dba/exp_ocr.dmp -s online
ocrconfig  -showbackup
ocrconfig -backup loc dirname
ocrconfig -restore
ocrcheck
 

Determing ocr location

cat /etc/oracle/ocr.loc

 oifcfg Commands

oifcfg iflist
oifcfg iflist -p -n
oifcfg getif -type public
oifcfg getif
oifcfg getif -n rac2
oifcfg getif -if eth2

--Crs Statistics

crs_stat -t
crs_stat -t -v

--Olsnodes

olsnode -n

 cluvfy

cluvfy stage -pre crsinst -n rac1,rac2
cluvfy comp nodereach -n rac1,rac2 -verbose
cluvfy stage -post crsinst -n rac1,rac2 -verbose
cluvfy comp clu -n rac1,rac2 -verbose
cluvfy comp clumgr -n rac1,rac2 -verbose
cluvfy comp nodeapp -n rac1,rac2 -verbose
cluvfy comp crs -n rac1,rac2 -verbose
cluvfy comp ocr -n rac1,rac2 -verbose
cluvfy stage -pre dbcfg -n rac1,rac2 -d -verbose
cluvfy stage -pre dbinst -n rac1,rac2 -verbose
cluvfy comp ofcr -n all

 Check CRS

crsctl check crsd
crsctl check cssd
crsctl check evmd
 

Query voting disks

crsctl query css votedisk

crsctl query crs softwareversion
crsctl query activeversion

List Modules

crsctl lsmodules crs
crsctl lsmodules evm

Archivelog Mode On RAC

This article highlights the differences between resetting the archive log mode on a single node instance and a Real Application Clusters (RAC).

In Stand Alone Database

    ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/ORCL/archive/' SCOPE=spfile;
    ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' SCOPE=spfile;

    SHUTDOWN IMMEDIATE;
    STARTUP MOUNT;
    ALTER DATABASE ARCHIVELOG;
    ALTER DATABASE OPEN;

The ALTER DATABASE ARCHIVELOG command can only be performed if the database in mounted in exclusive mode. This means the whole
clustered database must be stopped before the operation can be performed. First we set the relevant archive parameters.


    ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/ORCL/archive/' SCOPE=spfile;
    ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' SCOPE=spfile;

Since we need to mount the database in exclusive mode we must also alter the following parameter.

    ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;

From the command line we can stop the entire cluster using the following.

    $ srvctl stop database -d ORCL

With the cluster down we can connect to a single node and issue the following commands.

    STARTUP MOUNT;
    ARCHIVE LOG START;
    ALTER DATABASE ARCHIVELOG;
    ALTER SYSTEM SET cluster_database=TRUE SCOPE=spfile;
    SHUTDOWN IMMEDIATE;

Notice that the CLUSTER_DATABASE parameter has been reset to it's original value. Since the datafiles and spfile are
shared between all instances this operation only has to be done from a single node.

From the command line we can now start the cluster again using.

    $ srvctl start database -d ORCL

The current settings place all archive logs in the same directory. This is acceptible since the thread (%t) is part
of the archive format preventing any name conflicts between instances. If node-specific locations are required the
LOG_ARCHIVE_DEST_1 parameter can be repeated for each instance with the relevant SID prefix.

Thursday, March 29, 2012

Database Link Ras.Oracle.Com Connects To Ras.Regress.Oracle.Com


Alter Database Rename Global_Name To Ras.Oracle.Com;

Alter System Set Global_Name=False;

On Both target and source Databases

ORA- MEMORY_TARGET Is Not Supported On This System



we get this error in linux platform when the size of a temp file system is smaller than  Memory_Target parameter size

# umount tmpfs

 # mount -t tmpfs shmfs -o size=1300m /dev/shm

 # df -k /dev/shm

          filesystem           1k-blocks      used   available   use%    mounted on

          shmfs                  1331200         0      1331200     0%        /dev/shm

To Debug A Shell Script

    we can use        -v  OR -x

-v

      The -v option is used to print shell commands as they are read along with the outcome of the              
       script. So if after some command if see desired output is not coming you can
       note down that commands.

    example for  sh -v sample.sh

                    echo "Warning! You are installing the Fall Creek portal software"

                    echo -n "Enter the product installation directory: "

                    read InstallDir

   OUT PUT :

                    echo "Warning! You are installing the Fall Creek portal software"

                   Warning! You are installing the Fall Creek portal software

                   echo -n "Enter the product installation directory: "

                   Enter the product installation directory: read InstallDir

-x

           The -x option is used for expanding each command. It displays the command, system variable and  

           then its expanded arguments.

  EXAMPLE FOR sh -vx sample.sh

                     echo "Warning! You are installing the Fall Creek portal software"

                    + echo 'Warning! You are installing the Fall Creek portal software'

                  Warning! You are installing the Fall Creek portal software

                  echo -n "Enter the product installation directory: "

                  + echo -n 'Enter the product installation directory: '

                 Enter the product installation directory: read InstallDir

                 + read InstallDir

ORA-01031: insufficient privileges whiling logon through / as sysdba


Here we have 2 solutions

a)       In sqlnet file in network folder  we should have

When it is set to NTS, which should only be set on Windoze, it allows users to be authenticated using Windows NT native security. What this means is that by setting SQLNET.AUTHENTICATION_SERVICES to NTS
and a creating a role called ORA_DBA with your user in that group you should be able to log in to oracle without supplying a password. (connect / as sysdba)

b)        Or check weather is there  password file or not .  by giving sysdaba privilege to
           Sys . if u get any error 

create pwd file using orapwd utility  with not giving the “nosysdba=y”  parameter

Undo Tbs Increases and Doesn't Shrink or Gone to Recover State

drop Tablespace UNDOTBS;

drop Tablespace UNDOTBS

*
ERROR at line 1:

ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping tablespace

       1)Create pfile if you started with database with spfile.

SQL>Create PFILE from SPFILE;

        2)Edit pfile and set undo management to manual.

undo_management = manual

       3)Put the entries of the undo segments in the pfile by using the following statement in the pfile:

_offline_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,.....)

       4)Mount the database using new pfile.

Startup mount pfile='fullpath to pfile'

      5)Drop the datafiles,

sql>Alter Database datafile '&filename' offline drop;

     6)Open the database.

sql>Alter Database Open;

       7)Drop the undo segments,

sql>Drop Rollback Segment "_SYSSMU1$";

......

       8)Drop Old undo tablespace.

sql>Drop Tablespace old_tablespace_name Including Contents;

       9)Add the new undo tablespace.

      10) Shutdown Immediate;

      11) Change the pfile parameters back to Undo_management = AUTO and modify the parameter Undo_tablespace=new_undo_tablespace_name and remove the _offline_rollback_segments parameter.

      12) Startup the Database.

User is already authenticated

kill all os  processs related to that instance