Thursday, March 5, 2020

AWS S3

List Your Buckets

Use the s3 ls command to list your buckets. Here are some examples of common usage.

The following command lists all buckets.
$ aws s3 ls 2018-12-11 17:08:50 my-bucket 2018-12-14 14:55:44 my-bucket2

The following command lists all objects and folders
aws s3 ls s3://prod-backup/


===================================================
Upload:
===================================================

aws s3 cp db_info.html s3://prod-backup/DB/


===================================================
Download:
===================================================


aws s3 cp s3://prod-backup/dba/oracle/tool/AHF-LINUX_v19.3.2.zip .

Enable Oracle 12c Unified Auditing - Pure Mode

Enable Oracle 12c Unified Auditing - Pure Mode


Why we want Pure Mode?
The first is the audit trails are no longer written to their traditional pre-12c audit locations. Auditing is consolidated into the Unified Audit views and stored using Oracle SecureFiles. Oracle Secured Files use a proprietary format which means that Unified Audit logs cannot be viewed using editors such vi and may preclude or affect the use of third party logging solutions such as Splunk or HP ArcSight.

Operations done by SYS are also recorded.

Unified Auditing comes standard with Oracle Enterprise Edition; no additional license is required. It is installed by default, but not fully enabled by default.

Enable Unified Auditing(Pure Mode):

- Stop Application
- Stop Listener

$ lsnrctl stop

- Relink Oracle Home binaries:

SQL> select * from v$option where PARAMETER = 'Unified Auditing';
SQL> shutdown immediate
cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk uniaud_on ioracle
$ lsnrctl start
SQL> startup 


AUDIT POLICY ORA_CIS_RECOMMENDATIONS;
AUDIT POLICY ORA_LOGON_FAILURES;
AUDIT POLICY ORA_SECURECONFIG;

SQL>

CREATE AUDIT POLICY ORA_DML_APP_OBJ
  ACTIONS DELETE, INSERT, UPDATE
WHEN 'sys_context(''userenv'',''SESSION_USER'') not in ( ''APPUSR1'',''APPUSR2'')'
  EVALUATE PER STATEMENT;

AUDIT POLICY ORA_DML_APP_OBJ BY DBA_PITOU;


COL USER_NAME FOR A30
COL POLICY_NAME FOR A30  
SELECT USER_NAME,POLICY_NAME FROM AUDIT_UNIFIED_ENABLED_POLICIES;

USER_NAME                      POLICY_NAME
------------------------------ ------------------------------
ALL USERS                      ORA_SECURECONFIG
ALL USERS                      ORA_LOGON_FAILURES
ALL USERS                      ORA_CIS_RECOMMENDATIONS
ALL USERS                      ORA_DML_APP_OBJ


select SEGMENT_NAME,TABLESPACE_NAME,BLOCKS,BYTES/1024/1024 "Size Mb" 
from dba_segments where  SEGMENT_NAME = 'AUD$';

select SEGMENT_NAME,SEGMENT_SUBTYPE,SEGMENT_TYPE,BYTES/1024/1024 "Size Mb",TABLESPACE_NAME  
from dba_segments where OWNER = 'AUDSYS';



CREATE TABLESPACE AUDIT_TRAIL
  DATAFILE '/u01/app/oracle/oradata/pcrd/audit_trail01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
  ENCRYPTION USING 'AES256'
  DEFAULT STORAGE (ENCRYPT);
 
BEGIN
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(
       audit_trail_type            => DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD,
       audit_trail_location_value  =>  'AUDIT_TRAIL');
END;
/

BEGIN 
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(
AUDIT_TRAIL_TYPE =>DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
AUDIT_TRAIL_LOCATION_VALUE => 'AUDIT_TRAIL');
END;
/


select SEGMENT_NAME,TABLESPACE_NAME,BLOCKS,BYTES/1024/1024 "Size Mb" 
from dba_segments where  SEGMENT_NAME = 'AUD$';

select SEGMENT_NAME,SEGMENT_SUBTYPE,SEGMENT_TYPE,BYTES/1024/1024 "Size Mb",TABLESPACE_NAME  
from dba_segments where OWNER = 'AUDSYS';



CREATE AUDIT POLICY PL_AUD_DDL
 ACTIONS
 ALTER CLUSTER,CREATE CLUSTER,DROP CLUSTER,TRUNCATE CLUSTER,
 ALTER FUNCTION,CREATE FUNCTION,DROP FUNCTION,
 ALTER INDEX,CREATE INDEX,DROP INDEX,
 ALTER OUTLINE,CREATE OUTLINE,DROP OUTLINE,
 ALTER PACKAGE,CREATE PACKAGE,DROP PACKAGE,
 ALTER PACKAGE BODY,CREATE PACKAGE BODY,DROP PACKAGE BODY,
 ALTER SEQUENCE,CREATE SEQUENCE,DROP SEQUENCE,
 ALTER TABLE,CREATE TABLE,DROP TABLE,TRUNCATE TABLE,
 ALTER TRIGGER,CREATE TRIGGER,DROP TRIGGER,
 ALTER TYPE,CREATE TYPE,DROP TYPE,
 ALTER TYPE BODY,CREATE TYPE BODY,DROP TYPE BODY,
 ALTER VIEW,CREATE VIEW,DROP VIEW;


 AUDIT POLICY PL_AUD_DDL;


--NOAUDIT POLICY PL_AUD_DDL;
--DROP AUDIT POLICY PL_AUD_DDL;



Default Policy:

ORA_ACCOUNT_MGMT
ORA_CIS_RECOMMENDATIONS
ORA_DATABASE_PARAMETER
ORA_DV_AUDPOL
ORA_DV_AUDPOL2
ORA_LOGON_FAILURES
ORA_RAS_POLICY_MGMT
ORA_RAS_SESSION_MGMT
ORA_SECURECONFIG


SET LINESIZE 200
COL USER_NAME FOR A15
COL POLICY_NAME FOR A20
COL ENABLED_OPTION FOR A15
COL SUCCESS FOR A5
COL FAILURE FOR A5
SELECT USER_NAME,POLICY_NAME,ENABLED_OPTION,SUCCESS,FAILURE FROM AUDIT_UNIFIED_ENABLED_POLICIES;

USER_NAME       POLICY_NAME          ENABLED_OPTION  SUCCE FAILU
--------------- -------------------- --------------- ----- -----
ALL USERS       ORA_SECURECONFIG     BY USER         YES   YES
ALL USERS       ORA_LOGON_FAILURES   BY USER         NO    YES


COL USER_NAME FOR A30
COL POLICY_NAME FOR A30  
SELECT USER_NAME,POLICY_NAME FROM AUDIT_UNIFIED_ENABLED_POLICIES;


DBA_PITOU ORA_DML_APP_OBJ
ALL USERS ORA_SECURECONFIG
ALL USERS ORA_LOGON_FAILURES
ALL USERS ORA_CIS_RECOMMENDATIONS



SELECT * FROM audit_unified_policies
ORDER BY policy_name,
         audit_option;  
==========================================
SELECT * FROM audit_unified_policies
where policy_name in ('ORA_SECURECONFIG','ORA_CIS_RECOMMENDATIONS')
ORDER BY policy_name,
         audit_option;
 
SELECT * FROM audit_unified_policies
where policy_name in (SELECT POLICY_NAME FROM AUDIT_UNIFIED_ENABLED_POLICIES)
ORDER BY policy_name,
         audit_option;  

SELECT * FROM audit_unified_policies
where policy_name in (SELECT POLICY_NAME FROM AUDIT_UNIFIED_ENABLED_POLICIES) and audit_option like '%TABLE%'
ORDER BY policy_name,
         audit_option;

SET LINESIZE 200
COL OS_USERNAME FOR A11
COL USERHOST FOR A20
COL DBUSERNAME FOR A15
COL ACTION_NAME FOR A15
COL OBJECT_NAME FOR A25
COL CLIENT_PROGRAM_NAME FOR A15
COL SQL_TEXT FOR A50

select DBUSERNAME,EVENT_TIMESTAMP,SQL_TEXT,ACTION_NAME,SYSTEM_PRIVILEGE_USED,UNIFIED_AUDIT_POLICIES,OBJECT_SCHEMA,OBJECT_NAME,CLIENT_PROGRAM_NAME,OS_USERNAME,USERHOST
from unified_audit_trail
order by event_timestamp desc ;

select DBUSERNAME,ACTION_NAME,COUNT(*)
from unified_audit_trail
group by DBUSERNAME,ACTION_NAME
order by DBUSERNAME,ACTION_NAME;

select DBUSERNAME,EVENT_TIMESTAMP,SQL_TEXT,ACTION_NAME,SYSTEM_PRIVILEGE_USED,UNIFIED_AUDIT_POLICIES,OBJECT_SCHEMA,OBJECT_NAME,CLIENT_PROGRAM_NAME,OS_USERNAME,USERHOST
from unified_audit_trail
Where event_timestamp >= TO_DATE('15/FEB/2019','dd/mon/yyyy')
order by event_timestamp desc ;

select DBUSERNAME,EVENT_TIMESTAMP,SQL_TEXT,ACTION_NAME,SYSTEM_PRIVILEGE_USED,UNIFIED_AUDIT_POLICIES,OBJECT_SCHEMA,OBJECT_NAME,CLIENT_PROGRAM_NAME,OS_USERNAME,USERHOST
from unified_audit_trail
Where event_timestamp >= TO_DATE('20/FEB/2019','dd/mon/yyyy') and action_name not in('LOGON','LOGOFF BY CLEANUP')
order by event_timestamp desc ;


select DBUSERNAME,EVENT_TIMESTAMP,SQL_TEXT,ACTION_NAME,SYSTEM_PRIVILEGE_USED,UNIFIED_AUDIT_POLICIES,OBJECT_SCHEMA,OBJECT_NAME,CLIENT_PROGRAM_NAME,OS_USERNAME,USERHOST
from unified_audit_trail
Where TRUNC(event_timestamp) = '16-DEC-2019'
order by event_timestamp desc ;


select DBUSERNAME,TO_CHAR(EVENT_TIMESTAMP,'DD-MON-YYYY HH24:MI') EVENT_TIMESTAMP,Count(*)
from unified_audit_trail
where DBUSERNAME='SYS'
group by DBUSERNAME,TO_CHAR(EVENT_TIMESTAMP,'DD-MON-YYYY HH24:MI')
order by EVENT_TIMESTAMP desc ;

select DBUSERNAME,EVENT_TIMESTAMP,SQL_TEXT,ACTION_NAME,SYSTEM_PRIVILEGE_USED,UNIFIED_AUDIT_POLICIES,OBJECT_NAME,CLIENT_PROGRAM_NAME,OS_USERNAME,USERHOST
from unified_audit_trail
WHERE DBUSERNAME IN ('DBA_PITOU')
      AND TRUNC(event_timestamp)='21-SEP-2019'
order by event_timestamp desc ;

Saturday, October 14, 2017

Performance Tuning: PROCESSES

      The PROCESSES initialization parameter determines the maximum number of operating system processes that can be connected to Oracle Database concurrently. The value of this parameter must be a minimum of one for each background process plus one for each user process. The number of background processes will vary according the database features that you are using. For example, if you are using Advanced Queuing or the file mapping feature, you will have additional background processes. If you are using Automatic Storage Management, then add three additional processes for the database instance.

If you plan on running 50 user processes, a good estimate would be to set the PROCESSES initialization parameter to 70.

To count current number of process on database:
SQL> select count(*) from v$process;

  COUNT(*)
----------
       368

To display current value of process on database:
SQL> show parameter process

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
processes                            integer     6000
SQL>


To display current value of process on os:
$ ulimit -u
131072

To count current number of process on os:
ps -ef|wc -l
1299

To set value in database:
SQL> alter system set process=6000 scope=spfile;

To set value in OS:
vi /etc/security/limits.conf
orausr     soft    nproc       131072
orausr     hard   nproc       131072

Friday, October 13, 2017

Performance Tuning: Session_max_open_files

Performance Tuning: Session_max_open_files

        Specifies the maximum number of BFILEs that can be opened in any session. The maximum value for this parameter depends on the equivalent parameter defined for the underlying operating system. The range of value is 1 to either 50 or the value of MAX_OPEN_FILES defined at the operating system level, whichever is less

To display current value on database:
SQL> show parameter Session_max_open_files
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
session_max_open_files               integer     500
SQL>

To display current value on OS per user:
$ ulimit -Hn
65536
$ ulimit -Sn
65536

To set value in database:
SQL> alter system set session_max_open_files =500 scope=spfile;


To set value in OS:
vi /etc/security/limits.conf
orausr     soft    nofile       65536
orausr     hard   nofile       65536

To count number of data file on database:
SQL> select count(*) from dba_data_files;

  COUNT(*)
----------
       180

SQL>

We can increase values of session_max_open_files whenever number of database files get increase.

Monday, October 9, 2017

Performance Tuning: db_keep_cache_size

Performance Tuning-db_keep_cache_size

         Data which is frequently accessed should be kept in Keep buffer pool. Keep buffer pool retains data in the memory. So that next request for same data can be entertained from memory. This avoids disk read and increases performance. Usually small objects should be kept in Keep buffer.
According to Oracle documentation, a good candidate for a segment to put into the KEEP pool is a segment that is smaller than 10% of the size of the DEFAULT buffer pool.

To find the size of a particular table
select (x.blocks *8)/(1024) "Size in MB" from user_tables x where table_name = 'TBLMENU';


By selecting data from view v$db_cache_advice we can decide how much cache size should be set to db_keep_cache_size. Estimated Physical Read Factor equal to 1 is represent current value of db_keep_cache_size (2048 MB).



In this example, the output shows that if the cache was 384 MB, instead of the current size of 2048 MB—the estimated number of physical reads would increase by a factor of 2.01, or 101%. Hence, it is not advisable to decrease the cache size to 384MB.
However, increasing the cache size to 3840MB may potentially decrease reads by a factor of .87, or 13%. If an additional 1792MB memory is available on the system and the value of the SGA_MAX_SIZE parameter allows for the increment, it is advisable to increase the keep buffer cache pool (db_keep_cache_size) size to 3840MB.

To load a table tblMenu in KEEP buffer cache, we need to issue command as below:
ALTER TABLE TBLMENU STORAGE(BUFFER_POOL KEEP);

To unload a table tblMenu from buffer, we need to issue the following command:
ALTER TABLE TBLMENU STORAGE(BUFFER_POOL DEFAULT);

To check whether a table is keep in buffer, we need to issue the following command:
select s.segment_name,s.buffer_pool from dba_segments s where s.segment_name='TBLMENU';
SEGMENT_NAME    BUFFER_POOL
TBLMENU                 KEEP


Friday, August 4, 2017

Restore Duration Time for Database

     The query below is to show the duration of Restore Time for a Database.  It is very useful for a big database restoration that we need to know how long the restoration is completed. Please notice this script for your daily DBA jobs :). Please set the value to database which you want to know restoration duration time --SET @databaseName = 'TM201707'

/*

Query - Restore Duration Time for Database

Uses MSDB..RestoreHistory table for Start time and ErrorLog for Finish Time

*/

-- Name of the Database you want restore name of:
DECLARE @databaseName VARCHAR(50)
SET @databaseName = 'TM201707'



DECLARE @TSQL NVARCHAR(2000)
DECLARE @lC INT
DECLARE @ErrorLogStart DATETIME
DECLARE @CurrentLogStart DATETIME
SET @CurrentLogStart = GETDATE()

-- Error Message for ErrorLog search
DECLARE @errorLogResult VARCHAR(4000)
SET @errorLogResult = 'Restore is complete on database ''' + @databaseName
    + '''.  The database is now available.'

-- Results Table
CREATE TABLE #Restore
    (
      [database] VARCHAR(50) ,
      StartTime DATETIME ,
      EndTime DATETIME
    )

INSERT  INTO #Restore
        ( [database] )
VALUES  ( @databaseName )

-- Get start time by looking msdb..restorehistory and selecting the first record with your db
UPDATE  #Restore
SET     StartTime = ( SELECT TOP ( 1 )
                                restore_date
                      FROM      msdb.dbo.restorehistory
                      WHERE     destination_database_name = @databaseName
                    )
WHERE   [database] IS NOT NULL

-- Get end time by loading the errorlog into a temp table and filtering to find the restore command @errorLog Result


-- SET ErrorLogStart Date to Restore Start Time
SET @ErrorLogStart = ( SELECT   StartTime
                       FROM     #Restore
                       WHERE    [database] = @databaseName
                     )

CREATE TABLE #TempLog
    (
      LogDate DATETIME ,
      ProcessInfo NVARCHAR(50) ,
      [Text] NVARCHAR(MAX)
    )

CREATE TABLE #logF
    (
      ArchiveNumber INT ,
      LogDate DATETIME ,
      LogSize INT
    )

INSERT  INTO #logF
        EXEC sp_enumerrorlogs
SELECT  @lC = MIN(ArchiveNumber)
FROM    #logF

WHILE @lC IS NOT NULL
    BEGIN
        IF EXISTS ( SELECT  1
                    FROM    #TempLog )
            BEGIN
                SET @CurrentLogStart = ( SELECT TOP ( 1 )
                                                LogDate
                                         FROM   #TempLog
                                         ORDER BY LogDate
                                       )
            END
        IF ( @CurrentLogStart > @ErrorLogStart )
            BEGIN
                INSERT  INTO #TempLog
                        EXEC sp_readerrorlog @lC
                SELECT  @lC = MIN(ArchiveNumber)
                FROM    #logF
                WHERE   ArchiveNumber > @lC
            END
        ELSE
            BEGIN
                BREAK
            END
    END


   
UPDATE  #Restore
SET     EndTime = ( SELECT TOP ( 1 )
                            LogDate
                    FROM    #TempLog
                    WHERE   ProcessInfo = 'Backup'
                            AND [Text] LIKE @errorLogResult
                  )
WHERE   [database] IS NOT NULL



-- Return the Restore information
SELECT  [database] ,
        StartTime ,
        EndTime ,
        DATEDIFF(MINUTE, StartTime, EndTime) AS 'Restore Duration in Minutes' ,
        DATEDIFF(SECOND, StartTime, EndTime) AS 'Restore Duration in Seconds'
FROM    #Restore

-- Clean up
DROP TABLE #Restore
DROP TABLE #TempLog
DROP TABLE #logF

Sample Output:



Reference: https://sqlnotesfromtheunderground.wordpress.com/2014/10/02/restore-duration-time-for-database/

Wednesday, November 23, 2016

Part 3: Grid Infrastructure and Database Upgrade from 11gR2 11.2.0.3 to 12C 12.1.0.2

Upgrade Database to 12.1.0.2
Check Invalid Object:
set pagesize500
set linesize 100
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version from dba_registry order by comp_name;

select substr(object_name,1,40) object_name,substr(owner,1,15) owner,object_type from dba_objects where status='INVALID' order by owner,object_type;

select owner,object_type,count(*) from dba_objects where status='INVALID' group by owner,object_type order by owner,object_type ;

To VALIDATE the invalid objects:

$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus "/ as sysdba"
SQL> @utlrp.sql

Ref : Complete Checklist for Upgrading to Oracle Database 12c Release 1 using DBUA (Doc ID 1516557.1)

Collect DB Upgrade/Migrate Diagnostic Information:
cd <location of the script>
$ sqlplus / as sysdba
sql> alter session set nls_language='American';
sql> @dbupgdiag.sql
sql> exit

Ref: Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql) (Doc ID 556610.1)

Check What User Should Run Statistics:
$ sqlplus / as sysdba

SQL> @check_stale_stats.sql

Example:

EXEC DBMS_STATS.GATHER_DICTIONARY_STATS('SYS',OPTIONS=>'GATHER', ESTIMATE_PERCENT => DBMS_STATS.AUTO_SAMPLE_SIZE, METHOD_OPT => 'FOR ALL COLUMNS SIZE AUTO', CASCADE => TRUE);


Disable Oracle Database Vault & Oracle Label Security
Ref : Complete Checklist for Upgrading to Oracle Database 12c Release 1 using DBUA (Doc ID 1516557.1)

Drop EM DB Console Repository from 11gR2 DB

[oracle@ol6-112-rac1 ~]$ emca -deconfig dbcontrol db -repos drop

STARTED EMCA at Nov 7, 2016 4:09:00 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: RAC1
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:

----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Nov 7, 2016 4:10:45 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/RAC/emca_2016_11_07_16_09_00.log.
Nov 7, 2016 4:10:46 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed. Some of the possible reasons may be:
 1) EM is configured with different hostname then physical host. Set environment variable ORACLE_HOSTNAME=<hostname> and re-run EMCA script
 2) ORACLE_HOSTNAME is set. Unset it and re-run EMCA script
Nov 7, 2016 4:10:46 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Nov 7, 2016 4:14:24 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Nov 7, 2016 4:14:24 PM
[oracle@ol6-112-rac1 ~]$

For alternative solution please see step in:
Ref : Complete Checklist for Upgrading to Oracle Database 12c Release 1 using DBUA (Doc ID 1516557.1)

Verify cluster status
Perform an extra check on the status of the Grid Infrastructure post upgrade by executing the following command from one of the compute nodes:

(root)# /u01/app/12.1.0.2/grid/bin/crsctl check cluster -all

Change Custom Scripts and environment variables to Reference the 12.1.0.2 Grid Home
Start all primary instances in restricted mode
DBUA requires all RAC instances to be running from the current database home before starting the upgrade. To prevent an application from accidentally connecting to the primary database and performing work causing the standby to fall behind, startup the primary database in restricted mode, as follows:
(oracle)$ srvctl start database -d PRIM -o restrict

Upgrade the Database with Database Upgrade Assistant (DBUA)

NOTE: Before starting the Database Upgrade Assistant it is required change the preference for 'concurrent statistics gathering' on the current release if the current setting is not set to 'FALSE'.

First, while still on the 11.2. release, obtain the current setting:
SQL> SELECT dbms_stats.get_prefs('CONCURRENT') from dual;
When 'concurrent statistics gathering' is not not set to 'FALSE', change the value to 'FALSE before the upgrade.
BEGIN
DBMS_STATS.SET_GLOBAL_PREFS('CONCURRENT','FALSE');
END;
/


NOTE: Before starting the database upgrade assistant all databases that will be upgraded having services configured with PRECONNECT as option for 'TAF Policy specification' should have these services  stopped and disabled. Once a database upgrade is completed, services can be enabled and brought online. Not disabling services having the PRECONNECT option for 'TAF Policy specification' will cause an upgrade to fail.

For each database being upgraded use the srvctl command to determine if a 'TAF policy specification' with 'PRECONNECT' is defined. Example as follows:

(oracle)$ srvctl config service -d <db_unique_name> | grep -i preconnect | wc –l

For each database being upgraded the output of the above command should be 0. When the output of the above command is not equal to 0, find the specific service(s) for which PRECONNECT is defined. Example as follows:
(oracle)$ srvctl config service -d <db_unique_name> -s <service_name>

Those services found need to be stopped and disabled before proceeding the upgrade. Example as follows:
(oracle)$ srvctl stop service -d <db_unique_name> -s "<service_name_list>"
(oracle)$ srvctl disable service -d <db_unique_name> -s "<service_name_list>"


NOTE: Prior to running dbua and upgrading the primary database, remove DIAG_ADR_ENABLED=off from sqlnet.ora (or) either set sqlnet.ora parameter "DIAG_ADR_ENABLED" to ON (the default value). This is further described in Document 1969684.1 "DBCA & DBUA Does not Identify Disk Groups When DIAG_ADR_ENABLED=OFF In sqlnet.ora"


Oracle recommends removing the value for the init.ora parameter 'listener_networks' before starting DBUA. The value will be restored after running DBUA. Be sure to obtain the original value before removing, as follows:

SYS@PRIM1> set lines 200
SYS@PRIM1> select name, value from v$parameter where name='listener_networks';

If the value for parameter listener_networks was set, then the value needs to be removed as follows:

SYS@PRIM1> alter system set listener_networks='' sid='*' scope=both;



Run DBUA from the new 12.1.0.2 ORACLE_HOME as follows:
[oracle@ol6-112-rac1 ~]$ which dbua
/u01/app/oracle/product/12.1.0.2/db_1/bin/dbua
[oracle@ol6-112-rac1 ~]$
 [oracle@ol6-112-rac1 ~]$ dbua



































Part 2: Grid Infrastructure and Database Upgrade from 11gR2 11.2.0.3 to 12C 12.1.0.2

Install Database 12.1.0.2 Software
Prepare Installation Software
Unzip the 12.1.0.2 database software.  Run the following command on the database server where the software is staged.
(oracle)$ unzip -q /u01/app/oracle/patchdepot/linuxamd64_12c_database_1of2.zip -d /u01/app/oracle/patchdepot
(oracle)$ unzip -q /u01/app/oracle/patchdepot/linuxamd64_12c_database_2of2.zip -d /u01/app/oracle/patchdepot

Create the new Oracle DB Home directory on all database server nodes
Node 1 and Node 2:
mkdir -p /u01/app/oracle/product/12.1.0.2/db_1

Perform 12.1.0.2 Database Software Installation with the Oracle Universal Installer (OUI)
Note: For OUI installations or execution of important scripts it is recommend to use VNC to avoid problems in case connection with the server is lost.

[oracle@ol6-112-rac1 database]$ ./runInstaller




























[root@ol6-112-rac1 ~]# /u01/app/oracle/product/12.1.0.2/db_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/12.1.0.2/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
[root@ol6-112-rac1 ~]#

[root@ol6-112-rac2 ~]# /u01/app/oracle/product/12.1.0.2/db_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/12.1.0.2/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
[root@ol6-112-rac2 ~]#



 Now  Install Database 12.1.0.2 Software is completed.
Please click below link to see the next step Upgrade DB from 11gR2 to 12C




Followers