Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

RMAN configuration DataGuard from Active database with ASM

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I. Environment

Main library: install grid software and create disk groups; install database software and create databases

Standby library: just install grid software and create asm disk group, and install database software at the same time.

Hostnam

Database version

Dbname

Db_unique_name

Ip address

System version

Server1 (Master)

Oracle11204

Jason

Jason

192.168.1.250

Rhel6.6_x86_64

Server2 (standby)

Jason2

192.168.1.252

Second, the main library configuration 1. Make sure that the master database turns on the mandatory LOGGING mode

[oracle@server1 ~] $sqlplus / nolog

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jul 14 20:45:33 2016

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

SQL > conn / as sysdba

Connected.

SQL > ALTER DATABASE FORCE LOGGING

Database altered.

SQL > select force_logging from v$database

FOR

-

YES

two。 Open archiving

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination + DATA

Oldest online log sequence 24

Next log sequence to archive 26

Current log sequence 26

3. Create a standby log group

1). The file size of standby redo log is the same as the online redo log file size of primary database

2). The number of standby redo log log filegroups is calculated according to the following principles

Standby redo log group number formula > = (number of instance log groups + 1) * number of instance

For example, in my environment, there is only one node, and this node has three sets of redo, so

Standby redo log group number formula > = (3x 1) * 1 = = 4

So you need to create 4 groups of Standby redo log

3)。 For security reasons, each log group can contain multiple member files.

Check the number and size of log groups in the master database, and create standy log groups, which cannot be smaller than the online log size.

SQL > select member from v$logfile

MEMBER

+ DATA/jason/onlinelog/group_3.263.919631585

+ DATA/jason/onlinelog/group_2.262.919631583

+ DATA/jason/onlinelog/group_1.261.919631583

3 rows selected.

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

GROUP# BYTES/1024/1024

--

1 50

3 50

2 50

Create a standby log group in the primary database in the same path as the original log group.

SQL > ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 SIZE 50m

Database altered.

SQL > ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 SIZE 50m

Database altered.

SQL > ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 SIZE 50m

Database altered.

SQL > ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 SIZE 50m

Database altered.

SQL > select group#,status,type,member from v$logfile

GROUP# STATUS TYPE MEMBER

3 ONLINE + DATA/jason/onlinelog/group_3.263.919631585

2 ONLINE + DATA/jason/onlinelog/group_2.262.919631583

1 ONLINE + DATA/jason/onlinelog/group_1.261.919631583

4 STANDBY+DATA/jason/onlinelog/group_4.269.919707467

5 STANDBY+DATA/jason/onlinelog/group_5.270.919707475

6 STANDBY + DATA/jason/onlinelog/group_6.271.919707483

7 STANDBY+DATA/jason/onlinelog/group_7.272.919707491

7 rows selected.

SQL >

4. Main library parameter file configuration

Modify the parameters related to the dataguard configuration on the main library. The specific meaning of each parameter can be found in the oracle online documentation.

Alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (JASON,JASON2) 'SCOPE=SPFILE

Alter system set STANDBY_FILE_MANAGEMENT='AUTO' SCOPE=SPFILE

Alter system set LOG_ARCHIVE_DEST_1='LOCATION=+DATAVALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=JASON' scope=spfile

Alter system set LOG_ARCHIVE_DEST_2='SERVICE=JASON2 ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JASON2'scope=spfile

Alter system set LOG_ARCHIVE_DEST_STATE_1='ENABLE' scope=spfile

Alter system set LOG_ARCHIVE_DEST_STATE_2='ENABLE' scope=spfile

Alter system set FAL_SERVER='JASON2' scope=spfile

The DB_UNIQUE_NAME of the main library is not set and is consistent with the database name by default.

SQL > alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (JASON,JASON2) 'SCOPE=SPFILE

System altered.

SQL > alter system set STANDBY_FILE_MANAGEMENT='AUTO' SCOPE=SPFILE

System altered.

SQL > alter system set LOG_ARCHIVE_DEST_1='LOCATION=+DATAVALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=JASON' scope=spfile

System altered.

SQL > alter system set LOG_ARCHIVE_DEST_2='SERVICE=JASON2 ASYNCVALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JASON2'scope=spfile

System altered.

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.

SQL > alter system set FAL_SERVER='JASON2' scope=spfile

System altered.

SQL >

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > startup

ORACLE instance started.

Total System Global Area 409194496 bytes

Fixed Size 2253744 bytes

Variable Size 310381648bytes

Database Buffers 92274688 bytes

Redo Buffers 4284416 bytes

Database mounted.

Database opened.

5. Configure snooping and tnsname

Grid users create listeners as follows:

[grid@server1 ~] $cd / u01/app/11.2.0/grid/network/admin/

[grid@server1 admin] $cat listener.ora

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

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

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

)

)

ADR_BASE_LISTENER = / u01/app/grid

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent

The configuration of tnsname.ora under oracle users is as follows

[oracle@server1 ~] $cd / u01/app/oracle/product/11.2.0/dbhome_1/network/admin/

[oracle@server1 admin] $cat tnsnames.ora

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

# Generated by Oracle configuration tools.

JASON =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = JASON)

)

)

JASON2 =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = JASON2)

)

)

[oracle@server1 admin] $lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0-Production on 12-AUG-201622:43:25

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

Connecting to (ADDRESS= (PROTOCOL=tcp) (HOST=) (PORT=1521))

STATUS of the LISTENER

-

Alias LISTENER

Version TNSLSNRfor Linux: Version 11.2.0.4.0-Production

Start Date 12-AUG-2016 17:56:24

Uptime 0 days 4 hr. 47 min. 0 sec

Trace Level off

Security ON:Local OS Authentication

SNMP OFF

Listener Parameter File / u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File / u01/app/grid/diag/tnslsnr/server1/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=EXTPROC1521)

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=server1) (PORT=1521))

Services Summary...

Service "+ ASM" has 1 instance (s).

Instance "+ ASM", status READY, has 1 handler (s) for this service...

Service "JASON" has 1 instance (s).

Instance "JASON", status READY, has 1 handler (s) for this service...

Service "JASONXDB" has 1 instance (s).

Instance "JASON", status READY, has 1 handler (s) for this service...

The command completed successfully

[oracle@server1 admin] $

6. Generate pfile files and synchronize the corresponding files to the standby library

Generate a pfile file in the main database.

SQL > create pfile='/home/oracle/pfile.ora' from spfile

File created.

Synchronize password authentication files to the standby machine.

[oracle@jason1 dbs] $pwd

/ u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@jason1 dbs] $scp initJASON.ora orapwJASON 192.168.1.252:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/

The authenticity of host '192.168.1.100 (192.168.1.100)' can't beestablished.

RSA key fingerprint is 25:ca:65:90:d3:30:fa:68:ed:11:64:b2:0e:b0:39:a7.

Are you sure you want to continue connecting (yes/no)? Yes

Warning: Permanently added '192.168.1.100' (RSA) to the list of knownhosts.

Oracle@192.168.1.252's password:

InitJASON.ora 10015 1.4KB/s 00:00

OrapwJASON 100% 1536 1.5KB/s 00:00

[oracle@jason1 dbs]

Third, prepare the library configuration 7. Create a corresponding directory

Create a related directory on the standby library

[oracle@server2 oracle] $mkdir-p / u01/app/oracle/admin/JASON2/adump

8. Prepare the library parameter file configuration

Modify the initial parameter file on the standby library, and the parameters required to configure DG are as follows.

JASON.__db_cache_size=104857600

JASON.__java_pool_size=4194304

JASON.__large_pool_size=8388608

JASON.__pga_aggregate_target=180355072

JASON.__sga_target=230686720

JASON.__shared_io_pool_size=0

JASON.__shared_pool_size=104857600

JASON.__streams_pool_size=0

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

* .audit_trail='db'

* .compatible='11.2.0.4.0'

* .control_files='+DATA'

* .db_block_size=8192

* .db_create_file_dest='+DATA'

* .db_domain=''

* .db_name='JASON'

* .DB_UNIQUE_NAME='JASON2'

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

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=JASONXDB)'

* .fal_server='JASON'

* .log_archive_config='DG_CONFIG= (JASON,JASON2)'

* .log_archive_dest_1='LOCATION=+DATA VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=JASON2'

* .log_archive_dest_2='SERVICE=JASON ASYNCVALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JASON'

* .log_archive_dest_state_1='ENABLE'

* .log_archive_dest_state_2='ENABLE'

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

* .memory_target=411041792

* .open_cursors=300

* .processes=150

* .remote_login_passwordfile='EXCLUSIVE'

* .standby_file_management='AUTO'

* .undo_tablespace='UNDOTBS1'

9. Configure snooping

Grid users create listeners, and slave listeners must be configured for static snooping. As follows:

[grid@server2 admin] $cat listener.ora

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

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = JASON2)

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

(SID_NAME = JASON)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

)

(DESCRIPTION =

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

)

)

ADR_BASE_LISTENER = / u01/app/grid

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON

The configuration of tnsname.ora under oracle users is as follows

[oracle@server1 ~] $cd/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/

[oracle@server1 admin] $cat tnsnames.ora

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

# Generated by Oracle configuration tools.

JASON =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = JASON)

)

)

JASON2 =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = JASON2)

)

)

10. Create a standby library

Start the slave database to the nomount state, and then connect to the master library on the slave for duplicate operation.

[oracle@server2 dbs] $rman target sys/system@JASON auxiliarysys/system@JASON2

Recovery Manager: Release 11.2.0.4.0-Production on Fri Aug 12 18V 35V 212016

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

Connected to target database: JASON (DBID=2143845850)

Connected to auxiliary database: JASON (not mounted)

RMAN > duplicate target database for standby nofilenamecheck fromactive database

Starting Duplicate Db at 12-AUG-16

Using target database control file instead of recovery catalog

Allocated channel: ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: SID=23 device type=DISK

Contents of Memory Script:

{

Backup as copy reuse

Targetfile'/ u01 targetfile'/ u01apapapwJASON' auxiliaryformat

'/ u01apapapwJASON'.' / u01apapapwJASON'

}

Executing Memory Script

Starting backup at 12-AUG-16

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=45 device type=DISK

Finished backup at 12-AUG-16

Contents of Memory Script:

{

Backup as copy currentcontrolfile for standby auxiliary format'+ DATA/jason2/controlfile/current.256.919708533'

Sql clone "create spfilefrom memory"

Shutdown clone immediate

Startup clone nomount

Sql clone "alter systemset control_files =

'' + DATA/jason2/controlfile/current.256.919708533'' comment=

'' Set by RMAN''scope=spfile''

Shutdown clone immediate

Startup clone nomount

}

Executing Memory Script

Starting backup at 12-AUG-16

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile copy

Copying standby control file

Output filename=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_JASON.ftag=TAG20160812T183533 RECID=1 STAMP=919708533

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

Finished backup at 12-AUG-16

Sql statement: create spfile from memory

Oracle instance shut down

Connected to auxiliary database (not started)

Oracle instance started

Total System Global Area 409194496 bytes

Fixed Size 2253744 bytes

Variable Size 318770256 bytes

Database Buffers 83886080 bytes

Redo Buffers 4284416 bytes

Sql statement: alter system set control_files =''+ DATA/jason2/controlfile/current.256.919708533'' comment=''Set byRMAN'' scope=spfile

Oracle instance shut down

Connected to auxiliary database (not started)

Oracle instance started

Total System Global Area 409194496 bytes

Fixed Size 2253744 bytes

Variable Size 318770256 bytes

Database Buffers 83886080 bytes

Redo Buffers 4284416 bytes

Contents of Memory Script:

{

Sql clone 'alter database mountstandby database'

}

Executing Memory Script

Sql statement: alter database mount standby database

Contents of Memory Script:

{

Set newname for clonetempfile 1 to new

Switch clone tempfile all

Set newname for clonedatafile 1 to new

Set newname for clonedatafile 2 to new

Set newname for clonedatafile 3 to new

Set newname for clonedatafile 4 to new

Backup as copy reuse

Datafile 1 auxiliary format new

Datafile 2 auxiliary format new

Datafile 3 auxiliary format new

Datafile 4 auxiliary format new

Sql 'alter system archive logcurrent'

}

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 12-AUG-16

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00001name=+DATA/jason/datafile/system.256.919631481

Output file name=+DATA/jason2/datafile/system.257.919708567tag=TAG20160812T183605

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

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00002name=+DATA/jason/datafile/sysaux.257.919631481

Output file name=+DATA/jason2/datafile/sysaux.258.919708603tag=TAG20160812T183605

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

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00003name=+DATA/jason/datafile/undotbs1.258.919631481

Output file name=+DATA/jason2/datafile/undotbs1.259.919708627tag=TAG20160812T183605

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

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00004name=+DATA/jason/datafile/users.259.919631483

Output file name=+DATA/jason2/datafile/users.260.919708631tag=TAG20160812T183605

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

Finished backup at 12-AUG-16

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=919708632 filename=+DATA/jason2/datafile/system.257.919708567

Datafile 2 switched to datafile copy

Input datafile copy RECID=2 STAMP=919708632 filename=+DATA/jason2/datafile/sysaux.258.919708603

Datafile 3 switched to datafile copy

Input datafile copy RECID=3 STAMP=919708633 filename=+DATA/jason2/datafile/undotbs1.259.919708627

Datafile 4 switched to datafile copy

Input datafile copy RECID=4 STAMP=919708633 filename=+DATA/jason2/datafile/users.260.919708631

Finished Duplicate Db at 12-AUG-16

RMAN >

Note: after the slave database is created, the database is in mount state. Temporary tablespaces, online logs and standby logs will be initialized when the data is opened.

11. Turn on ADG

Put the slave database in active dataguard mode. After the slave database is created successfully, it defaults to mount status and needs to be opened manually.

[oracle@server2 dbs] $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 12 18:51:54 2016

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bitProduction

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

And Real Application Testing options

SQL > alter database open

Database altered.

SQL > alter database recover managed standby database using currentlogfile disconnect from session

Database altered.

SQL > select open_mode,database_role,db_unique_name from v$database

OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME

READ ONLY WITH APPLY PHYSICAL STANDBY JASON2

SQL > select protection_mode,protection_level from v$database

PROTECTION_MODE PROTECTION_LEVEL

--

MAXIMUMPERFORMANCE MAXIMUMPERFORMANCE

SQL >

SQL > select status from v$standby_log

STATUS

-

UNASSIGNED

ACTIVE

UNASSIGNED

UNASSIGNED

SQL > select group#,status,type,member from v$logfile

GROUP# STATUS TYPE MEMBER

3 ONLINE + DATA/jason2/onlinelog/group_3.263.919708637

2 ONLINE + DATA/jason2/onlinelog/group_2.262.919708637

1 ONLINE + DATA/jason2/onlinelog/group_1.261.919708633

4 STANDBY+DATA/jason2/onlinelog/group_4.264.919708637

5 STANDBY+DATA/jason2/onlinelog/group_5.265.919708639

6 STANDBY+DATA/jason2/onlinelog/group_6.266.919708639

7 STANDBY + DATA/jason2/onlinelog/group_7.267.919708641

7 rows selected.

SQL >

Main database view database status

[oracle@server1 ~] $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 12 18:34:16 2016

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bitProduction

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

And Real Application Testing options

SQL > select open_mode,database_role,db_unique_name from v$database

OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME

READ WRITE PRIMARY JASON

SQL > select protection_mode,protection_level from v$database

PROTECTION_MODE PROTECTION_LEVEL

--

MAXIMUMPERFORMANCE MAXIMUMPERFORMANCE

SQL >

twelve。 Create a spfile file

After the slave library is created, you need to create a spfile file.

Modify the control_files parameter of the pfile file, specify the control file of the backup library, and view the asm disk group to obtain the control file name and location. As follows:

Control_files='+DATA/jason2/controlfile/current.256.919708533'

Create spfile.

SQL > create SPFILE='+DATA/JASON2/spfileJASON.ora'from pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initJASON.ora'

File created.

Create a pfile file to point to

[oracle@server2dbs] $cat initJASON.ora

SPFILE='+DATA/JASON2/spfileJASON.ora'

[oracle@server2dbs] $

After the spfile file is created successfully, the standby database restart will start the database using the spfile file.

Use ALTERDATABASE RECOVER MANAGED STANDBY DATABASE CANCEL to cancel log recovery, close the database, open it again, and then open the log application.

SQL > showparameter spfile

NAME TYPE VALUE

-

Spfile string + DATA/jason2/spfilejason.ora

SQL >

Fourth, test 13. Master and standby database view log

Master database switch log

SQL > alter system switch logfile

System altered.

SQL > /

System altered.

SQL > /

System altered.

SQL > SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOGORDER BY SEQUENCE#

SEQUENCE# APPLIED

--

5 NO

6 NO

7 NO

8 NO

9 NO

10 NO

10 YES

11 NO

11 YES

12 NO

12 YES

SEQUENCE# APPLIED

--

13 NO

13 YES

14 NO

14 YES

15 NO

15 NO

17 rows selected.

SQL >

Prepare the library to view the log

SQL > SELECTSEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#

SEQUENCE# APPLIED

--

10 YES

11 YES

12 YES

13 YES

14 YES

15IN-MEMORY

6 rows selected.

SQL >

14.switch_over test

Main library switch

SQL > SELECTSWITCHOVER_STATUS FROM V$DATABASE

SWITCHOVER_STATUS

-

TO STANDBY

SQL > ALTERDATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN

Database altered.

SQL > startup

ORACLE instancestarted.

Total System GlobalArea 409194496 bytes

Fixed Size 2253744 bytes

Variable Size 322964560 bytes

DatabaseBuffers 79691776 bytes

Redo Buffers 4284416 bytes

Database mounted.

Database opened.

SQL > selectopen_mode,database_role,db_unique_name from v$database

OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME

READ ONLY PHYSICAL STANDBY JASON

SQL > ALTERDATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROMSESSION

Database altered.

SQL >

Reserve database switch

SQL > SELECTSWITCHOVER_STATUS FROM V$DATABASE

SWITCHOVER_STATUS

-

TO PRIMARY

SQL > ALTERDATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN

Database altered.

SQL > selectopen_mode,database_role,db_unique_name from v$database

OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME

MOUNTED PRIMARY JASON2

SQL > alterdatabase open

Database altered.

SQL > selectopen_mode,database_role,db_unique_name from v$database

OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME

READ WRITE PRIMARY JASON2

SQL >

Fifth, error reporting 15. Error 1

[oracle@server2 ~] $rman target sys/system@JASON auxiliarysys/system@jason2

Recovery Manager:Release 11.2.0.4.0-Production on Wed Aug 10 07:37:33 2016

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

Connected to target database:JASON (DBID=2143699214)

Connected toauxiliary database: JASON (not mounted)

RMAN > duplicatetarget database for standby nofilenamecheck from active database

Starting DuplicateDb at 10-AUG-16

Using targetdatabase control file instead of recovery catalog

Allocated channel:ORA_AUX_DISK_1

ChannelORA_AUX_DISK_1: SID=22 device type=DISK

Contents of MemoryScript:

{

Backup as copy reuse

Targetfile'/ u01 targetfile'/ u01apapapwJASON' auxiliaryformat

'/ u01apapapwJASON'.' / u01apapapwJASON'

}

Executing MemoryScript

Starting backup at10-AUG-16

Allocated channel:ORA_DISK_1

Channel ORA_DISK_1:SID=51 device type=DISK

Finished backup at10-AUG-16

Contents of MemoryScript:

{

Backup as copy current controlfile forstandby auxiliary format'+ DATA/jason2/controlfile/current.256.919708533'

}

Executing MemoryScript

Starting backup at10-AUG-16

Using channelORA_DISK_1

Channel ORA_DISK_1:starting datafile copy

Copying standby controlfile

RMAN-00571:===

RMAN-00569:= ERROR MESSAGE STACK FOLLOWS =

RMAN-00571:===

RMAN-03002: failureof Duplicate Db command at 08/10/2016 07:38:20

RMAN-05501: abortingduplication of target database

RMAN-03015: erroroccurred in stored script Memory Script

RMAN-03009: failureof backup command on ORA_DISK_1 channel at 08/10/2016 07:38:20

ORA-17628: Oracleerror 19505 returned by remote Oracle server

RMAN >

Error analysis: this error mos also provides a corresponding solution, which is caused by the inconsistency between the master and slave database directories without using the parameter db_file_name_convert,LOG_FILE_NAME_CONVERT parameter. In this case, both the primary and secondary libraries use + data disk groups, while OMF is used to manage files. Therefore, this case does not apply. During the creation of the database, the warning log reports the following error:

ORA-15025: could not open disk "/ dev/asm-diskb"

ORA-27041: unable to open file

Linux-x86_64 Error: 13: Permissiondenied

Additional information: 9

Wed Aug 10 07:38:19 2016

SUCCESS: diskgroup DATA wasdismounted

ERROR: diskgroup DATA was notmounted

Errors in file/u01/app/oracle/diag/rdbms/jason2/JASON/trace/JASON_ora_3131.trc:

ORA-19505:failed to identify file "+ DATA/jason2/controlfile/current.256.919708533"

ORA-17502:ksfdcre:3 Failed to create file + DATA/jason2/controlfile/current.256.919708533

ORA-15001: diskgroup "DATA" does not exist or is not mounted

ORA-15040: diskgroup is incomplete

If the slave disk group exists, and the permissions of the primary library disk group and the standby disk group are the same, then it may be caused by other reasons. Finally, it is found that the / u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle file permissions of the main library are inconsistent.

Main library

[root@server1 bin] # ll oracle

-rwsr-s--x 1 oracle asmadmin239626731 Aug 11 20:06 oracle

Prepare the library

[root@server2 bin] # ll oracle

-rwsr-s--x 1 oracle oinstall239626731 Aug 11 20:06 oracle

The only difference between the primary and secondary libraries is that the standby libraries are created through rman replication. The test found that the file permissions will be modified after dbca creates the database. The following is the test process:

When installing grid, database software, when the database is not created

[root@server1 dbhome_1] # cd bin/

[root@server1 bin] # ll oracle

-rwsr-s--x 1 oracle oinstall239626731 Aug 11 20:06 oracle

[root@server1 bin] #

After dbca creates the database

[root@server1 trace] # cd/u01/app/oracle/product/11.2.0/dbhome_1/bin/

[root@server1 bin] # ll oracle

-rwsr-s--x 1 oracle asmadmin239626731 Aug 11 20:06 oracle

[root@server1 bin] #

Therefore, modify the permissions of the file in the standby library, and the problem is solved.

[root@server2 bin] # chown oracle:asmadminoracle

[root@server2 bin] # chmod 6751 oracle

[root@server2 bin] # ll oracle

-rwsr-s--x 1 oracle asmadmin239626731 Aug 11 20:06 oracle

16. Error 2

The standby database startup times has the following error

ERROR: failed to establish dependency between database JASON2 anddiskgroup resource ora.DATA.dg

Check the log information because the database is not registered into the CRS startup times error. At the same time, slave restart only starts the ASM instance and crs, and CRS cannot start the database. So register the repository to CRS.

Execute as oracle user

[oracle@server2 dbs] $srvctl add database-d JASON2-o/u01/app/oracle/product/11.2.0/dbhome_1-p + DATA/JASON2/spfileJASON.ora-I jason-r PHYSICAL_STANDBY-n jason

[oracle@server2 dbs] $srvctl modify database-d JASON2-a 'data'

[oracle@server2 dbs] $srvctl config database-d jason2-a

Database unique name: JASON2

Database name: jason

Oracle home: / u01/app/oracle/product/11.2.0/dbhome_1

Oracle user: oracle

Spfile: + DATA/JASON2/spfileJASON.ora

Domain:

Start options: open

Stop options: immediate

Database role: PHYSICAL_STANDBY

Management policy: AUTOMATIC

Database instance: jason

Disk Groups: DATA

Services:

Database is enabled

[oracle@server2 dbs] $

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report