ag真人游戏

400-090-9964


教學文章

Linux下ORACLE 11G DATA GUARD搭建

時間:2020-04-10 來源:

1、huanjing

      system version  hostname  ip  oracle version    db_name    db_unique_name

primary    rhel6.2    dg1    192.168.230.129    11.2.0.1.0    dg1    dg1

standby    rhel6.2    dg2    192.168.230.130    11.2.0.1.0    dg1    dg2

primaryduanshujukuchuyuopenzhuangtai、guidangzhuangtaijiqiangzhiguidangzhuangtai,tongguodbcachuangjian,yijingyoumimawenjian;standbyduanjinanzhuangshujukuruanjian,meiyouchuangjianshujuku。

2、wangluopeizhi

2.1 primaryjiantingpeizhi

ag真人游戏 [oracle@dg1 ~]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# listener.ora network configuration file: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# generated by oracle configuration tools.

ag真人游戏 sid_list_listener =

(sid_list =

(sid_desc =

(global_dbname = dg1)

(oracle_home = /u01/app/oracle/product/11.2.0/dbhome_1)

(sid_name = dg1)

)

)

listener =

(description =

ag真人游戏 (address = (protocol = tcp)(host = 192.168.233.129)(port = 1521))

)

adr_base_listener = /u01/app/oracle

2.2 standbyjiantingpeizhi

[oracle@dg2 ~]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# listener.ora network configuration file: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

ag真人游戏 # generated by oracle configuration tools.

sid_list_listener =

ag真人游戏 (sid_list =

(sid_desc =

ag真人游戏 (global_dbname = dg2)

(oracle_home = /u01/app/oracle/product/11.2.0/dbhome_1)

ag真人游戏 (sid_name = dg2)

)

)

listener =

(description =

(address = (protocol = tcp)(host = 192.168.233.130)(port = 1521))

)

ag真人游戏 adr_base_listener = /u01/app/oracle

ag真人游戏 2.3 primarywangluofuwumingpeizhi

[oracle@dg1 ~]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

ag真人游戏 # tnsnames.ora network configuration file: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# generated by oracle configuration tools.

dg_129 =

(description =

ag真人游戏 (address_list =

(address = (protocol = tcp)(host = 192.168.233.129)(port = 1521))

)

(connect_data =

ag真人游戏 (service_name = dg1)

)

)

dg_130 =

ag真人游戏 (description =

(address_list =

(address = (protocol = tcp)(host = 192.168.233.130)(port = 1521))

)

ag真人游戏 (connect_data =

ag真人游戏 (service_name = dg2)

)

)

2.4 standbywangluofuwumingpeizhi

[oracle@dg2 ~]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# tnsnames.ora network configuration file: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# generated by oracle configuration tools.

dg_129 =

(description =

(address_list =

(address = (protocol = tcp)(host = 192.168.233.129)(port = 1521))

)

(connect_data =

ag真人游戏 (service_name = dg1)

)

)

dg_130 =

ag真人游戏 (description =

(address_list =

ag真人游戏 (address = (protocol = tcp)(host = 192.168.233.130)(port = 1521))

)

(connect_data =

(service_name = dg2)

)

)

2.5 qidongjiantingbingjinxingceshi

ag真人游戏 zhuyiyaojinxingfanghuoqiangfangxinghuozheguanbifanghuoqiang。

ag真人游戏 [oracle@dg1 ~]$ tnsping dg_130

tns ping utility for linux: version 11.2.0.1.0 - production on 01-feb-2015 17:46:08

copyright (c) 1997, 2009, oracle. all rights reserved.

ag真人游戏 used parameter files:

used tnsnames adapter to resolve the alias

attempting to contact (description = (address_list = (address = (protocol = tcp)(host = 192.168.233.130)(port = 1521))) (connect_data = (service_name = dg2)))

ok (0 msec)

[oracle@dg2 ~]$ tnsping dg_129

tns ping utility for linux: version 11.2.0.1.0 - production on 01-feb-2015 17:46:25

copyright (c) 1997, 2009, oracle. all rights reserved.

ag真人游戏 used parameter files:

used tnsnames adapter to resolve the alias

attempting to contact (description = (address_list = (address = (protocol = tcp)(host = 192.168.233.129)(port = 1521))) (connect_data = (service_name = dg1)))

ag真人游戏 ok (10 msec)

ag真人游戏 3、canshupeizhi

ag真人游戏 3.1 primarycanshupeizhi

genjuspfile.orashengchengpfile.ora。

ag真人游戏 [oracle@dg1 ~]$ cat pfile.ora

dg1.__db_cache_size=58720256

ag真人游戏 dg1.__java_pool_size=4194304

ag真人游戏 dg1.__large_pool_size=4194304

ag真人游戏 dg1.__oracle_base='/u01/app/oracle'#oracle_base set from environment

dg1.__pga_aggregate_target=197132288

dg1.__sga_target=247463936

dg1.__shared_io_pool_size=0

dg1.__shared_pool_size=167772160

ag真人游戏 dg1.__streams_pool_size=4194304

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

ag真人游戏 *.audit_trail='db'

*.compatible='11.2.0.0.0'

ag真人游戏 *.control_files='/u01/app/oracle/oradata/dg1/controlfile/o1_mf_bdkgbx5j_.ctl','/u01/app/oracle/flash_recovery_area/dg1/controlfile/o1_mf_bdkgbxcc_.ctl'

*.db_block_size=8192

ag真人游戏 *.db_create_file_dest='/u01/app/oracle/oradata'

ag真人游戏 *.db_domain=''

ag真人游戏 *.db_name='dg1'

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

*.db_recovery_file_dest_size=4070572032

ag真人游戏 *.diagnostic_dest='/u01/app/oracle'

ag真人游戏 *.dispatchers='(protocol=tcp) (service=dg1xdb)'

ag真人游戏 *.log_archive_config='dg_config=(dg1,dg2)'

ag真人游戏 *.log_archive_dest_2='service=dg_130 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=dg2'

ag真人游戏 *.log_archive_dest_state_2='enable'

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

ag真人游戏 *.memory_target=444596224

*.open_cursors=300

ag真人游戏 *.processes=150

*.remote_login_passwordfile='exclusive'

*.undo_tablespace='undotbs1'

3.2 standbycanshupeizhi

jiangprimarydepfile.orakaobeidaostandby,xiugaihoushengchengspfiledg2.ora。

ag真人游戏 [oracle@dg2 ~]$ cat pfile.ora

dg1.__db_cache_size=100663296

dg2.__db_cache_size=155189248

dg1.__java_pool_size=4194304

ag真人游戏 dg2.__java_pool_size=4194304

ag真人游戏 dg1.__large_pool_size=4194304

dg2.__large_pool_size=4194304

ag真人游戏 dg1.__oracle_base='/u01/app/oracle'#oracle_base set from environment

dg2.__oracle_base='/u01/app/oracle'#oracle_base set from environment

ag真人游戏 dg1.__pga_aggregate_target=155189248

ag真人游戏 dg2.__pga_aggregate_target=180355072

dg1.__sga_target=289406976

dg2.__sga_target=264241152

dg1.__shared_io_pool_size=0

ag真人游戏 dg2.__shared_io_pool_size=0

dg1.__shared_pool_size=167772160

ag真人游戏 dg2.__shared_pool_size=92274688

ag真人游戏 dg1.__streams_pool_size=4194304

dg2.__streams_pool_size=0

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

ag真人游戏 *.audit_trail='db'

*.compatible='11.2.0.0.0'

ag真人游戏 *.control_files='/u01/app/oracle/oradata/dg2/controlfile/o1_mf_bdkgbx5j_.ctl','/u01/app/oracle/flash_recovery_area/dg2/controlfile/o1_mf_bdkgbxcc_.ctl'#set by rman

*.db_block_size=8192

ag真人游戏 *.db_create_file_dest='/u01/app/oracle/oradata'

ag真人游戏 *.db_domain=''

ag真人游戏 *.db_name='dg1'

ag真人游戏 *.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

ag真人游戏 *.db_recovery_file_dest_size=4070572032

ag真人游戏 *.db_unique_name='dg2'

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(protocol=tcp) (service=dg1xdb)'

ag真人游戏 *.log_archive_config='dg_config=(dg1,dg2)'

ag真人游戏 *.log_archive_dest_1='location=/u01/app/oracle/oradata/dg2/archivelog/ valid_for=(all_logfiles,all_roles) db_unique_name=dg2'

ag真人游戏 *.log_archive_format='%t_%s_%r.dbf'

*.memory_target=444596224

*.open_cursors=300

*.processes=150

ag真人游戏 *.remote_login_passwordfile='exclusive'

ag真人游戏 *.standby_file_management='auto'

*.undo_tablespace='undotbs1'

4、xitongshezhi

4.1 standbymuluchuangjian

ag真人游戏 genjucanshuwenjianchuangjianxiangguanmulu。

mkdir -p /u01/app/oracle/admin/dg2/{adump,bdump,cdump,pfile,udump}

mkdir -p /u01/app/oracle/oradata/dg2/{controlfile,datafile,onlinelog,archivelog}

mkdir /u01/app/oracle/flash_recovery_area

4.2 standbymimawenjian

ag真人游戏 jiangprimaryduandemimawenjianfuzhidaostandbybingzhongmingming。

scp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg1 oracle@192.168.233.130:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/

ag真人游戏 mv /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg1 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg2

5、chuangjianstandbyshujuku

jiangstandbyshujukuqidongdaonomountzhuangtai,zaiprimaryduanyunxingruxiamingling:

ag真人游戏 [oracle@dg1 ~]$ rman target / auxiliary sys/123456@dg_130

ag真人游戏 recovery manager: release 11.2.0.1.0 - production on sun feb 1 16:22:59 2015

copyright (c) 1982, 2009, oracle and/or its affiliates. all rights reserved.

ag真人游戏 connected to target database: dg1 (dbid=1851568413)

connected to auxiliary database: dg1 (not mounted)

rman> duplicate target database for standby nofilenamecheck from active database;

ag真人游戏 starting duplicate db at 01-feb-15

using target database control file instead of recovery catalog

allocated channel: ora_aux_disk_1

ag真人游戏 channel ora_aux_disk_1: sid=20 device type=disk

ag真人游戏 contents of memory script:

{

backup as copy reuse

targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg1' auxiliary format

'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg2' ;

}

ag真人游戏 executing memory script

ag真人游戏 starting backup at 01-feb-15

ag真人游戏 allocated channel: ora_disk_1

channel ora_disk_1: sid=44 device type=disk

finished backup at 01-feb-15

contents of memory script:

{

sql clone "alter system set control_files =

''/u01/app/oracle/oradata/dg2/controlfile/o1_mf_bdkgbx5j_.ctl'', ''/u01/app/oracle/flash_recovery_area/dg2/controlfile/o1_mf_bdkgbxcc_.ctl'' comment=

''set by rman'' scope=spfile";

backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/dg2/controlfile/o1_mf_bdkgbx5j_.ctl';

ag真人游戏 restore clone controlfile to '/u01/app/oracle/flash_recovery_area/dg2/controlfile/o1_mf_bdkgbxcc_.ctl' from

'/u01/app/oracle/oradata/dg2/controlfile/o1_mf_bdkgbx5j_.ctl';

sql clone "alter system set control_files =

''/u01/app/oracle/oradata/dg2/controlfile/o1_mf_bdkgbx5j_.ctl'', ''/u01/app/oracle/flash_recovery_area/dg2/controlfile/o1_mf_bdkgbxcc_.ctl'' comment=

''set by rman'' scope=spfile";

ag真人游戏 shutdown clone immediate;

ag真人游戏 startup clone nomount;

}

ag真人游戏 executing memory script

sql statement: alter system set control_files = ''/u01/app/oracle/oradata/dg2/controlfile/o1_mf_bdkgbx5j_.ctl'', ''/u01/app/oracle/flash_recovery_area/dg2/controlfile/o1_mf_bdkgbxcc_.ctl'' comment= ''set by rman'' scope=spfile

starting backup at 01-feb-15

using channel ora_disk_1

channel ora_disk_1: starting datafile copy

copying standby control file

output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_dg1.f tag=tag20150201t162457 recid=4 stamp=870539108

channel ora_disk_1: datafile copy complete, elapsed time: 00:00:25

finished backup at 01-feb-15

ag真人游戏 starting restore at 01-feb-15

using channel ora_aux_disk_1

ag真人游戏 channel ora_aux_disk_1: copied control file copy

finished restore at 01-feb-15

sql statement: alter system set control_files = ''/u01/app/oracle/oradata/dg2/controlfile/o1_mf_bdkgbx5j_.ctl'', ''/u01/app/oracle/flash_recovery_area/dg2/controlfile/o1_mf_bdkgbxcc_.ctl'' comment= ''set by rman'' scope=spfile

oracle instance shut down

ag真人游戏 connected to auxiliary database (not started)

oracle instance started

ag真人游戏 total system global area 442601472 bytes

ag真人游戏 fixed size 2214176 bytes

variable size 281020128 bytes

ag真人游戏 database buffers 155189248 bytes

ag真人游戏 redo buffers 4177920 bytes

contents of memory script:

{

ag真人游戏 sql clone 'alter database mount standby database';

}

ag真人游戏 executing memory script

sql statement: alter database mount standby database

contents of memory script:

{

set newname for clone tempfile 1 to new;

ag真人游戏 set newname for clone tempfile 2 to new;

switch clone tempfile all;

set newname for clone datafile 1 to new;

set newname for clone datafile 2 to new;

ag真人游戏 set newname for clone datafile 3 to new;

set newname for clone datafile 4 to new;

set newname for clone datafile 5 to new;

backup as copy reuse

datafile 1 auxiliary format new

datafile 2 auxiliary format new

ag真人游戏 datafile 3 auxiliary format new

datafile 4 auxiliary format new

datafile 5 auxiliary format new

;

sql 'alter system archive log current';

}

ag真人游戏 executing memory script

executing command: set newname

executing command: set newname

renamed tempfile 1 to /u01/app/oracle/oradata/dg2/datafile/o1_mf_temp_%u_.tmp in control file

ag真人游戏 renamed tempfile 2 to /u01/app/oracle/oradata/dg2/datafile/o1_mf_n6datasp_%u_.tmp in control file

ag真人游戏 executing command: set newname

executing command: set newname

executing command: set newname

executing command: set newname

ag真人游戏 executing command: set newname

starting backup at 01-feb-15

using channel ora_disk_1

ag真人游戏 channel ora_disk_1: starting datafile copy

ag真人游戏 input datafile file number=00001 name=/u01/app/oracle/oradata/dg1/datafile/o1_mf_system_bdkg85cs_.dbf

ag真人游戏 output file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_system_0dpu6nuh_.dbf tag=tag20150201t162657

channel ora_disk_1: datafile copy complete, elapsed time: 00:01:05

channel ora_disk_1: starting datafile copy

input datafile file number=00002 name=/u01/app/oracle/oradata/dg1/datafile/o1_mf_sysaux_bdkg85ft_.dbf

ag真人游戏 output file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_sysaux_0epu6o0i_.dbf tag=tag20150201t162657

channel ora_disk_1: datafile copy complete, elapsed time: 00:00:56

channel ora_disk_1: starting datafile copy

ag真人游戏 input datafile file number=00005 name=/u01/app/oracle/oradata/dg1/datafile/n6_data01.dbf

output file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_n6datasp_0fpu6o2a_.dbf tag=tag20150201t162657

channel ora_disk_1: datafile copy complete, elapsed time: 00:00:35

ag真人游戏 channel ora_disk_1: starting datafile copy

input datafile file number=00003 name=/u01/app/oracle/oradata/dg1/datafile/o1_mf_undotbs1_bdkg85g2_.dbf

output file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_undotbs1_0gpu6o3d_.dbf tag=tag20150201t162657

ag真人游戏 channel ora_disk_1: datafile copy complete, elapsed time: 00:00:25

ag真人游戏 channel ora_disk_1: starting datafile copy

ag真人游戏 input datafile file number=00004 name=/u01/app/oracle/oradata/dg1/datafile/o1_mf_users_bdkg85gt_.dbf

ag真人游戏 output file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_users_0hpu6o46_.dbf tag=tag20150201t162657

channel ora_disk_1: datafile copy complete, elapsed time: 00:00:15

ag真人游戏 finished backup at 01-feb-15

ag真人游戏 sql statement: alter system archive log current

contents of memory script:

{

ag真人游戏 switch clone datafile all;

}

ag真人游戏 executing memory script

datafile 1 switched to datafile copy

ag真人游戏 input datafile copy recid=4 stamp=870539415 file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_system_0dpu6nuh_.dbf

ag真人游戏 datafile 2 switched to datafile copy

ag真人游戏 input datafile copy recid=5 stamp=870539415 file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_sysaux_0epu6o0i_.dbf

datafile 3 switched to datafile copy

ag真人游戏 input datafile copy recid=6 stamp=870539415 file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_undotbs1_0gpu6o3d_.dbf

datafile 4 switched to datafile copy

ag真人游戏 input datafile copy recid=7 stamp=870539415 file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_users_0hpu6o46_.dbf

datafile 5 switched to datafile copy

input datafile copy recid=8 stamp=870539415 file name=/u01/app/oracle/oradata/dg2/datafile/o1_mf_n6datasp_0fpu6o2a_.dbf

finished duplicate db at 01-feb-15

6、standbyduanqidongredoyingyong

ag真人游戏 sql> alter database recover managed standby database disconnect from session;

ag真人游戏 shujukuyigenggai。

7、yanzheng

7.1 primaryduanqiehuanrizhi

ag真人游戏 sql> alter system switch logfile;

system altered.

sql> select max(sequence#) from v$archived_log;

ag真人游戏 max(sequence#)

ag真人游戏 --------------

15

ag真人游戏 7.2 standbyduanchakanrizhi

ag真人游戏 sql> select max(sequence#) from v$archived_log;

max(sequence#)

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

15

banquansuoyou@ag真人游戏 (cuug,ag真人游戏 ) copyright 2017 all rights reserved jingicpbei11008061hao jinggongwang110108006275hao

CUUG旗下網站:fuelfromthesun.com.cn fuelfromthesun.com oracle.fuelfromthesun.com bbs.fuelfromthesun.com bd.fuelfromthesun.com

電話:010-59426307 010-59426319 郵政編碼:100089

海淀校區:北京市海淀區紫竹院路88號紫竹花園4號樓D座703(CUUG)

澳门agapp ag真人手机版 真人ag手机版 ag旗舰厅下载 ag体育滚球