ITPub博客

首页 > 应用开发 > IT综合 > Dataguard的配置

Dataguard的配置

原创 IT综合 作者:OmarChina 时间:2007-09-19 15:00:53 0 删除 编辑
在本机上使用这样的方式建立备用数据库[@more@]

一,物理备用数据库

是主数据库完全副本,直接应用REDO保持与主数据库的同步

物理备用数据库的建立

1, 使用用户管理的方式建立备用数据库

A:在本机上使用这样的方式建立备用数据库

1,先直接利用Tar包部署ORACLE服务端。---详见tar包配置10G服务端文档

[oracle@Ora10g-P u01]$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Sep 12 20:43:55 2007

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup mount

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1261372 bytes

Variable Size 155189444 bytes

Database Buffers 125829120 bytes

Redo Buffers 2932736 bytes

Database mounted.

SQL> archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 25

Current log sequence 27

SQL> alter database archivelog; ---设置DB为归档模式

Database altered.

SQL> alter database force logging; ----强制使用Logging的方式

Database altered.

SQL> alter database open;

Database altered.

SQL> select name from v$datafile;

NAME

--------------------------------------------------------------------------------

/u01/app/oracle/oradata/southdb/system01.dbf

/u01/app/oracle/oradata/southdb/undotbs01.dbf

/u01/app/oracle/oradata/southdb/sysaux01.dbf

/u01/app/oracle/oradata/southdb/users01.dbf

SQL> alter database begin backup;

Database altered.

SQL> ! cp /u01/app/oracle/oradata/southdb/*.dbf /u01/db_backup/

-------对数据库进行个全备份

SQL> alter database end backup;

Database altered.

SQL> alter system archive log current;

System altered.

SQL> alter database create standby controlfile as '/u01/db_backup/standby01.ctl';

------建立STANDBY 控制文件

Database altered.

-----建立STANDBYDB相应的目录

-----通过orapwd建立口令文件

[oracle@Ora10g-P dbs]$ pwd

/u01/app/oracle/product/10.1.0/southdb/dbs

[oracle@Ora10g-P dbs]$ orapwd file=orapwstandby1 password=biohazard entries=5

[oracle@Ora10g-P dbs]$ ls

hc_southdb.dat initdw.ora init.ora lkSOUTHDB orapwsouthdb pwdstandby01.ora spfilesouthdb.ora

------通过spfile来建立pfile

SQL> create pfile='/u01/app/oracle/admin/southdb/pfile/init_southdb.ora' from spfile;

File created.

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production

With the Partitioning, OLAP and Data Mining options

[oracle@Ora10g-P pfile]$ ls

init.ora.852007164948 init_southdb.ora

-----修改参数文件添加如下内容

db_unique_name=southdb

log_archive_dest_1='location=/u01/app/oracle/flash_recovery_area/SOUTHDB/archivelog valid_for=(all_logfiles,all_roles) db_u

nique_name=southdb'

log_archive_dest_2='service=standby1 valid_for=(online_logfiles,primary_role) db_unique_name=standby1'

log_archive_config='dg_config=(southdb,standby1)'

fal_server=standby1

fal_client=southdb

standby_file_management=auto

log_archive_format='%t_%s_%r.arc'

-----database参数如下:

southdb.__db_cache_size=121634816

southdb.__java_pool_size=29360128

southdb.__large_pool_size=4194304

southdb.__shared_pool_size=125829120

southdb.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/southdb/adump'

*.background_dump_dest='/u01/app/oracle/admin/southdb/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/u01/app/oracle/oradata/southdb/control01.ctl',

'/u01/app/oracle/oradata/southdb/control02.ctl',

'/u01/app/oracle/oradata/southdb/control03.ctl'

*.core_dump_dest='/u01/app/oracle/admin/southdb/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='southdb'

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.db_unique_name='southdb'--------------用户指定主数据库的惟一名称

*.dispatchers='(PROTOCOL=TCP) (SERVICE=southdbXDB)'

*.fal_client='southdb'--------------用于指定fal(fetch archive log)客户段的网络服务名

*.fal_server='standby1'-----------用于指定FAL服务器的网络服务名

*.job_queue_processes=10

*.log_archive_config='dg_config=(southdb,standby1)'--------------dg_config属性用于列出主数据库和所有备用数据库的唯一数据库名

*.log_archive_dest_1='location=/u01/app/oracle/flash_recovery_area/SOUTHDB/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=southdb'----------指定归档位置,location为本地归档位置,service用于指定备用数据库的网络服务名;

*.log_archive_dest_2='service=standby1 valid_for=(online_logfiles,primary_role) db_unique_name=standby1'

*.log_archive_format='%t_%s_%r.arc'

*.open_cursors=300

*.pga_aggregate_target=94371840

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=285212672

*.standby_file_management='auto'-------------------指定备用数据文件管理方式,auto时候,如果主数据库增加或删除数据文件,备用数据库会自动应用相应改变.

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u01/app/oracle/admin/southdb/udump'

SQL> create spfile from pfile='/u01/app/oracle/admin/southdb/pfile/init_southdb.ora';

----配置standbydb的参数文件如下:

standby1.__db_cache_size=113246208

standby1.__java_pool_size=33554432

standby1.__large_pool_size=4194304

standby1.__shared_pool_size=130023424

standby1.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/standby1/adump'

*.background_dump_dest='/u01/app/oracle/admin/standby1/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/u01/app/oracle/oradata/standby1/standby01.ctl'

*.core_dump_dest='/u01/app/oracle/admin/standby1/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_file_name_convert='/u01/app/oracle/oradata/southdb','/u01/app/oracle/oradata/standby1'

*.db_name='southdb'

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.db_unique_name='standby1'----------其不能与主数据库相同

*.fal_client='standby1'

*.fal_server='southdb'

*.instance_name='standby1'-------------实例名

*.job_queue_processes=10

*.log_archive_config='dg_config=(southdb,standby1)'

*.log_archive_dest_1='location=/u01/app/oracle/flash_recovery_area/STANDBY1/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=standby1'

*.log_archive_format='%t_%s_%r.arc'

*.log_file_name_convert='/u01/app/oracle/oradata/southdb','/u01/app/oracle/oradata/standby1'

*.open_cursors=300

*.pga_aggregate_target=94371840

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.service_names='standby1'-------------指定备用数据库的数据库服务名

*.sga_target=285212672

*.standby_archive_dest='/u01/app/oracle/flash_recovery_area/STANDBY1/archivelog'--------------用于指定主数据库归档日志被传送到

*.standby_file_management='auto'

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u01/app/oracle/admin/standby1/udump'

-----配置listener.oratnsnames.ora文件

Export ORACLE_SID=standby1

Connected to an idle instance.

SQL> startup nomount pfile='/u01/app/oracle/admin/standby1/pfile/init_standby1.ora';

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1261372 bytes

Variable Size 159383748 bytes

Database Buffers 121634816 bytes

Redo Buffers 2932736 bytes

SQL> create spfile from pfile='/u01/app/oracle/admin/standby1/pfile/init_standby1.ora';

File created.

SQL> alter database mount;

Database altered.

----做一个数据库的恢复动作

SQL> recover standby database using backup controlfile until cancel;

ORA-00279: change 791231 generated at 09/12/2007 20:46:50 needed for thread 1

ORA-00289: suggestion :

/u01/app/oracle/flash_recovery_area/standby01/archivelog/1_27_632508527.arc

ORA-00280: change 791231 for thread 1 is in sequence #27

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00279: change 791319 generated at 09/12/2007 20:49:39 needed for thread 1

ORA-00289: suggestion :

/u01/app/oracle/flash_recovery_area/standby01/archivelog/1_28_632508527.arc

ORA-00280: change 791319 for thread 1 is in sequence #28

ORA-00278: log file

'/u01/app/oracle/flash_recovery_area/standby01/archivelog/1_27_632508527.arc'

no longer needed for this recovery

ORA-00308: cannot open archived log

'/u01/app/oracle/flash_recovery_area/standby01/archivelog/1_28_632508527.arc'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information:

SQL> alter database open;

Database altered.

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

Database altered.

---------在主DATABASE中执行:

SQL> alter system switch logfile;

System altered.

--------standby1alert文件中出现;

Wed Sep 12 22:42:24 2007

RFS[1]: No standby redo logfiles created

RFS[1]: Archived Log:

'/u01/app/oracle/flash_recovery_area/STANDBY1/archivelog/1_31_632508527.arc'

Wed Sep 12 22:42:28 2007

Media Recovery Log /u01/app/oracle/flash_recovery_area/STANDBY1/archivelog/1_31_632508527.arc

Media Recovery Waiting for thread 1 sequence 32

B:在异机上使用这样的方式建立备用数据库

见:

http://www.eygle.com/ha/dataguard-step-by-step.htm

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

请登录后发表评论 登录
全部评论
  • 博文量
    68
  • 访问量
    997067