How to change DBID in oracle database 19c

 Objective:- Change DBID in oracle database .

For example, we will be changing existing DBID LOGCDB to a new DBID UATCDB


Step 1. Shutdown database instance

SQL> shu immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

 

Step 2. Start database in mount mode

SQL> STARTUP MOUNT

ORACLE instance started.

Total System Global Area 4294964000 bytes

Fixed Size                  9143072 bytes

Variable Size             805306368 bytes

Database Buffers         3472883712 bytes

Redo Buffers                7630848 bytes

Database mounted.


SQL> select name,open_mode,instance_name from v$database,v$instance; 

NAME      OPEN_MODE            INSTANCE_NAME

--------- -------------------- ----------------

LOGCDB    MOUNTED              LOGCDB

 


Step 3. Change DBNAME using nid utility

Syntax for changing DBNAME

 

nid sys/password@CURRENT_DBNAME DBNAME=NEW_DBNAME

 

[logminedb@ccuine1126 dbs]$ nid target=sys/manager@LOGCDB DBNAME=UATCDB

 

DBNEWID: Release 19.0.0.0.0 - Production on Tue Apr 19 16:47:33 2022

 

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

 

Connected to database LOGCDB (DBID=3597672493)

 

Connected to server version 19.9.0

 

Control Files in database:

    /db/app/logminedb/oradata/LOGCDB/control01.ctl

    /db/app/logminedb/oradata/LOGCDB/control02.ctl

 

Change database ID and database name LOGCDB to UATCDB? (Y/[N]) => Y

 

Proceeding with operation

Changing database ID from 3597672493 to 205605669

Changing database name from LOGCDB to UATCDB

    Control File /db/app/logminedb/oradata/LOGCDB/control01.ctl - modified

    Control File /db/app/logminedb/oradata/LOGCDB/control02.ctl - modified

    Datafile /db/app/logminedb/oradata/LOGCDB/system01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/pdbseed/system01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/sysaux01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/pdbseed/sysaux01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/undotbs01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/pdbseed/undotbs01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/users01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/UAT/system01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/UAT/sysaux01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/UAT/undotbs01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/UAT/users01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/temp01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/pdbseed/temp01.db - dbid changed, wrote new name

    Datafile /db/app/logminedb/oradata/LOGCDB/UAT/temp01.db - dbid changed, wrote new name

    Control File /db/app/logminedb/oradata/LOGCDB/control01.ctl - dbid changed, wrote new name

    Control File /db/app/logminedb/oradata/LOGCDB/control02.ctl - dbid changed, wrote new name

    Instance shut down

 

Database name changed to UATCDB.

Modify parameter file and generate a new password file before restarting.

Database ID for database UATCDB changed to 205605669.

All previous backups and archived redo logs for this database are unusable.

Database has been shutdown, open database with RESETLOGS option.

Succesfully changed database name and ID.

DBNEWID - Completed succesfully.



Step 4. Change dbname in parameter file

SQL> startup nomount

ORACLE instance started.

 

Total System Global Area 4294964000 bytes

Fixed Size                  9143072 bytes

Variable Size             805306368 bytes

Database Buffers         3472883712 bytes

Redo Buffers                7630848 bytes

SQL> alter system set db_name=UATCDB scope=spfile; 

System altered.

 

SQL>  shutdown immediate;

ORA-01507: database not mounted 

ORACLE instance shut down.


SQL> startup nomount

ORACLE instance started.

 Total System Global Area 4294964000 bytes

Fixed Size                  9143072 bytes

Variable Size             805306368 bytes

Database Buffers         3472883712 bytes

Redo Buffers                7630848 bytes

 

 SQL> show parameter db_name 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_name                              string      UATCDB

 

 

SQL> shu immediate

ORA-01507: database not mounted

 

ORACLE instance shut down.



Step 5. Create a new parameter file from old parameter file with a new db name

[logminedb@ccuine1126 ~]$ cd $ORACLE_HOME/dbs

SQL> create pfile from spfile;

 

[logminedb@ccuine1126 dbs]$ mv initLOGCDB.ora initUATCDB.ora

 

[logminedb@ccuine1126 dbs]$ export ORACLE_SID=UATCDB

 

SQL> startup nomount pfile='initUATCDB.ora'

ORACLE instance started.

 

Total System Global Area 4294964000 bytes

Fixed Size                  9143072 bytes

Variable Size             805306368 bytes

Database Buffers         3472883712 bytes

Redo Buffers                7630848 bytes

SQL> ! ps -ef | grep pmon

logmine+  4671     1  0 17:01 ?        00:00:00 ora_pmon_UATCDB

logmine+  4752  4654  0 17:01 pts/5    00:00:00 /bin/bash -c  ps -ef | grep pmon

logmine+  4754  4752  0 17:01 pts/5    00:00:00 grep pmon

 

SQL> create spfile from pfile='initUATCDB.ora';

 

SQL> alter database mount; 

Database altered.

 

SQL> alter database open resetlogs; 

Database altered.

 

SQL> select name,open_mode,instance_name from v$database,v$instance;


NAME      OPEN_MODE            INSTANCE_NAME

--------- -------------------- ----------------

UATCDB    READ WRITE           UATCDB





How to permanent change hostname in OCI for OEL 7 and later version

 

Step 1.

Update the /etc/hostname file following command.

 

[root@uat-database-dr rman_bkp]# hostnamectl set-hostname ccuine1126.xxx.co.in

 

 

 

 Step 2.

 Edit the oci configuration file for hostnames and set the value to 2.
    vi /etc/oci-hostname.conf
    PRESERVE_HOSTINFO=2
    save the changes.

 

Note:- By setting Value 2, it preserve user configured hostname across instance reboots; no custom changes to /etc/hosts and /etc/resolv.conf from the metadata service,

but dhclient will still overwrite /etc/resolv.conf

  

Step 3.

Update /etc/hosts file with following

192.168.10.126 ccuine1126.xxx.co.in        ccuine1126

And save & exit.

 

Step 4.

Update FQDN in OCI Console

Login to OCI console and navigate to compute instance


Select the compute instance where the FQDN will be updated and click on Attached VNICs and click on the Edit vnic 



This open a window like below where we need to set the updated hostname.

Note: Only provide the sub domain name . Do not enter entire FQDN as it doesn’t accept it.


And click on save changes. 

Once done, bounce the instance from and it will show updated FQDN from OCI console as well.

 Check the hostname with hostname or hostnamectl command.

 

[root@ccuine1126]# hostname

ccuine1126.xxx.co.in

 

[root@ccuine1126]# hostnamectl

   Static hostname: ccuine1126.xxx.co.in

         Icon name: computer-vm

           Chassis: vm

        Machine ID: aef0b6747ebeb75af2d053485bed

           Boot ID: 3a4b979bdf3b4a3591328acc3e362

    Virtualization: kvm

  Operating System: Oracle Linux Server 7.9

       CPE OS Name: cpe:/o:oracle:linux:7:9:server

            Kernel: Linux 5.4.17-2136.304.4.1.el7uek.x86_64

      Architecture: x86-64







Query to check currently running concurrent program in EBS R12.1.3

 

Login to apps user

 

sqlplus apps/<apps_passwd>

 

SELECT sess.sid,

   sess.serial#,

   oracle_process_id OS_PROCESS_ID,

   fusr.description user_name,

   fcp.user_concurrent_program_name progName,

   TO_CHAR (actual_Start_date, 'DD-MON-YYYY HH24:MI:SS')

   StartDate,

   request_id RequestId,

   (SYSDATE - actual_start_date) * 24 * 60 * 60 ETime

   FROM fnd_concurrent_requests fcr,

   fnd_concurrent_programs_tl fcp,

   fnd_user fusr,

   v$session sess

   WHERE fcp.concurrent_program_id = fcr.concurrent_program_id

   AND fcr.program_application_id = fcp.application_id

   AND fcp.language = 'US'

   AND fcr.phase_code = 'R'

   AND fcr.status_code = 'R'

   AND fcr.requested_by = fusr.user_id

   AND fcr.oracle_session_id = sess.audsid(+)

   ORDER BY 8;

 






How to backup EBS R12.2 application using shell script

 

How  to backup EBS R12.2 application using shell script


Create a shell script with any name for example /home/applmgr/apps_backup.sh

#!/bin/bash

date=`date +%d%m%Y`

. /app/prod/apps/fs2/EBSapps/appl/APPSPROD_prodappdb.env

echo ""

/app/prod/apps/fs2/inst/apps/PROD_prodappdb/admin/scripts/adpreclone.pl appsTier pwd=<apps_passwd> <<EOF

weblogic123

EOF

echo "---------Application Preclone end `date` --------------"

echo "" >> /home/applmgr/BACKUP_PROD_APPS/log/backup_$date.log

echo "--------------Tar backup end `date`---------------" >> /home/applmgr/BACKUP_PROD_APPS/log/backup_$date.log

cp /backup/PROD_APPS_Backup/apps_prod_$(date +%d-%m-%Y).tar.gz /remote_HDD/PROD_Backup_DND/Apps_backup/

echo "--------------backup copied to External HDD completed at `date`---------------" >> /home/applmgr/BACKUP_PROD_APPS/log/backup_$date.log

 

Once done , schedule it in crontab as per your requirement

0 0 * * * /home/applmgr/apps_backup.sh