Oracle 9i RMAN创建DataGuard

 

监听配置,主从库一样

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 服务器名称)(PORT = 1521))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = test)
      (ORACLE_HOME = /data/oracle/product/9.2)
      (SID_NAME = test)
    )
  )

 

tnsnames.ora配置,主从库一样,主库配置为primary,从库配置为standby

PRIMARY=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.36)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test)
    )
  )


STANDBY=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.38)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test)
    )
  )

 

主库参数文件:

*.aq_tm_processes=1
*.background_dump_dest='/data/oracle/admin/test/bdump'
*.compatible='9.2.0.0.0'
*.control_files='/data/oracle/oradata/test/control01.ctl','/data/oracle/oradata/test/control02.ctl','/data/oracle/oradata/test/control03.ctl'
*.core_dump_dest='/data/oracle/admin/test/cdump'
*.db_block_size=8192
*.db_cache_size=25165824
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
*.fal_client='PRIMARY'
*.fal_server='STANDBY'
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name='test'
*.java_pool_size=83886080
*.job_queue_processes=200
*.large_pool_size=8388608
*.log_archive_dest_1='location=/data/oracle/recover_archivelog/archivelog'
*.log_archive_dest_2='SERVICE=standby OPTIONAL reopen=60 ARCH SYNC NOAFFIRM'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_start=TRUE
*.open_cursors=300
*.pga_aggregate_target=25165824
*.processes=150
*.query_rewrite_enabled='FALSE'
*.remote_archive_enable='TRUE'
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=83886080
*.sort_area_size=524288
*.standby_archive_dest='/data/oracle/recover_archivelog/archivelog'
*.standby_file_management='AUTO'
*.star_transformation_enabled='FALSE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/data/oracle/admin/test/udump'

 

 

从库pfile参数文件:

*.aq_tm_processes=1
*.background_dump_dest='/data/oracle/admin/test/bdump'
*.compatible='9.2.0.0.0'
*.control_files='/data/oracle/oradata/test/control01.ctl','/data/oracle/oradata/test/control02.ct
l','/data/oracle/oradata/test/control03.ctl'
*.core_dump_dest='/data/oracle/admin/test/cdump'
*.db_block_size=8192
*.db_cache_size=25165824
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
*.fal_client='STANDBY'
*.fal_server='PRIMARY'
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name='testdg'
*.java_pool_size=83886080
*.job_queue_processes=200
*.large_pool_size=8388608
*.log_archive_dest_1='location=/data/oracle/recover_archivelog/archivelog'
*.log_archive_dest_2='SERVICE=primary OPTIONAL reopen=60 ARCH SYNC NOAFFIRM'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_start=TRUE
*.open_cursors=300
*.pga_aggregate_target=25165824
      *.processes=150
*.query_rewrite_enabled='FALSE'
*.remote_archive_enable='TRUE'
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=83886080
*.sort_area_size=524288
*.standby_archive_dest='/data/oracle/recover_archivelog/archivelog'
*.standby_file_management='AUTO'
*.star_transformation_enabled='FALSE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/data/oracle/admin/test/udump'

                             

四、在从库上建好相应的目录,免得出现找不到目录的错误


五、在主库上单独备份control文件(**必须的**),备份整个数据库和需要的归档日志文件,拷贝到从库的相同目录下,目录不同就不好使

--备份控制文件
RMAN> backup current controlfile for standby format '/data/rman_backup/control_new.ctl';

RMAN> sql "alter system switch logfile"; 
 
 --压缩备份数据库(局域网可以不用压缩备份):
RMAN> backup as compressed backupset database format '/data/rman_backup/2_%T_%U.bak' plus archivelog;


--可以分开备份归档日志,因为会自动备份到闪回区里面

RMAN> backup as compressed backupset database format '/data/rman_backup/full_%T_%U.bak';

  *****备份所有归档日志
RMAN> backup archivelog all   format '/data/rman_backup/archive_%T_%U.bak';   

  *****备份最近一天的归档日志
RMAN> backup archivelog from time "sysdate-1" until time "sysdate" format ='/data/rman_backup/archivelog_%T_%U.bak' ;


六、拷贝init参数文件和远程密码文件到从库
从库启动到nomount状态

SQL> conn /as sysdba

SQL> startup nomount


七、在主库用RMAN执行连接主库和从库的操作

RMAN> connect catalog rman/*****

RMAN> connect target /    (远程连主库则 connect targetrman/***@primary)

RMAN> connect auxiliary sys/******@standby  (用sys用户连接)


八、执行命令:

RMAN> duplicate target database for standby dorecover;

RMAN> duplicate target database for standby dorecover nofilenamecheck;

 

你可能感兴趣的:(Oracle,DataGuard)