Monday, July 6, 2015

Recreate and Resize Oracle Redo Logs

1. First see the size of the current logs:             
               
   > sqlplus /nolog
   SQL> connect / as sysdba 

select group#, bytes, status from v$log;

2. Retrieve all the log member names for the groups: 

select group#, member from v$logfile;

3. Retrieve the status of log members of the groups: 

select group#, status from v$log;

4.  In older versions of the database you needed to shutdown and issue the following
   commands in restricted mode. You can still do this, but the database can be online
   to perform these changes.

   Let's create 3 new log groups and name them groups 4, 5, and 6, each 150MB in
   size:                           

alter database add logfile group 4 '/swapphome/oracle/app/oradata/fcproddb/redo04.log' size 150m;

alter database add logfile group 5 '/swapphome/oracle/app/oradata/fcproddb/redo05.log' size 150m;

alter database add logfile group 6 '/swapphome/oracle/app/oradata/fcproddb/redo06.log' size 150m;

5. Now run a query to view the v$log status:  

SQL> select group#, status from v$log;                                       

      GROUP# STATUS
   --------- ----------------
           1 INACTIVE
           2 CURRENT
           3 INACTIVE            
           4 UNUSED
           5 UNUSED
           6 UNUSED   

6. Switch until we are into log group 4, so we can drop log groups 1, 2, and 3:

alter system switch logfile;
** repeat as necessary until group 4 is CURRENT **

7. Run the query again to verify the current log group is group 4:                                                            
                                                                
   SQL> select group#, status from v$log;                                       
                                                                  
      GROUP# STATUS
   --------- ----------------
           1 ACTIVE
           2 INACTIVE
           3 INACTIVE            
           4 CURRENT
           5 UNUSED
           6 UNUSED    

Note: redo log Group 1 or 2 or 3 can be active after "alter system switch log file" which means could not be dropped, in this case, 
you need to do "alter system checkpoint" to make redo log groups 1,2 and 3 inactive. 

8. Run the below command to make redo log groups 1,2 and 3 inactive.

SQL> alter system checkpoint;

Run the query again to verify the current log group is group 4:                                                            
                                                                
   SQL> select group#, status from v$log;                                       
                                                                  
      GROUP# STATUS
   --------- ----------------
           1 INACTIVE
           2 INACTIVE
           3 INACTIVE            
           4 CURRENT
           5 UNUSED
           6 UNUSED    

7. Now drop redo log groups 1, 2, and 3

alter database drop logfile group 1;

alter database drop logfile group 2;

alter database drop logfile group 3;

8. Verify the groups were dropped, and the new groups' sizes are correct.
   SVRMGR> select group#, bytes, status from v$log;

      GROUP#     BYTES STATUS
   --------- --------- ----------------
           4  10485760 CURRENT
           5  10485760 UNUSED
           6  10485760 UNUSED       
 
8.  At this point, you consider taking a backup of the database.

9.  You can now go out to the operating system and delete the filesASSOCIATED
    with redo log groups 1, 2, and 3 in step 2 above as they are no longer
    needed:
    
    % rm /usr/oracle/dbs/log1PROD.dbf
    % rm /usr/oracle/dbs/log2PROD.dbf  
    % rm /usr/oracle/dbs/log3PROD.dbf                                                 
                                                  
   Monitor the alert.log for the times of redo log switches. Due to increased
   redo log size, the groups should not switch as frequently under the same 
   load conditions. 

Thursday, July 2, 2015

ORA-04045: errors during recompilation/revalidation of ODSSTG.ODSPREBXE_STREAMS_LOGON

Verify if the object exists

select object_name, object_type, status, owner from dba_objects where object_name='ODSPREBXE_STREAMS_LOGON';

If the object status shows as invalid.

Compile as below.

OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE
----------------------------------------------------------------------------
STATUS                       OWNER
---------------------------- ------------------------------
ODSPREBXE_STREAMS_LOGON
TRIGGER
INVALID                      ODSSTG


22:54:24 SQL> alter trigger ODSSTG.ODSPREBXE_STREAMS_LOGON COMPILE;

Trigger altered.

Elapsed: 00:00:00.09

After the compilations the error is stopped in the alert log.


Remove dmsys befor upgrading to 11.2.0.X

20:14:11 SQL> 20:14:11 SQL> SELECT COUNT(*) FROM DBA_SYNONYMS WHERE TABLE_OWNER = 'DMSYS';
       4
Elapsed: 00:00:00.08
20:14:41 SQL> DROP USER DMSYS CASCADE;

Elapsed: 00:00:42.99
20:15:40 SQL> 20:15:40 SQL> SELECT COUNT(*) FROM DBA_SYNONYMS WHERE TABLE_OWNER = 'DMSYS';
       4
Elapsed: 00:00:00.01
20:15:48 SQL> DELETE FROM SYS.EXPPKGACT$ WHERE SCHEMA = 'DMSYS';
Elapsed: 00:00:00.04

20:16:03 SQL> SELECT COUNT(*) FROM DBA_SYNONYMS WHERE TABLE_OWNER = 'DMSYS';
       4
Elapsed: 00:00:00.00
20:16:18 SQL> SET HEAD OFF;
20:16:59 SQL> SELECT 'Drop public synonym ' ||'"'||SYNONYM_NAME||'";' FROM DBA_SYNONYMS
WHERE TABLE_OWNER = 'DMSYS';20:17:07   2

Drop public synonym "CLUSTER_RULE_TYPE";
Drop public synonym "CLUSTER_TYPE";
Drop public synonym "ODM_ATTRIBUTE_IMPORTANCE_MODEL";
Drop public synonym "ODM_NAIVE_BAYES_MODEL";
Elapsed: 00:00:00.05

20:17:08 SQL> Drop public synonym "CLUSTER_RULE_TYPE";
Elapsed: 00:00:00.06
20:17:22 SQL> Drop public synonym "CLUSTER_TYPE";
Elapsed: 00:00:00.04
20:17:28 SQL> Drop public synonym "ODM_ATTRIBUTE_IMPORTANCE_MODEL";
Elapsed: 00:00:00.04
20:17:33 SQL> Drop public synonym "ODM_NAIVE_BAYES_MODEL";
Elapsed: 00:00:00.03
20:17:39 SQL> SELECT COUNT(*) FROM DBA_SYNONYMS WHERE TABLE_OWNER = 'DMSYS';
       0
Elapsed: 00:00:00.00
20:17:46 SQL>

Tuesday, June 16, 2015

How to Create TEMPORARY tablespace and drop existing temprary tablespace in oracle 11g


Step by Step guide to create new TEMP tablespace and drop existing temporary tablespace.

While doing this activity, existing temporary tablespace may have existing live sessions, due to same oracle won’t let us to drop existing temporary tablespace. Resulting, we need to kill existing session before dropping temporary tablespace.
Following query will give you tablespace name and datafile name along with path of that data file.
SQL> select FILE_NAME,TABLESPACE_NAME from dba_temp_files;
Following query will create temp tablespace named: ‘TEMP_NEW’ with 500 MB size along with auto-extend and maxsize unlimited.
SQL> CREATE TEMPORARY TABLESPACE TEMP_NEW TEMPFILE '/DATA/database/ifsprod/temp_01.dbf' SIZE 500m autoextend on next 10m maxsize unlimited;
Following query will help you to alter database for default temporary tablespace. ( i.e. Newly created temp tablespce: ‘TEMP_NEW’ )
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP_NEW;
Retrieve ‘SID_NUMBER’ & ‘SERIAL#NUMBER’ of existing live session’s who are using old temporary tablespace ( i.e. TEMP ) and kill them.
SQL> SELECT b.tablespace,b.segfile#,b.segblk#,b.blocks,a.sid,a.serial#,
a.username,a.osuser, a.status
FROM v$session a,v$sort_usage b
WHERE a.saddr = b.session_addr;
Provide above inputs to following query, and kill session’s.
SQL> alter system kill session 'SID_NUMBER, SERIAL#NUMBER';
For example:
SQL> alter system kill session '59,57391';
Now, we can drop old temporary tablespace without any trouble with following:
SQL> DROP TABLESPACE old_temp_tablespace including contents and datafiles;

Tuesday, June 9, 2015

Password Profiles in Oracle E-Business Suite R12

Password Policies in Oracle E-Business Suite

One of my customers is required to define the Password policies in Oracle E-Business Suite

Profile: Signon Password Failure Limit
The Signon Password Failure Limit profile option defines the maximum number of login attempts before the user’s account is disabled.

Profile: Signon Password Hard to Guess

Set this Profile Option to Yes to ensure that they will be "hard to guess."
A password is considered hard-to-guess if it meets this requirements:
• The password contains at least one letter and at least one number.
• The password does not contain the username.
• The password does not contain repeating characters.

Profile: Signon Password Length

Signon Password Length defines the minimum length of the password. Te default is 5 characters



Profile: Signon Password No Reuse
This profile option specifies the number of days before any previously given password can be reused.



Profile: Signon Password Case
Set this profile option to 'Sensitive' to make the password case sensitive (it defaults to 'Insensitive in 11i, apparently, it defaults to 'Sensitive' in R12.1.1).











Thanks
RK

Thursday, May 28, 2015

Java VM: Java HotSpot(TM) while running autoconfig on the database tier 10g

Issue: While running the autoconfig on the database tier below issue occurred.

Context Value Management will now update the Context file
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  SIGSEGV (0xb) at pc=0xf7a8172a, pid=8033, tid=4160080576
#
# Java VM: Java HotSpot(TM) Server VM (1.5.0_06-b05 mixed mode)
# Problematic frame:
# V  [libjvm.so+0x4eb72a]
#
# An error report file with more information is saved as hs_err_pid8033.log

#

Log details.

Stack: [0xffb43000,0xffd43000),  sp=0xffd3eda4,  free space=2031k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x5056fa]
V  [libjvm.so+0x4320f8]
V  [libjvm.so+0x26a6a6]
V  [libjvm.so+0x28b95f]
C  [libnjni10.so+0x5e4c]  Java_oracle_net_common_NetGetEnv_getLocalHostName+0xd6
j  oracle.net.common.NetGetEnv.getLocalHostName()Ljava/lang/String;+0
j  oracle.net.config.Config.systemName()Ljava/lang/String;+36
j  oracle.net.config.DirectoryService.getSystemObjectPath(Loracle/net/config/Config;)Ljava/lang/String;+6
j  oracle.net.config.DirectoryService.qualifyObjectName(Loracle/net/config/Config;Ljava/lang/String;Z)Ljava/lang/String;+36
j  oracle.net.config.Listener.<init>(Loracle/net/config/Config;Ljava/lang/String;)V+37
v  ~StubRoutines::call_stub
V  [libjvm.so+0x26a17c]
V  [libjvm.so+0x43b3f8]
V  [libjvm.so+0x269faf]
V  [libjvm.so+0x4877cc]
"hs_err_pid11679.log" 375L, 23491C 

Cause: In this case in our server the hostname command was returning null, unfortunately the hostname was disappeared in the linux prompt.

Solution:
=======
[oradr@- ~]$ printenv |less
NLS_SORT=binary
ADJREOPTS=-Xms128M -Xmx512M
HOSTNAME=-
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000

Added the hostname to the environment as below.

[root@- ~]# /bin/hostname localhost.domain
[root@- ~]# hostname
localhost.domain
[root@- ~]#
[oradr@drdb PRODSTBY_drdb]$ printenv |less
NLS_SORT=binary
ADJREOPTS=-Xms128M -Xmx512M
HOSTNAME=localhost.domain
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000

Run the autoconfig it should complete.


Tuesday, May 26, 2015