Thứ Sáu, 6 tháng 11, 2015

Oracle 11g RMAN Tuning

1/ Identifying RMAN Processes
2/ Measuring Backup Performance
3/ Monitoring RMAN Job Progress
4/ Identifying I/O Bottlenecks
5/ Improving Tape I/O Performance
6/ Maximizing Throughput to Backup Device
7/ Setting Large Pool Memory Size
8/ Tunning Media Recovery
9/ Tuning Crash Recovery
10/ Slowing RMAN Down
11/ Improving Performance Through Parallelism
12/ Improving Performance Using Incremental Features

Thứ Ba, 3 tháng 11, 2015

Patching Oracle Software with no downtime !

Các phương pháp cập nhật bảo mật cho Oracle Software. Đảm bảo Downtime thấp nhất. 
Có vài Rule trước khi tiến hành Patching:
1- Luôn Test việc cập nhật trên môi trường Test.
2- Backup Oracle Software, Database ...mọi thứ trước khi thay đổi.

Đối với môi trường DC-DR Single Node:
- Stop Database trên Node DR
- Tiến hành Patching Node DR.
- Start Database Node DR. Khởi chạy tiến hành đồng bộ DC-DR.
- Tiến hành Switchover Database cho chạy sang Node DR.
- Chuyển Node DC database thành Physical standby
- Tiến hành Patching Node DC
- Sau khi Patching xong thì Start Database để đồng bộ lại, rồi thì chuyển lại vai trò DC-DR như ban đầu.

Đối với môi trường RAC DC-DR:
- Stop Database ở DR
- Tiến hành Patching Node ở DR.
- Start Database ở DR, Tiến hành đồng bộ DC-DR
- Đối với cặp RAC ở DC thì tiến hành Patching bằng cách Stop instance/Cluster trên từng node để patching. Sau khi Patching cho Node đó xong thì khởi động Cluster/Instance và làm như trên cho các Node còn lại.


--------------------------------------------Have Fun--------------------------------------------

Thứ Tư, 21 tháng 10, 2015

IBM AIX Web-based Management

IBM AIX Web-based Management. This is a tool to management IBM AIX OS. This tool is based on Java, web interface. it is easy to use.

1/ Log in CDE Graphic interface. running wsm command.


 2/ At once, IBM Web-based System Manager is invoked.


3/ Let's discover, Have fun.

Thứ Hai, 5 tháng 10, 2015

[ORACLE 11g RAC] ENABLE ARCHIVELOG MODE

DB NAME: CDBRAC
instance1: CDBRAC1
instance2: CDBRAC2
ASM DISKGROUP: DISK01 -> For data files.
DISK02 -> Archivelog files.
OCR
DB MODE NOARCHIVELOG -> Need change mode to -> ARCHIVELOG.

CDBRAC1 - TAB1:

[oracle@rac1 ~]$ sqlplus / as sysdba
SQL> select log_mode from v$database;
LOG_MODE
------------
NOARCHIVELOG

[oracle@rac1 ~]$ srvctl status database -d CDBRAC
Instance CDBRAC1 is running on node rac1
Instance CDBRAC2 is running on node rac2

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL> show parameter log_archive_dest_1;

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1     string
log_archive_dest_10     string
log_archive_dest_11     string
log_archive_dest_12     string
log_archive_dest_13     string
log_archive_dest_14     string
log_archive_dest_15     string
log_archive_dest_16     string
log_archive_dest_17     string
log_archive_dest_18     string
log_archive_dest_19     string

SQL> alter system set log_archive_dest_1='location=+DISK02/archivelog';

System altered.

SQL> show parameter log_archive_dest_1;

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1     string location=+DISK02/archivelog
log_archive_dest_10     string
log_archive_dest_11     string
log_archive_dest_12     string
log_archive_dest_13     string
log_archive_dest_14     string
log_archive_dest_15     string
log_archive_dest_16     string
log_archive_dest_17     string
log_archive_dest_18     string
log_archive_dest_19     string



CDBRAC1 - TAB2:

[oracle@rac1 ~]$ grid_env
[oracle@rac1 ~]$ asmcmd

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      5115     3269                0            3269              0             N  DISK01/
MOUNTED  EXTERN  N         512   4096  1048576      5115     4986                0            4986              0             N  DISK02/
MOUNTED  EXTERN  N         512   4096  1048576      1023      627                0             627              0    Y  OCR/

ASMCMD> cd +DISK02
ASMCMD> mkdir archivelog
ASMCMD> cd archivelog
ASMCMD> pwd
+DISK02/archivelog

Return CDBRAC1 - TAB1:

[oracle@rac1 ~]$ srvctl status database -d CDBRAC
Instance CDBRAC1 is running on node rac1
Instance CDBRAC2 is running on node rac2
[oracle@rac1 ~]$ srvctl stop database -d CDBRAC
[oracle@rac1 ~]$ srvctl status database -d CDBRAC
Instance CDBRAC1 is not running on node rac1
Instance CDBRAC2 is not running on node rac2

[oracle@rac1 ~]$ srvctl start instance -d CDBRAC -i CDBRAC1 -o mount
[oracle@rac1 ~]$ srvctl status database -d CDBRAC
Instance CDBRAC1 is running on node rac1
Instance CDBRAC2 is not running on node rac2

[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Mon Oct 5 05:29:08 2015

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database archivelog;

Database altered.

SQL> alter database open;


Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@rac1 ~]$ srvctl status database -d CDBRAC
Instance CDBRAC1 is running on node rac1
Instance CDBRAC2 is not running on node rac2
[oracle@rac1 ~]$ srvctl start instance -d CDBRAC -i CDBRAC2
[oracle@rac1 ~]$ srvctl status database -d CDBRAC
Instance CDBRAC1 is running on node rac1
Instance CDBRAC2 is running on node rac2

Check Archivelog Mode is enabled:

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Mon Oct 5 05:33:24 2015

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select log_mode from v$database;

LOG_MODE
------------
ARCHIVELOG
SQL> show parameter log_archive_dest_1;

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1     string location=+DISK02/archivelog
log_archive_dest_10     string
log_archive_dest_11     string
log_archive_dest_12     string
log_archive_dest_13     string
log_archive_dest_14     string
log_archive_dest_15     string
log_archive_dest_16     string
log_archive_dest_17     string
log_archive_dest_18     string
log_archive_dest_19     string

SQL> alter system archive log current;

ASMCMD> cd archivelog
ASMCMD> ls
1_10_891304305.dbf
1_9_891304305.dbf
2_7_891304305.dbf

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


Thứ Tư, 19 tháng 8, 2015

Add New Node to ORACLE RAC

Extend GRID Software
---Step 1:

[root@rac1]$ su - grid
[grid@rac1]$ export GRID_HOME=/u01/app/11.2.0/grid
[grid@rac1]$ $GRID_HOME/bin/cluvfy stage -post hwos -n rac2

----Step 2:
[grid@rac1]$ $GRID_HOME/bin/cluvfy comp peer -refnode rac1 -n rac2 -orainv oinstall -osdba dba -verbose

----Step 3:
Verify New Node (NEW NODE PRE)
$GRID_HOME/bin/cluvfy stage -pre nodeadd -n rac2 -fixup -verbose

----Step 4:

[grid@rac1]$ export IGNORE_PREADDNODE_CHECKS=Y
[grid@rac1]$ $GRID_HOME/oui/bin/addNode.sh -silent "CLUSTER_NEW_NODES={rac2}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={rac2-vip}"

----Step 5:

[root@rac2]$ /u01/app/oraInventory/orainstRoot.sh
[root@rac2]$ /u01/app/11.2.0/grid/root.sh
[grid@rac1]$ $GRID_HOME/bin/cluvfy stage -post nodeadd -n rac2 -verbose

Extend ORACLE DATABASE SOFTWARE

----Step 1:

[oracle@rac1]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@rac1]$ $ORACLE_HOME/oui/bin/addNode.sh -silent "CLUSTER_NEW_NODES={rac2}"

----Step 2:

[root@rac2]$ /u01/app/oracle/product/11.2.0/db_1/root.sh

[oracle@rac2]$ $ORACLE_HOME/bin/cluvfy comp admprv -o db_config -d $ORACLE_HOME -n rac1,rac2 -verbose

----Step 3:Add Instance to Clustered Database
dbca -> Intance Management -> Add instance



Thứ Năm, 6 tháng 8, 2015

Another way: To Create An Oracle Dataguard !

@@@@@@@@@@@@@PRIMARY@@@@@@@@@@@@@

1/ Backup RMAN full + Standby Controlfile:

RMAN> run {
2> allocate channel st1 device type disk;
3> allocate channel st2 device type disk;
4> backup as compressed backupset format '/setup/rman/%d_%U.rman' database plus archivelog;
5> backup format '/setup/rman/std_controlfile.ctl' current controlfile for standby;
6> release channel st1;
7> release channel st2;
8> }

2/ Backup spfile.ora

SQL> create pfile='/setup/rman/pfile.ora' from spfile;[backup]

3/ Set new parameters

SQL>ALTER SYSTEM SET DB_UNIQUE_NAME='EWALLET';
SQL>ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(EWALLET,EWALLET_DR)';
SQL>ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/app/oracle/fast_recovery_area/EWALLET/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=EWALLET';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=EWALLET_DR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=EWALLET_DR';
ALTER SYSTEM SET DB_FILE_NAME_CONVERT='EWALLET','EWALLET' SCOPE=SPFILE;
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='EWALLET','EWALLET' SCOPE=SPFILE;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
ALTER SYSTEM SET FAL_SERVER='EWALLET_DR';
ALTER SYSTEM SET FAL_CLIENT='EWALLET';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1=ENABLE;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
ALTER SYSTEM SET STANDBY_ARCHIVE_DEST='/home/oracle/app/oracle/fast_recovery_area/EWALLET/standbylog';
SQL> create pfile='/setup/rman/pfile_for_standby.ora' from spfile;

4/ Create standby logfile to use realtime apply log
[(maximum number of logfiles for each thread + 1) * maximum number of threads]
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL;
SQL> alter database add standby logfile group 4 ('/home/oracle/app/oracle/oradata/EWALLET/standby1.rdo') size 200M;
SQL> alter database add standby logfile group 5 ('/home/oracle/app/oracle/oradata/EWALLET/standby2.rdo') size 200M;
SQL> alter database add standby logfile group 6 ('/home/oracle/app/oracle/oradata/EWALLET/standby3.rdo') size 200M;
SQL> alter database add standby logfile group 7 ('/home/oracle/app/oracle/oradata/EWALLET/standby4.rdo') size 200M;
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

5/ Create tnsnames by netmgr


EWALLET =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.159.20)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = EWALLET)
    )
  )

EWALLET_DR =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.159.21)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = EWALLET_DR)
    )
  )



@@@@@@@@@@@@@DR@@@@@@@@@@@@@

6/ Copy all to DR

$scp /setup/rman/* oracle@192.168.159.21:/setup/rman

7/ set pfile_for_standby.ora:

*.db_unique_name='EWALLET_DR'
*.db_file_name_convert='EWALLET','EWALLET'
*.fal_client='EWALLET_DR'
*.fal_server='EWALLET'
*.log_archive_config='DG_CONFIG=(EWALLET,EWALLET_DR)'
*.log_archive_dest_1='LOCATION=/home/oracle/app/oracle/fast_recovery_area/EWALLET/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=EWALLET_DR'
*.log_archive_dest_2='SERVICE=EWALLET_DR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=EWALLET'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_file_name_convert='EWALLET','EWALLET'
*.standby_archive_dest='/home/oracle/app/oracle/fast_recovery_area/EWALLET/standbylog'
*.standby_file_management='AUTO'

8/ Create directories follow pfile_for_standby.ora:

9/ Create tnsnames by netmgr or copy from primary

EWALLET =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.159.20)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = EWALLET)
    )
  )

EWALLET_DR =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.159.21)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = EWALLET_DR)
    )
  )

10/ Make standby

[oracle@dg02 ~]$ export ORACLE_SID=EWALLET
[oracle@dg02 ~]$ rman target /
RMAN> startup nomount pfile='/setup/rman/pfile_for_standby.ora'
RMAN> restore standby controlfile from '/setup/rman/stb_controlfile.ctl';
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
[oracle@dg02 ~]$ export ORACLE_SID=EWALLET
[oracle@dg02 ~]$ sqlplus / as sysdba
SQL> alter system register;
SQL> !lsnrctl status
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL;
SQL> alter database add standby logfile group 4 ('/home/oracle/app/oracle/oradata/EWALLET/standby1.rdo') size 200M;
SQL> alter database add standby logfile group 5 ('/home/oracle/app/oracle/oradata/EWALLET/standby2.rdo') size 200M;
SQL> alter database add standby logfile group 6 ('/home/oracle/app/oracle/oradata/EWALLET/standby3.rdo') size 200M;
SQL> alter database add standby logfile group 7 ('/home/oracle/app/oracle/oradata/EWALLET/standby4.rdo') size 200M;
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
SQL> alter database recover managed standby database using current logfile disconnect from session;
SQL> create spfile='/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileEWALLET' from pfile='/setup/rman/pfile_for_standby.ora';

11/ Check standby

SQL>  select sequence#,applied,completion_time from v$archived_log;

 SEQUENCE# APPLIED   COMPLETIO
---------- --------- ---------
2 YES     16-JAN-15
12 YES     16-JAN-15
3 YES     16-JAN-15
4 YES     16-JAN-15
6 YES     16-JAN-15
5 YES     16-JAN-15
7 YES     16-JAN-15
8 YES     16-JAN-15
9 YES     16-JAN-15
10 YES     16-JAN-15
11 YES     16-JAN-15

 SEQUENCE# APPLIED   COMPLETIO
---------- --------- ---------
13 YES     16-JAN-15
14 YES     16-JAN-15