Thứ Tư, 30 tháng 9, 2015

[ORACLE 11g RAC] Configuration Network Interface

Public Network Configuration

# chkconfig –-list | grep NetworkManager
# service NetworkManager stop# chkconfig NetworkManager off


Bonding Public Interface

# echo "alias bond0 bonding" > /etc/modprobe.d/bonding.conf

# cp /etc/sysconfig/network-scripts/ifcfg-em1 /etc/sysconfig/networkscripts/em1.bkup
# cp /etc/sysconfig/network-scripts/ifcfg-em2 /etc/sysconfig/networkscripts/em2.bkup

# cat /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE="bond0"
BONDING_OPTS="mode=1 miimon=100 primary=em1"
NM_CONTROLLED="no"
IPADDR="10.16.142.51"
NETMASK="255.255.248.0"
GATEWAY="10.16.143.254"
ONBOOT="yes"


# cat /etc/sysconfig/network-scripts/ifcfg-em1

DEVICE="em1"
BOOTPROTO="none"
HWADDR="00:25:B3:A8:6F:18"
IPV6INIT="no"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
UUID="3db45d28-e63c-401b-906a-ef095de4fc1e"
SLAVE="yes"
MASTER="bond0"


# cat /etc/sysconfig/network-scripts/ifcfg-em2

DEVICE="em2"
BOOTPROTO="none"
HWADDR="00:25:B3:A8:6F:19"
IPV6INIT="no”
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
UUID="7d29d87f-52bb-4dc6-88ca-d0857c7d7fd9"
SLAVE="yes"
MASTER="bond0"



# service network restart


Private Network Configuration


# cp /etc/sysconfig/network-scripts/ifcfg-em3 /etc/sysconfig/networkscripts/em3.bkup
# cp /etc/sysconfig/network-scripts/ifcfg-em4 /etc/sysconfig/networkscripts/em4.bkup



# cat /etc/sysconfig/network-scripts/ifcfg-em3
DEVICE="em3"
BOOTPROTO="static"
HWADDR="00:25:B3:A8:6F:18"
IPV6INIT="no"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
UUID="3db45d28-e63c-401b-906a-ef095de4fc1e"
IPADDR=”192.11.142.51”
NETMASK=”255.255.255.0”
MTU=”9000”





# cat /etc/sysconfig/network-scripts/ifcfg-em4
DEVICE="em4"
BOOTPROTO="static"
HWADDR="00:25:B3:A8:6F:19"
IPV6INIT="no”
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
UUID="7d29d87f-52bb-4dc6-88ca-d0857c7d7fd9"
IPADDR=”192.12.142.51”
NETMASK=”255.255.255.0”
MTU=”9000”



NOTE: The MTU size is set to 9000 for the enablement of Jumbo Frames. Ensure Jumbo
Frames are enabled on the private Ethernet switches.



# service network restart

Thứ Ba, 29 tháng 9, 2015

[ORACLE 11g RAC] Change Public/Interconnect IP Subnet Configuration

Check information

$ <CRS HOME>/bin/oifcfg getif
eth0 139.2.156.0 global public
eth1 192.168.0.0 global cluster_interconnect

Stop Database, Stop Cluster
Change IP interface

$ oifcfg delif -global eth0
$ oifcfg setif –global eth0/139.2.166.0:public

$ oifcfg delif –global eth1
$ oifcfg setif –global eth1/192.168.1.0:cluster_interconnect

Verify

$ oifcfg getif
eth0 139.2.166.0 global public
eth1 192.168.1.0 global cluster_interconnect
#ifconfig -a

Start Cluster, Start Database

[ORACLE 11g RAC] Change VIP Addresses

Check Status
$ ifconfig -a
CRS Stop
$ srvctl stop instance -d DB -i DB1
$ srvctl stop asm -n node1
# srvctl stop nodeapps -n node1
Verify
$ ifconfig -a
$ crs_stat
Change IP in /etc/hostsand DNS
Change VIP Addresses
# srvctl modify nodeapps -n node1 -A 192.168.2.125/255.255.255.0/eth0
Start nodeappsand all resources depending on it
# srvctl start nodeapps -n node1
Repeat from step 1 for the next node

Thứ Năm, 24 tháng 9, 2015

[ORACLE 11g] Security updates during installing.


Oracle 11g: Security updates during installing.







Checking patch was applied.

[oracle@rac1 OPatch]$ ./opatch lsinventory -patch_id desc
Invoking OPatch 11.2.0.1.1

Oracle Interim Patch Installer version 11.2.0.1.1
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.2.0.1.1
OUI version       : 11.2.0.2.0
OUI location      : /u01/app/oracle/product/11.2.0/db_1/oui
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2015-09-24_22-53-04PM.log

Patch history file: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2015-09-24_22-53-04PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.2.0
There are 1 products installed in this Oracle Home.


Interim patches (45) :

Patch  16303118     : applied on Thu Sep 24 22:21:59 ICT 2015
Unique Patch ID:  16162176
   Created on 8 Mar 2013, 14:42:50 hrs PST8PDT
   Bugs fixed:
     16303118, 14841812

Patch  16303117     : applied on Thu Sep 24 22:17:38 ICT 2015
Unique Patch ID:  16162176
   Created on 6 Mar 2013, 06:39:38 hrs PST8PDT
   Bugs fixed:
     16303117, 14841558, 12880299, 14127510

Patch  16303116     : applied on Thu Sep 24 22:19:19 ICT 2015
Unique Patch ID:  16162176
   Created on 8 Mar 2013, 14:39:59 hrs PST8PDT
   Bugs fixed:
     14220725, 16303116

Patch  16303115     : applied on Thu Sep 24 22:19:59 ICT 2015
Unique Patch ID:  16162176
   Created on 8 Mar 2013, 14:38:49 hrs PST8PDT
   Bugs fixed:
     13596521, 16303115

Patch  16303114     : applied on Thu Sep 24 22:20:08 ICT 2015
Unique Patch ID:  16162176
   Created on 6 Mar 2013, 06:33:15 hrs PST8PDT
   Bugs fixed:
     16303114, 13561951

Patch  16294412     : applied on Thu Sep 24 22:22:21 ICT 2015
Unique Patch ID:  16162176
   Created on 4 Mar 2013, 10:05:17 hrs PST8PDT
   Bugs fixed:
     12419321, 13632725, 14841437, 16294412, 14038791, 12828071, 13343244
     14390377, 11724984

Chủ Nhật, 13 tháng 9, 2015

[Oracle GoldenGate Director 12C] Administrator

1/ Setup Oracle GoldenGate Director Server on IBM AIX:

- Install java 7 for AIX: <Java7r1_64.jre.tar.gz>,<Java7r1_64.sdk.tar.gz>
- Install Weblogic 12c <wls_121200.jar>
- Install Oracle GoldenGate Director Server <121201_gg-director-serversetup_unix_v12_1_2_0_1.zip>
- Start  Oracle GoldenGate Director Server 12c:


2/ Setup Oracle GoldenGate Director Client on PC:
- On Windows 7, x64: Install <121201_gg-director-clientsetup_win_v12_1_2_0_1.exe>
3/ Configuration Oracle GoldenGate Director Server:
 - Using Oracle GoldenGate Director Client Admin Tool to access Oracle GoldenGate Director Server and configuration connection between  Oracle GoldenGate Director Server and  Oracle GoldenGate. Default user/pass: diradmin/diradmin

 - Configuration Oracle GoldenGate Director Server 12C connects to Oracle GoldenGate 12C Server
- Next, We can access to Oracle GoldenGate Director Client to monitor, configuration Oracle GoldenGate 12C Server:




With Oracle GoldenGate Director 12C. everything is easy to manage, monitor Oracle GoldenGate 12C. Easy to add, modify, delete, monitor extract, extract pump, replicate, trail file of Oracle GoldenGate 12C. even you can set an alarm by mail if Oracle GoldenGate 12C has problems. you alse connect directly to Oracle GoldenGate Director 12C by webconsole like this.



Thứ Tư, 9 tháng 9, 2015

ORACLE RMAN BACKUP SCHEDULER IN 14 DAYS

1/ Set RMAN backup policy:

SQL> alter system set control_file_record_keep_time=14;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE RETENTION POLICY TO recovery window of 14 days;

2/ Make scripts

[root@DW scripts]# cat DWdb_full.sh
export ORACLE_SID=DWDB
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=/u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/u01/bin
rman target / log=/data/RMAN/DWDB_rman_level_0_`date +"%d-%m-%Y"`.log << EOF
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
set controlfile autobackup format for device type disk to '/data/RMAN/DWDB_control_%F';
backup as compressed backupset incremental level 0 format '/data/RMAN/%d_%t_%U.rman' database;
sql 'alter system archive log current';
backup as compressed backupset format '/data/RMAN/%d_archive_%s_%t_%U.rman' archivelog all not backed up 1 times delete input;
release channel c1;
release channel c2;
delete noprompt obsolete recovery window of 14 days;
}
EOF
exit;


[root@DW scripts]# cat DWdb_incre.sh
export ORACLE_SID=DWDB
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=/u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/u01/bin
rman target / log=/data/RMAN/DWDB_rman_level_1_`date +"%d-%m-%Y"`.log << EOF
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
set controlfile autobackup format for device type disk to '/data/RMAN/DWDB_control_%F';
backup as compressed backupset incremental level 1 format '/data/RMAN/%d_%t_%U.rman' database;
sql 'alter system archive log current';
backup as compressed backupset format '/data/RMAN/%d_archive_%s_%t_%U.rman' archivelog all not backed up 1 times delete input;
release channel c1;
release channel c2;
delete noprompt obsolete recovery window of 14 days;
}
EOF
exit;

3/ Make Crontab to schedule backup

[root@DW ~]# crontab -l
0 0 * * 6 su - oracle /data/scripts/DWdb_full.sh
0 0 * * 0,1,2,3,4,5 su - oracle /data/scripts/DWdb_incre.sh

Thứ Ba, 8 tháng 9, 2015

Oracle database index on a table may be not good.

Table 1-5. Impact of multiple indexes on insert performance
Number of inserts and indexes Runtime
Inserting 256 rows with 0 indexes 1.101 seconds
Inserting 512 rows with 0 indexes 1.161 seconds
Inserting 256 rows with 5 indexes 3.936 seconds
Inserting 512 rows with 5 indexes 12.788 seconds
Inserting 256 rows with 10 indexes 12.558 seconds
Inserting 512 rows with 10 indexes 22.132 seconds

Thứ Bảy, 5 tháng 9, 2015

Unix is so easy !



How to kill all similar processes with single command (in this case opmn)

ps -ef | grep opmn |grep -v grep | awk ‘{print $2}’ |xargs -i kill -9 {}
Locating Files under a particular directory
find . -print |grep -i test.sql
 Using AWK in UNIX
To remove a specific column of output from a UNIX command – for example to determine the UNIX process Ids for all Oracle processes on server (second column)
ps -ef |grep -i oracle |awk '{ print $2 }'
Changing the standard prompt for Oracle Users
Edit the .profile for the oracle user
PS1="`hostname`*$ORACLE_SID:$PWD>"
 Display top 10 CPU consumers using the ps command
/usr/ucb/ps auxgw | head -11
 Show number of active Oracle dedicated connection users for a particular ORACLE_SID
ps -ef | grep $ORACLE_SID|grep -v grep|grep -v ora_|wc -l
 Display the number of CPU’s in Solaris
psrinfo -v | grep "Status of processor"|wc -l
Display the number of CPU’s in AIX
lsdev -C | grep Process|wc -l
Display RAM Memory size on Solaris
prtconf |grep -i mem
Display RAM memory size on AIX
First determine name of memory device
lsdev -C |grep mem
then assuming the name of the memory device is ‘mem0’
lsattr -El mem0
Swap space allocation and usage
Solaris : swap -s or swap -l
Aix : lsps -a
 Total number of semaphores held by all instances on server
ipcs -as | awk '{sum += $9} END {print sum}'
View allocated RAM memory segments
ipcs -pmb
Manually deallocate shared memeory segments
ipcrm -m '<ID>'
 Show mount points for a disk in AIX
lspv -l hdisk13
 Display amount of occupied space (in KB) for a file or collection of files in a directory or sub-directory
du -ks * | sort -n| tail
Display total file space in a directory
du -ks .
 Cleanup any unwanted trace files more than seven days old
find . *.trc -mtime +7 -exec rm {} \;
 Locate Oracle files that contain certain strings
find . -print | xargs grep rollback
 Locate recently created UNIX files (in the past one day)
find . -mtime -1 -print
 Finding large files on the server (more than 100MB in size)
find . -size +102400 -print
Crontab :
To submit a task every Tuesday (day 2) at 2:45PM
45 14 2 * * /opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1
To submit a task to run every 15 minutes on weekdays (days 1-5)
15,30,45 * 1-5 * * /opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1
To submit a task to run every hour at 15 minutes past the hour on weekends (days 6 and 0)
15 * 0,6 * * opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1

Additional:

find . -print | xargs grep -i dba_2pc_pending
find . -mtime -1 - print
find . -size +10000 -print
find . -mtime +7 -exec rm {} \;
cut -f1 -d ':' | wc -l
lsattr -El sys0
prtconf | grep -i mem
lsdev -C | grep mem
lsattr -El mem0
svmon -P 26060
lsdev -C | grep Process | wc -l