Posts Tagged ‘Oracle’

Find A String In Database

July 1st, 2017, posted in Oracle
Share

I’ve tried using this statement below to find an appropriate column based on what I think it should be named but it returned no results :

SELECT * from dba_objects WHERE
object_name like '%DTN%'

A column isn't an object. If you mean that you expect the column name to be like '%DTN%', the query you want is:

SELECT owner, table_name, column_name FROM all_tab_columns WHERE column_name LIKE '%DTN%';
Share

Unix for DBA

May 24th, 2017, posted in Solaris
Share

Below are some of the basic unix commands which will be useful for Oracle DBA.

How to kill all similar processes with single command (in this case opmn)

ps -ef | grep opmn |grep -v grep | awk ‘{print $2}’ |xargs -i kill -9 {}

Locating Files under a particular directory

find . -print |grep -i test.sql

Using AWK in UNIX

To remove a specific column of output from a UNIX command – for example to determine the UNIX process Ids for all Oracle processes on server (second column)

ps -ef |grep -i oracle |awk ‘{ print $2 }’

Changing the standard prompt for Oracle Users

Edit the .profile for the oracle user

PS1=”`hostname`*$ORACLE_SID:$PWD>”

Display top 10 CPU consumers using the ps command

/usr/ucb/ps auxgw | head -11

Show number of active Oracle dedicated connection users for a particular ORACLE_SID

ps -ef | grep $ORACLE_SID|grep -v grep|grep -v ora_|wc -l

Display the number of CPU’s in Solaris

psrinfo -v | grep “Status of processor”|wc -l

Display the number of CPU’s in AIX

lsdev -C | grep Process|wc -l

Display RAM Memory size on Solaris

prtconf |grep -i mem

Display RAM memory size on AIX

First determine name of memory device

lsdev -C |grep mem

then assuming the name of the memory device is ‘mem0’

lsattr -El mem0

Swap space allocation and usage

Solaris : swap -s or swap -l

Aix : lsps -a

Total number of semaphores held by all instances on server

ipcs -as | awk ‘{sum += $9} END {print sum}’

View allocated RAM memory segments

ipcs -pmb

Manually deallocate shared memeory segments

ipcrm -m ‘<ID>’

Show mount points for a disk in AIX

lspv -l hdisk13

Display amount of occupied space (in KB) for a file or collection of files in a directory or sub-directory

du -ks * | sort -n| tail

Display total file space in a directory

du -ks .

Cleanup any unwanted trace files more than seven days old

find . *.trc -mtime +7 -exec rm {} \;

Locate Oracle files that contain certain strings

find . -print | xargs grep rollback

Locate recently created UNIX files (in the past one day)

find . -mtime -1 -print

Finding large files on the server (more than 100MB in size)

find . -size +102400 -print

Crontab :

To submit a task every Tuesday (day 2) at 2:45PM

45 14 2 * * /opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1

To submit a task to run every 15 minutes on weekdays (days 1-5)

15,30,45 * 1-5 * * /opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1

To submit a task to run every hour at 15 minutes past the hour on weekends (days 6 and 0)

15 * 0,6 * * opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1

Share

How To Upload Excel/Text File Data Into Oracle Table Using TOAD

February 27th, 2017, posted in Oracle
Share

n this we will explain how to put Excel or text file data into an Oracle table. You can do this easily in SQL Server with a Copy (Ctrl+C) of the data from Excel then open the target table into edit mode and Paste (Ctrl+V). Done.

But this will not work in Oracle.

In an Oracle database you can do it using the import command. I will show you each and every step with snapshots.

Step 1 : Open TOAD.

Step 2 : Write the following query to create a test table:

  1. Create table TESTTABLE
  2. (
  3. NAME varchar2(20),
  4. Address varchar2(100),
  5. RollNo integer
  6. )

Step 3 : Now my table is ready. It’s time to create the data in an Excel file.

Step 4 : Go to Database -> Import -> Table Data.

Step 5 : Select the table you want to import the Excel data to.

Step 6 : Click on show data. Now execute the data button to enable the use. Click on that.

Step 7 : After clicking on Execute Wizard the following screen will open:

Next ->

Step 8 : Now, browse to your Excel file – > Next ->

Next ->

Step 9 : Choose the sheet and click on AutoMap. The AutoMap button will automatically bind your Excel sheet column data with the Oracle table column.

Next ->

Next ->

Here your Excel data has been bound with the table columns. Next ->

Step 10 : Click on Execute to finish the process. It may ask for sheet selection. Click on Okay with the desired sheet.

Here is your uploaded data:

Step 11 : Commit the Task by clicking on the commit button.

Using the preceding procedure you can easily import Excel data. You can also import text flat files data. All steps are nearly the same. The only change is the following step. In this import I need to choose the separator for the flat file. Apart from any separators you can use fixed width. In the attached example I used a comma separator.

I think the procedure is very clear with snapshots. If you have found any mistake in concept, please do comment.

Your comments will make me perfect in the future.

Thanks for reading.

 

Share

AC-00005: No write permissions for creating the Context file – /tmp/temp.xml

September 12th, 2015, posted in Oracle
Share

Problem : 

While making Oracle Application Clone : 

Target System Root Service [enabled] :

Target System Web Entry Point Services [enabled] :

Target System Web Application Services [enabled] :

Target System Batch Processing Services [enabled] :

Target System Other Services [disabled] :

Do you want to preserve the Display [hooraps1:0.0] (y/n) ? : n

Target System Display [erp2:0.0] :
RC-50004: Error occurred in CloneContext:
AC-00005: No write permissions for creating the Context file – /tmp/temp.xml
Raised by oracle.apps.ad.context.AppsContext
Check Clone Context logfile /u07/appprod/apps/apps_st/comn/clone/bin/CloneContext_0908103640.log for details.

ERROR: Context creation not completed successfully.
For additional details review the file /tmp/adcfgclone_17325.err if present.

When you check log file you will get this : 

StackTrace:
java.lang.Exception: AC-00005: No write permissions for creating the Context file – /tmp/temp.xml
Raised by oracle.apps.ad.context.AppsContext
at oracle.apps.ad.context.AppsContext.getOaEnabledValues(AppsContext.java:733)
at oracle.apps.ad.context.CloneContext.setConfigHome(CloneContext.java:2306)
at oracle.apps.ad.context.CloneContext.doClone(CloneContext.java:606)
at oracle.apps.ad.context.CloneContext.main(CloneContext.java:5023)

RC-50004: Error occurred in CloneContext:
AC-00005: No write permissions for creating the Context file – /tmp/temp.xml
Raised by oracle.apps.ad.context.AppsContext
Context file creation not succesful

 

Solution :

Simply go to this path by root user /tmp/temp.xml . Give 777 rights to temp.xl .
And now login with application user and run perl adcfgclone.pl appsTier  !!

GoodLuck !! 🙂

Share

SQL Query / Code To Change English Date To Arabic

September 2nd, 2015, posted in Oracle
Share

SELECT

to_char(SYSDATE,’day dd month yyyy’, ‘nls_calendar=”Arabic Hijrah”’),
to_char(SYSDATE,’day dd month yyyy’, ‘nls_calendar=”English Hijrah”’),
to_char(SYSDATE,’day dd month yyyy’, ‘nls_calendar=”gregorian”’)

FROM DUAL;

SQL Query / Code To Change English Date To Arabic Date,Query To Change English Date To Arabic Date,Code,Change English Date To Arabic Date,  ,Oracle,MySQL,SQL,change english to arabic,Arabic date,english date,date converstaion,conversation,

Share