[E-Bussiness Suite] Background Engine Down


Deskripsi
     Jika Backgroud Engine Oracle E-Bussiness Suite statusnya 'Down' , maka bisa kembali di 'Up' melalui user account setup (not sysadmin).

How To
     1. After login Admin, Goto System Administrator > Requests
     2. Pilih Request Workflow Background Process.
     3. Isi Parameter :
         Default : - Process Deffered : Yes
                      - Process Timeout : Yes
                      - Process Stuck : Yes
     4. Submit Request and done.
     5. Background Engine harusnya sudah 'UP' setelah process running request selesai.


Berikut adalah penjelasan parameter , based on oracle documents :

Item TypeSpecify an item type to restrict this engine to activities associated with that item type. If you do not specify an item type, the engine processes any deferred activity regardless of its item type.
Minimum ThresholdSpecify the minimum cost that an activity must have for this background engine to execute it, in hundredths of a second.
Maximum ThresholdSpecify the maximum cost that an activity can have for this background engine to execute it, in hundredths of a second.
By using Minimum Threshold and Maximum Threshold you can create multiple background engines to handle very specific types of activities. The default values for these arguments are null so that the background engine runs activities regardless of cost.
Process DeferredSpecify whether this background engine checks for deferred activities. Setting this parameter to 'Yes' allows the engine to check for deferred activities.
Process TimeoutSpecify whether this background engine checks for activities that have timed out. Setting this parameter to 'Yes' allows the engine to check for timed out activities.
Process StuckSpecify whether this background engine checks for stuck processes. Setting this parameter to 'Yes' allows the engine to check for stuck processes.

[E-Bussiness Suite] Query Creation Date PR - PO - RR


Deskripsi
     Menampilkan data PR - PO - RR beserta Creation Datenya dan difilter berdasarkan tanggal pembuatan PR , Status PR Approved , dan employee yang membuat (Preparer)

How To
1. Jalan Query Show Hidden View , article bisa dilihat DISINI
2. Jalankan Query dibawah ini :
select distinct PRHA.segment1 as PR
               ,PRHA.CREATION_DATE as CREATE_PR
               ,PRHA.DESCRIPTION as Deskripsi_PR
               ,PRLA.LINE_NUM as LINE
               ,PRLA.ITEM_DESCRIPTION as DESKRIPSI_LINE_PR
               ,PRHA.APPROVED_DATE as Approved_PR
               ,PHA.segment1 as PO
               ,PHA.CREATION_DATE as CREATE_PO
               ,PHA.APPROVED_DATE as Approved_PO
               ,RVHV.RECEIPT_NUM as RECEIPT_NUMBER
               ,RVHV.CREATION_DATE as CREATE_RECEIPT
       
from po_requisition_headers_all PRHA
       ,po_requisition_lines_all PRLA
       ,po_line_locations_all PLLA
       ,po_headers_all PHA
       ,po_lines_all PLA
       ,RCV_SHIPMENT_LINES RSL
       ,RCV_VRC_HDS_V RVHV

where prha.creation_date >= to_date('1/1/2013','dd/mm/yyyy')
and prha.requisition_header_id = PRLA.requisition_header_id(+)
and PRLA.line_location_id = PLLA.line_location_id(+)
and PHA.po_header_id(+) = PLA.po_header_id
and PLA.po_line_id(+) = plla.po_line_id
AND PHA.po_header_id = RSL.po_header_id (+)
AND RSL.shipment_header_id = RVHV.shipment_header_id(+)
AND PRHA.AUTHORIZATION_STATUS = 'APPROVED'
AND (PRHA.PREPARER_ID = 646 OR PRHA.PREPARER_ID =743 )

order by PRHA.CREATION_DATE , PRLA.LINE_NUM as LINE

*NOTE :
Untuk mendapatkan list dari PREPARER / EMPLOYEE (Preparer_ID), bisa didapat dari table PER_PEOPLE_F (Person_ID).

[VB.NET] Thread Execution


Deskripsi
      Thread is the smallest sequence of programmed instructions that can be managed independently , normally if we write coding and running that app , it will execute the code by sequential.
and what if we need process that running with main code on the same time but independently ? 
so if main code parsing interupted by somehow code (example sleep) to stop execution temporary the another instance still running. USE THREAD.

How to

Concept :
1. Imports System.Threading
2. create var global thread3. create function / sub mythread(example)
4. create object thread and addressing to that function / sub mythread (example)

here's the code :
* create 1 button and double click

Imports System.Threading
 Private objthread As Thread

Public Sub mythread()
  ' your routine here
End Sub

Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdthread.Click
        objthread = New Thread(AddressOf mythread)
        objthread .IsBackground = True
        objthread .Name = "NameThread"
        objthread .Start() 'Start Thread
End Sub

Note : * after execution of function complete , thread automatically stop.
             you can check them using method objthread.isAlive
          * if you want keep the thread still alive , you can use infinite loop , but add sleep 1 - 3 second.
             to use sleep use : System.Threading.Thread.Sleep(3000)

[VB.NET] CRUD using ADO.NET


Deskripsi
    Create, Update , Read / Retrieval , Insert on VB.NET (Different from VB 6) , before go to the next step we must know conceptual ADO.NET. here's the picture (taken from MSDN).



How To

Concept :
1. Import OleDb
2. Create Connection String , if you don't know how to create read this article
3. Specify the type of statement :
    - Create , Update , Insert is execute type (required open connection) , you can use adapter (not use open connection)  it's not recommended but it's depends on user habits (manipulation data should use open connection).
    - Read / Retrieval is safe without required open connection , it's just get the data without manipulation.

i only give raw code vb.net , you should create your own class in order to look better code and manageable, ok let's start :)

SQL Type Execute (Create , Update , Insert), create 1 button on form and double click :
// import collection
Imports System.Data.OleDb
Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdshutdown.Click
// Declare variable
Dim dbcmd
Dim strsql As String
Dim dbconn = New OleDbConnection
// create connection string , and open the connection
dbconn.ConnectionString = "Provider=SQLOLEDB.1;Password=xxxxx;Persist Security Info=True;User ID=sa;Initial Catalog=mytable;Data Source=192.168.0.xx"
dbconn.Open()
//create your sql statement
strsql = "insert test (id,name) values ('1','yeah')"
//add your sql statement to oledb command
dbcmd = New OleDbCommand(strsql, dbconn)
 dbcmd.CommandType = CommandType.Text
//executed the oledbcommand 
dbcmd.ExecuteReader()
End Sub


SQL Type Retrieval(select), create 1 button and 1 datagridview on form and double click the button:
// import collection
Imports System.Data.OleDb
Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdshutdown.Click
// Declare variable
Dim dbcmd,adaptor, datacontent
Dim strsql As String
Dim dbconn = New OleDbConnection
// create connection string , and open the connection
dbconn.ConnectionString = "Provider=SQLOLEDB.1;Password=xxxxx;Persist Security Info=True;User ID=sa;Initial Catalog=mytable;Data Source=192.168.0.xx"
//dbconn.Open()
//create your sql statement
strsql = "select * from table where xxx=yyy"
//add your sql statement to oledb command
dbcmd = New OleDbCommand(strsql, dbconn)
dbcmd.CommandType = CommandType.Text
//running sql command via adapter (look the conceptual)
adaptor = New OleDbDataAdapter(dbcmd)
datacontent= New DataTable
adaptor.Fill(datacontent)
datagridview1.DataSource = datacontent
End Sub     

note : to fill data on gridview , datagridview require an object datatable that filled by adaptor , look my red mark.



Single Retrieval
Dim adaptor
Dim strsql As String
Dim i As Double
Dim dbcmd As OleDbCommand
Dim datacontent As DataTable
Dim dbconn = New OleDbConnection
Dim reader As OleDbDataReader
Dim fetchReader As OleDbDataReader

dbconn.ConnectionString = "FILE NAME=" & My.Application.Info.DirectoryPath & "\SQLServer.udl"
strsql = "select USER_ID,USERNAME from MS_USER_LOGIN"

 'add your sql statement to oledb command
dbcmd = New OleDbCommand(strsql, dbconn)
dbcmd.CommandType = CommandType.Text
dbconn.Open()

reader = dbcmd.ExecuteReader
datacontent = New DataTable
datacontent.Load(reader)

'item(1) is index row number 2 , the first row always at index 0.
'ItemArray(1) refers index column, total index based on your query and always start at index 0
MsgBox(datacontent.Rows.Item(1).ItemArray(1).ToString())
MsgBox(datacontent.Rows(0).Field(Of String)("USERNAME").ToString)

'this for fetching all row
For Each row As DataRow In datacontent.Rows
      MsgBox(row.Field(Of String)("USERNAME").ToString)
Next

reader.Close()

[Database][Sql Server 2005] Determine free space


Deskripsi
     Get all Disk Space , Freespace , Filename , Filetype . Drive , Physical Path database file.

How To

Source taken from This website, just run query below :

USE MASTER

GO

CREATE TABLE #TMPFIXEDDRIVES (
  DRIVE  CHAR(1),
  MBFREE INT)

INSERT INTO #TMPFIXEDDRIVES
EXEC xp_FIXEDDRIVES

CREATE TABLE #TMPSPACEUSED (
  DBNAME    VARCHAR(50),
  FILENME   VARCHAR(50),
  SPACEUSED FLOAT)

INSERT INTO #TMPSPACEUSED
EXEC( 'sp_msforeachdb''use ?; Select ''''?'''' DBName, Name FileNme,
fileproperty(Name,''''SpaceUsed'''') SpaceUsed from sysfiles''')

SELECT   C.DRIVE,
         CASE
           WHEN (C.MBFREE) > 1000 THEN CAST(CAST(((C.MBFREE) / 1024.0) AS DECIMAL(18,2)) AS VARCHAR(20)) + ' GB'
           ELSE CAST(CAST((C.MBFREE) AS DECIMAL(18,2)) AS VARCHAR(20)) + ' MB'
         END AS DISKSPACEFREE,
         A.NAME AS DATABASENAME,
         B.NAME AS FILENAME,
         CASE B.TYPE
           WHEN 0 THEN 'DATA'
           ELSE TYPE_DESC
         END AS FILETYPE,
         CASE
           WHEN (B.SIZE * 8 / 1024.0) > 1000
           THEN CAST(CAST(((B.SIZE * 8 / 1024) / 1024.0) AS DECIMAL(18,2)) AS VARCHAR(20)) + ' GB'
           ELSE CAST(CAST((B.SIZE * 8 / 1024.0) AS DECIMAL(18,2)) AS VARCHAR(20)) + ' MB'
         END AS FILESIZE,
         CAST((B.SIZE * 8 / 1024.0) - (D.SPACEUSED / 128.0) AS DECIMAL(15,2)) SPACEFREE,
         B.PHYSICAL_NAME
FROM     SYS.DATABASES A
         JOIN SYS.MASTER_FILES B
           ON A.DATABASE_ID = B.DATABASE_ID
         JOIN #TMPFIXEDDRIVES C
           ON LEFT(B.PHYSICAL_NAME,1) = C.DRIVE
         JOIN #TMPSPACEUSED D
           ON A.NAME = D.DBNAME
              AND B.NAME = D.FILENME
ORDER BY DISKSPACEFREE,
         SPACEFREE DESC
       
DROP TABLE #TMPFIXEDDRIVES

DROP TABLE #TMPSPACEUSED

[Database][Sql Server] Time out expired


Deskripsi
      the cause is still unknown , may be crash because large of data or the false setting or bugs. but mostly come from crash.

HowTo

Step 1 : Set Execution Time-Out
1) Selected Tools -> Options
2) Expanded the "Query Execution" node
3) Clicked on "SQL Server"
4) Set value for "Execution time-out" from 0 to 1800 (30 Minutes Query Timeout)

Step 2 : Set Transaction Time-Out
1) Selected Tools -> Options
2) Expanded the "Designer" node
3) Clicked on "Table and Database Designer"
4) Uncheck Override Connection String Time-Out Value
5) Check again Override Connection String Time-Out Value
6) Set value for "Transaction time-out after" from 30 to 1800 (30 Minutes Query Timeout)

Step 3 : Restart SQL Server to apply settings (just Stop and Start Again)

Step 4 : Test you table by viewing your data. if success then done , but if error still exist go to step 5

Step 5 : Open your Database , expand and find the table which problematic , left click and find REFRESH tools near summary tag. if still exist go to step 6.

Step 6 : i don't know .....