Thursday, November 7, 2013

ORA-00838: Specified value of MEMORY_TARGET is too small, needs to be at least 1328M

1) create pfile from spfile;
2) SQL> startup nomount pfile=D:\app\oracle\product\11.2.0\dbhome_1\database\INITorcl.ora
3)  alter database open;
4) alter database open;
5) create spfile from pfile;

Spool table in excel sheet / html page

set feed on markup html on
spool c:\test.xls
select * from emp;
spool off
set feed off markup html off

same way you can export it in html also, you just need to change file extension from .xls to .html

Converting exponential value to numeric

e.g.
select 1987252000000000000 from dual
1.987252E18

Check this:
select to_char(''||1987252000000000000) from dual
1987252000000000000

Saturday, June 22, 2013

Find word count from string

select (length('mmohsamohsdmohsg')-length(replace('mmohsamohsdmohsg','mohs',''))) / length('mohs') from dual;

undo retention for ORA-01555

1) alter system set undo_retention = 1500 scope=both;

2) Check undot tablespace size

3) Disk size where datafile of tablespaces are located

4) Query optimiztion if required which causes this issue

creating dbconsole service for OEM

#drop
emca -deconfig dbcontrol db -repos drop

After drop check in regedit dbconsole service in path "HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\SYSMAN\OracleDBConsoleorcl" if not removed then remove OracleDBConsoleorcl then create

#create (use this)
emca -config dbcontrol db -repos create

To find locked oracle query

SELECT sql_text
FROM   v$sql
WHERE  sql_id IN (SELECT sql_id
                  FROM   v$session
                  WHERE  sid IN (SELECT sid
                                 FROM   v$lock
                                 WHERE  (id1,id2,TYPE) IN (SELECT id1,
                                                                  id2,
                                                                  TYPE
                                                           FROM   v$lock
                                                           WHERE  request > 0)))

ORA-12012 ORA-27468: "SYS.PURGE_LOG" is Locked by Another Process ORA-29516: Aurora assertion failure

SQL> STARTUP UPGRADE
SQL> SPOOL patch.log
SQL> @?/rdbms/admin/catupgrd.sql
SQL> SPOOL OFF
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
SQL> @?/rdbms/admin/utlrp.sql

ORA-01092 ORA-00704: bootstrap process failure / ORA-39700

while starting db giving ORA-01092: ORACLE instance terminated. Disconnection forced & in alert log file  ORA-00704: bootstrap process failure / ORA-39700

Solution:

1. Open a command prompt and browse to /rdbms/admin
2. Start sqlplus (sqlplus / as sysdba)
3. Run "startup upgrade"
4. Run @catproc.sql and SQL> STARTUP UPGRADE
SQL> SPOOL patch.log
SQL> @?/rdbms/admin/catupgrd.sql

SQL> SPOOL OFF