Tuesday, 16 December 2014

Tuning Inter-Instance Performance in RAC

Tuning Inter-Instance Performance in RAC and OPS (Doc ID 181489.1)


This note was written to help DBAs and Support Analysts understand Inter-Instance Performance and Tuning in RAC.

Real Application Clusters (RAC) uses the interconnect to transfer blocks and messages between instances. If inter-instance performance is bad, almost all database operations can be delayed. This note describes methods of identifying and resolving inter-instance performance issues.

See Oracle Support Doc ID 181489.1 for details.

RAC interconnect traffic

Summary


I was looking for RAC cluster interconnect throughput and so accessed to Oracle Database Reference 11g Release 2 (11.2) documentation and surprisingly, at least for me, I was not able to find a V$ view simply displaying it.


This is a nice article on the subject of RAC interconnect traffic.

Click here to read the article.

Thursday, 11 December 2014

ADD_COLORED_SQL Procedure

From the Oracle supplied documentation:
This procedure adds a colored SQL ID. If an SQL ID is colored, it will be captured in every snapshot, independent of its level of activities (so that it does not have to be a TOP SQL). Capture occurs if the SQL is found in the cursor cache at snapshot time.

This can be very useful in the interests of fault finding or diagnosing problems.


SQL> execute dbms_workload_repository.add_colored_sql('6rj1tt5s6n497');

To confirm the SQL_ID has been colored, run the following SQL statement:
SQL> select * from sys.WRM$_COLORED_SQL

This will give you:

fred SQL> select * from sys.WRM$_COLORED_SQL
  2  /
      DBID SQL_ID        OWNER CREATE_TIME
---------- ------------- ----- --------------------
 413071501 6rj1tt5s6n497     1 11-Dec-2014 19:02:51
1 row selected.



and the following SQL will remove the color:
SQL> execute dbms_workload_repository.remove_colored_sql('6rj1tt5s6n497');


See also


AWR Colored SQL 11g

Oracle Support document
How to Determine the Execution Plan for a SQL Statement for a Range of AWR snapshots? (Doc ID 795204.1)

Oracle Support document
Information Center: SQL Query Performance Overview (Doc ID 1516494.2)



Keywords: oracle sql_id

Friday, 5 December 2014

11g Interactive Quick Reference

Oracle Database 11g: Interactive Quick Reference

Your Essential Guide to Oracle Database 11g Release 2


Oracle Database 11g Release 2 Enterprise Edition provides comprehensive features to easily manage the most demanding transaction processing, business intelligence, and content management applications.

Now you have easy access to information that you need to administer your Oracle Database with our downloadable Interactive Quick Reference. We have taken our traditional printed poster for Database Administrators, and created an electronic format packed with even more information.

Use this helpful reference as a cheat sheet for writing custom data dictionary scripts, locating views pertinent to a specific database component, and more.


Click here for the article.



Keywords: oracle 11g cheat sheet reference

Basics of SSIS and Creating Packages

SQL Server Integration Services (SSIS) – Part 1: Basics of SSIS and Creating Packages

In this article, we will see what a SQL Server Integration Services (SSIS) is; basics on what SSIS is used for, how to create an SSIS Package and how to debug the same.

Cick here for the article.


Friday, 17 October 2014

Looking at DBA_AUDIT_TRAIL

The view DBA_AUDIT_TRAIL displays all standard audit trail entries in an Oracle database. In my case, I was using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0.

The following SQL can be used to look at entries in this view.

SELECT os_username,
       username,
       terminal,
       To_char(timestamp, 'YYYY-MM-DD HH24:MI:SS') AS tstamp,
       returncode,
       action_name
FROM   dba_audit_trail
order by tstamp asc;

Sample output:

OS_USERNAME  USERNAME  TERMINAL     TSTAMP   RETURNCODE ACTION_NAME
------------ ------------ ------------ ------------------- ---------- ----------------------------
oracle     DBSNMP  ~       2014-10-17 18:32:10 1017 LOGON
root     RLBUSY  unknown      2014-10-17 18:32:15    0 LOGOFF
abc082     IMPREP  MACH-42    2014-10-17 18:32:35    0 LOGOFF
oracle     DBSNMP  unknown      2014-10-17 18:32:36    0 LOGON
oracle     DBSNMP  unknown      2014-10-17 18:32:36    0 LOGOFF BY CLEANUP
oracle     DBSNMP  unknown      2014-10-17 18:32:36    0 LOGOFF BY CLEANUP
oracle     DBSNMP  unknown      2014-10-17 18:32:36    0 LOGON
oracle     DBSNMP  ~       2014-10-17 18:32:57    0 LOGON
oracle     DBSNMP  ~       2014-10-17 18:32:57    0 LOGOFF
FRED       DUMMY  ~       2014-10-17 18:33:00 1017 LOGON
oracle     DBSNMP  ~       2014-10-17 18:33:29 1017 LOGON
oracle     DBSNMP  unknown      2014-10-17 18:33:36    0 LOGOFF BY CLEANUP
oracle     DBSNMP  unknown      2014-10-17 18:33:36    0 LOGOFF BY CLEANUP
oracle     DBSNMP  unknown      2014-10-17 18:34:36    0 LOGON
oracle     DBSNMP  unknown      2014-10-17 18:34:36    0 LOGOFF BY CLEANUP
oracle     DBSNMP  ~       2014-10-17 18:34:39 1017 LOGON
oracle     DBSNMP  ~       2014-10-17 18:34:53    0 LOGOFF
oracle     DBSNMP  ~       2014-10-17 18:34:53    0 LOGON
root     RLBUSY  unknown      2014-10-17 18:35:00    0 LOGON


The RETURNCODE column is the number associated with the ORA-????? error code that was returned to the client computer:

RETURNCODE=0 indicates success
RETURNCODE=1017 indicates bad password
RETURNCODE=28000 indicates account is locked out


For confirmation of the meaning of the returncode value, execute the following code:

SQL> execute dbms_output.put_line(sqlerrm(-1017)) ;

and you should see:

ORA-01017: invalid username/password; logon denied

or from the O/S prompt:

[oracle@host ~]$ oerr ora 01017
01017, 00000, "invalid username/password; logon denied"
// *Cause:
// *Action:


See also


Oracle Support Note "Master Note For Oracle Database Auditing (Doc ID 1299033.1)"



Keywords: oracle audit trail failed login

Wednesday, 27 August 2014

PowerShell GetEnumerator

I was working with some PowerShell collections recently and forgot how to iterate over an object of the type System.Collections.ArrayList. So after a little digging around, I made some notes to remind myself.

The test code I used to create and populate the array was:


$myArray = New-Object -TypeName System.Collections.ArrayList(100);

$myArray.Add('hearts') | Out-Null;

$myArray.Add('clubs') | Out-Null;
$myArray.Add('diamonds') | Out-Null;
$myArray.Add('spades') | Out-Null;

Write-Host "Before trimming, capacity of the array: $($myArray.Capacity)";

$myArray.TrimToSize();
$myArray.Sort();
Write-Host "After trimming, capacity of the array: $($myArray.Capacity)";
Write-Host "Number of elements actually contained in the ArrayList: $($myArray.Count)";


I created myArray variable with a capacity of 100.  I didn't have to of course as I've only used the suit names found in a deck of playing cards, i.e., four names. This number is so trivial I could have created a new instance of the ArrayList class that is empty and has the default initial capacity. I'll mention later what the default initial capacity might be.

The return type of the ArrayList.Add Method is the type System.Int32, a 32-bit signed integer. Rather than see this value (which represents the ArrayList index at which the value has been added) I've suppressed the output by using the Out-Null Cmdlet. The Out-Null cmdlet sends output to NULL, in effect, deleting it.

Other ArrayList methods and properties have been used to give a little information regarding the array.

Property Capacity - in the first use of this property, the value returned is 100 which is the same value as the number of elements (capacity) used as an argument in the constructor.

In the second use of this property, we get a value of four which reflects the number of suits in our deck of cards. The value has changed because of the use of the TrimToSize method.

Method TrimToSize - sets the capacity to the actual number of elements in the ArrayList. In our example, four. Of course, we could have used a value four in our constructor knowing what we were going to add to the arraylist. But this is just to show what can be done. Especially if you might not know what the number of items you're going to load into the arraylist will be. It's easy to specify the correct value in small demonstrations like this.

Method Sort - sort the elements in the arraylist.

Property Count - confirms the number of elements that are actually in the ArrayList.

Enumerating over the collection - example 1


$myenum = $myArray.GetEnumerator();
while($myenum.MoveNext())
{
    Write-Host "Our playing card is now: $($myenum.Current)";
}


The property $myenum.Current represents the current element in the collection.


For details of the methods and properties of variable myenum, have a look at the IEnumerator interface.


Enumerating over the collection - example 2


$myArray.GetEnumerator() | ForEach-Object {
   Write-Host "Our playing card is now: $_";
}



Keywords: enum enumerator iterate