Blog

ORA-00054: resource busy and acquire with NOWAIT

To check which session is holding the object:

select a.inst_id, sid, serial#, username, machine  
from gv$session a, gv$locked_object b, dba_objects c
where b.object_id = c.object_id
and a.sid = b.session_id
and a.inst_id=b.inst_id
and OBJECT_NAME='TABLENAME';


INST_ID SID SERIAL# USERNAME MACHINE OWNER OBJECT_NAME
------- ----- ------- ---------- ----------- ---------- -------------
2 3365 42069 SYS TESTSERVER TESTUSER TABLENAME

Kill the session, then the error should disappear.

ORA-28003: password verification for the specified password failed

The following error occurs when trying to change user password in Oracle Database.

SQL> alter user TESTUSER identified by "TestPassword";
alter user TESTUSER identified by "TestPassword";
*
ERROR at line 1:
ORA-28003: password verification for the specified password failed

Check user profile:

SQL> select profile from dba_users where username='TESTUSER';

PROFILE
------------------------------------------------------
TEST_USER_PROFILE

Find password verify function

SQL> select RESOURCE_NAME,RESOURCE_TYPE,LIMIT 
FROM DBA_PROFILES
WHERE PROFILE='TEST_USER_PROFILE'
AND RESOURCE_NAME='PASSWORD_VERIFY_FUNCTION';

RESOURCE_NAME RESOURCE LIMIT
-------------------------- --------- ----------------------
PASSWORD_VERIFY_FUNCTION PASSWORD TEST_USER_VFY_FN

Extract code of password verify function

SQL> select OWNER,substr(TEXT,1,50)  
from dba_source
where NAME='TEST_USER_VFY_FN'
order by line;

OWNER SUBSTR(TEXT,1,50)
---------- --------------------------------------------------
SYS FUNCTION test_user_vfy_fn (username varchar2,
SYS BEGIN

...
..
.

SYS IF LENGTH(password) >= 25 THEN
SYS RETURN(TRUE);
SYS ELSE
SYS RETURN(FALSE);
SYS END IF;
SYS END;

The password length should be equal or greater than 25.

How to Restore a PDB into another CDB from Tape Backups

This is to demonstrate how to restore a pdb from backups, then plug into a different cdb with same or another pdb name.

Environment

Source database name CDBDBA , pdb name pdba
Target database name CDBDBB, pdb name pdbb

Prepare Auxiliary Database

create pfile from target db

SQL> create pfile='/tmp/initCDBDUP1.ora' from spfile;

File created.

drop pdbb on target if already exists

SQL> ALTER PLUGGABLE DATABASE PDBB  CLOSE IMMEDIATE INSTANCES=ALL;

SQL> DROP PLUGGABLE DATABASE  PDBB  including datafiles;

SQL> select NAME,TOTAL_MB/1024,FREE_MB/1024 from  v$asm_diskgroup order by NAME;

startup auxiliary instance

Modify /tmp/initCDBDUP1.ora file with the following values:

cluster_database = false
control_files ='+DATA1','+FRA' 
db_unique_name = CDBDUP 
*.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST'
SQL> startup nomount pfile='/tmp/initCDBDUP1.ora'

The create a spfile, which is compulsory for duplicate database.

SQL>  create spfile from pfile='/tmp/initCDBDUP1.ora';

Make sure $ORACLE_HOME/dbs/initCDBDUP1.ora pointing to newly created spfile either in $ORACLE_HOME/dbs or in ASM

Then force instance to use spfile.

SQL> startup nomount force
ORACLE instance started.

Total System Global Area 5.3687E+10 bytes
Fixed Size 37495560 bytes
Variable Size 9261023232 bytes
Database Buffers 4.4292E+10 bytes
Redo Buffers 96718848 bytes
SQL> show parameter pfile;

NAME    TYPE  VALUE
-----   ----  -------------------------------------------------------------
spfile string /u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfileCDBDUP1.ora

Maybe the spfile created in ASM :

SQL> show parameter pfile;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/CDBDUP/PARAMETERFILE/spfile.859.1175610247

Duplicate Database with Required pdb:

$ nohup rman auxiliary / catalog rman@rman_catalog/Passwd cmdfile=duplicate_CDBDBA_PDBA_to_CDBDUP.rmna log= rman_duplicate_CDBDBA_PDBA_to_CDBDUP.log &
$ cat duplicate_CDBDBA_PDBA_to_CDBDUP.rman
run
{
Allocate auxiliary channel c1 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576";
Allocate auxiliary channel c2 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576";
Allocate auxiliary channel c3 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576";
SET NEWNAME FOR DATABASE TO '+DATA';
duplicate database CDBDBA to CDBDUP pluggable database pdba until time "TO_DATE('2024-07-10 11:11:11','YYYY-MM-DD HH24:MI:SS')";
}

While duplicate a PDB, the following error might occur at the end of the RMAN process when dropping a tablespace, though it can be ignored because the PDB has been open.

Executing: drop tablespace "AUDIT_AUX" including contents cascade constraints
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 02/19/2025 19:39:47
RMAN-05501: aborting duplication of target database
RMAN-06136: Oracle error from auxiliary database: ORA-22868: table with LOBs contains segments in different tablespaces

Recovery Manager complete.

Unplug and Plug pdb

The rest of the work is to unplug the PDB from the temporary auxiliary PDB, drop the auxiliary CDB and finally plug the PDB into the target CDB.

Uuplug pdb

SQL> select name from v$database;

NAME
-----
CDBDUP
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
------ --------- --------- -----------
2 PDB$SEED READ ONLY NO
3 pdba READ WRITE NO

Better bounce the Auxiliary database here.

SQL> shutdown immediate;

SQL> startup;

SQL> alter pluggable database pdba close immediate instances=all;

Pluggable database altered.
SQL> alter pluggable database  pdba unplug into '/tmp/pdba.xml';

Pluggable database altered.
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
------ --------- --------- -----------
2 PDB$SEED READ ONLY NO

plug pdb into new CDB

SQL> select name from v$database;

NAME
-----
CDBDBB
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
------ --------- --------- -----------
2 PDB$SEED READ ONLY NO

$ grep -v "<parameter>" /tmp/pdba.xml > /tmp/pdba_no_param.xml

Check compatibility:

set serveroutput on
declare
compatible constant varchar2(3) :=
case dbms_pdb.check_plug_compatibility(
pdb_descr_file=>'/tmp/pdba_no_param.xml',
pdb_name=>'pdba')
when true then 'YES'
else 'NO'
END;
begin
dbms_output.put_line(compatible);
end;

/

YES

PL/SQL procedure successfully completed.
SQL> create pluggable database pdbb using '/tmp/pdba_no_param.xml' NOCOPY TEMPFILE REUSE;

Pluggable database created.

here there are two options
— copy
SQL> create pluggable database pdbb using ‘/tmp/pdba_no_param.xml’ copy;
— NOCOPY TEMPFILE REUSE

SQL> alter pluggable database pdbb open instances=all;

Pluggable database altered.
SQL> alter pluggable database pdbb save state;

Pluggable database altered.
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
------ --------- --------- -----------
2 PDB$SEED READ ONLY NO
3 pdba READ WRITE NO

Now we can drop the auxiliary database.

drop auxillary duplicate database

-- no need this step, cos after the auxiliary database, the orphan PDB pdba will be dropped with CDB auxiliary database CDBDUP.

SQL> drop pluggable database pdba keep datafiles;

Pluggable database dropped.
SQL> startup mount restrict 

ORACLE instance started.

Total System Global Area 5.3687E+10 bytes
Fixed Size 37495560 bytes
Variable Size 7918845952 bytes
Database Buffers 4.5634E+10 bytes
Redo Buffers 96718848 bytes
Database mounted.
SQL> drop database;

Database dropped.

If you use COPY option to create the pdb, then you are able to remove the ASM files of the old pdb manually if still there.

ASMCMD> pwd
+data2/CDBDUP/05CBB1A7A1FCD520E0630C21010A57ED/datafile
ASMCMD> rm *
You may delete multiple files and/or directories.
Are you sure? (y/n) y
ASMCMD> pwd
+data2/CDBDUP/05CBB1A7A1FCD520E0630C21010A57ED/datafile
ASMCMD> cd ../
ASMCMD-8002: entry 'CDBDUP' does not exist in directory '+data2/'

run datapatch if rquired when the patch versions are different.

$ cd $ORACLE_HOME/OPatch
$ ./datapatch -verbose
SQL> select NAME,CAUSE,MESSAGE,TYPE,CON_ID  from PDB_PLUG_IN_VIOLATIONS where STATUS !='RESOLVED';

If still get Errors in PDB_PLUG_IN_VIOLATIONS

  1. check rollback/applied sqlpatch to confirm.
    SQL>set linesize 150col logfile for a90
    SQL>select patch_id, action, logfile, status from registry$sqlpatch;
  2. Bounce the database, make PDB online on all nodes, the it should be fine.
SQL> select NAME,CAUSE,MESSAGE,TYPE,CON_ID  from PDB_PLUG_IN_VIOLATIONS where STATUS !='RESOLVED';

How to Skip Long Running Transaction in Oracle Goldengate using SKIPTRANS

We always see the similar WARNING in ggserr.log:

2024-07-14T20:33:15.697+1000  WARNING OGG-01027  Oracle GoldenGate Capture for Oracle, EXTDB.prm:  Long Running Transaction: XID 3708191792.181.17.473582, Items 0, Extract EXTDB, Redo Thread 2, SCN 1447.4108855138 (6218926532450), Redo Seq #38608, Redo RBA 88457232.

Check the transaction in GGSCI:

GGSCI  > send extract EXTDB, showtrans

OR show transactions lasting for more than 1200 minutes already.

GGSCI >  send extract EXTDB, showtrans duration 1200 MIN TABULAR

Check the transaction in database:

SQL> select INST_ID,ADDR,XIDUSN,XIDSLOT,XIDSQN,STATUS,START_TIME,START_DATE from  gv$transaction where XIDUSN=181 and XIDSLOT=17 and XIDSQN=473582;

   INST_ID ADDR                 XIDUSN    XIDSLOT     XIDSQN STATUS           START_TIME           START_DATE
---------- ---------------- ---------- ---------- ---------- ---------------- -------------------- --------------------
         2 000000021236DA28        181         17     473582 ACTIVE           07/05/24 18:37:56    07-May-2024 18:37:59

Skip the transaction:

GGSCI > send extract EXTDB,skiptrans 3708191792.181.17.473582

Sending SKIPTRANS request to EXTRACT EXTDB ...
Are you sure you sure you want to skip transaction XID 3708191792.181.17.473582, Redo Thread 2, Start Time 2024-05-07:18:37:56, SCN 1447.4108855138 (6218926532450)? (y/n)y

Sending SKIPTRANS request to EXTRACT EXTDB ...
Skiptrans operation successfully processed. Transaction XID 3708191792.181.17.473582, Redo Thread 2, Start Time 2024-05-07:18:37:56, SCN 1447.4108855138 (6218926532450) skipped


OGG: Not Able To Register Extract After DB Refresh

After database is refreshed, the following errors occur:

GGSCI> register extract DTCAP database

2024-05-16 01:12:23 ERROR OGG-08221 Cannot register or unregister EXTRACT DTCAP because of the following SQL error: OCI Error ORA (status = 26668-ORA-26668: GoldenGate process OGG$DTCAP exists
ORA-06512: at "SYS.DBMS_XSTREAM_GG_ADM", line 145
ORA-06512: at "SYS.DBMS_XSTREAM_GG_ADM", line 186
ORA-06512: at line 1
).

This is because dictionary tables were not cleaned up properly when OGG process was removed.

set linesize 130
col session_name format a20
col global_db_name format a45

SQL> select SESSION#,CLIENT#,SESSION_NAME,DB_ID,GLOBAL_DB_NAME 
     from system.LOGMNR_SESSION$;

  SESSION# CLIENT# SESSION_NAME DB_ID GLOBAL_DB_NAME
---------- ------- ------------ ---------- ---------
         1      0 OGG$CAP_DTCAP 576966795  PROD     <----OLD PROD DB

Because current DB ID is different from old PROD database one:

SQL> select name, dbid from v$database;

NAME DBID
--------- ----------
TEST 2095324014

Drop the Extract

SQL>SELECT CAPTURE_NAME, CAPTURE_TYPE, STATUS, to_char(REQUIRED_CHECKPOINT_SCN,'999999999999999')as REQ_SCN ,to_char(OLDEST_SCN,'999999999999999')as OLDEST_SCN FROM DBA_CAPTURE;


CAPTURE_NAME                                                                                                                     CAPTURE_TY STATUS   REQ_SCN          OLDEST_SCN
-------------------------------------------------------------------------------------------------------------------------------- ---------- -------- ---------------- ----------------
OGG$CAP_DTCAP                                                                                                                    LOCAL      DISABLED    6217502668722    6215549732638

SQL> exec DBMS_CAPTURE_ADM.DROP_CAPTURE('OGG$CAP_DTCAP');

PL/SQL procedure successfully completed.

SQL> SELECT CAPTURE_NAME, CAPTURE_TYPE, STATUS, to_char(REQUIRED_CHECKPOINT_SCN,'999999999999999')as REQ_SCN ,to_char(OLDEST_SCN,'999999999999999')as OLDEST_SCN FROM DBA_CAPTURE;


no rows selected

Drop queue tables from log miner.

 set linesize 100
col owner format a20
col name format a25
col queue_table format a20
select owner, name, queue_table from dba_queues where owner = 'C##OGGADMIN';

OWNER NAME QUEUE_TABLE
-------------------- ------------------------- --------------------
C##OGGADMIN OGG$Q_DTCAP OGG$Q_TAB_DTCAP
C##OGGADMIN AQ$_OGG$Q_TAB_DTCAP_E OGG$Q_TAB_DTCAP

SQL> exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table =>'C##OGGADMIN.OGG$Q_TAB_DTCAP', force => TRUE);

PL/SQL procedure successfully completed.

SQL> select queue_table, owner from dba_queues where owner ='C##OGGADMIN';

no rows selected

OR

Stop and clean the queues.

set linesize 100
col owner format a20
col name format a25
col queue_table format a20
select owner, name, queue_table from dba_queues where owner = 'C##OGGADMIN';

OWNER NAME QUEUE_TABLE
-------------------- ------------------------- --------------------
C##OGGADMIN OGG$Q_DTCAP OGG$Q_TAB_DTCAP
C##OGGADMIN AQ$_OGG$Q_TAB_DTCAP_E OGG$Q_TAB_DTCAP

BEGIN
DBMS_AQADM.STOP_QUEUE(queue_name => 'C##OGGADMIN.OGG$Q_DTCAP');
DBMS_AQADM.STOP_QUEUE(queue_name => 'C##OGGADMIN.AQ$_OGG$Q_TAB_DTCAP_E');
DBMS_AQADM.DROP_QUEUE(queue_name => 'C##OGGADMIN.OGG$Q_DTCAP');
DBMS_AQADM.DROP_QUEUE(queue_name => 'C##OGGADMIN.AQ$_OGG$Q_TAB_DTCAP_E');
END;

BEGIN
EXEC DBMS_STREAMS_ADM.REMOVE_QUEUE(
  queue_name => C##OGGADMIN.OGG$Q_DTCAP',
  cascade => true,
  drop_unused_queue_table => true);
END;
/

BEGIN
EXEC DBMS_STREAMS_ADM.REMOVE_QUEUE(  queue_name => 'C##OGGADMIN.AQ$_OGG$Q_TAB_DTCAP_E', 
cascade => true, 
drop_unused_queue_table => true); 
END;
/

SQL> select queue_table, owner from dba_queues where owner ='C##OGGADMIN';

no rows selected


SQL> select SESSION#,CLIENT#,SESSION_NAME,DB_ID,GLOBAL_DB_NAME
from system.LOGMNR_SESSION$;
no rows selected

Not Able To Register Extract After DB Refresh (Doc ID 2593741.1)