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

ag真人游戏 2.1 primaryjiantingpeizhi

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

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

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

ag真人游戏 sid_list_listener =

(sid_list =

ag真人游戏 (sid_desc =

(global_dbname = dg1)

ag真人游戏 (oracle_home = /u01/app/oracle/product/11.2.0/dbhome_1)

ag真人游戏 (sid_name = dg1)

)

)

listener =

(description =

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

)

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

ag真人游戏 2.2 standbyjiantingpeizhi

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

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

# generated by oracle configuration tools.

sid_list_listener =

ag真人游戏 (sid_list =

ag真人游戏 (sid_desc =

(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

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

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

dg_129 =

(description =

(address_list =

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

)

ag真人游戏 (connect_data =

(service_name = dg1)

)

)

dg_130 =

ag真人游戏 (description =

ag真人游戏 (address_list =

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

)

(connect_data =

(service_name = dg2)

)

)

2.4 standbywangluofuwumingpeizhi

ag真人游戏 [oracle@dg2 ~]$ 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.

ag真人游戏 dg_129 =

(description =

ag真人游戏 (address_list =

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

)

ag真人游戏 (connect_data =

(service_name = dg1)

)

)

dg_130 =

(description =

(address_list =

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

)

(connect_data =

(service_name = dg2)

)

)

2.5 qidongjiantingbingjinxingceshi

zhuyiyaojinxingfanghuoqiangfangxinghuozheguanbifanghuoqiang。

[oracle@dg1 ~]$ tnsping dg_130

ag真人游戏 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.

used parameter files:

ag真人游戏 used tnsnames adapter to resolve the alias

ag真人游戏 attempting to contact (description = (address_list = (address = (protocol = tcp)(host = 192.168.233.130)(port = 1521))) (connect_data = (service_name = dg2)))

ok (0 msec)

ag真人游戏 [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.

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)))

ok (10 msec)

3、canshupeizhi

ag真人游戏 3.1 primarycanshupeizhi

genjuspfile.orashengchengpfile.ora。

[oracle@dg1 ~]$ cat pfile.ora

ag真人游戏 dg1.__db_cache_size=58720256

ag真人游戏 dg1.__java_pool_size=4194304

ag真人游戏 dg1.__large_pool_size=4194304

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

dg1.__pga_aggregate_target=197132288

ag真人游戏 dg1.__sga_target=247463936

ag真人游戏 dg1.__shared_io_pool_size=0

ag真人游戏 dg1.__shared_pool_size=167772160

ag真人游戏 dg1.__streams_pool_size=4194304

ag真人游戏 *.audit_file_dest='/u01/app/oracle/admin/dg1/adump'

*.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'

ag真人游戏 *.db_block_size=8192

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

*.db_domain=''

*.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)'

*.log_archive_config='dg_config=(dg1,dg2)'

*.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'

*.memory_target=444596224

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='exclusive'

*.undo_tablespace='undotbs1'

3.2 standbycanshupeizhi

ag真人游戏 jiangprimarydepfile.orakaobeidaostandby,xiugaihoushengchengspfiledg2.ora。

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

ag真人游戏 dg1.__db_cache_size=100663296

ag真人游戏 dg2.__db_cache_size=155189248

dg1.__java_pool_size=4194304

dg2.__java_pool_size=4194304

dg1.__large_pool_size=4194304

dg2.__large_pool_size=4194304

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

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

dg1.__pga_aggregate_target=155189248

ag真人游戏 dg2.__pga_aggregate_target=180355072

dg1.__sga_target=289406976

ag真人游戏 dg2.__sga_target=264241152

ag真人游戏 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'

*.audit_trail='db'

ag真人游戏 *.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

ag真人游戏 *.db_block_size=8192

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

*.db_domain=''

*.db_name='dg1'

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

*.db_recovery_file_dest_size=4070572032

*.db_unique_name='dg2'

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

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

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

*.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'

ag真人游戏 *.memory_target=444596224

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='exclusive'

*.standby_file_management='auto'

ag真人游戏 *.undo_tablespace='undotbs1'

ag真人游戏 4、xitongshezhi

4.1 standbymuluchuangjian

ag真人游戏 genjucanshuwenjianchuangjianxiangguanmulu。

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

ag真人游戏 mkdir -p /u01/app/oracle/oradata/dg2/{controlfile,datafile,onlinelog,archivelog}

mkdir /u01/app/oracle/flash_recovery_area

4.2 standbymimawenjian

jiangprimaryduandemimawenjianfuzhidaostandbybingzhongmingming。

ag真人游戏 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

recovery manager: release 11.2.0.1.0 - production on sun feb 1 16:22:59 2015

ag真人游戏 copyright (c) 1982, 2009, oracle and/or its affiliates. all rights reserved.

connected to target database: dg1 (dbid=1851568413)

ag真人游戏 connected to auxiliary database: dg1 (not mounted)

ag真人游戏 rman> duplicate target database for standby nofilenamecheck from active database;

starting duplicate db at 01-feb-15

ag真人游戏 using target database control file instead of recovery catalog

ag真人游戏 allocated channel: ora_aux_disk_1

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

contents of memory script:

{

backup as copy reuse

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

ag真人游戏 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg2' ;

}

executing memory script

starting backup at 01-feb-15

allocated channel: ora_disk_1

channel ora_disk_1: sid=44 device type=disk

finished backup at 01-feb-15

contents of memory script:

{

ag真人游戏 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=

ag真人游戏 ''set by rman'' scope=spfile";

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

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 =

ag真人游戏 ''/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";

shutdown clone immediate;

startup clone nomount;

}

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

ag真人游戏 using channel ora_disk_1

channel ora_disk_1: starting datafile copy

ag真人游戏 copying standby control file

ag真人游戏 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

starting restore at 01-feb-15

using channel ora_aux_disk_1

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

ag真人游戏 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

total system global area 442601472 bytes

fixed size 2214176 bytes

variable size 281020128 bytes

database buffers 155189248 bytes

redo buffers 4177920 bytes

contents of memory script:

{

sql clone 'alter database mount standby database';

}

ag真人游戏 executing memory script

sql statement: alter database mount standby database

contents of memory script:

{

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

set newname for clone tempfile 2 to new;

ag真人游戏 switch clone tempfile all;

set newname for clone datafile 1 to new;

ag真人游戏 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

ag真人游戏 datafile 1 auxiliary format new

ag真人游戏 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

ag真人游戏 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

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

executing command: set newname

ag真人游戏 executing command: set newname

ag真人游戏 executing command: set newname

executing command: set newname

ag真人游戏 executing command: set newname

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

ag真人游戏 using channel ora_disk_1

ag真人游戏 channel ora_disk_1: starting datafile copy

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

ag真人游戏 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

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

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

ag真人游戏 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

ag真人游戏 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

input datafile file number=00004 name=/u01/app/oracle/oradata/dg1/datafile/o1_mf_users_bdkg85gt_.dbf

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

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

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

sql statement: alter system archive log current

contents of memory script:

{

switch clone datafile all;

}

ag真人游戏 executing memory script

datafile 1 switched to datafile copy

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

datafile 2 switched to datafile copy

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

ag真人游戏 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;

max(sequence#)

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

15

ag真人游戏 7.2 standbyduanchakanrizhi

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

max(sequence#)

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

15

banquansuoyou@agzhenrenyouxi (cuug,agzhenrenyouxi ) 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体育滚球