Thursday, September 28, 2017

Oracle / PLSQL: TO_DATE Function

This Oracle tutorial explains how to use the Oracle/PLSQL TO_DATE function with syntax and examples.

Description

The Oracle/PLSQL TO_DATE function converts a string to a date.

Syntax

The syntax for the TO_DATE function in Oracle/PLSQL is:
TO_DATE( string1 [, format_mask] [, nls_language] )

Parameters or Arguments

string1
The string that will be converted to a date.
format_mask
Optional. This is the format that will be used to convert string1 to a date. It can be one or a combination of the following values:
ParameterExplanation
YEARYear, spelled out
YYYY4-digit year
YYY
YY
Y
Last 3, 2, or 1 digit(s) of year.
IYY
IY
I
Last 3, 2, or 1 digit(s) of ISO year.
IYYY4-digit year based on the ISO standard
RRRRAccepts a 2-digit year and returns a 4-digit year.
A value between 0-49 will return a 20xx year.
A value between 50-99 will return a 19xx year.
QQuarter of year (1, 2, 3, 4; JAN-MAR = 1).
MMMonth (01-12; JAN = 01).
MONAbbreviated name of month.
MONTHName of month, padded with blanks to length of 9 characters.
RMRoman numeral month (I-XII; JAN = I).
WWWeek of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
WWeek of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.
IWWeek of year (1-52 or 1-53) based on the ISO standard.
DDay of week (1-7).
DAYName of day.
DDDay of month (1-31).
DDDDay of year (1-366).
DYAbbreviated name of day.
JJulian day; the number of days since January 1, 4712 BC.
HHHour of day (1-12).
HH12Hour of day (1-12).
HH24Hour of day (0-23).
MIMinute (0-59).
SSSecond (0-59).
SSSSSSeconds past midnight (0-86399).
AM, A.M., PM, or P.M.Meridian indicator
AD or A.DAD indicator
BC or B.C.BC indicator
TZDDaylight savings information. For example, 'PST'
TZHTime zone hour.
TZMTime zone minute.
TZRTime zone region.
nls_language
Optional. This is the nls language used to convert string1 to a date.

Returns

The TO_DATE function returns a date value.

Applies To

The TO_DATE function can be used in the following versions of Oracle/PLSQL:
  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let's look at some Oracle TO_DATE function examples and explore how to use the TO_DATE function in Oracle/PLSQL.
For example:
TO_DATE('2003/07/09', 'yyyy/mm/dd')
Result: date value of July 9, 2003

TO_DATE('070903', 'MMDDYY')
Result: date value of July 9, 2003

TO_DATE('20020315', 'yyyymmdd')
Result: date value of Mar 15, 2002
You could use the TO_DATE function with the dual table as follows:
SELECT TO_DATE('2015/05/15 8:30:25', 'YYYY/MM/DD HH:MI:SS')
FROM dual;
This would convert the string value of 2015/05/15 8:30:25 to a date value

Tuesday, September 26, 2017


telnet: connect to address 10.1.150.139: Connection refused

[root@ve ~]#  netstat -tulpn | grep 1521
[root@ve ~]#  ps aux | grep oracle

sqlplus / as sysdba
startup
lsnrctl start listener

[root@ve2 ~]# netstat -tuplen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       User       Inode      PID/Program name
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      0          10168      1641/rpcbind
tcp        0      0 0.0.0.0:37779               0.0.0.0:*                   LISTEN      29         1931       1685/rpc.statd
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      0          10766      1859/sshd
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      0          11715      1740/cupsd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      0          10825      1939/master
tcp        0      0 :::37382                    :::*                        LISTEN      1500       22646      6882/ora_d000_dbtes
tcp        0      0 :::111                      :::*                        LISTEN      0          10173      1641/rpcbind
tcp        0      0 :::1521                     :::*                        LISTEN      1500       21481      6952/tnslsnr
tcp        0      0 :::23602                    :::*                        LISTEN      29         1939       1685/rpc.statd
tcp        0      0 :::22                       :::*                        LISTEN      0          10768      1859/sshd
tcp        0      0 ::1:631                     :::*                        LISTEN      0          11714      1740/cupsd
tcp        0      0 ::1:25                      :::*                        LISTEN      0          10827      1939/master
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               0          10165      1641/rpcbind
udp        0      0 0.0.0.0:24700               0.0.0.0:*                               29         1927       1685/rpc.statd
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               0          11717      1740/cupsd
udp        0      0 0.0.0.0:968                 0.0.0.0:*                               0          10167      1641/rpcbind
udp        0      0 0.0.0.0:1013                0.0.0.0:*                               0          1921       1685/rpc.statd
udp        0      0 :::9648                     :::*                                    29         1935       1685/rpc.statd
udp        0      0 ::1:61374                   :::*                                    1500       22641      6882/ora_d000_dbtes
udp        0      0 ::1:14353                   :::*                                    1500       22586      6850/ora_pmon_dbtes
udp        0      0 :::111                      :::*                                    0          10170      1641/rpcbind
udp        0      0 :::47502                    :::*                                    1500       21758      6878/ora_mmon_dbtes
udp        0      0 ::1:23356                   :::*                                    1500       21664      6884/ora_s000_dbtes
udp        0      0 :::968                      :::*                                    0          10172      1641/rpcbind

Thursday, September 21, 2017


Increase JAVA heap size in Oracle Application (EBS) 12.2.5



select developer_parameters from  fnd_cp_services
WHERE service_id = (SELECT manager_type
FROM fnd_concurrent_queues
WHERE concurrent_queue_name = 'FNDCPOPP');

You simply increase the value.


   UPDATE fnd_cp_services SET developer_parameters =
'J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx4096m'
WHERE service_id = (SELECT manager_type
FROM fnd_concurrent_queues
WHERE concurrent_queue_name = 'FNDCPOPP');


Commit;
To BottomTo Bottom

R12.0.6+ :  ORACLE RECEIVABLES (AR): RECEIPT DATA SETUP DIAGNOSTIC TEST

To execute the test, do the following:
  1. Start Oracle E-Business Suite
  2. Connect to responsibility Application Diagnostics
  3. Select the Diagnose menu option
  4. Click button Select Application and select Application "Oracle Receivables"
  5. Scroll down to group "Receipts"
  6. Select test name "Receipt Data"
  7. Input Parameters (* required)
      Responsibility ID  
      Cash Receipt Id  
      Include GL Tables  

Friday, September 8, 2017


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


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 !!

RC-50013 Fatal: Instantiate driver

Error:
Seen the issue during the execution of adcfgclone.
perl adcfgclone.pl dbTechStack
====================
WARNING: [AutoConfig Error Report]
The following report lists errors AutoConfig encountered during each
phase of its execution. Errors are grouped by directory and phase.
The report format is:
<filename> <phase> <return code where appropriate>
[APPLY PHASE]
AutoConfig could not successfully execute the following scripts:
Directory: /EBS/oracle/product/12c/perl/bin/perl -I /EBS/oracle/product/12c/perl/lib/5.14.1 -I /EBS/oracle/product/12c/perl/lib/site_perl/5.14.1 -I /EBS/oracle/product/12c/appsutil/perl /EBS/oracle/product/12c/appsutil/clone
ouicli.pl INSTE8_APPLY 1
AutoConfig is exiting with status 1
WARNING: RC-50013: Fatal: Instantiate driver did not complete successfully.
/EBS/oracle/product/12c/appsutil/driver/regclone.drv
====================
CAUSE:
The script was trying to register the oracle home in inventory but its failing to update it.
SOLUTION:
Please delete existing files under oraInventory folder and retry the adcfgclone.
[oracle@ebsdb01 bin]$ cat /etc/oraInst.loc
inst_group=dba
inventory_loc=/EBS/oracle/product/oraInventory
cd /EBS/oracle/product
rm -rf oraInventory
mkdir oraInventory
Retry :   perl adcfgclone.pl dbTechStack

Wednesday, September 6, 2017


ORA-02062: distributed recovery received DBID


select * from DBA_2PC_PENDING;
select * from DBA_2PC_NEIGHBORS;
select * from sys.pending_trans$;
select * from SYS.PENDING_SESSIONS$;
select * from SYS.PENDING_SUB_SESSIONS$;

SELECT KTUXEUSN, KTUXESLT, KTUXESQN, /* Transaction ID */
KTUXESTA Status,
KTUXECFL Flags
FROM x$ktuxe
WHERE ktuxesta!='INACTIVE'


1. Force committing the transactions in collecting state:
COMMIT FORCE 'transaction_id',commit#;

2. execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('transaction_id');

Transaction ID:
160.15.14218
17.25.695140
22.22.673214


Commit;

  RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...