中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Setting up 11g Active Dataguard(ADG)

發布時間:2020-07-23 17:29:46 來源:網絡 閱讀:623 作者:striong 欄目:關系型數據庫

 

環境:

主:

IP: 172.18.130.55    DB:11.2.0.1 SID: wsqtest  

ORACLE_BASE: /apps/oracle 

ORACLE_HOME:/apps/oracle/product/11.2.0.1

備:

IP:  172.18.130.52  DB:11.2.0.1  SID:wsqteststd

ORACLE_BASE:/apps/oracle

ORACLE_HOME:/apps/oracle/product/11.2.0.1

 

55上安裝好oracle軟件、建好數據庫,52上裝好oracle軟件,不裝庫

 

1、主庫55上,開啟歸檔,force logging

SQL> conn /as sysdba

Connected.

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     20

Next log sequence to archive   22

Current log sequence           22

SQL> alter database force logging;

 

Database altered.

 

2、配置監聽:

主:

--靜態注冊

listener.ora:

SID_LIST_LISTENER =

  (SID_LIST =

   (SID_DESC =

    (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /apps/oracle/product/11.2.0.1)

         (PROGRAM = extproc)

   )

  (SID_DESC =

   (GLOBAL_DBNAME =wsqtest)

     (ORACLE_HOME = /apps/oracle/product/11.2.0.1)

     (SID_NAME =wsqtest)

  )

)

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = wsqtest)(PORT = 1521))

    )

  )

 

--tnsnames.ora:

WSQTEST =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.130.55)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = wsqtest)

    )

  )

 

WSQTESTSTD =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.130.52)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = wsqteststd)

    )

  )

 

 

3、配置參數文件:

主庫添加以下參數:

*.log_archive_config='dg_config=(wsqtest,wsqteststd)'

*.log_archive_dest_1='location=/apps/oracle/flash_recovery_area/wsqtest/archivelogs valid_for=(all_logfiles,all_roles) db_unique_name=wsqtest'

*.log_archive_dest_2='service=wsqteststd reopen=120 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=wsqteststd'

*.log_archive_dest_state_1=enable

*.log_archive_dest_state_2=enable

*.standby_file_management='auto'

*.fal_server='wsqteststd'

*.fal_client='wsqtest'

*.db_unique_name='wsqtest'

 

4、備庫端創建密碼文件

$cd $ORACLE_HOME/dbswho

$orapwd  file=orapwwsqteststd password=oracle entries=5

 

5、創建相應的目錄

mkdir /apps/oracle/oradata/wsqteststd

mkdir /apps/oracle/oradata/wsqteststd/onlinelogs  /apps/oracle/oradata/wsqteststd/datafiles /apps/oracle/oradata/wsqteststd/controlfiles

mkdir /apps/oracle/admin/wsqteststd

mkdir /apps/oracle/admin/wsqteststd/adump  /apps/oracle/admin/wsqteststd/bdump /apps/oracle/admin/wsqteststd/cdump /apps/oracle/admin/wsqteststd/udump

mkdir /apps/oracle/flash_recovery_area/wsqteststd

 

6、修改備庫參數文件

從主庫參數文件復制過來,修改響應的路徑,添加響應的參數:

*.log_archive_config='dg_config=(wsqteststd,wsqtest)'

*.log_archive_dest_1='location=/apps/oracle/flash_recovery_area/wsqteststd/archivelogs valid_for=(all_logfiles,all_roles) db_unique_name=wsqteststd'

*.log_archive_dest_2='service=wsqtest reopen=120 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=wsqtest'

*.log_archive_dest_state_1=enable

*.log_archive_dest_state_2=enable

*.standby_file_management='auto'

*.fal_server='wsqtest'

*.fal_client='wsqteststd'

*.log_file_name_convert='/apps/oracle/oradata/wsqtest/onlinelogs/','/apps/oracle/oradata/wsqteststd/onlinelogs/'

*.db_file_name_convert='/apps/oracle/oradata/wsqtest/datafiles/','/apps/oracle/oradata/wsqteststd/datafiles/'

 

 

7、備庫啟動到nomount

[oracle@localhost dbs]$ env | grep ORACLE_SID

ORACLE_SID=wsqteststd

[oracle@localhost dbs]$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 4 14:43:21 2013

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup nomount

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

ORACLE instance started.

 

Total System Global Area  450953216 bytes

Fixed Size                  2214256 bytes

Variable Size             142608016 bytes

Database Buffers          301989888 bytes

Redo Buffers                4141056 bytes

SQL>

 

8、備庫開始復制數據庫:

[oracle@localhost ~]$ rman target sys/oracle@wsqtest auxiliary sys/oracle@wsqteststd

 

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Dec 4 14:54:06 2013

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: WSQTEST (DBID=1260868535)

connected to auxiliary database: WSQTEST (not mounted)

 

RMAN> duplicate target database for standby from active database;

 

Starting Duplicate Db at 2013-12-04 14:55:18

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=20 device type=DISK

 

contents of Memory Script:

{

   backup as copy reuse

   targetfile  '/apps/oracle/product/11.2.0.1/dbs/orapwwsqtest' auxiliary format

 '/apps/oracle/product/11.2.0.1/dbs/orapwwsqteststd'   ;

}

executing Memory Script

 

Starting backup at 2013-12-04 14:55:20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=15 device type=DISK

Finished backup at 2013-12-04 14:55:21

 

contents of Memory Script:

{

   backup as copy current controlfile for standby auxiliary format  '/apps/oracle/oradata/wsqteststd/controlfiles/control01.ctl';

   restore clone controlfile to  '/apps/oracle/flash_recovery_area/wsqteststd/controlfiles/control02.ctl' from

 '/apps/oracle/oradata/wsqteststd/controlfiles/control01.ctl';

}

executing Memory Script

 

Starting backup at 2013-12-04 14:55:21

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

copying standby control file

output file name=/apps/oracle/product/11.2.0.1/dbs/snapcf_wsqtest.f tag=TAG20131204T145308 RECID=1 STAMP=833295189

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 2013-12-04 14:55:22

 

Starting restore at 2013-12-04 14:55:22

using channel ORA_AUX_DISK_1

 

channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 2013-12-04 14:55:23

 

contents of Memory Script:

{

   sql clone 'alter database mount standby database';

}

executing Memory Script

 

sql statement: alter database mount standby database

 

contents of Memory Script:

{

   set newname for tempfile  1 to

 "/apps/oracle/oradata/wsqteststd/datafiles/temp01.dbf";

   switch clone tempfile all;

   set newname for datafile  1 to

 "/apps/oracle/oradata/wsqteststd/datafiles/system01.dbf";

   set newname for datafile  2 to

 "/apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf";

   set newname for datafile  3 to

 "/apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf";

   set newname for datafile  4 to

 "/apps/oracle/oradata/wsqteststd/datafiles/data01.dbf";

   backup as copy reuse

   datafile  1 auxiliary format

 "/apps/oracle/oradata/wsqteststd/datafiles/system01.dbf"   datafile

 2 auxiliary format

 "/apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf"   datafile

 3 auxiliary format

 "/apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf"   datafile

 4 auxiliary format

 "/apps/oracle/oradata/wsqteststd/datafiles/data01.dbf"   ;

   sql 'alter system archive log current';

}

executing Memory Script

 

executing command: SET NEWNAME

 

renamed tempfile 1 to /apps/oracle/oradata/wsqteststd/datafiles/temp01.dbf in control file

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting backup at 2013-12-04 14:55:29

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=/apps/oracle/oradata/wsqtest/datafiles/undotbs01.dbf

output file name=/apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf tag=TAG20131204T145316

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/apps/oracle/oradata/wsqtest/datafiles/system01.dbf

output file name=/apps/oracle/oradata/wsqteststd/datafiles/system01.dbf tag=TAG20131204T145316

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002 name=/apps/oracle/oradata/wsqtest/datafiles/sysaux01.dbf

output file name=/apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf tag=TAG20131204T145316

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=/apps/oracle/oradata/wsqtest/datafiles/data01.dbf

output file name=/apps/oracle/oradata/wsqteststd/datafiles/data01.dbf tag=TAG20131204T145316

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Finished backup at 2013-12-04 14:55:57

 

sql statement: alter system archive log current

 

contents of Memory Script:

{

   switch clone datafile all;

}

executing Memory Script

 

datafile 1 switched to datafile copy

input datafile copy RECID=1 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=2 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=3 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=4 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/data01.dbf

Finished Duplicate Db at 2013-12-04 14:55:59

 

RMAN>

 

 

9、備庫添加standbylog:比主庫redolog組數多一組

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo01.log') size 50m;

 

Database altered.

 

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo02.log') size 50m;

 

Database altered.

 

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo03.log') size 50m;

 

Database altered.

 

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo04.log') size 50m;

 

Database altered.

 

10、主庫添加standbylog

 

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo01.log') size 50m;

 

Database altered.

 

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo02.log') size 50m;

 

Database altered.

 

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo03.log') size 50m;

 

Database altered.

 

SQL> alter database add standby logfile ('/apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo04.log') size 50m;

 

Database altered.

 

 

11、開啟redo real-time apply

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

 

Database altered.

 

SQL> alter database recover managed standby database cancel;

 

Database altered.

 

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01531: a database already open by the instance

 

 

SQL> select open_mode from v$database;

 

OPEN_MODE

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

READ ONLY

 

SQL> alter database recover managed standby database using current logfile disconnect;

 

Database altered.

 

SQL> select open_mode from v$database;

 

OPEN_MODE

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

READ ONLY WITH APPLY

 

 

 

 

 

 

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

宜黄县| 万年县| 彰武县| 温州市| 锡林浩特市| 永宁县| 丰宁| 临漳县| 浦东新区| 拉孜县| 宣武区| 栖霞市| 堆龙德庆县| 奈曼旗| 新余市| 沂源县| 偃师市| 浠水县| 苍梧县| 永福县| 景德镇市| 巧家县| 宁强县| 仪陇县| 台南县| 横山县| 郯城县| 怀集县| 呼伦贝尔市| 绥芬河市| 天镇县| 黄龙县| 闸北区| 四川省| 开鲁县| 兰溪市| 屏东县| 蕲春县| 县级市| 新沂市| 烟台市|