Вы находитесь на странице: 1из 14

Creating physical standby in Oracle 10g

Creating physical standby in Oracle 10g

primary database name: 10gpri on raclinux2 server

standby database name: 10gsb on raclinux1 serverCreate a Physical Standby


environment, General Review.

Detailed implementation of a physical standby environment


Primary Database Steps
Primary Database General View

SQL> archive log list;


Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 0
Current log sequence 1
SQL> select name from v$database;

The Enviroment
2 Linux servers, Oracle Distribution 2.6.9-55 EL i686 i386 GNU/Linux
Oracle Database 10g Enterprise Edition Release 10g R2
ssh is configured for user Oracle on both nodes
Oracle Home is on identical path on both nodes
Implementation notes:
Once you have your primary database up and running these are the steps to
follow:
1. Enable Forced Logging
2. Create a Password File
3. Configure a Standby Redo Log
4. Enable Archiving
5. Set Primary Database Initialization Parameters
Having followed these steps to implement the physical standby you need to
follow these steps:
1. Create a Control File for the Standby Database
2. Backup the Primary Database and transfer a copy to the Standby node.
3. Prepare an Initialization Parameter File for the Standby Database
4. Configure the listener and tnsnames to support the database on both nodes
5. Set Up the Environment to Support the Standby Database on the standby node.
6. Start the Physical Standby Database
7. Verify the Physical Standby Database Is Performing Properly
physical standby manually.implementconfiguration is necessary to
additionalsuccessfully and no is installed, Oracle database are met, that
accommodate an Oracle database. All prerequisites raclinux2and raclinux1Manually
setting up a Physical standby database is a simple task when all prerequisites and
setup steps are carefully planed and executed. In this example We use 2 hosts,

NAME
���
10GPRI

SQL> select name from v$datafile;

NAME
���������������������������
/u01/app/oracle/oradata/10gpri/system01.dbf
/u01/app/oracle/oradata/10gpri/undotbs01.dbf
/u01/app/oracle/oradata/10gpri/sysaux01.dbf
/u01/app/oracle/oradata/10gpri/users01.dbf

SQL> show parameters unique

NAME TYPE VALUE


������������ ���� ����������
db_unique_name string 10gpri
SQL>

Enable Forced Logging


In order to implement Standby Database we enable �Forced Logging�.
This option ensures that even in the event that a �nologging� operation is done,
force logging takes precedence and all operations are logged into the redo logs.
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
Create a Password File
A password file must be created on the Primary and copied over to the Standby
site. The sys password must be identical on both sites. This is a key pre
requisite in order to be able to ship and apply archived logs from Primary to
Standby.

[oracle@raclinux2 ~]$ cd $ORACLE_HOME/dbs


[oracle@raclinux2 dbs]$ orapwd file=orapw10gpri password=oracle force=y

SQL> select * from v$pwfile_users;

USERNAME SYSDB SYSOP


���������� �� ��
SYS TRUE TRUE

Configure a Standby Redo Log


A Standby Redo log is added to enable Data Guard Maximum Availability and maximum
Protection modes. It is important to configure the Standby Redo Logs (SRL) with
the same size as the online redo logs. In this example I�m using Oracle Managed
Files, that�s why I don�t need to provide the SRL path and file name. If you are
not using OMF�s you then must pass the full qualified name.

SQL> select group#,type,member from v$logfile;

GROUP# TYPE MEMBER


���- ��- �����������������
3 ONLINE /u01/app/oracle/oradata/10gpri/redo03.log
2 ONLINE /u01/app/oracle/oradata/10gpri/redo02.log
1 ONLINE /u01/app/oracle/oradata/10gpri/redo01.log

SQL> select bytes from v$log;


BYTES
���-
52428800
52428800
52428800Edit the pfile to add the standby parameters, here shown highlighted:Once
the new parameter file is ready we create from it the spfile:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount pfile=/u01/app/oracle/product/10.2.0/db_1/dbs/init10gpri.ora
ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated
ORA-07286: sksagdi: cannot obtain device information.
Linux Error: 2: No such file or directory
note:
create an archive log destination(location) folder as per init parameter file and
then startup the database.
SQL> startup nomount pfile=/u01/app/oracle/product/10.2.0/db_1/dbs/init10gpri.ora
ORACLE instance started.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4


�/u01/app/oracle/oradata/10gpri/stby04.log� size 50m;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5


�/u01/app/oracle/oradata/10gpri/stby05.log� size 50m;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6


�/u01/app/oracle/oradata/10gpri/stby06.log� size 50m;

Database altered.

SQL> SELECT GROUP#,TYPE,MEMBER FROM V$LOGFILE;

GROUP# TYPE MEMBER


���- ��- �����������������
3 ONLINE /u01/app/oracle/oradata/10gpri/redo03.log
2 ONLINE /u01/app/oracle/oradata/10gpri/redo02.log
1 ONLINE /u01/app/oracle/oradata/10gpri/redo01.log
4 STANDBY /u01/app/oracle/oradata/10gpri/stby04.log
5 STANDBY /u01/app/oracle/oradata/10gpri/stby05.log
6 STANDBY /u01/app/oracle/oradata/10gpri/stby06.log

6 rows selected.

Set Primary Database Initialization Parameters


Data Guard must use spfile, in order to configure it we create and configure the
standby parameters on a regular pfile, and once it is ready we convert it to an
spfile.
Several init.ora parameters control the behavior of a Data Guard environment. In
this example the Primary database init.ora is configured so that it can hold both
roles, as Primary or Standby.

SQL> CREATE PFILE FROM SPFILE;

File created.

(or)

SQL> CREATE PFILE=�/tmp/init10gpri.ora� from spfile;

File created.

10gpri.__db_cache_size=184549376
10gpri.__java_pool_size=4194304
10gpri.__large_pool_size=4194304
10gpri.__shared_pool_size=88080384
10gpri.__streams_pool_size=0
*.audit_file_dest=�/u01/app/oracle/admin/10gpri/adump�
*.background_dump_dest=�/u01/app/oracle/admin/10gpri/bdump�
*.compatible=�10.2.0.1.0'
*.control_files=�/u01/app/oracle/oradata/10gpri/control01.ctl�,�/u01/app/oracle/ora
data/10gpri/control02.ctl�,�/u01/app/oracle/oradata/10gpri/control03.ctl�
*.core_dump_dest=�/u01/app/oracle/admin/10gpri/cdump�
*.db_block_size=8192
*.db_domain=�
*.db_file_multiblock_read_count=16
*.db_name=�10gpri�
*.db_recovery_file_dest=�/u01/app/oracle/flash_recovery_area�
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=10gpriXDB)�
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile=�EXCLUSIVE�
*.sga_target=285212672
*.undo_management=�AUTO�
*.undo_tablespace=�UNDOTBS1'
*.user_dump_dest=�/u01/app/oracle/admin/10gpri/udump�
db_unique_name=�10gpri�
LOG_ARCHIVE_CONFIG=�DG_CONFIG=(10gpri,10gsb)�
LOG_ARCHIVE_DEST_1=�LOCATION=/u01/app/oracle/oradata/10gpri/arch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=10gpri�
LOG_ARCHIVE_DEST_2=�SERVICE=10gsb LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=10gsb�
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
#Standby role parameters��������������
fal_server=10gsb
fal_client=10gpri
standby_file_management=auto
db_file_name_convert=�/u01/app/oracle/oradata/10gsb/�,�/u01/app/oracle/oradata/10gp
ri/�
log_file_name_convert=�/u01/app/oracle/oradata/10gsb/�,�/u01/app/oracle/oradata/10g
pri/�

Total System Global Area 285212672 bytes


Fixed Size 1218992 bytes
Variable Size 96470608 bytes
Database Buffers 184549376 bytes
Redo Buffers 2973696 bytes
SQL> create spfile from pfile;

File created.

SQL> shutdown immediate;


ORA-01507: database not mounted

ORACLE instance shut down.

Enable Archiving
On 10g you can enable archive log mode by mounting the database and executing the
archivelog command:
SQL> startup mount
ORACLE instance started.

Total System Global Area 285212672 bytes


Fixed Size 1218992 bytes
Variable Size 96470608 bytes
Database Buffers 184549376 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;


Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/oradata/10gpri/arch/
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL>

Standby Database Steps


Here, we are going to create standby database using backup of the primary database
using rman.where in comparison to user managed backup, rman is comfortable and
flexible method.

Create an RMAN backup which we will use later to create the standby:

[oracle@raclinux2 ~]$ . oraenv


ORACLE_SID = [orcl] ? 10gpri
[oracle@raclinux2 ~]$ rman target=/

Recovery Manager: Release 10.2.0.1.0 � Production on Wed Jan 20 18:41:51 2010

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

connected to target database: 10GPRI (DBID=3603807872)

RMAN> backup full database format �/u01/app/oracle/backup/%d_%U.bckp� plus


archivelog format �/u01/app/oracle/backup/%d_%U.bckp�;

Next, create a standby controlfile backup via RMAN:


RMAN> configure channel device type disk format �/u01/app/oracle/backup/%U�;

new RMAN configuration parameters:


CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT �/u01/app/oracle/backup/%U�;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1

RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY;

RMAN> BACKUP ARCHIVELOG ALL;


In this simple example, We are backing up the primary database to disk;
therefore,we must make the backupsets available to the standby host if we want to
use them as the basis for my duplicate operation:
[oracle@raclinux2 ~]$ cd /u01/app/oracle/backup
[oracle@raclinux2 backup]$ ls -lart
total 636080
drwxrwxr-x 9 oracle oinstall 4096 Jan 20 18:42 ..
-rw-r�� 1 oracle oinstall 50418176 Jan 20 18:43 10GPRI_01l3v1uv_1_1.bckp
-rw-r�� 1 oracle oinstall 531472384 Jan 20 18:54 10GPRI_02l3v203_1_1.bckp
-rw-r�� 1 oracle oinstall 7143424 Jan 20 18:54 10GPRI_03l3v2jf_1_1.bckp
-rw-r�� 1 oracle oinstall 1346560 Jan 20 18:54 10GPRI_04l3v2jv_1_1.bckp
-rw-r�� 1 oracle oinstall 7110656 Jan 20 19:19 05l3v41r_1_1
drwxr-xr-x 2 oracle oinstall 4096 Jan 20 19:20 .
-rw-r�� 1 oracle oinstall 53174272 Jan 20 19:21 06l3v448_1_1
[oracle@raclinux2 backup]$ scp * oracle@raclinux1:/u01/app/oracle/backup/
05l3v41r_1_1 100% 6944KB 6.8MB/s 00:00
06l3v448_1_1 100% 51MB 16.9MB/s 00:03
10GPRI_01l3v1uv_1_1.bckp 100% 48MB 2.7MB/s 00:18
10GPRI_02l3v203_1_1.bckp 100% 507MB 1.5MB/s 05:47
10GPRI_03l3v2jf_1_1.bckp 100% 6976KB 996.6KB/s 00:07
10GPRI_04l3v2jv_1_1.bckp 100% 1315KB 1.3MB/s 00:01

NOTE:

The primary and standby database location for backup folder must be same.

for eg: /u01/app/oracle/backup folder

On the standby node create the required directories to get the datafiles

mkdir -p /u01/app/oracle/oradata/10gsb
mkdir -p /u01/app/oracle/oradata/10gsb/arch
mkdir -p /u01/app/oracle/admin/10gsb
mkdir -p /u01/app/oracle/admin/10gsb/adump
mkdir -p /u01/app/oracle/admin/10gsb/bdump
mkdir -p /u01/app/oracle/admin/10gsb/udump
mkdir -p /u01/app/oracle/flash_recovery_area/10GPRI
mkdir -p /u01/app/oracle/flash_recovery_area/10GPRI/onlinelogPrepare an
Initialization Parameter File for the Standby Database

Copy from the primary pfile to the standby destination


[oracle@raclinux2 ~]$ cd /u01/app/oracle/product/10.2.0/db_1/dbs/
[oracle@raclinux2 dbs]$ scp init10gpri.ora oracle@raclinux1:/tmp/init10gsb.ora
init10gpri.ora 100% 1704 1.7KB/s 00:00

Copy and edit the primary init.ora to set it up for the standby role,as shown
highlighted below:

10gsb.__db_cache_size=188743680
10gsb.__java_pool_size=4194304
10gsb.__large_pool_size=4194304
10gsb.__shared_pool_size=83886080
10gsb.__streams_pool_size=0
*.audit_file_dest=�/u01/app/oracle/admin/10gsb/adump�
*.background_dump_dest=�/u01/app/oracle/admin/10gsb/bdump�
*.compatible=�10.2.0.1.0'
*.control_files=�/u01/app/oracle/oradata/10gsb/control01.ctl�,�/u01/app/oracle/orad
ata/10gsb/control02.ctl�,�/u01/app/oracle/oradata/10gsb/control03.ctl�
*.core_dump_dest=�/u01/app/oracle/admin/10gsb/cdump�
*.db_block_size=8192
*.db_domain=�
*.db_file_multiblock_read_count=16
*.db_file_name_convert=�/u01/app/oracle/oradata/10gpri/�,�/u01/app/oracle/oradata/1
0gsb/�
*.db_name=�10gpri�
*.db_recovery_file_dest=�/u01/app/oracle/flash_recovery_area�
*.db_recovery_file_dest_size=2147483648
*.db_unique_name=�10gsb�
*.dispatchers='(PROTOCOL=TCP) (SERVICE=10gsbXDB)�
*.fal_client=�10gsb�
*.fal_server=�10gpri�
*.job_queue_processes=10
*.LOG_ARCHIVE_CONFIG=�DG_CONFIG=(10gpri,10gsb)�
*.LOG_ARCHIVE_DEST_1=�LOCATION=/u01/app/oracle/oradata/10gsb/arch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=10gsb�
*.LOG_ARCHIVE_DEST_2=�SERVICE=10gpri LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=10gpri�
*.LOG_ARCHIVE_DEST_STATE_1=�ENABLE�
*.LOG_ARCHIVE_DEST_STATE_2=�ENABLE�
*.LOG_ARCHIVE_FORMAT=�%t_%s_%r.arc�
*.LOG_ARCHIVE_MAX_PROCESSES=30
*.log_file_name_convert=�/u01/app/oracle/oradata/10gpri/�,�/u01/app/oracle/oradata/
10gsb/�
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile=�EXCLUSIVE�
*.sga_target=285212672
*.standby_file_management=�auto�
*.undo_management=�AUTO�
*.undo_tablespace=�UNDOTBS1'
*.user_dump_dest=�/u01/app/oracle/admin/10gsb/udump�

Configure the listener and tnsnames to support the database on both nodes

Configure listener.ora on both servers to hold entries for both databases

#on RACLINUX2 Machine


LISTENER_VMRACLINUXTEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux2.gj.com)(PORT = 1521))
)
)

SID_LIST_LISTENER_VMRACLINUXTEST =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = 10gpri)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = 10gpri)
)
)

#on raclinux1 machine


LISTENER_VMRACLINUXTEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux1.gj.com)(PORT = 1521))
)
)

SID_LIST_LISTENER_VMRACLINUXTEST =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = 10gsb)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = 10gsb)
)
)

Configure tnsnames.ora on both servers to hold entries for both databases

#on raclinux2 machine

LISTENER_VMRACLINUXTEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux2.gj.com)(PORT = 1521))
)
)

10GPRI =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux2.gj.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = 10gpri)
)
)
10GSB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux1.gj.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = 10gsb)
)
)
#on raclinux1 machine

LISTENER_VMRACLINUXTEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux1.gj.com)(PORT = 1521))
)
)

10GPRI =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux2.gj.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = 10gpri)
)
)

10GSB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raclinux1.gj.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = 10gsb)
)
)

Start the listener and check tnsping on both nodes to both services

#on machine raclinux1

[oracle@raclinux1 tmp]$ lsnrctl stop LISTENER_VMRACLINUXTEST

LSNRCTL for Linux: Version 10.2.0.1.0 � Production on 20-JAN-2010 23:59:41

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=raclinux1.gj.com)
(PORT=1521)))
The command completed successfully

[oracle@raclinux1 tmp]$ lsnrctl start LISTENER_VMRACLINUXTEST

LSNRCTL for Linux: Version 10.2.0.1.0 � Production on 25-DEC-2009 00:00:00

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait�

TNSLSNR for Linux: Version 10.2.0.1.0 � Production


System parameter file is
/u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to
/u01/app/oracle/product/10.2.0/db_1/network/log/listener_vmraclinuxtest.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=raclinux1.gj.com)
(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=raclinux1.gj.com)
(PORT=1521)))
STATUS of the LISTENER
��������
Alias LISTENER_VMRACLINUXTEST
Version TNSLSNR for Linux: Version 10.2.0.1.0 � Production
Start Date 25-DEC-2009 00:00:00
Uptime 0 days 0 hr. 0 min. 0 sec
Traclinuxe Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/product/10.2.0/db_1/network/log/listener_vmraclinuxtest.log
Listening Endpoints Summary�
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=raclinux1.gj.com)(PORT=1521)))
Services Summary�
Service �10gsb� has 1 instance(s).
Instance �10gsb�, status UNKNOWN, has 1 handler(s) for this service�
Service �10gsb_DGMGRL� has 1 instance(s).
Instance �10gsb�, status UNKNOWN, has 1 handler(s) for this service�
The command completed successfully

[oracle@raclinux1 tmp]$ tnsping 10gsb

TNS Ping Utility for Linux: Version 10.2.0.1.0 � Production on 25-DEC-2009 00:00:21

Copyright (c) 1997, 2005, Oracle. All rights reserved.

Used parameter files:


/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias


Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
raclinux1.gj.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME
= 10gsb)))
OK (10 msec)

[oracle@raclinux1 tmp]$ tnsping 10gpri

TNS Ping Utility for Linux: Version 10.2.0.1.0 � Production on 25-DEC-2009 00:00:29
#on raclinux2 machine

Copyright (c) 1997, 2005, Oracle. All rights reserved.

Used parameter files:


/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias


Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
raclinux2.gj.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME
= 10gpri)))
OK (10 msec)

[oracle@raclinux2 dbs]$ lsnrctl stop LISTENER_VMRACLINUXTEST

LSNRCTL for Linux: Version 10.2.0.1.0 � Production on 25-DEC-2009


00:22:48[oracle@raclinux2 dbs]$ lsnrctl start LISTENER_VMRACLINUXTEST

LSNRCTL for Linux: Version 10.2.0.1.0 � Production on 25-DEC-2009 00:23:08

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=raclinux2.gj.com)(PORT=1
521)))
The command completed successfully

Copyright (c) 1991, 2005, Oracle. All rights reserved.


Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait�

TNSLSNR for Linux: Version 10.2.0.1.0 � Production


System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/liste
ner.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener
_vmraclinuxtest.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=raclinux2.gj.com)(PORT=1
521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=raclinux2.gj.com)(PORT=1
521)))
STATUS of the LISTENER
��������
Alias LISTENER_VMRACLINUXTEST
Version TNSLSNR for Linux: Version 10.2.0.1.0 � Production
Start Date 25-DEC-2009 00:23:08
Uptime 0 days 0 hr. 0 min. 0 sec
Traclinuxe Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/list
ener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listen
er_vmraclinuxtest.log
Listening Endpoints Summary�
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=raclinux2.gj.com)(PORT=1521)))
Services Summary�
Service �10gpri� has 1 instance(s).
Instance �10gpri�, status UNKNOWN, has 1 handler(s) for this service�
Service �10gpri_DGMGRL� has 1 instance(s).
Instance �10gpri�, status UNKNOWN, has 1 handler(s) for this service�
The command completed successfully

[oracle@raclinux2 dbs]$ tnsping 10gpri

TNS Ping Utility for Linux: Version 10.2.0.1.0 � Production on 25-DEC-2009 00:23 :
14

Copyright (c) 1997, 2005, Oracle. All rights reserved.

Used parameter files:


/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias


Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
raclinux2.loc aldomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = whi te)))
OK (0 msec)

[oracle@raclinux2 dbs]$ tnsping 10gsb

TNS Ping Utility for Linux: Version 10.2.0.1.0 � Production on 25-DEC-2009 00:23 :
18

Copyright (c) 1997, 2005, Oracle. All rights reserved.


Used parameter files:
/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias


Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
raclinux1.loc aldomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = bla ck)))
OK (10 msec)

Set Up the Environment to Support the Standby Database on the standby node.

Create a passwordfile for the standby:


[oracle@raclinux1 ~]$ orapwd file=$ORACLE_HOME/dbs/orapw10gsb password=oracle
note: sys password must be identical for both primary and standby
databaseoratab:Startup nomount the Standby database

Append an entry to

[oracle@raclinux1 ~]$ echo �10gsb:/u01/app/oracle/product/10.2.0/db_1:N� >>


/etc/oratab

Nomount the standby instance in preparation for the duplicate operation:


Startup nomount the Standby database and generate an spfile
SQL*Plus: Release 10.2.0.1.0 � Production on Thu Jan 21 00:38:03 2010SQL> startup
nomount pfile=�/tmp/init10gsb.ora�
ORACLE instance started.ORA-01507: database not mounted
SQL> startup nomount
ORACLE instance started.
Create the standby database using rman:
[oracle@raclinux1 ~]$ . oraenv
ORACLE_SID = [orcl1] ? 10gsb
[oracle@raclinux1 ~]$ rman target=sys/oracle@10gpri auxiliary=/

[oracle@raclinux1 ~]$ . oraenv


ORACLE_SID = [orcl1] ? 10gsb
[oracle@raclinux1 ~]$ sqlplus �/as sysdba�

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

Connected to an idle instance.

Total System Global Area 285212672 bytes


Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes

SQL> create spfile from pfile=�/tmp/init10gsb.ora�;

File created.

SQL> shutdown immediate

ORACLE instance shut down.

Total System Global Area 285212672 bytes


Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes

Recovery Manager: Release 10.2.0.1.0 � Production on Thu Jan 21 00:43:11 2010

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

connected to target database: 10GPRI (DBID=3603807872)


connected to auxiliary database: 10GPRI (not mounted)

RMAN> DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK;

Start the redo apply:

SQL> alter database recover managed standby database disconnect from session;

Test the configuration by generating archive logs from the primary and then
querying the standby to see if the logs are being successfully applied.

On the Primary:

SQL> alter system switch logfile;

SQL> alter system archive log current;

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u01/app/oracle/oradata/10gpri/arch/

Oldest online log sequence 8

Next log sequence to archive 10

Current log sequence 10

On the Standby:

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u01/app/oracle/oradata/10gsb/arch/

Oldest online log sequence 8

Next log sequence to archive 0

Current log sequence 10

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;


Stop the managed recovery process on the standby:

SQL> alter database recover managed standby database cancel;

Вам также может понравиться