Search This Blog

Using SQL*Plus to Unlock Accounts and Reset Passwords

oracle sql


Using SQL*Plus to Unlock Accounts and Reset Passwords

Use this SQL*Plus procedure to unlock and reset user account passwords.

  1. Log in as the Oracle Database software owner user.
  2. Set the ORACLE_HOME and ORACLE_SID environment variables.
  3. Start SQL*Plus and log in as the SYS user, connecting as SYSDBA:

$ $ORACLE_HOME/bin/sqlplus
SQL> CONNECT SYS as SYSDBA
Enter password: sys_password 

4. To unlock an account:

ALTER USER account ACCOUNT UNLOCK;

5. To reset the password:

ALTER USER user_name IDENTIFIED BY new_password; 


Note:

If you unlock an account but do not reset the password, then the password remains expired. The first time someone connects as that user, they must change the user's password.

For more SQL visit our SQL Tutorial.

Link Between AR and GL with XLA tables in R12

AR to GL Link in oracle apps 

oracle ebs r12


Data Flow from AR to XLA to GL


Important SQL queries and tables related to Oracle GL

 

oracle ebs R12

Oracle Applications

--sql to find code combinations

 SELECT code_combination_id, enabled_flag
         FROM gl_code_combinations gcc
             ,gl_sets_of_books gsb
        WHERE gcc.chart_of_accounts_id = gsb.chart_of_accounts_id
          AND segment1 = p_segment1  --pass segment details as your acct structure
          AND segment2 = p_segment2
          AND segment3 = p_segment3
          AND segment4 = p_segment4
          AND segment5 = p_segment5
          AND segment6 = p_segment6
           AND set_of_books_id = p_set_of_book_id; --pass set of books id


--SQL to derive gl CATEGORY NAME

 SELECT *
               FROM gl_je_categories gjc
             WHERE UPPER (gjc.user_je_category_name) = UPPER (:p_cat_name);
         
         
            
--SQL to derive  gl SOURCE NAME

  SELECT *
              FROM gl_je_sources gjs
             WHERE UPPER (gjs.user_je_source_name) = UPPER (:p_source_name);

-- sql to derive gl ledger id

SELECT ledger_id
           FROM gl_ledgers
          WHERE UPPER (NAME) = UPPER (:name);


--SQL to check THAT PARTICULAR PERIOD IS OPEN OR NOT BY PASSING PARAMETER AS PERIOD NAME AND LEDGER ID

SELECT 'X'
               FROM apps.gl_period_statuses gps,
                    apps.fnd_application fa,
                    apps.gl_periods glp
              WHERE gps.period_name = glp.period_name
                AND gps.closing_status IN ('O', 'F')
                AND fa.application_short_name = 'SQLGL'
                AND gps.application_id = fa.application_id
                AND glp.period_set_name = 'JLP_GL_CALENDER' --pass period set name
                AND p_transaction_date BETWEEN glp.start_date AND glp.end_date
                AND gps.ledger_id = v_ledger_id; --set of books id

To find balances of all Assets, Liabilities & Shareholders Equity accounts 

SELECT * FROM (
SELECT
GL.GL_CODE_COMBINATIONS.SEGMENT1 LEGAL_ENTITY,
GL.GL_CODE_COMBINATIONS.SEGMENT2 ACCOUNT,
GL.GL_CODE_COMBINATIONS.SEGMENT5 ENTRY_IND,
GL.GL_BALANCES.PERIOD_NAME, GL_CODE_COMBINATIONS.ACCOUNT_TYPE ,
SUM((NVL(BEGIN_BALANCE_DR,0)-
NVL(BEGIN_BALANCE_CR,0))+
(NVL(PERIOD_NET_DR,0)-
NVL(PERIOD_NET_CR,0))) YTD_ACTUAL_AMOUNT
FROM
GL.GL_BALANCES,
GL.GL_CODE_COMBINATIONS
WHERE GL.GL_BALANCES.CODE_COMBINATION_ID=GL.GL_CODE_COMBINATIONS.CODE_COMBINATION_ID
AND GL.GL_CODE_COMBINATIONS.ACCOUNT_TYPE IN ('O','L','A')
AND GL.GL_BALANCES.SET_OF_BOOKS_ID = 1
AND GL.GL_BALANCES.PERIOD_NAME = 'DEC-13'
AND GL.GL_BALANCES.CURRENCY_CODE = 'USD'
AND GL.GL_BALANCES.ACTUAL_FLAG ='A'
GROUP BY SEGMENT1, SEGMENT2, SEGMENT5, PERIOD_NAME , ACCOUNT_TYPE
ORDER BY ACCOUNT_TYPE,SEGMENT1 ) WHERE YTD_ACTUAL_AMOUNT <>0 ;

QUERY TO CHECK PERIODS STATUS (OPEN/CLOSE) FOR ALL MODULES

QUERY TO CHECK PERIODS STATUS (OPEN/CLOSE) FOR ALL MODULES

oracle ebs r12


 SELECT ROWID,

  (SELECT application_short_name

  FROM fnd_application fa
  WHERE fa.application_id = gps.application_id
  ) application,
  (SELECT name
  FROM gl_sets_of_books gsp
  where GSP.SET_OF_BOOKS_ID = GPS.SET_OF_BOOKS_ID
  ) SETOFBOOK,
  period_name,
  closing_status,
  DECODE (gps.closing_status, 'O', 'Open', 'C', 'Closed', 'F', 'Future', 'N', 'Never' ) status,
  period_num,
  period_year,
  start_date,
  end_date
from GL_PERIOD_STATUSES GPS
WHERE PERIOD_YEAR = '2018'
ORDER BY period_year DESC,
  period_num DESC

Query to Get On-hand Stock at Organization, Subinventory, Locator for the lot and non Lot Items

oracle ebs r12


 SELECT

    mp.organization_code,
    mpoq.subinventory_code,
    mil.segment1|| '.'|| mil.segment2|| '.'|| mil.segment3|| '.'|| mil.segment4 locator,
    msib.inventory_item_id,
    msib.segment1 item_number,
    msib.description,
    msib.inventory_item_status_code item_status,
    msib.primary_uom_code,
    SUM(mpoq.primary_transaction_quantity) onhand_qty,
    mpoq.secondary_uom_code,
    SUM(mpoq.secondary_transaction_quantity) sec_onhand_qty,
    mln.lot_number,
    TO_CHAR(mln.expiration_date,'DD-MON-RRRR') expiration_date,
    mms1.status_code lot_status,
    msib.organization_id
FROM
    mtl_system_items_b msib,
    mtl_item_status mis,
    mtl_item_locations mil,
    org_organization_definitions mp,
    mtl_lot_numbers mln,
    mtl_onhand_quantities_detail mpoq,
    mtl_material_statuses_tl mms1,
    mtl_material_statuses_tl mms2,
    mtl_material_statuses_tl mms3,
    mtl_secondary_inventories msi
WHERE
    1 = 1
    AND   mln.inventory_item_id = msib.inventory_item_id
    AND   mln.organization_id = msib.organization_id
    AND   mis.inventory_item_status_code = msib.inventory_item_status_code
    AND   msib.organization_id = mp.organization_id
    AND   mil.inventory_location_id = mpoq.locator_id
    AND   mil.organization_id = mln.organization_id
    AND   mln.inventory_item_id = mpoq.inventory_item_id (+)
    AND   mln.organization_id = mpoq.organization_id (+)
    AND   mln.lot_number = mpoq.lot_number (+)
    AND   mpoq.organization_id = msi.organization_id
    AND   mpoq.subinventory_code = msi.secondary_inventory_name
    AND   mms1.status_id = mln.status_id
    AND   mms2.status_id = msi.status_id
    AND   mms3.status_id = mil.status_id
    AND   mms1.language = userenv('LANG')
    AND   mms2.language = userenv('LANG')
    AND   mms3.language = userenv('LANG')
GROUP BY
    mp.organization_code,
    msib.segment1,
    msib.description,
    msib.inventory_item_id,
    msib.organization_id,
    mln.lot_number,
    mil.inventory_location_id,
    msi.secondary_inventory_name,
    msib.inventory_item_status_code,
    msi.attribute6,
    mms1.status_code,
    mms2.status_code,
    mms3.status_code,
    msi.attribute4,
    mil.segment1,
    mil.segment2,
    mil.segment3,
    mil.segment4,
    msib.primary_uom_code,
    mpoq.subinventory_code,
    mpoq.secondary_uom_code,
    ( mln.expiration_date - SYSDATE ),
    msib.shelf_life_days,
    TO_CHAR(mln.expiration_date,'DD-MON-RRRR'),
    mln.status_id,
    mpoq.locator_id,
    mp.operating_unit,
    mln.attribute14,
    msi.reservable_type
UNION ALL
SELECT
    mp.organization_code,
    a.subinventory_code,
    mil.segment1|| '.'|| mil.segment2|| '.'|| mil.segment3|| '.'|| mil.segment4 locator,
    a.inventory_item_id,
    b.segment1,
    b.description,
    b.inventory_item_status_code item_status,
    b.primary_uom_code,
    SUM(a.primary_transaction_quantity) primary_transaction_quantity,
    a.secondary_uom_code,
    SUM(a.secondary_transaction_quantity) secondary_transaction_quantity,
    a.lot_number,
    NULL expiration_date,
    NULL lot_status,
    a.organization_id
FROM
    mtl_onhand_quantities_detail a,
    mtl_system_items_b b,
    org_organization_definitions mp,
    mtl_item_locations mil
WHERE
    1 = 1
    AND   mp.organization_id = b.organization_id
    AND   a.organization_id = b.organization_id
    AND   a.inventory_item_id = b.inventory_item_id
    AND   mil.inventory_location_id = a.locator_id
    AND   b.lot_control_code = 1
    AND   b.serial_number_control_code = 1
GROUP BY
    mp.organization_code,
    a.subinventory_code,
    mil.segment1,
    mil.segment2,
    mil.segment3,
    mil.segment4,
    a.inventory_item_id,
    b.segment1,
    b.description,
    b.inventory_item_status_code,
    b.primary_uom_code,
    a.secondary_uom_code,
    a.lot_number,
    a.organization_id;