Enabling Write back cache using hpacucli

Hi,

Write back cache enabled systems are mostly more optimized because writing into the cache is faster than writing into the disk. Lets look how can we enable this feature for the controller using hpacucli.

To Display :
hpacucli ctrl all show config detail

This command’s output is starting with :

Smart Array P400 in Slot 1
Bus Interface: PCI
Slot: 1  <<< This is the Slot# (We will use it to enable Write back cache)
Serial Number: PXXXXXXXXX
Cache Serial Number: PXXXXXXX
RAID 6 (ADG) Status: Enabled
Controller Status: OK
Chassis Slot:
...
Cache Board Present: True
Cache Status: OK
Accelerator Ratio: 25% Read / 75% Write
Drive Write Cache: Disabled <<< This Means Write back cache is disabled
Total Cache Size: 512 MB <<< This is the size of cache
No-Battery Write Cache: Disabled <<< This means when Battery is Not OK, WRB will be automatically get disabled.
Cache Backup Power Source: Batteries
Battery/Capacitor Count: 1 <<< One Battery is present
Battery/Capacitor Status: OK <<< Battery is OK
SATA NCQ Supported: True
....

To enable WBC please run this command :

ctrl slot=1 modify dwc=enable

When you run this command a warning message is shown about possible loss of data in the event of power failure.
Warning: Without the proper safety precautions, use of write cache on physical
drives could cause data loss in the event of power failure.  To ensure
data is properly protected, use redundant power supplies and
Uninterruptible Power Supplies. Also, if you have multiple storage
enclosures, all data should be mirrored across them. Use of this
feature is not recommended unless these precautions are followed.
Continue? (y/n) y

If no problem with this message , you can pree y and go on.

That’s all.

Good luck 🙂  

Advertisements

“crsctl stop/start crs” vs “crsctl start/stop cluster”

Hi,

crs and cluster start/stop operations are sometimes confused.

For that reason, I want to identify the difference between crs and cluster operations.

Lets clearify this from “crsctl stop” command help :

-bash-3.2$ crsctl stop
.... (Some usage hints...)
(Here is important ..)
crsctl stop crs [-f]
Stop OHAS on this server.(This means you can ONLY stop local host's CRS.)
where
-f  Force option  (You can use Force optin using "-f")


crsctl stop cluster [[-all]|[-n <server>[...]]] [-f]
Stop CRS stack
where
Default         Stop local server
-all            Stop all servers
-n              Stop named servers
server [...]    One or more blank-separated server names
-f              Force option

As you see above, you can stop CRS stack using cluster command both local node and remote node while OHASD is running. OHASD must be running for managing CRS stack.(That is important)

 

enq: TM Contention Wait Events

Hi all, Missing index on the Foreign Key column of the Child table is the first cause of TM Contention Wait Events. Other one is may be Parallel DML.

We first look at the first “missing index” case. Lets create environment for the test case. We need one parent table called “Cities” and a child one called “Districts”.

CREATE TABLE CITIES
(
CITY_ID     NUMBER,
CITY_NAME   VARCHAR2 (20),
CONSTRAINT CITIES_PK PRIMARY KEY (CITY_ID)
);

CREATE TABLE DISTRICTS
(
DISTRICT_ID     NUMBER,
CITY_ID         NUMBER,
DISTRICT_NAME   VARCHAR2 (30),
CONSTRAINT DISTRICTS_PK PRIMARY KEY (DISTRICT_ID),
CONSTRAINT CITY_FK FOREIGN KEY (CITY_ID) REFERENCES CITIES (CITY_ID)
);

Lets INSERT SOME rows.

INSERT INTO CITIES
VALUES (1, 'Istanbul');

INSERT INTO CITIES
VALUES (2, 'Hatay');

INSERT INTO CITIES
VALUES (3, 'Ankara');

COMMIT;

INSERT INTO DISTRICTS
VALUES (1, 1, 'Kadikoy');

INSERT INTO DISTRICTS
VALUES (2, 1, 'Basiktas');

INSERT INTO DISTRICTS
VALUES (3, 2, 'Antakya');

INSERT INTO DISTRICTS
VALUES (4, 2, 'Defne');

COMMIT;

Now we can run some DMLs for reproduce this wait event. Session 1 inserts a new district into the DISTRICTS table running this dml :

SQL> insert into districts values (6,1,'Sisli');

1 row created.

Session 2 updates Primary Key column of the CITIES table running this dml :

SQL> update cities set city_id=4,city_name='Adana' where city_id=3;

Lets have a look to the blockers :

SQL> set lines 500

SQL> r

1  SELECT sid,

2        sql_id,

3        blocking_session,

4        event,

5        p2

6    FROM v$session

7   WHERE blocking_session IS NOT NULL

8  UNION ALL

9  SELECT sid,

10        sql_id,

11        blocking_session,

12        event,

13        p2

14    FROM v$session

15*  WHERE sid IN (SELECT blocking_session FROM v$session)

SID SQL_ID         BLOCKING_SESSION  EVENT                 P2

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

147 6tadxuk2a86fn  26                 enq: TM - contention 

58382 26                              SQL*Net msg frm clie  1

As you see these two tables are not huge tables. I mean it is size independent. Problem is uncommitted transaction and missing index as well. Lets create an index for solving problem on DISTRICTS table column (CITY_ID)

CREATE INDEX city_id_ndx ON DISTRICTS (CITY_ID);

Conclusion : Bad design (Missing index on the FK column) and uncommitted transactions are the main cause of this wait.

For more reading :

Doc ID 1905174.1

http://www.confio.com/logicalread/solving-oracle-enq-tm-contention-wait-events/#.U8ZIyqjjcsk

http://www.dbspecialists.com/blog/database-maintenance/unindexed-foreign-keys-enqtm-contention/

Find command tips

Deleting old files from Linux is handy for DBAs. You can do it automatically using find command.

find is a powerful binary to explore your host.

Lets see some examples :

PS: As you know  “.” means here.

find . -mtime +1      ###  Find all files which are modified more than 1 day
find . -mtime -1       ###  Find all files which are modified less than 1 day
find . -perm 644      ### Find all files whose permission is set to 644
find . -size +400k    ### Find all files whose size is more than 400 KB
find . -size -400k    ### Find all files whose size is less than 400 KB
find . -size 400k    ### Find all files whose size is 400 KB

You can automatically delete files from file system appending “-exec rm {} \;” at the end of the command like :

find . -mtime +1 -exec rm {} \;  ### Find all files which are modified more than 1 day and delete them from file system.

Good Luck 🙂