1. 程式人生 > >Oracle 11.2.0.4.0 DG (ASM) 搭建案例

Oracle 11.2.0.4.0 DG (ASM) 搭建案例

art 一個 日誌文件 enc 最大數 end was redo dataguard

技術分享圖片

圖示:ARC進程

實驗環境

主機:CentOS release 6.5 (Final)

軟件:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

主庫:db_unique_name:orcl1

備庫:db_unique_name:orcl1dg

============================================================================

1.檢查主庫配置{是否已歸檔,是否強制日誌模式}

SQL> show parameter name

NAME TYPE VALUE

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

cell_offloadgroup_name string

db_file_name_convert string

db_name string orcl1

db_unique_name string orcl1

global_names boolean FALSE

instance_name string orcl1

lock_name_space string

log_file_name_convert string

processor_group_name string

service_names string orcl1

SQL> archive log list

Database log mode Archive Mode #歸檔模式

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

#說明設置了參數:db_recovery_file_dest和db_recovery_file_dest_size

Oldest online log sequence 8

Next log sequence to archive 10

Current log sequence 10

SQL> select force_logging from v$database;

FOR

---

NO

#數據庫為非強制日誌模式

2.設置強制日誌模式

SQL> alter database force logging;

Database altered.

3.添加standby 日誌,standby logfile的大小與redo logfile相同,數量可多不可少{standby的日誌大小,必須跟online redo log的大小一樣,組數要比redo log多一組}

SQL> alter database add standby logfile group 4 ‘+DATA‘ size 50m;

Database altered.

SQL> alter database add standby logfile group 5 ‘+DATA‘ size 50m;

Database altered.

SQL> alter database add standby logfile group 6 ‘+DATA‘ size 50m;

Database altered.

SQL> select member from v$logfile;

MEMBER

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

+DATA/orcl1/onlinelog/group_3.258.980937245

+DATA/orcl1/onlinelog/group_3.265.980937245

+DATA/orcl1/onlinelog/group_2.260.980937243

+DATA/orcl1/onlinelog/group_2.259.980937245

+DATA/orcl1/onlinelog/group_1.268.980937243

+DATA/orcl1/onlinelog/group_1.267.980937243

+DATA/orcl1/onlinelog/group_4.275.980942223

+DATA/orcl1/onlinelog/group_5.274.980942265

+DATA/orcl1/onlinelog/group_6.273.980942275

9 rows selected.

SQL> select thread#,group#,members,bytes/1024/1024 from v$log;

THREAD# GROUP# MEMBERS BYTES/1024/1024

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

1 1 2 50

1 2 2 50

1 3 2 50

SQL> select thread#,group#,bytes/1024/1024 from v$standby_log;

THREAD# GROUP# BYTES/1024/1024

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

0 4 50

0 5 50

0 6 50

附加:增加日誌組成員

SQL> alter database add standby logfile member ‘+DATA‘ to group 4;

Database altered.

SQL> alter database add standby logfile member ‘+DATA‘ to group 5;

Database altered.

SQL> alter database add standby logfile member ‘+DATA‘ to group 6;

Database altered.

SQL> select member from v$logfile order by member;

MEMBER

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

+DATA/orcl1/onlinelog/group_1.267.980937243

+DATA/orcl1/onlinelog/group_1.268.980937243

+DATA/orcl1/onlinelog/group_2.259.980937245

+DATA/orcl1/onlinelog/group_2.260.980937243

+DATA/orcl1/onlinelog/group_3.258.980937245

+DATA/orcl1/onlinelog/group_3.265.980937245

+DATA/orcl1/onlinelog/group_4.271.980942747

+DATA/orcl1/onlinelog/group_4.275.980942223

+DATA/orcl1/onlinelog/group_5.272.980942779

+DATA/orcl1/onlinelog/group_5.274.980942265

+DATA/orcl1/onlinelog/group_6.273.980942275

+DATA/orcl1/onlinelog/group_6.279.980942791

12 rows selected.

OK!standby log 日誌組已添加成功。

4.設置數據庫口令模式

SQL> show parameter remote_login_passwordfile

NAME TYPE VALUE

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

remote_login_passwordfile string EXCLUSIVE

如果不是,執行以下命令進行設置,並且重啟數據庫,使其生效:

SQL>alter system set remote_login_passwordfile=EXCLUSIVE scope=spfile;

SQL>shutdown immediate;

SQL>startup;

5.參數設置{最關鍵的一步}

1).dg集群所有節點的唯一名,用於識別彼此

SQL> alter system set log_archive_config=‘dg_config=(orcl1,orcl1dg)‘ scope=spfile;

System altered.

2).設置歸檔日誌路徑,路徑1寫入本地,路徑N寫入其他備機

SQL> alter system set log_archive_dest_1=‘location=+DATA valid_for=(all_logfiles,all_roles) db_unique_name=orcl1‘ scope=spfile;

System altered.

SQL> alter system set log_archive_dest_2=‘service=orcl1dg arch noaffirm async valid_for=(online_logfiles,primary_role) db_unique_name=orcl1dg‘ scope=both;

System altered.

註:第一個ocrls是tnsname.ora的連接名,第二個ocrls是db_unique_name

3).啟用設置的日誌路徑

SQL> alter system set log_archive_dest_state_1=enable scope=spfile;

System altered.

SQL> alter system set log_archive_dest_state_2=enable scope=spfile;

System altered.

4).設置歸檔日誌進程的最大數量(視實際情況調整)

SQL> alter system set log_archive_max_processes=30 scope=spfile;

System altered.

5).設置standby庫從哪個數據庫獲取歸檔日誌(只對standby庫有效,在主庫上設置是為了在故障切換後,主庫可以成為備庫使用)

SQL> alter system set fal_server=orcl1dg scope=spfile;

System altered.

SQL> alter system set fal_client=orcl1 scope=spfile;

System altered.

參數介紹說明:

當Primary Database的某些日誌沒有成功發送到Standby Database, 這時候發生了歸檔裂縫(Archive Gap)。

FAL是Fetch Archive Log的簡寫它是dataguard主備之間GAP的處理機制。

當Primary Database的某些日誌沒有成功發送到Standby Database, 這時候發生了歸檔裂縫(Archive Gap)。

Primary上不會有GAP,所以fal_server和fal_client也是只在standby上生效的參數,當然為了switch over的需要同樣會在primary端進行預設置。

缺失的這些日誌就是裂縫(Gap)。 Data Guard能夠自動檢測,解決歸檔裂縫,不需要DBA的介入。這需要配置FAL_CLIENT, FAL_SERVER 這兩個參數(FAL: Fetch Archive Log)。

從FAL 這個名字可以看出,這個過程是Standby Database主動發起的“取”日誌的過程,Standby Database 就是FAL_CLIENT. 它是從FAL_SERVER中取這些Gap, 10g中,這個FAL_SERVER可以是Primary Database, 也可以是其他的Standby Database。

6).設置文件管理模式,此項設置為自動,不然在主庫創建數據文件後,備庫不會自動創建

SQL> alter system set standby_file_management=auto scope=spfile;

System altered.

7).路徑切換{主備庫文件的存放路徑不同,還需要設置以下兩個參數{路徑轉換/文件結構不同一一對應}}

SQL> alter system set db_file_name_convert=‘+DATA‘,‘+DATA‘ scope=spfile;

System altered.

SQL> alter system set log_file_name_convert=‘+DATA‘,‘+DATA‘ scope=spfile;

System altered.

8).設置數據庫唯一名

SQL> alter system set db_unique_name=orcl1 scope=spfile;

System altered.

備註:因為這裏是ASM,啟動了OMF功能,所以只需要寫磁盤組的名字,如果日誌文件和數據文件不在同一磁盤組,則寫相應的磁盤組名字即可!提示:如果非磁盤組,即為文件管理系統需要寫絕對路徑否則備機無法創建相應的文件!!!

6.創建參數文件spfile.ora,用於備庫啟庫(需要調整部分參數)

SQL> create pfile=‘/home/oracle/orcl1/spfile.ora‘ from spfile;

File created.

[oracle@localhost orcl1]$ cat initorcl1dg.ora

orcl1.__db_cache_size=176160768

orcl1.__java_pool_size=4194304

orcl1.__large_pool_size=88080384

orcl1.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASE set from environment

orcl1.__pga_aggregate_target=402653184

orcl1.__sga_target=385875968

orcl1.__shared_io_pool_size=0

orcl1.__shared_pool_size=109051904

orcl1.__streams_pool_size=0

*.audit_file_dest=‘/u01/app/oracle/admin/orcl1dg/adump‘ #調整參數

*.audit_trail=‘db‘

*.compatible=‘11.2.0.4.0‘

*.control_files=‘+DATA/orcl1dg/controlfile/current.269.980937237‘,‘+DATA/orcl1dg/controlfile/current.270.980937237‘ #調整參數

*.db_block_size=8192

*.db_create_file_dest=‘+DATA‘

*.db_domain=‘‘

*.db_file_name_convert=‘+DATA‘,‘+DATA‘

*.db_name=‘orcl1‘

*.db_recovery_file_dest=‘+DATA‘

*.db_recovery_file_dest_size=4385144832

*.db_unique_name=‘ORCL1DG‘#調整參數

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

*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=orcl1XDB)‘

*.fal_client=‘ORCL1DG‘ #調制參數

*.fal_server=‘ORCL1‘ #調制參數

*.log_archive_config=‘dg_config=(orcl1,orcl1dg)‘

*.log_archive_dest_1=‘location=+DATA valid_for=(all_logfiles,all_roles) db_unique_name=orcl1dg‘ #調制參數

*.og_archive_dest_2=‘service=orcl1dg arch noaffirm async valid_for=(online_logfiles,primary_role) db_unique_name=orcl1dg‘ #調制參數

*.log_archive_dest_state_1=‘ENABLE‘

*.log_archive_dest_state_2=‘ENABLE‘

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

*.log_archive_max_processes=30

*.log_file_name_convert=‘+DATA‘,‘+DATA‘

*.memory_target=786432000

*.open_cursors=300

*.processes=200

*.remote_login_passwordfile=‘EXCLUSIVE‘

*.sessions=225

*.standby_file_management=‘AUTO‘

*.undo_tablespace=‘UNDOTBS1‘

7.傳遞參數文件,密碼文件至備機

-rw-r--r--. 1 oracle asmadmin 1609 Jul 8 14:15 initorcl1dg.ora

-rw-r--r--. 1 oracle asmadmin 1504 Jul 8 14:12 spfile.ora

[oracle@localhost orcl1]$ scp initorcl1dg.ora [email protected]:/home/oracle/orcl1dg

initorcl1dg.ora 100% 1609 1.6KB/s 00:00

[oracle@localhost orcl1]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/

[oracle@localhost dbs]$ scp orapworcl1 [email protected]:/home/oracle/orcl1dg

orapworcl1 100% 1536 1.5KB/s 00:00

8.備機執行:更換名稱,防止$ORACLE_HOME/dbs目錄下

[oracle@localhost orcl1dg]$ ll

total 8

-rw-r--r--. 1 oracle oinstall 1609 Jul 8 14:19 initorcl1dg.ora

-rw-r-----. 1 oracle oinstall 1536 Jul 8 14:20 orapworcl1

[oracle@localhost orcl1dg]$ cp -p initorcl1dg.ora /u01/app/oracle/product/11.2.0/dbhome_1/dbs/

[oracle@localhost orcl1dg]$ mv orapworcl1 orapworcl1dg

[oracle@localhost orcl1dg]$ cp -p orapworcl1dg /u01/app/oracle/product/11.2.0/dbhome_1/dbs/

9.配置TNS文件{主備一致}

主庫>>>

[oracle@localhost admin]$ cat 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.

ORCL1DG =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl1dg)

)

)

ORCL1 =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl1)

)

)

備庫>>

[oracle@localhost admin]$ cat 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.

ORCL1DG =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl1dg)

)

)

ORCL1 =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl1)

)

)

10.靜態配置監聽文件 listener.ora {切換grid用戶$ORACLE_HOME/network/admin}

主庫>>

[grid@localhost admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = orcl1)

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

(SID_NAME = orcl1)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

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

)

)

ADR_BASE_LISTENER = /u01/app/grid

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent

備庫>>

[grid@localhost admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = orcl1dg)

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

(SID_NAME = orcl1dg)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

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

)

)

ADR_BASE_LISTENER = /u01/app/grid

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent

配置完成後,重啟監聽!!!

11.備庫根據參悟文件,新增相應的文件目錄(+DATA下的目錄不用新增)

[oracle@localhost dbs]$ mkdir -p /u01/app/oracle/admin/orcl1dg/adump

12.備庫定義實例,啟動nomount狀態

[oracle@localhost dbs]$ export ORACLE_SID=orcl1dg

[oracle@localhost dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Jul 8 14:49:07 2018

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

Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 784998400 bytes

Fixed Size 2257352 bytes

Variable Size 524291640 bytes

Database Buffers 255852544 bytes

Redo Buffers 2596864 bytes

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

13.rman duplicate 復制數據庫>備庫

[oracle@localhost dbs]$ rman target sys/oracle@orcl1 auxiliary sys/oracle@orcl1dg

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Jul 8 17:11:52 2018

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

connected to target database: ORCL1 (DBID=1365386709)

connected to auxiliary database: ORCL1 (not mounted)

RMAN> duplicate target database for standby from active database;

提示:如果備庫和主庫的數據文件位置一致,則執行:

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

Starting Duplicate Db at 08-JUL-2018 20:41:50

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=24 device type=DISK

contents of Memory Script:

{

backup as copy reuse

targetfile ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl1‘ auxiliary format

‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl1dg‘ ;

}

executing Memory Script

Starting backup at 08-JUL-2018 20:41:51

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=21 device type=DISK

Finished backup at 08-JUL-2018 20:41:52

contents of Memory Script:

{

sql clone "alter system set control_files =

‘‘+DATA/orcl1dg/controlfile/current.256.980961229‘‘, ‘‘+DATA/orcl1dg/controlfile/current.257.980961229‘‘ comment=

‘‘Set by RMAN‘‘ scope=spfile";

backup as copy current controlfile for standby auxiliary format ‘+DATA/orcl1dg/controlfile/current.256.980961229‘;

restore clone controlfile to ‘+DATA/orcl1dg/controlfile/current.257.980961229‘ from

‘+DATA/orcl1dg/controlfile/current.256.980961229‘;

sql clone "alter system set control_files =

‘‘+DATA/orcl1dg/controlfile/current.256.980961229‘‘, ‘‘+DATA/orcl1dg/controlfile/current.257.980961229‘‘ comment=

‘‘Set by RMAN‘‘ scope=spfile";

shutdown clone immediate;

startup clone nomount;

}

executing Memory Script

sql statement: alter system set control_files = ‘‘+DATA/orcl1dg/controlfile/current.256.980961229‘‘, ‘‘+DATA/orcl1dg/controlfile/current.257.980961229‘‘ comment= ‘‘Set by RMAN‘‘ scope=spfile

Starting backup at 08-JUL-2018 20:41:53

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_orcl1.f tag=TAG20180708T204151 RECID=2 STAMP=980973714

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

Finished backup at 08-JUL-2018 20:41:56

Starting restore at 08-JUL-2018 20:41:56

using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 08-JUL-2018 20:41:57

sql statement: alter system set control_files = ‘‘+DATA/orcl1dg/controlfile/current.256.980961229‘‘, ‘‘+DATA/orcl1dg/controlfile/current.257.980961229‘‘ comment= ‘‘Set by RMAN‘‘ scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area 784998400 bytes

Fixed Size 2257352 bytes

Variable Size 528485944 bytes

Database Buffers 251658240 bytes

Redo Buffers 2596864 bytes

contents of Memory Script:

{

sql clone ‘alter database mount standby database‘;

}

executing Memory Script

sql statement: alter database mount standby database

RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

contents of Memory Script:

{

set newname for tempfile 1 to

"+data";

switch clone tempfile all;

set newname for datafile 1 to

"+data";

set newname for datafile 2 to

"+data";

set newname for datafile 3 to

"+data";

set newname for datafile 4 to

"+data";

backup as copy reuse

datafile 1 auxiliary format

"+data" datafile

2 auxiliary format

"+data" datafile

3 auxiliary format

"+data" datafile

4 auxiliary format

"+data" ;

sql ‘alter system archive log current‘;

}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to +data in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 08-JUL-2018 20:42:16

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=+DATA/orcl1/datafile/system.266.980937107

output file name=+DATA/orcl1dg/datafile/system.258.980973737 tag=TAG20180708T204214

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

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002 name=+DATA/orcl1/datafile/sysaux.257.980937107

output file name=+DATA/orcl1dg/datafile/sysaux.259.980973771 tag=TAG20180708T204214

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

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=+DATA/orcl1/datafile/undotbs1.256.980937107

output file name=+DATA/orcl1dg/datafile/undotbs1.260.980973797 tag=TAG20180708T204214

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

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=+DATA/orcl1/datafile/users.264.980937107

output file name=+DATA/orcl1dg/datafile/users.261.980973799 tag=TAG20180708T204214

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

Finished backup at 08-JUL-2018 20:43:20

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=2 STAMP=980973801 file name=+DATA/orcl1dg/datafile/system.258.980973737

datafile 2 switched to datafile copy

input datafile copy RECID=3 STAMP=980973801 file name=+DATA/orcl1dg/datafile/sysaux.259.980973771

datafile 3 switched to datafile copy

input datafile copy RECID=4 STAMP=980973802 file name=+DATA/orcl1dg/datafile/undotbs1.260.980973797

datafile 4 switched to datafile copy

input datafile copy RECID=5 STAMP=980973802 file name=+DATA/orcl1dg/datafile/users.261.980973799

Finished Duplicate Db at 08-JUL-2018 20:43:38

14.當前模式下(mount)啟動歸檔,重啟數據庫

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Jul 8 20:46:28 2018

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> select open_mode from v$database;

OPEN_MODE

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

MOUNTED

SQL> alter database archivelog;

Database altered.

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

[oracle@localhost trace]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Jul 8 21:37:37 2018

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

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 784998400 bytes

Fixed Size 2257352 bytes

Variable Size 528485944 bytes

Database Buffers 251658240 bytes

Redo Buffers 2596864 bytes

SQL> alter database mount standby database;

Database altered.

SQL> alter database open read only;

Database altered.

SQL> alter database open read only;

alter database open read only

*

ERROR at line 1:

ORA-10458: standby database requires recovery

ORA-01152: file 1 was not restored from a sufficiently old backup

ORA-01110: data file 1: ‘+DATA/oradejiadg/datafile/system.289.984396905‘

如果出現上訴錯誤是因為,主庫參數scope=spfile,需要重啟生效,否則無法通信導致備份啟動失敗

15.開啟日誌應用

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

Database altered.

16.驗證日誌切換,是否同步!

主庫:

SQL> alter system switch logfile;

System altered.

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination +DATA

Oldest online log sequence 15

Next log sequence to archive 17

Current log sequence 17

備庫:

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination +DATA

Oldest online log sequence 16

Next log sequence to archive 0

Current log sequence 17

17.增加參數文件

1.拷貝spfile文件至磁盤組

2.設置initorcl1dg.ora,制定參數文件位置

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

備庫

SQL> select database_role,open_mode,switchover_status,protection_mode,protection_level from v$database;

SQL> /

DATABASE_ROLE OPEN_MODE SWITCHOVER_STATUS PROTECTION_MODE PROTECTION_LEVEL

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

PHYSICAL STANDBY READ ONLY WITH APPLY NOT ALLOWED MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE

主庫

SQL> select database_role,open_mode,switchover_status,protection_mode,protection_level from v$database;

DATABASE_ROLE OPEN_MODE SWITCHOVER_STATUS PROTECTION_MODE PROTECTION_LEVEL

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

PRIMARY READ WRITE TO STANDBY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE

文章可以轉載,必須以鏈接形式標明出處。

Oracle 11.2.0.4.0 DG (ASM) 搭建案例