Category Archives: Oracle database

Disable Case Sensitive in Oracle Database 11g

Prior to 11g Passwords in Oracle are not case sensitive. Now from 11g Oracle passwords are Case sensitive. Parameter sec_case_sensitive_logon has been included in Oracle 11g.

sql> create user test identified by test;
sql> Grant create session to test;
SQL> show parameter logon
NAME                                       TYPE                              VALUE
—————————-     ———————-   ——————————
sec_case_sensitive_logon     boolean                           TRUE

SQL> conn test/TEST
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.

SQL> conn test/test
Connected.

Disable Password case sensitive:

SQL> alter system set sec_case_sensitive_logon=false;
System altered.

SQL> conn test/TEST
Connected.

Thank You !!

Find size of Table,Index and USER/SCHEMA in Oracle

How to find size of Table or Index or User/Schema in Oracle Database.

SIZE OF TABLE:

Select segment_name,sum(bytes)/1024/1024/1024 as “SIZE in GB” from user_segments where segment_name=’TABLE_NAME’ group by segment_name;

OR

select owner,segment_name,sum(bytes)/1024/1024/1024 as “SIZE in GB” from dba_segments where owner=’SCHEMA_NAME’ and segment_name=’TABLE_NAME’ group by owner,segment_name;

SIZE OF INDEX:

select segment_name,sum(bytes)/1024/1024/1024 as “SIZE in GB” from user_segments where segment_name=’INDEX_NAME’ group by segment_name;

OR

select owner,segment_name,sum(bytes)/1024/1024/1024 as “SIZE in GB” from dba_segments where owner=’SCHEMA_NAME’ and segment_name=’INDEX_NAME’ group by owner,segment_name

SIZE OF A USER/SCHEMA:

select owner,sum(bytes)/1024/1024/1024 as “SIZE in GB” from dba_segments where owner=’SCHEMA_NAME’ group by owner;

 

 

Thank You !!

Oracle 11gR2 installation on windows machine

Oracle Database Patch Set 11.2.0.2 (Patch#10098816) for Win32 and Win64 is available in Oracle support for downloading.

download

After downloading patchset, Unzip the patch which will creates folder “database”

Run the setup executable with “Run as administrator”

run

Unchecked the box for not to receive any security updates from Oracle Support

skip

skip1

Click on Skip software updates radio button

skip3

Click on instal database software only, As we are installing only software.

install1

single

english

enterprise

location

summary

progress

success

 

Thank You !!

Drop temp tablespace taking long time

Created new temporary tablespace:

CREATE TEMPORARY TABLESPACE TEMP01 TEMPFILE ‘/u01/oracle/oradata/temp02.dbf’ SIZE 2g;

Make new temporary tablespace as default:

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP01;

Dropping old temporary tablespace, Which is taking long time to complete:

DROP TABLESPACE TEMP INCLDING CONTENTS AND DATAFILES;

The issue because of temp is being used by oracle sessions

SOLUTION 1:

SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP
SQL>SELECT NAME,OPEN_MODE,LOG_MODE FROM V$DATABASE;
SQL>DROP TABLEPSACE TEMP INCLUDIING CONTENTS AND DATAFILES;

SOLUTION 2:

Run below query and see any sessions using temp, Find out the all the sessions that are not active and kill those sessions.

select  tu.username,s.sid,s.serial# from v$tempseg_usage tu, v$session s
where tu.session_addr=s.saddr;

alter system kill session ‘sid,serial’;

Thank You !!

DROP DATABASE THROUGH RMAN

In Oracle Database 10gR1 Oracle introduced the RMAN command DROP DATABSE. This one simple statement has the ability to completely remove a database including all RMAN backups with the optional INCLUDING BACKUPS clause.

sqlplus “/ as sysdba”

SQL> shutdown immediate;

SQL> startup mount exclusive

SQL> alter system enable restricted session

SQL> exit

rman target /

RMAN> drop database including backups;

 

Thank You !!

CHECK TABLESPACE SIZE, FREE AND USED SPACE

Below query is used for finding total tablespace size and free, used space.

select tablespace_name, ROUND(bytes_free,2) free,ROUND(bytes_total-bytes_free,2) used, ROUND(bytes_total,2) total,perused
from (select a.tablespace_name, a.bytes_free,b.bytes_total,
ROUND((100-(100*a.bytes_free/b.bytes_total)),2) perused from
(Select tablespace_name,sum(bytes)/1024/1024 bytes_free From dba_free_space Group by tablespace_name) a,
(Select tablespace_name,sum(bytes)/1024/1024 bytes_total From dba_data_files Group by tablespace_name) b
where a.tablespace_name=b.tablespace_name) where perused >= 0 ORDER BY tablespace_name;

 

Thank You !!

ORA-12537: TNS:connection closed

Giving below error when trying to connect oracle user

ERROR:

Sqlplus scott/tiger@PROD

SQL*Plus: Release 10.2.0.1.0 – Production on Thu Oct 16 15:06:46 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:
ORA-12537: TNS:connection closed

SOLUTION:

Add the relevant LD_LIBRARY_PATH into the SID_DESC section in listener.ora file

(SID_DESC =
(ORACLE_HOME = /home/oracle/product/1020)
(ENVS=”LD_LIBRARY_PATH=/home/oracle/product/1020/lib:/usr/dt/lib:/usr/openwin/lib”)
(SID_NAME = PROD)
)

 

Thank You !!

Oracle ORA-21561 : OID generation failed

Giving below error when trying to connect from Oracle client

“ORA-21561 : OID generation failed”

ERROR:

sqlplus <test_user>/<test_user_password>@<database_name>
xxxxx xxxx
xxxx xxxx
ERROR:
ORA-21561 : OID generation failed

Enter user-name: <username>/<password> @ <tns connect string>

SOLUTION:

Then the problem is most likely in the client machine hosts file.
Check that there is client machine fully qualified name and short name in the client machine hosts file. If these are missing you’ll get ORA-21561 errors when trying to connect server.
Example:

127.0.0.1            localhost.localdomain      localhost
10.160.116.10   dbamasters.oracle.com     dbamasters

Thank You !!

ORA-01031: insufficient privileges when connect as sysdba

Not able to connect Oracle database, When issue command — > sqlplus “/ as sysdba”

[oraprod@oracle-dba ~]$ sqlplus “/ as sysdba”
SQL*Plus: Release 10.2.0.1.0 Production on Wed Jan 22 02:09:17 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
ERROR:
ORA-01031: insufficient privileges

SOLUTION:

SET CORRECT ORACLE SID
———————-
export ORACLE_SID=PROD         — LINUX
D:\oracle>set ORACLE_SID=PROD  — WINDOWS

SET ORACLE_HOME
—————
export ORACLE_HOME=/u01/oracle/product/10.2.0   — LINUX
set ORACLE_HOME=D:\oracle                                           — WINDOWS

SET SQLNET.ORA FILE
——————-
Check sqlnet.ora file for SQLNET.AUTHENTICATION_SERVICES parameter. It should be set to NTS for windows and for linux set it to ALL.

SQLNET.AUTHENTICATION_SERVICES=NTS  —WINDOWS
SQLNET.AUTHENTICATION_SERVICES=ALL  —LINUX

Please reproduce the issue and see if it resolves !!

ORA-27125: unable to create shared memory segment when run DBCA

I have installed 10gR2 on linux environment, When running DBCA it got filed with below error

ORA-27125: unable to create shared memory segment

SOLUTION:

cd $ORACLE_HOME/bin
 
mv oracle oracle.bin
 
 
—- Paste it as one —
 
cat >oracle <<“EOF”
#!/bin/bash
export DISABLE_HUGETLBFS=1
exec $ORACLE_HOME/bin/oracle.bin $@
EOF
 
—- End of paste —

chmod +x oracle

Thank You !!