码迷,mamicode.com
首页 > 数据库 > 详细

Oracle 11.2.0.4.0 DG (ASM) 搭建案例

时间:2018-08-31 18:07:26      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:exe   trail   图片   oaf   async   smo   ber   active   .com   

 技术分享图片

 

 

图示: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 oracle@192.168.1.160:/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 oracle@192.168.1.160:/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) 搭建案例

标签:exe   trail   图片   oaf   async   smo   ber   active   .com   

原文地址:https://www.cnblogs.com/ly315/p/9567099.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!