Thursday, February 10, 2011

Creating a physical standby database

Some details about the set-up before we begin:

1. There are 2 servers running oracle binaries. (11gR2 in my case)
2. They can see each other on the network
3. Your primary database is already running on primary host
4. Primary database is in archive log mode

In this example, the primary host is called H1. And the standby host is called H2.
First thing to do is to set up the listeners on H1 and H2.

There are 2 databases, chicago on H1 and boston on H2. Test the connections.

Ping boston from H1

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = H2.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = boston)))

OK (10 msec)

Ping chicago from H2

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = H1.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = chicago)))

OK (70 msec)

Prepare the pfile from chicago and put it on the H2. Edit it when it is on H2.

Take note of all the paths that needs to be corrected and reflected from H2 now. Make sure those paths do exist before continuing. Connect to the database now. You will see it is in IDLE state. Create a spfile.

Now start boston with nomount.

We will backup chicago database.

backup device type disk format '/data/stage/%U' database plus archivelog;
backup device type disk format '/data/stage/%U' current controlfile for standby;

Send the files over to H2.
Once transmission is done, duplicate the database on H2.

duplicate target database for standby;

When that is complete, add the redo log files. Also, add standby redo logs.

Start the standby recover process on boston now:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Check the archive logs now on boston.

Switch the log on chicago
Check again the archive logs on boston now.

Now, let's switch over to standby

No comments:

Post a Comment