Monday 27 June 2016

ORA-12516: TNS:listener could not find available handler with matching protocol stack


CAUSE

 This is an issue with the number of database process/sessions. There are some bugs that reduce the processes/sessions required, and the fixes are included in Patch:19197270 AD:R12.AD.C.DELTA.6 PATCH and later.

SOLUTION


As a workaround, bouncing the database, and raising the number of processes/sessions should let you complete the patch (you will need to restart the patch after you do the workaround). (NOTE: Simply bouncing the database might allow you to continue.)


Reference: adop fails with "ORA-12516: TNS:listener could not find available handler with matching protocol stack" (Doc ID 2105049.1)

Wednesday 22 June 2016

Row Level Locking with Hybrid Columnar Compression (HCC)

Database Storage Optimization

Row Level Locking with Hybrid Columnar Compression (HCC)

Hybrid Columnar Compression (HCC) is a very unique feature in that it gives a very big gain in compression ratios (10x on average), makes table scans run a lot faster (up to 10x), and all this not for a subset of DW scenarios, but for every DW use case. HCC is used by most if not all Exadata DW customers and POCs.

The only real limitation of HCC in first release was that it was not suited for data that is actively being modified (thought it can be still used in such environments as part of an ILM strategy). As of Oracle Database 11g Release 2, Hybrid Columnar Compression didn’t support row level locking like with other table formats in Oracle, such as non-compressed or Advanced Row compressed tables.

Oracle’s Hybrid Columnar Compression technology is a different and new method for organizing data within a database block. As the name implies, this technology utilizes a combination of both row and columnar methods for storing data. This hybrid approach achieves the compression benefits of columnar storage, while avoiding the performance shortfalls of a pure columnar format. A logical construct called the compression unit (CU) is used to store a set of hybrid columnar compressed rows. When data is loaded, column values for a set of rows are grouped together, compressed and stored in a compression unit. With Oracle Database 11g Release 2, HCC supported compression unit level locking; that is, locking the entire compression unit on an active transaction modifying a single row in the unit.



Row level locking is a requirement for mixed OLTP and DW environments and is a definite requirement for OLTP applications. For mixed workloads, ILM approach likely works fine, but needs to be used much more cautiously. Lack of row level locking was a major restriction for HCC, and as a result HCC was mainly targeted for Data Warehouse environments. With Oracle Database 12c, HCC tables now support row level locking. In order to do so, it needs to be able to store the locking information on per row basis (including whether or not a row is locked, and if locked the locking transaction information). The approach is similar to locking in non-compressed or Advanced Row compressed tables as described next.

For non-compressed or Advanced Row compressed tables Oracle stores a lock byte (index into the list of active transactions in the data block) in the row header to indicate whether or not the row is locked, and if locked then information about the locking transaction. This approach works well when there can be high concurrency and many active transactions in a block at a given time. But in the most typical cases allocating a byte per row is an over kill.

For HCC tables, the approach is similar but a more efficient. Rather than allocating the lock byte upfront, Oracle allocates lock bit(s) on demand and based on number of active and anticipated transactions on a compression unit. It could pre-allocate enough bits to support anticipated concurrency on the block (dependent on INITRANS setting for the table), OR with a CU level lock for the entire compression unit.  Since most of the times there won’t be any transactions modifying data in the CUs, there is no need to allocate any bits per row for locking. If there are active transactions and a need for row level locking, Oracle allocates more bit(s) per row to be able to support row level locking. 1 bit per row will be able to support 1 active transaction, 2 bits supports up to 3 concurrent transactions, 3 bits supports up to 7 concurrent transactions and so on... The maximum need is to support 255 active transactions per compression unit, as the number of ITLs (interested transaction list) in the data blocks is limited to 255. That is, we will need maximum of 1 byte per row.

As you see, this approach doesn’t pre-allocate 1 byte per row; but allocates it on demand. It is possible to support 255 concurrent transactions (like uncompressed or Advanced Row compressed blocks); have CU level locking; or anywhere in between. In the worst case, Oracle needs 1 byte per row to support this; but in most practical cases, we will be much better than that.

The next question that comes to one’s mind is where does the space for allocating locking bit(s) come from? Just like non-compressed tables use PCTFREE to extend the ITLs as needed, Oracle uses PCTFREE in the blocks to extend ITLs and allocate any additional lock bits for HCC tables. This is the most natural place to allocate the space from.

And where are lock bits stored? The lock information is stored uncompressed in the CU header. Today Oracle already stores other information for rows in the CU header. Lock bit(s) are stored in the CU header along with other per row information.

The ability to have row level locking has further widened the applicability of HCC’s columnar and compression technology to OLTP or mixed workload environments. It has allowed for making the use of HCC wide spread and operationally complete. Row Level Locking for Hybrid Columnar Compression is part of Advanced Compression Option which enables the highest levels of data compression and provides enterprises with tremendous cost-savings and performance improvements due to reduced I/O.

Source: https://blogs.oracle.com/DBStorage/entry/row_level_locking_with_hybrid

CREATING DBLINK BETWEEN ORACLE AND SQLSERVER USING ODBC GATEWAY METHOD

Creating DBLINK between ORACLE AND SQLSERVER using ODBC gateway method

Configuration Steps:

1.       Install ODBC Gateway 11gR2

1.1   Download the Oracle Database Gateways 11g Release 2 (11.2.0.1.0) for Microsoft Windows (32-bit) from the  
        following link :
1.2   unzip the file and install the gateway


   
          
    


    


   
   
    


   



2.       Create DSN in windows

Go to Control Panel àAdministrative Tools àData sources (ODBC)àSystem DSN
2.1   click add and follow the below steps
2.2   Select SQL SERVER from driver list. 



2.3   Next Screen give the following details

             Name:  <DSN NAME >     // This name will use in initdg4odbc.ora file as a DSN NAME

            Description: any message 
                           
                 

             Server : <Sql server name >
                                 
                                 
 
                          

                             
2.4   Select Sql Authentication and provide the sql server username and password.
2.5   Connection will established when all the given details (username, password, server) correct otherwise it will show error. 
                  
    
2.6   Once the connection established, it will show the database list and other things related to sql server. 
                    




2.7   Follow the screens and finally test the connection. Now , The DSN name have created and added to the list. 



3.       Edit the initdg4odbc.ora file

Go to initdg4odbc.ora file location and edit the following parameters

     Location:  E:\product\11.2.0\tg_1\hs\admin

     Parameters:

              HS_FDS_CONNECT_INFO = mssql     // Give the DSN name which have already created
              HS_FDS_TRACE_LEVEL = off


4.       Configure the listener
Location: E:\product\11.2.0\tg_1\NETWORK\ADMIN
                dg4odbc =
 (ADDRESS_LIST=
      (ADDRESS=(PROTOCOL=tcp)(HOST=172.16.1.97)(PORT=1530))
 )


SID_LIST_dg4odbc=
  (SID_LIST=
      (SID_DESC=
         (SID_NAME=dg4odbc)
         (ORACLE_HOME=E:\product\11.2.0\tg_1)
         (PROGRAM=dg4odbc)
      )
  )

4.1   Run the dg4odbc listener Manually

C:\lsnrctl start dg4odbc




5.       Configure the tnsnames in oracle box(Linux OS)

Location:   $ cd /d1/oracledb/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

dg4odbc =
 (ADDRESS_LIST=
      (ADDRESS=(PROTOCOL=tcp)(HOST=172.16.1.97)(PORT=1530))
 )

SID_LIST_dg4odbc=
  (SID_LIST=
      (SID_DESC=
         (SID_NAME=dg4odbc)
         (ORACLE_HOME=E:\product\11.2.0\tg_1)
         (PROGRAM=dg4odbc)
      )
  )


$ tnsping dg4odbc




6.       Create a dblink

 Sql> create public database link mlink
          Connect to “sa”
          Identified by “apps”
          Using ‘dg4odbc’;       // this is tnsname entry
             



7.       Run the query based on sqlserver tables. Now, you can get the result from sqlserver.




ORACLE to ORACLE  DBlink
TNS entry on both the nodes
General  Ledger Super User -> setup -> system -> Database links




Apps Read Only schema creation in R12.2

check the invalid objects before creating apps read only schema

sqlplus / as sysdba

create user appsro identified by appsro;
grant connect, resource to appsro;
grant create synonym to appsro;
commit;

sqlplus apps/oracle1234
set head off
set newpage none
set pagesize 9999
spool create_synonyms.sql
select 'create synonym ' || OBJECT_NAME || ' for ' || OWNER ||'.' ||OBJECT_NAME || ';' from all_objects where OWNER not in ('SYS','SYSTEM') and OBJECT_NAME not like '%/%' and OBJECT_TYPE in ('TABLE','VIEW','SYNONYM');
spool off

spool grant_select.sql
select 'grant select on '|| OWNER ||'.' ||OBJECT_NAME || ' to appsro;' from all_objects where OWNER not in ('SYS','SYSTEM') and OBJECT_NAME not like '%/%' and OBJECT_TYPE in ('TABLE','VIEW','SYNONYM');
spool off
exit


sqlplus / as sysdba
@grant_select.sql
exit;

sqlplus SYSTEM/manager121
alter session set current_schema=APPS;
exec AD_ZD_PREP.ENABLE_CUSTOM_USER('APPSRO');

sqlplus appsro/appsro
@create_synonyms.sql
exit;

after completion of above steps validate the invalid objects count.

Issue:
======
SQL> @create_synonyms.sql

But many synonyms creation failed while executing create_synonyms.sql. like
ORA-38818: illegal reference to editioned object APPS.OE_ENDECA_FULFILL_DELAY_V..


Solution:
========
Before running create_synonym pls do the below steps.

sqlplus SYSTEM
SQL> alter session set current_schema=APPS;
SQL> exec AD_ZD_PREP.ENABLE_CUSTOM_USER('CUSTOM_SCHEMA');

Ref: Create And Register CUSTOM Schema On EBS 12.2 (Doc ID 1929668.1)

Delete Server Pool in Oracle RAC

crsctl status serverpool -f

crsctl delete serverpool 

Day to Day Activities of Oracle DBA - Checklist

DBA Checklist (Activities of Oracle DBA):

-->Daily DBA Checklist
-->Daily Night DBA Checklist
-->Weekly DBA Checklist
-->Weekly Tuning DBA Checklist
-->Monthly DBA Checklist
-->Quarterly DBA Checklist
-->One Time Activity DBA Checklist

Daily DBA Checklist:

* Health check of the Database Instance and Listener.
* Viewing the Alert log file and/or check Alert log in regular interval to solve the ORA errors.
* Check any session blocking the other session and oracle locks. Clear locks
* Check long running UNIX process
* Ensure that there are no DBMS_JOBS with the status of failed or broken. Also last refresh times of all running jobs should be current.
* Check all cron house keeping script logs
* Daily Tablespace Utilization.
* Rebuilding of Indexes, if bulk load of data is inserted.
* Check the temporary tablespace/files.
* Check the UNDO tablespace and retaintion.
* Monitor the Unix /tmp and /var Location
* Monitor the UTL_FILE location.
* Monitor all Database file system or drive.
* Monitor Archive Log location.
* Verify success of database archiving to tape
* Monitoring Backups.
* Monitoring the log files, backups, database space usage and the use of system resources.
* Monitoring Production Database Performance
* Find high CPU/Memory/Physical IO consuming processes and trace the SQL/From running behind and Update to Application team.
* Check OEM Agent is running Or not in each node.
* Verify DBSNMP is running
* Verify success of database backup
* Daily RMAN(Incremental+Cumulative)/Data Pump export backups after business hours.
* User Management. User Profile monitoring.
* Monitor User account GRACE period.
* Check Invalid objects and recompile.
* Check and monitor Audit log or table.
* Backup your CRONTAB or Win Schedular
* Most Important - read DBA manuals for one hour
* Most Important - Check your oracle licence and do not run/execute/create beyond the oracle Licence policy.

Daily Night DBA Checklist:

* Look for objects that break rules (Check for Huge NEXT_EXTENT or MAX_EXTENT)
* Check the objects reaching to it’s Max extents
* Note, All tables should have unique primary keys, so check missing/disabled PK and
* Check for Block corruption


Weekly DBA Checklist:

* Database Growth Comparision.
* Identify bad growth projections.
* RMAN full databsae(Level 0) backup.
* Weekly cold backup during maintaince windows.
* Analyze Database and Schemas to gather statistics
* Check Index monitoring Usage to validate the Index usage which is not used yet. Drop/Mark Unuseable the unused Indexes.
* All indexes should use INDEXES tablespace and shoud not user DATA tablespace.
* All index datafile should not be in same file system where the DATA tablespace or SYSTEM/SYSAUX/UNDO/TEMP datafiles are.
* Look in SQL*Net logs for errors, issues (Both in Client side & Server side)
* Archive all Alert Logs and application log to history
* Check the number of log switch per hour
* How_much_redo_generated_per_hour
* Check free quota limited available of each user
* Truncate the listener.log file in the $ORACLE_HOME/network/log, if the listener log has increased to a size > than 500 MB. Ensure the space is released, otherwise 'reload' listener.

Weekly Tuning DBA Checklist:

* Check the Chaining & Migrated Rows
* Check the size of tables & check weather it need to partition or not
* Check the objects having the more extents
* Check the tables having FK but there is no Index
* Check the tables having no Indexes and tables having more Indexes
* Check the frequently pin objects & place them in separate tablespace & in cache
* Check the objects reload in memory many time
* Check open cursor not reaching to the max limit
* Check locks not reaching to the max lock
* Check I/O of each data file

Monthly DBA Checklist:

* Index Rebuild.
* Tablespace Reorganization.
* Bounce critical database once a month (If no cold backup configured)
* Look for Harmful Growth Rates
* Review database file activity.  Compare to past output to identify trends that could lead to possible contention.
* Investigate fragmentation (e.g. row chaining, etc.).
* Check location of data file also check auto extendable or not
* Check default tablespace & temporary tablespace of each user
* Check the Extents of each object and compare if any object extent are overriddenwhich is define at tablespace level
* Tablespace need coalescing
* Check the overall database statistics
* Trend Analysis of objects with tablespace, last analyzed, no. of Rows, Growth indays & growth in KB

Quarterly DBA Checklist:

* Patching
* Database Reorganization
* Check the quota of non-system tables in system tablespace.
* Bounce most critical database once a month (If no cold backup configured)
* Review common Oracle tuning points such as cache hit ratio, latch contention, and other points dealing with memory management

One Time Activity DBA Checklist:

* Database user creation with required privileges
* Make the portal of Oracle Predefined error with possible solution.
* Check database startup time(if not 24X7)
* Check location of control file
* Check location of log file
* Prepare the Backup strategy and test all the recovery scenario

How To Setup Password Security in Oracle EBS 11i/R12

NOTE:
These profiles should only be set at Site level, but can be set at other levels, such as User or Responsibility.
However, when logging in there is no User context, so if a User is prompted to change their password at log in, the profiles are only evaluated at site level.
Once logged in and resetting passwords using Preferences> Change Password, or the Security >  User> Define form these other levels will have effect and will confuse the issue. Thus, these profiles should only be set at Site level, for consistent enforcement. Please test making use of the level that works as expected for each environment.

Signon Password Failure Limit:
The Signon Password Failure Limit profile option determines the maximum number of log in attempts before the user's account is disabled. Users cannot see or update this profile option. The internal name for this profile option is SIGNON_PASSWORD_FAILURE_LIMIT.

Signon Password Hard to Guess:
The Signon Password Hard to Guess profile option sets rules for choosing passwords to ensure that they will be "hard to guess." A password is considered hardtoguess if it follows these rules:
The password contains at least one letter and at least one number.
The password does not contain the user name.
The password does not contain repeating characters.
Users can see but not update this profile option.
The internal name for this profile option is SIGNON_PASSWORD_HARD_TO_GUESS.

Signon Password Length:
Signon Password Length sets the minimum length of an Applications signon password.
If no value is entered the minimum length defaults to 5. Users can see but not update this profile option.
The internal name for this profile option is SIGNON_PASSWORD_LENGTH.

Signon Password No Reuse:
This profile option specifies the number of days that a user must wait before being allowed to reuse a password.
Users can see but not update this profile option.
The internal name for this profile option is SIGNON_PASSWORD_NO_REUSE.

Signon Password Case:
This profile option is not available from the beginning. With 11i.ATG_PF.H RUP3 comes the system profile 'Password Case Option'
After 11i.ATG_PF.H.RUP4 this system profile option was renamed to 'Signon Password Case'.
There are two settings: 'Sensitive' and 'Insensitive'. The default is 'Insensitive'.
Setting this profile option to 'Sensitive' will make the password case sensitive.
'Mixed' is no longer supported.

P.S:
The "Signon Password Case" profile can be set to 'Sensitive,'
however the following rules apply for the GUEST user:
Currently the GUEST user's password CANNOT be mixed or lowercase.
Currently the GUEST user's password MUST be UPPERCASE.

Choosing Service Name for Node Affinity for Concurrent Programs/Managers Over Instance Alias... PCP/CONCURRENT MANAGER RAC NODE AFFINITY & LISTENER LOAD

CAUSE:

Issue identified in Bug 18803853 1OFF:
4159920:APPSRAP:PCP/CONCURRENT MANAGER RAC
NODE AFFINITY
& LISTENER LOAD. This patch will allow a user to enter additional environment variables for each
specific manager in the Define Managers UI environment button.

SOLUTION:

1) Please download and review the readme for Patch 18803853: 1OFF:4159920:APPSRAP:PCP/CONCURRENT
MANAGER RAC
NODE AFFINITY & LISTENER LOAD for this functionality.
2) Please apply Patch 18803853 in a Test environment initially before application to any Production instance.
3) Please retest the issue.
4) If the issue is resolved, please migrate the solution as appropriate to other environments.

Query to check the affected modules after applying the patch in Oracle EBS R12

select distinct aprb.application_short_name as "Affected Modules"
from ad_applied_patches aap,
ad_patch_drivers apd,
ad_patch_runs apr,
ad_patch_run_bugs aprb
where aap.applied_patch_id = apd.applied_patch_id
and apd.patch_driver_id = apr.patch_driver_id
and apr.patch_run_id = aprb.patch_run_id
and aprb.applied_flag = 'Y'
and aap.patch_name = '&PatchName';

Query to find the users having sysadmin responsibility EBS R12

 SELECT fu.user_id, fu.user_name, fu.email_address
    FROM fnd_user_resp_groups_direct furg,
         fnd_user fu,
         fnd_responsibility_tl fr
   WHERE     UPPER (fr.responsibility_name) = UPPER ('&Enter_Resp_Name')
         AND fr.responsibility_id = furg.responsibility_id
         AND furg.user_id = fu.user_id
         AND furg.end_date IS NULL
         AND fu.end_date IS NULL
         AND fr.language = USERENV ('LANG')
ORDER BY fu.user_name;

Crontab Syntax Definition

*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

Basic RMAN Configuration of Oracle Database 11g Example

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO NONE;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/db/oracle/rman/bkp/DEVGRC-%F';
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/db/oracle/rman/bkp/DEVGRC-%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/db/oracle/snapcf_DEVGRC.f'; # default

RMAN>