Thursday, June 4, 2020

Manual Oracle Home Cloning || 11g Release 2 (11.2.0.4)

Below are the details manual oracle home cloning steps.

Please refer the attached log file with detailed steps and execution log files.

Please refer my YouTube channel and for more details

https://youtu.be/czC73ljVCKE


1. Take tar backup of existing Oracle home.

tar -cvzf OH_BINARIES_BKP.tar.gz /u01/app/oracle/product/11204/dbhome_1/*

2. untar the backup tar file in step1 with Target Oracle home and target owner

mkdir -p /u01/app/oracle/product/11204/dbhome_2
cd /u01/app/oracle/product/11204/dbhome_2
tar -xvzf/u01/app/oracle/product/11204/OH_BINARIES_BKP.tar.gz .

3. Post steps to be performed on both the nodes. 

cd /u01/app/oracle/product/11204/dbhome_2/clone/bin 
./clone.pl ORACLE_HOME=/u01/app/oracle/product/11204/dbhome_2 ORACLE_HOME_NAME=11204_dbhome_2 ORACLE_BASE=/u01/app/oracle

4. Update the cluster nodes 

Repeat step1 to step3 on all cluster nodes and run below commands

/u01/app/oracle/product/11204/dbhome_2/oui/bin/runInstaller -updateNodeListORACLE_HOME=/u01/app/oracle/product/11204/dbhome_2 "CLUSTER_NODES={npexdbadm01, npexdbadm02}"

5. Enable on rds protocol on oracle Home (Applicable only for Oracle homes in EXADATA machine) 

export ORACLE_HOME=/u01/app/oracle/product/11204/dbhome_2


cd $ORACLE_HOME/rdbms/lib

make -f ins_rdbms.mk ipc_rdsioracle

6. To check if the Binaries are RAC Enabled: (Applicable only for RAC)

cd $ORACLE_HOME/rdbms/lib
nm -r libknlopt.a | grep -c kcsm.o
1 >>> means RAC feature enabled 
0 >>> means RAC feature NOT enabled 

cd $ORACLE_HOME/rdbms/lib

make -f ins_rdbms.mk rac_onioracle

7. Verification:

/u01/app/oracle/product/11204/dbhome_2/OPatch/opatchlsinventory

 cat /u01/app/oracInventory/Context/inventory.xml  

>>> Verify Target OH is having all the cluster nodes


Regards,

Mallik


Oracle Patching Demo|| PSU Patching || 11g Release 2 (11.2.0.4) - OPatch


Maintaining patch compliance helps ensure performance and security in your Oracle system

Why do we do patching?

-         Security

-         BUG fixes

-         New feature enhancement

-         Upgradations

-         Compliance

What all we do patching in Oracle database?

-         Grid Home/binaries (In case of Oracle RAC)

-         Oracle Home/binaries

-         Databases

What are types are patching in Oracle database?

-         Rolling Patching (Hot patching, Online Patching, Out of place patching)

-         Non-Rolling Patching

What are types re patches do Oracle has?

-         Bundle patch

-         ONEOFF patch

-         Online patch

-         Composite patch

-         Merge patching many more 

What are tolls we do use in Oracle patching?

-         OPatch (in case of Binaries)

-         Catbudle-11g & datapatch-12c (in case of database)

Note: There are other patching in Exadata, YUM patching, CELL patching, IB switch patching and other component’s patching


Master Document for downloading Latest Patches: 888828.1

BUG List:

Bug Fix List: the 11.2.0.4 Patch Bundles for Oracle Exadata Database Machine (Doc ID 1601749.1)  

 

Start with Oracle 11g Patching:

1) Prechks: 

-Patch_April2017

$ORACLE_HOME/OPatch/opatchprereqCheckConflictAgainstOHWithDetail -phBaseDir/u01/patches/25440411/24828123

$ORACLE_HOME/OPatch/opatchprereqCheckConflictAgainstOHWithDetail -phBaseDir/u01/patches/25440411/23054319/custom/server/23054319

$ORACLE_HOME/OPatch/opatchprereqCheckSystemSpace -phBaseDir/u01/patches/25440411/24828123

$ORACLE_HOME/OPatch/opatchprereqCheckSystemSpace -phBaseDir/u01/patches/25440411/23054319/custom/server/23054319


2) backup database and oracle binaries before patching and stop listener & database:

 ps -ef|grepsmon

cat /etc/oratab

ps -ef | grep agent | grep java | sed 's/\s\+/ /g' | cut -d " " -f 1,8 | sed 's/\/jdk.*//'


-- database backup

-- Oracle home binaries backup 


lsnrctl stop

lsnrctlstatus

shut immediate

 

3) Stop Agent:

 su -l oracle -c "/opt/OracleHomes/agent_home/core/12.1.0.3.0/bin/emctl stop agent"

su -l oracle -c "/opt/OracleHomes/agent_home/core/12.1.0.3.0/bin/emctl status agent"

 

4) Change the ownership of patch directory:

chown -R oracle:oinstall /u01/patches

--Place the latest Patch 6880880 


5) Create response file

/u01/app/oracle/product/11204/dbhome_1/OPatch/ocm/bin/emocmrsp -output /u01/patches/ocm.rsp 

6) Patching

/u01/patches/25440411/23054319/custom/server/23054319/custom/scripts/prepatch.sh -dbhome /u01/app/oracle/product/11204/dbhome_1

/u01/app/oracle/product/11204/dbhome_1/OPatch/opatchnapply -oh /u01/app/oracle/product/11204/dbhome_1 -local -silent -ocmrf /u01/patches/ocm.rsp /u01/patches/25440411/24828123

/u01/app/oracle/product/11204/dbhome_1/OPatch/opatchnapply -oh /u01/app/oracle/product/11204/dbhome_1 -local -silent -ocmrf /u01/patches/ocm.rsp /u01/patches/25440411/23054319/custom/server/23054319

/u01/patches/25440411/23054319/custom/server/23054319/custom/scripts/postpatch.sh -dbhome /u01/app/oracle/product/11204/dbhome_1

 

7) Oracle home patch verification

/u01/app/oracle/product/11204/dbhome_1/OPatch/opatchlspatches -oh /u01/app/oracle/product/11204/dbhome_1

 

8) Database patch

Verify which database you are connected to    

              select name from v$database;

              select database_role from v$database;

             

Check for invalid objects            

              column comp_name format a40

              column version format a12

              column status format a15

              select comp_name,version,status from dba_registry;

         

              column owner format a15

              column object_name format a40

              column object_type format a20

              select owner, object_name, object_type from dba_objects where status='INVALID' order by object_type,owner,object_name;

             

If there are a lot of invalids, this next command will list only the invalids containing SYS in the owner

              select owner, object_name, object_type from dba_objects where status='INVALID' and owner like '%SYS%' order by object_type,owner,object_name;

If there are invalids then run utlrp and check again      

              @?/rdbms/admin/utlprp.sql 16

              select comp_name,version,status from dba_registry;

              select owner, object_name, object_type from dba_objects where status='INVALID' order by object_type,owner,object_name;

 

Execute the catbundle script    

              @?/rdbms/admin/catbundle.sqlexa apply

              @?/rdbms/admin/utlprp.sql 8

             

Check invalids again     

              select comp_name,version,status from dba_registry;

              select owner, object_name, object_type from dba_objects where status='INVALID' order by object_type,owner,object_name;


9) Database patch verification:

Check that the apply finished successfully            

              select * from dba_registry_history;


col ACTION for a20

col NAMESPACE for a20

col VERSION for a30

col BUNDLE_SERIES for a20

col COMMENTS for a50

select * from dba_registry_history;

 

Regards

Mallik


Wednesday, June 3, 2020

Oracle Home Installation on Oracle Linux || 11g Release 2 (11.2)

Please refer the below YouTube channel for detailed explanation:

https://www.youtube.com/watch?v=azzh8khOUyM&t=151s

1.       Build or Installation Linux Server

Oracle linux is ready and it is update and running

2.       Download Oracle software and unzip

#11.2.0.4

unzip p13390677_112040_Linux-x86-64_1of7.zip

unzip p13390677_112040_Linux-x86-64_2of7.zip


3.       Hostname verification 

192.168.0.101   OEL58.localdomain    OEL58

4.       Verify the system pre-configuration

/sbin/sysctl -a

/etc/sysctl.conf

/etc/security/limits.conf

oracle              soft    nproc   16384

oracle              hard    nproc   16384

oracle              soft    nofile  4096

oracle              hard    nofile  65536

oracle              soft    stack   10240

 

Creating the Oracle user and groups

groupadd -g 54321oinstall

groupadd -g 54322 dba

groupadd -g 54323 oper

groupadd -g 54324asmadmin

groupadd -g 54325 asmdba

groupadd -g 54326 asmoper

 

useradd -u 54321 -g oinstall -G dba,asmdba,oper oracle

passwd oracle

>>> Welcome2020


Creating the directories

mkdir -p /u01/app/oracle/product/11.2.0.4/dbhome_1

chown -R oracle:oinstall /u01

chmod -R 775 /u01

 

Setting up the .bash_profile for oracle user

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1; export ORACLE_HOME

TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

 

5.       Oracle Home Installation

Go to the software location and launch the GUI screen for Installation

./runInstaller

Follow the installation screen and installation wizard

 

6.       Post Oracle Home Installation

Verify the /etc/oratab

Apply the Latest OPatch and Latest BP/CPU/PSU


Regards,
Mallik

Sunday, May 31, 2020

Create Physical Standby Database using RMAN Backup Restore

In this article, we will see Physical Standby database creation and configuration using RMAN backup and restore. 

Step 1: Connect to the Primary database and check if recovery area

show parameter db_recovery

Step 2: Connect to RMAN and take backup

rman target /

backup database plus archivelog;

Step 3: Create standby control file from the primary database and create pfile from spfile.

ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/u01/DEVDRDB.ctl';

CREATE PFILE FROM SPFILE;

Step 4: Change following parameter in pfile.

CHANGE FOLLOWING PARAMETER IN PFILE

*.db_unique_name='DEVDRDB'

*.fal_server='DEVDB'

*.log_archive_dest_2='SERVICE=DEVDB ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DEVDB'

Step 5: Connect to Standby database server and create necessary directories.

mkdir -p /u01/app/oracle/oradata/DEVDRDB/datafile

mkdir -p /u01/app/oracle/oradata/DEVDRDB/controlfile

mkdir -p /u01/app/oracle/fast_recovery_area/DEVDRDB/controlfile

mkdir -p /u01/app/oracle/oradata/DEVDRDB/onlinelog

mkdir -p /u01/app/oracle/fast_recovery_area/DEVDRDB/onlinelog

Step 6: Transfer standby control file to standby database and rename it as defined in control_files initialization parameter.

Step 7: Transfer backup to Standby database server

Step 8: Transfer pfile to standby database

Step 9: Transfer password file to standby database.

Step 10: Connect to Standby database and create spfile from pfile.

 sqlplus / as sysdba 

create spfile from pfile;

Step 11: In standby database connect to RMAN and start the database in mount stage.

rman target /

startup mount

Step 12Restore database using restore database command.

restore database;

Step 13: Connect to SQL prompt of standby database and create redo log files.

alter system set standby_file_management=manual;

alter database add logfile ('/u01/app/oracle/oradata/DEVDRDB/onlinelog/redo01.log') size 512m;

alter database add logfile ('/u01/app/oracle/oradata/DEVDRDB/onlinelog/redo02.log') size 512m;

alter database add logfile ('/u01/app/oracle/oradata/DEVDRDB/onlinelog/redo03.log') size 512m;


alter database add logfile ('/u01/app/oracle/fast_recovery_area/DEVDRDB/onlinelog/redo01.log') size 512m;

alter database add logfile ('/u01/app/oracle/fast_recovery_area/DEVDRDB/onlinelog/redo02.log') size 512m;

alter database add logfile ('/u01/app/oracle/fast_recovery_area/DEVDRDB/onlinelog/redo03.log') size 512m;


alter system set standby_file_management=AUTO;

Check Standby database synchronization with the Primary database

Step 14: Connect to the Primary database and check the role of the primary database.

select name,open_mode,database_role from v$database;

Step 15: Connect to Standby database and check the role of the database.

select name,open_mode,database_role from v$database;

Step 16: Check maximum archive log sequence from the primary.

select max(sequence#) from v$thread;

Step 17: Check maximum archive log sequence from standby database.

select max(sequence#) from v$thread;

Step 18: Start the MRP process at standby side.

alter database recover managed standby database disconnect from session;

alter database recover managed standby database cancel;

Step 19: Switch logfile at primary database

alter system switch logfile;

Step 20: Check again max archive log sequence at the standby database.

select max(sequence#) from v$thread;

 

Regards,
Mallik

Saturday, May 30, 2020

Drop Database Delete Database manual method or GUI method

Drop Database:

1. GUI Method:

--- Launch dbca and select drop option to drop the database

--- OEM or Grid Control (Only Instance delete)

2. Manual Method:

--- connect to database in mount restrict mode and drop the database

--- shutdown the database and manually delete all the datafiles and configuration file (Not Recommended)

Drop Database possibilities:

open mode - drop database is not possible

mount mode - drop database is not possible

mount exclusive - drop database is not possible

mount restricted - drop database is possible


Please refer the more details in my YouTube channel https://youtu.be/3EWLBLie8-w


Regards,
Mallik

Friday, May 29, 2020

How to identify any parameter as static or dynamic?



Answer: Check for v$parameter we can find one column ie. ISSYS_MODIFIABLE

set pages 1000
set lines 200
col name for a35
col value for a25
select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter;

1. Parameters basics:

In general, parameter is a placeholder for a variable that contains some value of some type.
We can call it as key-value pair

db_block_siz(key)=8K(value)
db_name(key)=DEVDB(value)

2. How to Identify the parameter as stic or dynamic

SQL> select ISSYS_MODIFIABLE from v$parameter where name like '%utl_file_dir%';
ISSYS_MOD
---------
FALSE=======================================>static 

Other examples are:
select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='processes';
select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='sessions';

alter system set processes=200 scope=spfile;
alter system set sessions=500 scope=spfile;

3. Check the current value for a parameter processes & sessions

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='processes';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
processes                           150                       FALSE FALSE

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='sessions';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
sessions                            248                       FALSE FALSE

4. Try to change staic parameter with scope=both it will fail

SQL> alter system set processes=200 scope=both;
alter system set processes=200 scope=both
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified


SQL> alter system set sessions=500 scope=both;
alter system set sessions=500 scope=both
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

5. Try to change static parameter with scope=memory it will fail

SQL> alter system set processes=200 scope=memory;
alter system set processes=200 scope=memory
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified


SQL> alter system set sessions=500 scope=memory;
alter system set sessions=500 scope=memory
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified


6. Try to change static parameter with scope=spfile it will be successful

SQL> alter system set processes=200 scope=spfile;

System altered.

SQL> alter system set sessions=500 scope=spfile;

System altered.

7. After changing the parameter re verify the values still pointing to old values since these static parameter takes effect only after database bounce
 
SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='processes';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
processes                           150                       FALSE FALSE

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='sessions';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
sessions                            248                       FALSE FALSE

10. Shutdown the database

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

11. Start the database

SQL> startup;
ORACLE instance started.

Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size            1023413488 bytes
Database Buffers          536870912 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.

12. Verify the static parameter and now poiting to new values

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='processes';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
processes                           200                       FALSE FALSE

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='sessions';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
sessions                            500                       FALSE FALSE

SQL>


13. How to Identify the parameter as static or dynamic

SQL>  select ISSYS_MODIFIABLE from v$parameter where name like '%log_archive_dest_2';
ISSYS_MOD
---------
IMMEDIATE====================================>dynamic 

Other examples are:
select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='log_archive_dest_2';
select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='open_cursors';
select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='awr_snapshot_time_offset';

alter system set open_cursors=500 scope=both;
alter system set awr_snapshot_time_offset=2 scope=both;

14. Check the current value for a parameter open_cursors & awr_snapshot_time_offset

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='open_cursors';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
open_cursors                        300                       FALSE IMMEDIATE

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='awr_snapshot_time_offset';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
awr_snapshot_time_offset            0                         FALSE IMMEDIATE

SQL>

15. Try to change these dynamic parameter with scope=both it will be successful

SQL> alter system set open_cursors=500 scope=both;

System altered.

SQL> alter system set awr_snapshot_time_offset=2 scope=both;

System altered.

12. Verify the these dynamic parameter and now pointing to new values immediately without bouncing the database.

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='open_cursors';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
open_cursors                        500                       FALSE IMMEDIATE

SQL> select name,value,ISSES_MODIFIABLE,ISSYS_MODIFIABLE from v$parameter where name='awr_snapshot_time_offset';

NAME                                VALUE                     ISSES ISSYS_MOD
----------------------------------- ------------------------- ----- ---------
awr_snapshot_time_offset            2                         FALSE IMMEDIATE


Please refer the YoutTube video for more information

https://youtu.be/hSntn8Gfedo


Regards,
Mallik


Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...