Primary and Standby On Windows PDF
Primary and Standby On Windows PDF
Primary and Standby On Windows PDF
Introduction................................................................................................................................................... 2
Configuration Steps ....................................................................................................................................... 2
Network configuration .................................................................................................................................. 2
Hosts File ....................................................................................................................................................... 3
Creating "oracle" User ................................................................................................................................... 3
Assigning Full Control to "oracle" User to the Drives.................................................................................... 4
Environment Variables .................................................................................................................................. 4
Windows Firewall .......................................................................................................................................... 4
Oracle Installation ......................................................................................................................................... 5
Primary Server Setup..................................................................................................................................... 5
Service Setup ................................................................................................................................................. 7
Create Standby Controlfile and PFILE............................................................................................................ 8
STANDBY Server ............................................................................................................................................ 9
Change Computer Name ............................................................................................................................... 9
Network configuration .................................................................................................................................. 9
Creating directories on the Standby Server .................................................................................................. 9
Create Service.............................................................................................................................................. 10
Creation of Service using "oradim" ............................................................................................................. 10
Copy Control File and PFILE on Standby Server .......................................................................................... 11
Create Standby Redo Logs on Primary Server ............................................................................................. 12
RMAN Duplicate .......................................................................................................................................... 13
Start REDO APPLY ........................................................................................................................................ 13
Test Log Transport ....................................................................................................................................... 13
References ................................................................................................................................................... 14
Introduction
In this set up I used :
Two Oracle VMs/Boxes with Windows Server 2008 Server operating system already installed
Oracle Database 11.2.0.4 will be used and
Domain name is not used in this setup
Configuration Steps
1st Server Name "orasys1" (physical)
Network configuration
I choose to use the default DNS Server IP of Oracle Virtual Box.
See the section "VirtualBox Network Setup" from the below link, If you want to set up Networking on
"Oracle Virtual Box"
http://www.oracle-base.com/articles/12c/oracle-db-12cr1-rac-installation-on-oracle-linux-6-usingvirtualbox.php
Navigation :
From "Start" ->on "Network" -> "Network and Sharing Center" -> "Manage Network
Connections" - right click on "Local Area Connections" -> uncheck "internet protocol version 6"
(We configure with Internet Protocol Version 4)
Click on "Internet Protocol Version 4 (TCP/IPv4)"
Click on "Properties" in this window and
Select "use the following IP Address", It is :
IP Address - 192.168.56.101
Subnet Mask - 255.255.255.0
Hosts File
This may not be a compulsion on Windows but I want to make sure that I mention the IP and
Host name in this Hosts file.
To amend host name in the host file we use "notepad" at the prompt to open the Hosts File.
C:\> notepad \windows\system32\drivers\etc\hosts
We write the IP Address and Host Name (we are not using any domain in this setup and we will
mention only Host Name and it works).
In this way " 192.168.56.101 orasys1 ". I usually type the IP and press "TAB" Key once and then
write the hostname.
To keep things easier I typed the second Host Name and IP in the next line in advance.
It was " 192.168.56.102 orasys2 ". Save the Hosts file.
To open "Server Manager " directly from CMD Window, type at the prompt :
%systemroot%\system32\compmgmtlauncher.exe OR
Navigate:
open "Server manager" -> expand "Configuration" and "Local Users and Groups" and finally right
click on "Users" and open "New User"
In the "User Name" box we write "oracle"
Check only "password never expires"
Click on "create" to create "oracle" User
In the window "Users" we should now see the user "oracle"
Double click on "oracle" User
"Oracle Properties" window pops up. Click on "Member Of" (we assign the User "oracle" in the
Administrator Group. It is a must.)
Click on "add" and now "select groups" window should pop up
Click on "advanced " and again on "find now"
In the column "Name" we would see "Administrators". Click on "Administrators" and now click
"OK"
We should now see "the_host_name\administrators" in the box "enter the object names to
select"
Click " OK " and "Apply"
Click "start" -> "computer" -> right click on Drive "E" and select "properties"
Click on "security" and on "edit"
Click on "add"
Write "oracle" in the box "enter the object names to select " and click on "check names".
"the_host_name\oracle" should be now seen
Click on "ok"
Click on the User "oracle" and now we click or put a check mark to "full control" under "allow"
Click "ok". This way the User "oracle" has full control over the Drive
Verify:
In the "group or usernames" find the user "oracle" and click on it. We will see a "right check
mark" next to "full control"
We repeat the same step for the Drives "F" and "G"
Environment Variables
Windows Firewall
off"
Oracle Installation
Login as "oracle" User and we install Oracle Software and create Database
The Oracle Software is saved on my Shared Folder of Oracle Virtual Box. So, this folder is a
Network Folder
Navigation: From "Start" open "network" and open the shared folder accessed from the guest
system OR start -> computer -> open the folder in "network location"
Double click on "set up" (Note: we use the same "sys" password for Primary and Standby)
Prefer the "Desktop Class" or "Server Class" type of Installation that is suitable to you during the
Installation. I prefer to test always with "Server class " installation
I set Oracle SID as "db11g" and Global Database Name as "db11g.world"
I completed the installation with :
Drive E - Oracle Home
Drive F - oradata
Drive G - fast_recovery_area/recovery_area
We should now make a note or check the locations of oradata (that means, the location of
database files), admin, diag and fast_recovery_area/recovery_area (if enabled)
The DB_NAME of the standby database will be the same as that of the primary, but it must have a
different DB_UNIQUE_NAME value.
The DB_UNIQUE_NAME values of the primary and standby database should be used in the DG_CONFIG
setting of the LOG_ARCHIVE_CONFIG parameter.
For this example, the standby database will have the value "DB11G_STBY".
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG= 'DG_CONFIG=(DB11G,DB11G_STBY)' ;
Set suitable remote archive log destinations. In this case I'm using the fast recovery area for the local
location, but you could specify an location explicitly if you prefer.
Notice the SERVICE and the DB_UNIQUE_NAME for the remote location reference the standby location.
ALTER
SYSTEM
SET
LOG_ARCHIVE_DEST_2='SERVICE=db11g_stby
NOAFFIRM
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DB11G_STBY';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
ASYNC
Service Setup
Entries for the primary and standby databases are needed in the tnsnames.ora files on both servers.
First we setup this on Primary.
"C:\ notepad %ORACLE_HOME%\network\admin\tnsnames.ora". You can create these using the
Network Configuration Utility (netca) or manually. The following entries were used during this setup.
DB11G =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = orasys1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DB11G.WORLD)
)
)
DB11G_STBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = orasys2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DB11G.WORLD)
)
)
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
STANDBY Server
Network configuration
From "Start" -> click on "network" -> click on "network and sharing center" -> "manage network
connections" -> right click on "local area connections" -> uncheck "internet protocol version 6"
(We configure with Internet Protocol Version 4)
Click on "internet protocol version 4 (TCP/IPv4)" and now click on the "properties" in this
window and select "use the following IP Address"
IP Address - 192.168.56.102
Subnet Mask - 255.255.255.0
Default Gateway - 192.168.56.1
In the preferred DNS Server - 192.168.56.1
Click "OK" and again "OK"
This may not be a compulsion on Windows but I want to make sure that I mention the IP and
Host name in the Hosts File.
To amend Host Name in the Host File we use "notepad" at the Command prompt. In this way
C:\> notepad \windows\system32\drivers\etc\hosts
We write the IP Address and Host Name (As we are not using any Domain in this setup I
mentioned only Host Name and it works).
In this way " 192.168.56.102 orasys2". I usually type the IP and press "TAB" Key once and write
the Host Name.
To keep things easier I typed " 192.168.56.101 orasys1 " in the next line which is the IP Address
and Host Name of the 1st Host that we created already. Save the file.
Create Service
The first step is to create a Service (cmd window is opened with "run as administrator")
While you are in cmd window just type "oradim" and the "oradim" usage help is displayed
Enter the same "sys" password for "-intpwd" that you created for the primary database. The full
command to create Service is :
C:\> oradim -new -sid db11g -intpwd <password> -startmode manual
Verify: Open "Services" and just click on any service and then press 'o' key (Oracle related
services are saved with the letter "o". We save our time to search in this way)
A Service with a name "oracleservicedb11g" should be visible now. Note the status of it. It
should be in the State "manual"
The password file will be saved in %ORACLE_HOME%\database Folder
Listener.ora
When using active duplicate, the standby server requires static listener configuration in a "listener.ora"
file. In this case I used the following configuration.
"C:\ notepad %ORACLE_HOME%\network\admin\listener.ora"
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = DB11G.WORLD)
(ORACLE_HOME = E:\app\oracle\product\11.2.4\dbhome)
(SID_NAME = DB11G)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = orasys2)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = E:\app\oracle
tnsnames. ora
"C:\ notepad %ORACLE_HOME%\network\admin\tnsnames.ora".
You can create this using the Network Configuration Utility (netca) or manually. The following entries
were used during this setup.
DB11G =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = orasys1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DB11G.WORLD)
)
)
DB11G_STBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = orasys2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DB11G.WORLD)
)
)
On Standby Server
C:\> set ORACLE_SID=DB11G
C:\> sqlplus sys as sysdba
SQL> STARTUP NOMOUNT
On Primary Server
Connect to RMAN on the Primary specifying a full connect string for both the TARGET and AUXILIARY
instances.
C:\> rman TARGET sys/password@DB11G AUXILIARY sys/password@DB11G_STBY
RMAN Duplicate
Now we issue the following DUPLICATE command
DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
DORECOVER
SPFILE
SET db_unique_name='DB11G_STBY' COMMENT 'Is standby'
SET LOG_ARCHIVE_DEST_2='SERVICE=db11g ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=DB11G'
SET FAL_SERVER='DB11G' COMMENT 'Is primary'
NOFILENAMECHECK;
References
The below articles helped me out to play Oracle on Windows Server:
http://www.oracle-base.com/articles/11g/data-guard-setup-11gr2.php
Oradim Utility on Windows:
http://www.dba-oracle.com/tips_oradim_utility.htm
And also the below links were helpful too:
http://nadeemmohammed.wordpress.com/2012/05/24/how-to-create-oracle-11g-database-manuallyon-windows/
http://neeraj-dba.blogspot.in/2011/10/active-standby-database-in-oracle-11g.html