Friday, November 9, 2012

ORA-12518: TNS:listener could not hand off client connection


You may get below error when trying to connect to the database using sqlplus or through an application login.


ORA-12518: TNS:listener could not hand off client connection



Reason:
The process of handing off a client connection to another process failed.


Solution;
 Increase PROCESSES initialization parameter.


Use the following command to check the value of the PROCESSES initialization parameter:

show parameter processes;


If the database was started using an spfile, then the following command can be used to increase the PROCESSES initialization parameter:

alter system set processes=600 scope=spfile;

If the database was started using a pfile, then the value of the processes parameter must be changed in the pfile and the database bounced.


Thursday, September 20, 2012

ftp "500 OOPS: cannot change directory" error


Error:

When trying to log in through ftp you may receive below error:

ftp 500 OOPS: cannot change directory


Solution:


In the console do the following
(Log in as ROOT)

su -
getsebool -a | grep ftp
setsebool -P ftp_home_dir on
getsebool -a | grep ftp


Eg:

[root@test ~]# getsebool -a | grep ftp
allow_ftpd_anon_write --> on
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> on
httpd_enable_ftp_server --> off

Friday, August 24, 2012

Oracle CSS Daemon


In Oracle CSS Daemon refers to Cluster Synchronization Services , a daemon process that is used for synchronization between different RAC nodes and synchronization between ASM and Oracle database instances.



To stop the Oracle Cluster Services Synchronization (CSS) daemon, run the following command:
On AIX:
/etc/init.cssd stop

On other platforms:
/etc/init.d/init.cssd stop

To start the CSS daemon, run the following command:
/etc/init.d/init.cssd start   

This command stops the Oracle CSS daemon and then restarts it.
$ORACLE_HOME/bin/localconfig reset   

Friday, June 1, 2012

Oracle User Quota


Quota
A quota is the amount of space allocated to a user in a tablespace.
You may get oracle error like below due to this problem.
ORA-01536:space quota exceeded for tablespace 'string'


Change quota allocation
A user's quota can be changed with the ALTER USER command. Examples: Restrict user to 10M:
ALTER USER test QUOTA 10M ON users;


Allow unlimited space
ALTER USER test QUOTA unlimited ON users;


Monitor
Query the USER_TS_QUOTAS view to see the quota allocation.
SQL> SELECT * FROM user_ts_quotas;

Friday, May 18, 2012

How to Create a Shortcut to Run a Program as a Specified User in Windows



1. Right click on an empty area on desktop, and click on New and Shortcut.

2. Type the command below into the location area, and click on the Next button. (see screenshot below)

Replace USER-NAME in the command with the actual name of the user account that you want to run the program as.

runas /user:USER-NAME "C:\full\path\of\Program.exe"

For example, if I wanted to run Notepad as the test user, I would type this command below.
runas /user:myadmin "D:\myprogram\myprogram.exe"







3. Type a name for the shortcut in the name section, and click on the Finish button. 




4. Right click on the new shortcut on the Desktop and click on Properties.

5. Click on the Shortcut tab, then click on the Change Icon button.



6.Now you can access the file through your new shortcut. Double click on the icon and you may ask to enter the password for the user through a command prompt.Give the password and press Enter.Application will be loaded.




Thursday, March 15, 2012

DBVERIFY: Database Verification Utility

DBVERIFY is a utility of Oracle , that can be used to perform a physical structure integrity check against database files.


Note that the database should be off line before performing a DBVERIFY.
But it will work with online data files also,but its not recommended.


DBVERIFY is invoked using dbv command.It should be called from ORACLE_HOME/bin directory.

To access help on DB_VERIFY type: 
dbv help=y




To perform a simple DBVIRIFY use below command.Output will be written to the dbv.log file.


>dbv file=/u01/oracle/product/10.2.0/oradata/orcl/users01.dbf logfile=dbv.log


Note that this is only a verification tool to get a idea about data files,whether they are corrupted or not.You'll have to follow other methods to recover corrupted data files.




Exmples:
dbv example of  a datafile with no corruption.
(Pages are data blocks)


DBVERIFY: Release 11.2.0.2.0 - Production on Tue Mar 13 15:41:47 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /..../a_01.dbf
DBVERIFY - Verification complete


Total Pages Examined         : 193648
Total Pages Processed (Data) : 43877
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 65406
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 18833
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 65532
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 3753900931 (1388.3753900931)


dbv example of  a datafile with a corruption. 


DBVERIFY: Release 11.2.0.2.0 - Production on Tue Mar 13 15:32:33 2012


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


DBVERIFY - Verification starting : FILE = /..../a_02.dbf
Page 127845 is influx - most likely media corrupt
Corrupt block relative dba: 0x03c1f365 (file 15, block 127845)
Fractured block found during dbv:
Data in bad block:
 type: 6 format: 2 rdba: 0x03c1f365
 last change scn: 0x056c.dd2d2b24 seq: 0x1 flg: 0x06
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x00000000
 check value in block header: 0x21e0
 computed block checksum: 0x4ce


Page 127846 is marked corrupt
Corrupt block relative dba: 0x03c1f366 (file 15, block 127846)
Completely zero block found during dbv:


Page 127847 is marked corrupt
Corrupt block relative dba: 0x03c1f367 (file 15, block 127847)
Completely zero block found during dbv:


Page 127848 is marked corrupt
Corrupt block relative dba: 0x03c1f368 (file 15, block 127848)
Completely zero block found during dbv:
......
.....
....
...
Page 141294 is marked corrupt
Corrupt block relative dba: 0x03c227ee (file 15, block 141294)
Completely zero block found during dbv:


Page 141295 is marked corrupt
Corrupt block relative dba: 0x03c227ef (file 15, block 141295)
Completely zero block found during dbv:


Page 141296 is marked corrupt
Corrupt block relative dba: 0x03c227f0 (file 15, block 141296)
Completely zero block found during dbv:


DBVERIFY - Verification complete


Total Pages Examined         : 141296
Total Pages Processed (Data) : 60687
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 43333
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 5417
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 18407
Total Pages Marked Corrupt   : 13452
Total Pages Influx           : 1
Total Pages Encrypted        : 0
Highest block SCN            : 3753900926 (1388.3753900926)

Tuesday, March 13, 2012

Partitioning and Formatting Second Hard Drive in Linux - (ext3)



by Jeff Hunter

http://www.idevelopment.info/data/Unix/Linux/LINUX_PartitioningandFormattingSecondHardDrive_ext3.shtml

Linux tar Command

The tar(tape archive) command bundles a bunch of files together and creates an archive on a tape, disk drive etc.


Simple way for creating a tar file.
Go to the relevant path.In our example go to the path where "myfolder" resides.So if I want to add files in myfolder to a tar file issue below command.It will create the tar file in /my location.


tar -cvf  /my/test.tar  myfolder


How to untar...
Go to the location where you want to untar the files/folder and issue below command.


tar -xvf  /my/test.tar


You can use below command to list the contents of a tar file to a log.


tar -tvf  test.tar  > temp/test.log




Options available with tar command:


Create a new archive.
List the contents of an archive.
Extract the contents of an archive.
The archive file name is given on the command line (required whenever the tar output is going to a file)
The archive can span multiple floppies.
Print verbose output (list file names as they are processed).
Add files to the archive if they are newer than the copy in the tar file.
Compress or decompress files automatically.











Thursday, February 23, 2012

Oracle Database 9i DBCA error - ORA-29807: Specified oprator does not exist

During installation of Oracle 9i database - DBCA - Creating a database step - you will get an error like below.Error will be shown in "Creating data dictionary Views" section when the process is around 17% complete.

ORA-29807: Specified oprator does not exist 

This is actually a bug in the software.It is a known Oracle 9i problem regarding data dictionary views.
It has been determined that this error is being raised while DBCA is running the script prvtxml.plb.
Prvtxml.plb is a script which creates a particular package body. This script is called from the catxml.sql script - which in turn is called by the catproc.sql script - run automatically when creating a database using DBCA.

Anyway You can safely ignore the error and continue with the creation of the database.


Workaround:

1. Click Ignore and go ahead with DBCA (after invoking DBCA).
    The database creation using DBCA should now proceed without additional errors.


OR 


2. Go to the script catxml.sql and comment out the line which will run prvtxml.plb ( before invoking DBCA).



Thursday, February 9, 2012

Use ps -ef to see current processes in Linux


Display full information about each of the processes currently running in Linux.
$ps -ef

You can use ps -ef together with grep command to search for a process with a given keyword.

$ps -ef |grep oracle

Restart Linux Network Service

Login as root user:


RHEL command to restart network.


# service network restart
OR
# /etc/init.d/network restart


To start Linux network service:
# service network start


To stop Linux network service:
# service network stop

Wednesday, January 25, 2012

Change open_cursors Value


The Oracle initialization parameter OPEN_CURSORS specifies the number of cursors a session can have open at any one time. The default value is 300.
If the session attempts to open a new cursor but already has the maximum number of cursors open, the Oracle error -1000 will be returned.
Your client application may hit the following error :
ORA-01000: maximum open cursors exceeded

You can do two things,
1) Change the inti.ora parameter open_cursors = <increased-no>
init.ora file location = ORACLE_HOME\dbs
A database restart is needed to affect the above change.
You can check the value by below sql.
SQL> show parameter OPEN_CURSORS;
Note:
If you are using a spfile you can do it through below statement.
alter system set open_cursors=xxx scope=both;


2) In your application code , use For ...Cursors, because that automatically closes the cursor.
    If you cannot use For..Cursor, take care to close the cursors. Otherwise the opened cursors will persist in memory and increase the open_cursors count unnecessarily.



Tuesday, January 17, 2012

How to Enable Archive log Mode

If you are using an spfile



With the database open, issue
ALTER SYSTEM SET log_archive_start = true SCOPE=spfile;
ALTER SYSTEM SET log_archive_dest_1 = "location=D:\Oracle\oradata\orcl\archive" SCOPE=spfile;
ALTER SYSTEM SET log_archive_format = %%ORACLE_SID%%T%TS%S.ARC SCOPE spfile;


Then do the shutdown and mount the database.


connect sys/<pwd> as sysdba
startup mount;
ALTER DATABASE ARCHIVELOG; 
ALTER DATABASE OPEN; 
ALTER SYSTEM SWITCH LOGFILE; (To force the archive generation)
archive log list ; (for see that database is runing on archive or not)




If you are using a pfile


shutdown the database
in the INIT<SID>.ORA set
log_archive_start = true
log_archive_dest_1 = "location=D:\Oracle\oradata\orcl\archive" 
log_archive_format = %%ORACLE_SID%%T%TS%S.ARC


Then do the shutdown and mount the database.


connect sys/<pwd> as sysdba
startup mount;
ALTER DATABASE ARCHIVELOG; 
ALTER DATABASE OPEN; 
ALTER SYSTEM SWITCH LOGFILE; (To force the archive generation) 
archive log list(for see that database is runing on archive or not)







Friday, January 13, 2012

Flash Recovery Area renamed to Fast Recovery Area in 11g

Flash Recovery Area renamed to Fast Recovery Area in 11g
Curious about this renaming? Is it just a word change or is there something else behind ? 

It is just a name/word change. 

Suppose Oracle wanted it to better reflect the meaning - Ultimate goal of Fast Recovery


http://docs.oracle.com/cd/E11882_01/server.112/e10595/whatsnew003.htm#BGGBBGFI

Thursday, January 12, 2012

How to Check SGA size in Oracle Database

Use below sql statements to check the SGA size of a Oracle Database.


sql> SHOW SGA;
or
sql> SELECT name,value/1024/1024 "SGA (MB)" "FROM v$sga;


You can check the Total SGA size from below sql statement.


sql> SELECT sum(value)/1024/1024 "TOTAL SGA (MB)" FROM v$sga;











Using ORADIM to Create Instance on Oracle - Windows Platform

Oradim is an Oracle utility that creates a Service to a database. 
If a database is created upon install, or if you use Database Assistant to create a db, it will automatically use this utility to create a service to the db upon creation of the db. If you double click on the Services icon in Control Panel, you will see all the services that are available to the machine. If a machine has a db running on it, you will see a service by the name of OracleService(SID) with a manual or automatic startup type. If the startup is set to automatic, the db will shutdown/startup whenever the machine is restarted, else you will have to shutdown/startup manually. 


So you have to use oradim only when you create a database without using the Database Configuration Assistant. You have to use Oradim to create services if you created the database manually. 


Example of Oradim to create a service for an 9i database:

Create an instance by specifying the following options:
(type at command prompt) --->

 ORADIM -NEW -SID sid | -SRVC srvc | -ASMSID sid | -ASMSRVC srvc [-SYSPWD pass]
 [-STARTMODE auto|manual] [-SRVCSTART system|demand] [-PFILE file | -SPFILE]
 [-SHUTMODE normal|immediate|abort] [-TIMEOUT secs] [-RUNAS osusr/ospass]



Eg:

C:\oracle\bin\oradim –new –sid MYSID –intpwd <pwd> –maxusers 20 startmode auto –pfile initMYSID.ora







Monday, January 9, 2012

Oracle Spool Command (Output To File)

You can use Oracle SPOOL command to output of a query in SQL Plus in Oracle to an output file.


Below is an example.


SQL> Spool on
SQL> Spool c:\abc.log
SQL> Query
SQL> Spool off



Spool the output to a file without column names included.



SQL> Spool on
SQL> set heading off 
SQL> Spool c:\abc.log
SQL> Query
SQL> Spool off



Difference between ALTER DATABASE RECOVER & RECOVER DATABASE

Do you know the difference between below two commands/methods of recovery..?
You may get confused over these two commands.


1.ALTER DATABASE RECOVER;


2.RECOVER DATABASE;
   or
   RECOVER DATABASE UNTIL CANCEL; 


Both above commands are intend to achieve same task..but only difference is..


(1)Use ALTER DATABASE if you want to do the recoverying step by step, manually , issuing each and every single command to recover the database.


(2)Use the SQLPLUS  'RECOVER' command to have sqlplus automate the steps in (1) for you. 


RECOVER is not even a SQL command, rather it is a SQLPlus command.It is an automated command to do the normal recovery steps.


Oracle Corporation recommends that you use the SQL*Plus RECOVER statement.





Friday, January 6, 2012

Setting ORACLE_SID

The Oracle System ID (SID) is used to uniquely identify a particular database on a system


How to set ORACLE_SID:
Windows:
set ORACLE_SID=orcl


Unix/ Linux:
export ORACLE_SID=orcl


SID is case sensitive in Unix / Linux environments.




How to check the current ORACLE_SID:
Windows:
Go to the commnand prompt and type as


C:\> set ORACLE_SID (This will show if any ORACLE_SID is already set).
C:\> set (To know all the parameters set)


Unix/ Linux:
echo $ORACLE_SID