ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DataGuard的基本配置

DataGuard的基本配置

原创 Linux操作系统 作者:oracle_ace 时间:2007-12-31 12:31:15 0 删除 编辑

Keep on being vacation today.So written down some steps abt how to configuration for the DataGuard for both primary database and standby database.

Set up the PRIMARY database
-----------------------------------------
1.Create the database for primary database with archived mode based on the current oracle rdbms

2.Configurate the Oracle Net both including Listener and Net Service Name.
(By the way,in the DataGuard environment,the primary database and standby database are both the server and client for each other.So both of them need to configuration these two kind of configuration)

3.As the words mentioned above,after configuration,the tnsnames.ora should have at least two kinds of the Net Service Name(connect string to primary and standby),of  course the listener configuration for primary database should be finished

For the example of tnsname.ora:

PRIMARY_DB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rmsvtp02)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = icmnlsdb)
    )
  )
  
STANDBY_DB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rmsvtp01)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = icmnlsdb)
    )
  )

4.Edit the /etc/hosts to resolv the hostname for each other.

5.Test the primary database connect by sqlplus

6.Disable the logging funciton temporary for primary database by using:

alter database force logging;

7.Check the database for the archived mode by using

archive log list;

8.create the the controlfile for standby database by using:

alter database create standby controlfile as
'/opt/oracle/oradata/icmnlsdb/standby_control.ctl';

9.Add or Modify the following parameter in spfile or pfile:
 
log_archive_dest_2='SERVICE=STANDBY_DB'
log_archive_dest_state_2=enable
log_archive_dest_state_1=enable

remote_archive_enable=true
standby_archive_dest='/opt/oracle/oradata/icmnlsdb/standby'
standby_file_management=auto

fal_server=standby_db
fal_client=primary_db

10.Shutdown immediate

11.Copy all the datafile and spfile or pfile,even included the passwordfile of primary database to a standby database.

12.startup the primary database.

Set up the STANDBY database
-----------------------------------------
1.Configurate the Oracle Net both including Listener and Net Service Name.
(By the way,in the DataGuard environment,the standby database and primary database are both the server and client for each other.So both of them need to configuration these two kind of configuration)

2.As the words mentioned above,after configuration,the tnsnames.ora should have at least two kinds of the Net Service Name(connect string to primary and standby),of course the listener configuration for standby database should be finished

For the example of tnsname.ora:

PRIMARY_DB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rmsvtp02)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = icmnlsdb)
    )
  )
  
STANDBY_DB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rmsvtp01)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = icmnlsdb)
    )
  )

4.Edit the /etc/hosts to resolv the hostname for each other.

5.Modify the spfile or pfile that received from primary database for following parameters
log_archive_dest_2='SERVICE=PRIMARY_DB'
log_archive_dest_state_2=enable
log_archive_dest_state_1=enable

remote_archive_enable=true
standby_archive_dest='/opt/oracle/oradata/icmnlsdb/standby'
standby_file_management=auto

fal_server=primary_db
fal_client=standby_db

6.Replace all the controlfile received from primary database with the new created standby_control.ctl,and the location of controlfile was recorded in the initial paramter files.

7.Test the database remote connect to primary database by sqlplus

8.Start the listener,then the primary database can connect to the standby database by using the net service name remotely,and can transfer the redo data to standby database.

9.Standby database should be startup in nomount mode firstly, not mounted and opened.then mount the database in standby mode.
by using:

conn / as sysdba;

startup nomount;

alter database mount standby database;

10.Let the standby database can received from primary database and apply the changed redo data
by using:
 
alter database recover managed standby database disconnect from session;

11.select sequence#,first_time,next_time from v$archived_log order by sequence#;

12.In PRIMARY database using the command:
alter system archive log current;
force the redo data transfer to the standby database

13.select sequence#,applied from v$archived_log order by sequence#, this command is to see whether the recevied redo log have applied in the standby database.

14.alter database recover managed standby database cancel;
this command is to cancelled the redo apply operation.and alter database open read only
to open database in read only mode to query the verifed the change.

15,Of crouse we can use the
alter database recover managed standby database disconnect from session;
to change the standby database from open read only to mount status again to perform. the redo apply operation.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12361284/viewspace-64620/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-10

  • 博文量
    284
  • 访问量
    843159