Tuesday, December 4, 2018

Step by Step 12c Opatch Update Prcess




1. Backup the OPatch directory and Copy the new OPatch file into the Oracle Home directory then run then command:

bash-4.2$ cp p6880880_122010_AIX64-5L.zip /orafs/app/oracle/12.2.0.1/db_1/p6880880_122010_AIX64-5L.zip

bash-4.2$  unzip p6880880_122010_AIX64-5L.zip

2. copy and unzip the PSU file to the following location and then unzip the file

bash-4.2$ bash-4.2$ cp p28662603_122010_AIX64-5L.zip 
/orafs/app/oracle/12.2.0.1/db_1/OPatch/p28662603_122010_AIX64-5L.zip


bash-4.2$  unzip p28662603_122010_AIX64-5L.zip
bash-4.2$  cd 28662603
----------------

$ORACLE_HOME/OPatch/opatch lsinventory

bash-4.2$  $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

3.  apply opatch :

bash-4.2$  $ORACLE_HOME/OPatch/opatch apply

4. Run ./datapatch after patching :

sqlplus /nolog
Connect / as sysdba
startup
quit

bash-4.2$  cd $ORACLE_HOME/OPatch
bash-4.2$  ./datapatch -verbose

DB Upgrade from 11.2.0.3 to 12.2.0.1



DB upgrade  from 11g to 12c using DBUA

Step 1: 

At first install the 12c binary and then follow the following activities.

Copy spfilea.ora and password file to /orafs/app/oracle/12.2.0.1/db_1/dbs/ 
Step 2:

$ORACLE_HOME/jdk/bin/java -jar /orafs/app/oracle/12.2.0.1/db_1/rdbms/admin/preupgrade.jar FILE DIR /home/oracle/preupgrade_log

bash-4.2$ sqlplus / as sysdba

SQL> @preupgrade_fixups.sql


Step 3:

SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql



Step 4. EM Remove:

cd /orafs/app/oracle/12.2.0.1/db_1/rdbms/admin/
SQL>SET ECHO ON
SQL>SET SERVEROUTPUT ON
SQL>@emremove.sql


Step 5:

SQL> show parameter SEC_CASE_SENSITIVE_LOGON

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sec_case_sensitive_logon             boolean     FALSE
SQL> alter system set sec_case_sensitive_logon=true;

System altered.



Step 6:


bash-4.2$ vi sqlnet.ora

SQLNET.ALLOWED_LOGON_VERSION_SERVER=11


Step 7:


Add the following line on the /etc/oratab


bash-4.2$ vi /etc/oratab
dbname:/orafs/app/oracle/11.2.0.3/db_1:N

Step 8: run DBUA

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




Restore RMAN Backup TO a Different Server


This blog will detail the steps to restore a database on a new host using RMAN. 

Step_1. Create Pfile

Step_2. Startup nomount:

SQL> startup nomount pfile='/rmanfs/pfile.ora';
----------------------------------------------------
Transfer the full backup with control file to the desired server.

Step_3. Restore Controlfile:

RMAN> restore controlfile from '/rmanfs/backup/o1_mf_s_99261014_.bkp';
RMAN> catalog start with '/rmanfs/backup';


Step_4: Mount Database

SQL> alter database mount;

Step_5: Restrore DB


ORACLE_UNQNAME=dbname; export ORACLE_UNQNAME
ORACLE_BASE=/orafs/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/11.2.0.3/db_1; export ORACLE_HOME
ORACLE_SID=dbname; export ORACLE_SID

PATH=$PATH:$ORACLE_HOME/bin; 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

$ORACLE_HOME/bin/rman  target /

run
{
allocate channel disk1 device type disk;
allocate channel disk2 device type disk;

set newname for datafile 1 to '/dbsystemfs/oradata/system01.dbf';
set newname for datafile 2 to '/dbsystemfs/oradata/sysaux01.dbf';
set newname for datafile 3 to '/undofs/undo_tbs01.dbf';
set newname for datafile 4 to '/dbsystemfs/oradata/ababil/users/users01.dbf';
set newname for tempfile 1 to '/tempfs/oradata/temp/temp01.dbf';

restore database;
switch datafile all;
switch tempfile all;
release channel disk1;
release channel disk2;
}


Step_6: Recover Database;

RMAN> recover database;(RMAN> recover database until scn 21046745532;)
RMAN> alter database open resetlogs;