Saturday, January 25, 2014

How to collect Memory utilization in linux

How to collect Memory utilization

Ran the below command

sar -rq 1
Linux 2.6.31-201.18.1.el5uek (abcdef.testing.com)    01/25/2014

01:28:07 AM kbmemfree kbmemused  %memused kbbuffers  kbcached kbswpfree kbswpused  %swpused  kbswpcad
01:28:08 AM  14303340 250232948     94.59   1688944 144753888  25165816         0      0.00         0

01:28:07 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
01:28:08 AM         2      2085      1.34      1.39      1.36

Average:    kbmemfree kbmemused  %memused kbbuffers  kbcached kbswpfree kbswpused  %swpused  kbswpcad
Average:     14303340 250232948     94.59   1688944 144753888  25165816         0      0.00         0

Average:      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
Average:            2      2085      1.34      1.39      1.36

Memory utilization = (kbmemused-kbcached-)*100/(kbmemfree+kbmemused)

Some uses
Memory utilization = (kbmemused-kbcached-kbbuffers)*100/(kbmemfree+kbmemused)

Friday, January 24, 2014

How to restart Oracle Standby Database(DR Database)

How to restart Oracle Standby Database(DR Database)

1. First stop the managed recovery with the below command. in standby database
              alter database recover managed standby database cancel;
2. Once it is done you have to stop the database using the srvctl or by sqlplus.
3. Startup standby database to mount stage
              startup mount;
4. Then you have to start the managed recovery.
              alter database recover managed standby database using current logfile disconnect from session;

How to move or rename a datafile of a tablespace in oracle database

Datafile movement 12c Database Code

ALTER DATABASE MOVE DATAFILE '+DATA/orcl/datafile/orcl_custom.702.836915343' TO '+DATA_BKP/orcl/datafile/orcl_custom.702.836915343';


In 12c Database you need not have to make the datafile offline to do the changes. You can do it online. It is a new feature. 

For other version you need to follow the below steps.

step1: Bring the datafile offline
ALTER DATABASE DATAFILE '+DATA/orcl/datafile/orcl_custom.702.836915343' OFFLINE;
step 2: Nove the datafile to new location
rman target /
COPY DATAFILE '+DATA/orcl/datafile/orcl_custom.702.836915343' TO '+DATA_BKP';
step 3: Rename the datafile with new details with alter database  
ALTER DATABASE RENAME FILE '+DATA/orcl/datafile/orcl_custom.702.836915343'
TO '+DATA_BKP/orcl/datafile/';
step 4: Make a copy of datafile
rman target /
SWITCH DATAFILE '+DATA_BKP/orcl/datafile/' TO COPY;
step 5: Recover the datafile
RECOVER DATAFILE '+DATA_BKP/orcl/datafile/';
step 6: Bring the datafile online
ALTER DATABASE DATAFILE '+DATA_BKP/orcl/datafile/' ONLINE;

Wednesday, January 22, 2014

How to take a snapshot in oracle Database

To create a snapshot you have to run the below command in oracle database.

EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;

New snapshot with snap id will be generated.

Command to do active duplicate for Oracle Database

1. First login to target server 2. Validate tns connectivity between Source DB and Target DB 3. Prepare and validate space availability 4. S...