Sunday 3 December 2023

ORA-02085: Database Link LINK_NAME Connects To TARGET_DB


 This issue may come in multitenant database even GLOBAL_NAMES=false in container level.

we can fix this issue by setting the same parameter in PDB level, login to the PDB and set as below.

sqlplus / as sysdba

alter session set container=<pdb name>;

alter system set GLOBAL_NAMES=false;


Saturday 4 November 2023

create clone database from standby database using Duplicate command

 

If we have a method to create clone database from standby database, its bliss for DBAs, they can perform production database clone without impacting production database.

 

In this article we can see how we can create a clone database from standby database using DUPLICATE command.

Source is standby - PRODDB

target is new clone server - TESTDB

 

Steps:

1.     Network configuration between standby server and new clone server

  • configure static listener in target so that database will connect as sysdba in nomount state without any blocking

 SID_LIST_LISTENER=

  (SID_LIST=

    (SID_DESC=

      (SID_NAME= TESTDB)

      (GLOBAL_DBNAME = TESTDB)

      (ORACLE_HOME= /u01/app/oracle/product/19c/db1)

      )

     )

 

·         Enter source and target tns entries in both sides.

TESTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 9.9.9.9)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TESTDB)
      (UR=A) 
    )
  )

 

PRODDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PRODDB )
      (UR=A)
    )
  )

2.     Create pfile for TESTDB  by taking reference from standby pfile and start in nomount.

3.     Test connectivity.

$rman target sys/passwd@proddb auxiliary sys/passwd@testdb

4.     Stop arch deletion scripts in standby side if configured any,  this is required for retaining archivelogs required for recovery in target side.

 

5.     Use below script to create clone database. In this script we are using FS /oradata, where as source database uses ASM

RUN

{

SET NEWNAME FOR DATABASE TO '/oradata/RMVL/datafiles/%b';

DUPLICATE TARGET DATABASE TO 'RMVL' from active database

  LOGFILE

    GROUP 1 ('/oradata/RMVL/datafiles/redo01a.log') SIZE 4096M REUSE,

    GROUP 2 ('/oradata/RMVL/datafiles/redo02a.log') SIZE 4096M REUSE,

        GROUP 3 ('/oradata/RMVL/datafiles/redo03a.log') SIZE 4096M REUSE;

}

 

 

That’s it, database will open in read write mode after this scripts completed successfully.

 

Happy Cloning 😊


Sunday 29 October 2023

How to apply OJVM patch without down time of database in RAC


In RAC environment, we can do any patch without down time if we follow rolling method(node by node).

We dont required to bring down database for running datapatch, so no down time here as well.

But for OJVM patch, its required to run in upgrade mode, hence DB restart required which is a bad news for RAC environments.


But we have a workaround to run datapatch without putting database in upgrade mode, i.e using   -skip_upgrade_check


./datapatch -verbose -skip_upgrade_check

DBAs will face challenge to apply OJVM patch as it required to put database in upgrade mode to run datapatch.

This way DBA can apply all patches with Zero down time in RAC environments.


Finding OEM urls including weblogic console url.

 OEM urls will be stored in setupinfo.txt file under OMS_HOME/install.


cat /u01/app/oracle/middleware/install/setupinfo.txt

The following is output shows the contents of the file.

Use the following URL to access:


        1. Enterprise Manager Cloud Control URL: https://abcdhost1:7803/em

        2. Admin Server URL: https://abcdhost1:7102/console

        3. BI Publisher URL: https://abcdhost1:9803/xmlpserver/servlet/home


The following details need to be provided while installing an additional OMS:


        1. Admin Server Host Name: abcdhost1

        2. Admin Server Port: 7102


You can find the details on ports used by this deployment at : /u01/app/oracle/middleware/install/portlist.ini


How to find weblogic password in OEM

 Finding Existing weblogic password in OEM



    - To get the existing weblogic's password, please do the below:

1. Weblogic's password is stored in encrypted form in 'password' field in the file -

  /u01/app/oracle/gc_inst/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/security/boot.properties. Get the encrypted password from it.

cat boot.properties

# Generated by Configuration Wizard on Sun Mar 29 13:21:08 CEST 2020

username={AES}i3XAY7iKtI9kZ2sd6jqu9nKnUoiBAXXYnua7qQaQYWMUxQ=

password={AES}A1W4HlGanBCEFqLyNpdzgRR16V/ls6EIdptRjg5Kn2/YU0=


2. Run the below commands to get the plain password from encrypted format :

cd /opt/oracle/gc_inst/user_projects/domains/GCDomain/bin

. ./setDomainEnv.sh


3.  Now you will be under /u01/app/oracle/gc_inst/user_projects/domains/GCDomain 

Create a java file to convert the password to text format.

vi recoverpassword.java

public class recoverpassword {

 public static void main(String[] args)

 {

  System.out.println(

  new weblogic.security.internal.encryption.ClearOrEncryptedService(

  weblogic.security.internal.SerializedSystemIni.getEncryptionService(args[0]

   )).decrypt(args[1]));

  }

}

4. compile the Java script.

javac recoverpassword.java


5. Replace the encrypted password find in step 1 in below command and run, it displays the password in text format.


java -cp $CLASSPATH:. recoverpassword /orasoft/oracle/gc_inst/user_projects/domains/GCDomain {AES}A1W4HlGanBCEFqLyNpdzgRR16V/ls6EIdptRjg5Kn2/YU0=


Opoldrgx123


Above is the password in text format.


same method you can follow if you want to know the username.