Search This Blog

Monday, December 4, 2023

Oracle : ORA-01591: lock held by in-doubt distributed transaction

 

f you got ” ORA-01591: lock held by in-doubt distributed transaction ” error, it means there are some uncommitted transactions in the database.

We need to perform rollback or commit force for Uncommitted transactions to solve this problem.


ORA-01591

You can query uncommitted or pending transaction with following script. This script will generate rollback force command also, so you can execute the result of following command.


You can check from your user schema but execute rollback or commit  from SYS user .

SQL> select 'rollback force '''||local_tran_id||''';' from DBA_2PC_PENDING where state='prepared';

rollback force '72.6.1262301';


Then from SYS user execute below command:

SQL> rollback force '72.6.1262301';


SQL> commit force '72.6.1262301';

Sunday, August 6, 2023

Enable local network access to sites on WAMP Server 3.2.6

 

In the place of httpd.conf , in the follwoing tagg , add

<Directory "d:/wamp/www/">

  # Require local

    Require all granted


     Order Deny,Allow

     Allow from all

</Directory>


also open httpd-vhosts.conf , modfy as below

<VirtualHost *:80>

    #Require local 

    Require all granted

</Directory>

</VirtualHost>

Saturday, May 27, 2023

Weblogic: java.sql.SQLException: ORA-28001: the password has expired weblogic service start (During Admin Server start)

C:>sqlplus /nolog
SQL> connect / as SYSDBA
SQL> select * from dba_profiles;
SQL> alter profile default limit password_life_time unlimited;
SQL> alter user identified by ;
SQL> commit;

SQL> exit; 

First connect SYS users in the pluggable database:

We know, belows users are needed for WEBLOGIC start. May be, password of foloowing users may expire or locked account. 

DEV_IAU_VIEWER

DEV_IAU_APPEND

DEV_IAU

DEV_OPSS

DEV_STB

DEV_WLS

DEV_WLS_RUNTIME


For all above users, The following command needs to run from SYS user:


 alter user DEV_WLS account unlock

   alter user DEV_WLS_RUNTIME identified by ABc#654

Monday, March 27, 2023

Enable Desktop Environment : GNOME Desktop (Fedora Linux)

[root@dlp ~]# dnf -y group install "Basic Desktop" GNOME

[root@dlp ~]# startx 

[root@dlp ~]#yum update

Saturday, December 10, 2022

List of FIles using Query in a Directory: Oracle

 -- Create objects to support SELECT statements against server directories.

-- Make sure that the user is the JAVAUSERPRIV

-- Akter Hossain  naosolver.blogspot.com

 

 

create table DIRECTORY_LIST

(

  filename VARCHAR2(255),

  length   NUMBER,

  mod_date DATE,

  type     VARCHAR2(1)

);

 

CREATE OR REPLACE TYPE t_dir_list_rec AS OBJECT

(

  filename VARCHAR2(255),

  length   NUMBER,

  mod_date DATE,

  TYPE     VARCHAR2(1)

);

/

 

CREATE OR REPLACE TYPE t_dir_list_tab AS TABLE OF t_dir_list_rec;

/

 

create or replace and compile java source named "DirList" as

import java.io.*;

import java.sql.*;

import java.text.SimpleDateFormat;

import java.util.Date;

 

public class DirList

{

public static void getList(String directory)

                   throws SQLException

{

    //Thanks to asktom.oracle.com for initial code sample

 

    File path = new File( directory );

    String[] list = path.list();

    String element;

 

    File fileObject;

    long length;

    String dateStr, type;

    Date now = new Date();

    SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy H:m:s");

 

    for(int i = 0; i < list.length; i++)

    {

        element = list[i];

        fileObject = new File(directory + File.separatorChar + list[i]);

        length = fileObject.length();

        if (fileObject.isDirectory()) {

          type = "d";

        } else if (fileObject.isFile()) {

          type = "f";

        } else {

          type = "?";

        }

 

        java.util.Date d = new java.util.Date(fileObject.lastModified());

        dateStr = format.format(d);

 

         sql { INSERT INTO directory_list (filename,length, mod_date, type)

               VALUES (:element, :length, to_date(:dateStr,'dd-mm-yyyy hh24:mi:ss'), :type) };

    }

}

 

}

/

 

create or replace procedure get_dir_list( p_directory in varchar2 )

as language java

name 'DirList.getList( java.lang.String )';

/

 

CREATE OR REPLACE PROCEDURE call_get_dir_list(p_directory IN VARCHAR2) IS

  PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

  EXECUTE IMMEDIATE 'truncate table directory_list';

  get_dir_list(p_directory);

  COMMIT;

END;

/

 

CREATE OR REPLACE FUNCTION dir_list_fn(p_directory IN VARCHAR2)

  RETURN t_dir_list_tab

  PIPELINED IS

  TYPE l_cur_type IS REF CURSOR;

  l_cur l_cur_type;

  l_rec directory_list%ROWTYPE;

  l_sql VARCHAR2(1000);

  x     NUMBER;

BEGIN

  l_sql := 'SELECT * FROM directory_list';

  call_get_dir_list(p_directory);

 

  OPEN l_cur FOR l_sql;

  LOOP

    FETCH l_cur

      INTO l_rec;

    EXIT WHEN l_cur%NOTFOUND;

    PIPE ROW(t_dir_list_rec(filename => l_rec.filename,

                            length   => l_rec.length,

                            mod_date => l_rec.mod_date,

                            TYPE     => l_rec.type));

  END LOOP;

 

  RETURN;

 

END dir_list_fn;

/

 

col filename for a30

col type for a5

set pagesize 30

set linesize 100

set termout on feedback on


LENGTH MOD_DATE  TYPE

 

SELECT * FROM TABLE(dir_list_fn('/')) ORDER BY filename;

Saturday, September 24, 2022

Oracle Job every 30 minutes using DBMS_SCHEDULER.CREATE_JOB package

 

Excample : 


begin

    DBMS_SCHEDULER.CREATE_JOB (

         job_name             => 'test_gmt_prod30min',

         job_type             => 'STORED_PROCEDURE',

         job_action           => 'TESTSCHEMA.DPR_TEST_PROCEDURE_NAME',

         start_date           => timestamp '2022-09-24 10:15:00',

         repeat_interval      => 'FREQ=MINUTELY;INTERVAL=30;',

         enabled              => TRUE);

end;

Tuesday, November 30, 2021

Oracle : ORA-00333: redo log read error block XXXX count XXXX


As per Oracle information, ORA-00333 is caused by an IO error while reading the log described in the accompanying error. The resolution is to restore accessibility to the file, or get another copy of the file.

First run following command:

1. SQL> Conn sys as sysdba

          Pass: 

 2. SQL> Shutdown immediate;


 3.  SQL> startup mount;


4. SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

 

5. SQL> Shutdown immediate;

6. SQL> alter database open resetlogs;

   Here , you will get error. Then  try next command.


7. SQL>recover database until cancel;

   For any promopt error or anything, just press ENTER ( I followed) .

8. SQL> alter database open resetlogs;


9. SQL> Shutdown immediate;


10. SQL> Startup


After database open, please take backup first then try following. 


11. SQL> Shutdown immediate;


12. SQL> startup mount;


13. SQL> alter system set "_allow_resetlogs_corruption"=false  scope=spfile;

14. SQL> Shutdown immediate;

15. SQL> startup