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

Using RMAN backup set to build Oracle Dataguard Step by Step (2)

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

5. Network configuration and password file configuration

Primary and Standby have the same requirements for managing passwords for sys users, so direct copy naming is supported for password files.

[oracle@SimpleLinux oracle] $cd $ORACLE_HOME/dbs

[oracle@SimpleLinux dbs] $ls-l

Total 9552

-rw-rw----. 1 oracle oinstall 1544 May 24 21:12 hc_ora11g.dat

-rw-rw----. 1 oracle oinstall 1544 May 24 21:20 hc_ora11gsy.dat

-rw-r--r--. 1 oracle oinstall 2851 May 15 2009 init.ora

-rw-r--r--. 1 oracle oinstall 774 May 24 21:17 initora11g.ora

-rw-r--r--. 1 oracle oinstall 774 May 24 21:18 initora11gsy.ora

-rw-r-. 1 oracle oinstall 24 Apr 1 12:39 lkORA11G

-rw-r-. 1 oracle oinstall 1536 Apr 1 12:45 orapwora11g

-rw-r-. 1 oracle oinstall 9748480 May 24 20:47 snapcf_ora11g.f

-rw-r-. 1 oracle oinstall 3584 May 24 21:13 spfileora11g.ora

[oracle@SimpleLinux dbs] $cp orapwora11g orapwora11gsy

In the Linux environment, the automatic search rule for password files is the orapw file in the $ORACLE_HOME/dbs directory.

Oracle NET involves two files, tnsnames.ora file and listener.ora file. Tnsnames.ora is responsible for providing links to local names, while listener.ora provides listener static registration parameters.

[oracle@SimpleLinux 2014 / 05 / 24] $cd / u01/app/oracle/network/admin/

[oracle@SimpleLinux admin] $ls-l

Total 20

-rw-r--r--. 1 oracle oinstall 345 May 24 22:50 listener.ora

-rw-r--r--. 1 oracle oinstall 345 Apr 1 13:10 listener.ora.bk

Drwxr-xr-x. 2 oracle oinstall 4096 Apr 1 12:27 samples

-rw-r--r--. 1 oracle oinstall 381 Dec 17 2012 shrept.lst

-rw-r--r--. 1 oracle oinstall 502 May 24 22:49 tnsnames.ora

The ora11g and ora11gsy information are configured on the two files, respectively.

[oracle@SimpleLinux admin] $cat tnsnames.ora

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

# Generated by Oracle configuration tools.

ORA11GSY =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = ora11gsy)

)

)

ORA11G =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = ora11g)

)

)

[oracle@SimpleLinux admin] $cat listener.ora

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

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

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

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = ora11g)

(ORACLE_HOME = / u01/app/oracle)

(PROGRAM = extproc)

(GLOBAL_DBNAME = ora11g)

)

(SID_DESC =

(SID_NAME = ora11gsy)

(ORACLE_HOME = / u01/app/oracle)

(GLOBAL_DBNAME = ora11gsy)

)

)

ADR_BASE_LISTENER = / u01/app

The listener restarts.

[oracle@SimpleLinux admin] $lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.4.0-Production on 24-MAY-2014 22:52:14

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

Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=SimpleLinux) (PORT=1521)

The command completed successfully

[oracle@SimpleLinux admin] $lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0-Production on 24-MAY-2014 22:52:23

(for reasons of space, there are omissions. )

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

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

Services Summary...

Service "ora11g" has 1 instance (s).

Instance "ora11g", status UNKNOWN, has 1 handler (s) for this service...

Service "ora11gsy" has 1 instance (s).

Instance "ora11gsy", status UNKNOWN, has 1 handler (s) for this service...

The command completed successfully

Now the recovery action can be carried out.

6 、 restore backup set

Start rman to restore the action.

-- Connect to ora11gsy

[oracle@SimpleLinux ~] $export ORACLE_SID=ora11gsy

[oracle@SimpleLinux ~] $rman target /

Recovery Manager: Release 11.2.0.4.0-Production on Sat May 24 21:32:23 2014

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

Connected to target database (not started)

Boot to nomount state and set dbid value. This value is the same as that of the Primary database.

RMAN > startup nomount

Oracle instance started

Total System Global Area 372449280 bytes

Fixed Size 1364732 bytes

Variable Size 301993220 bytes

Database Buffers 62914560 bytes

Redo Buffers 6176768 bytes

RMAN > set dbid=4239941846

Executing command: SET DBID

Restore control files directly from the backup collection.

RMAN > restore standby controlfile from'/ standbybackup/o1_mf_ncnnf_TAG20140524T204716_9r156r7j_.bkp'

Starting restore at 24-MAY-14

Using target database control file instead of recovery catalog

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=1 device type=DISK

Channel ORA_DISK_1: restoring control file

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:07

Output file name=/u01/app/oradata/ORA11GSY/controlfile/o1_mf_9r18tmv6_.ctl

Output file name=/u01/app/fast_recovery_area/ORA11GSY/controlfile/o1_mf_9r18tpkf_.ctl

Finished restore at 24-MAY-14

Note two phenomena: first, we read backups directly from the file system in the form of standby controlfile. The second is that we did not configure the control_files parameter in initora11gsy.ora. Oracle directly created two images of the control file according to the OMF rule. Third, this data is not written into spfile/pfile, which brings some trouble to the system in the future.

Boot to the mount state.

RMAN > sql 'alter database mount standby database'

Sql statement: alter database mount standby database

Released channel: ORA_DISK_1

Finally, there is a more troublesome step, the backup collection is in the file path of Primary, there is no way to carry out the remap action. Therefore, Oracle needs to manually perform a series of set newname actions on the file.

RMAN > run {

2 > ALLOCATE CHANNEL C1 DEVICE TYPE DISK

3 > set newname for datafile 1 to'/ u01 Placement ORA11GSYUniqdatafileAccording to ORA11GSYUniqdatafileAccording to 9mnjrztypermission. Dbf'

4 > set newname for datafile 2 to'/ u01 Placement ORA11GSYUniqdatafileGSysaux9mnjs04hm2. Dbf'

5 > set newname for datafile 3 to'/ u01 Placement ORA11GSYUniqdatafileAccording to ORA11GSYUniDover datafile, O1mfqundotbs1and9mnjs068characters .dbf'

6 > set newname for datafile 4 to'/ u01 Placement ORA11GSYUniqdatafileCompare ORA11GSY _ datafileCharpy 9mnjs074account.dbf'

7 >

8 >}

Allocated channel: c1

Channel c1: SID=20 device type=DISK

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Released channel: c1

If the Primary and Standby directory structures are exactly the same, this step is not required. After that, if it is a version prior to 10g, the copied backup collection must be placed in the same directory structure as the original. If it is after 10g, you can use catalog backuppiece to manually load the backup collection.

RMAN > catalog backuppiece'/ standbybackup/o1_mf_nnndf_TAG20140524T204320_9r14z9hn_.bkp'

Cataloged backup piece

Backup piece handle=/standbybackup/o1_mf_nnndf_TAG20140524T204320_9r14z9hn_.bkp RECID=3 STAMP=848442509

Restore database files directly.

RMAN > run {

2 > restore database

3 > switch datafile all

4 >}

Starting restore at 24-MAY-14

Using channel ORA_DISK_1

(for reasons of space, there are omissions. )

Channel ORA_DISK_1: restoring datafile 00002 to / u01/app/oradata/ORA11GSY/datafile/o1_mf_sysaux_9mnjs04h_.dbf

Channel ORA_DISK_1: restoring datafile 00003 to / u01/app/oradata/ORA11GSY/datafile/o1_mf_undotbs1_9mnjs068_.dbf

Channel ORA_DISK_1: reading from backup piece / standbybackup/o1_mf_nnndf_TAG20140524T204320_9r14z9hn_.bkp

Channel ORA_DISK_1: piece handle=/standbybackup/o1_mf_nnndf_TAG20140524T204320_9r14z9hn_.bkp tag=TAG20140524T204320

Channel ORA_DISK_1: restored backup piece 1

Channel ORA_DISK_1: restore complete, elapsed time: 00:08:25

Finished restore at 24-MAY-14

Recover database to complete the recovery process.

RMAN > restore database

Starting restore at 24-MAY-14

Using channel ORA_DISK_1

Skipping datafile 1; already restored to file/ u01/app/oradata/ORA11GSY/datafile/o1_mf_system_9r1cgl8x_.dbf

Skipping datafile 2; already restored to file/ u01/app/oradata/ORA11GSY/datafile/o1_mf_sysaux_9r1cgld1_.dbf

Skipping datafile 3; already restored to file/ u01/app/oradata/ORA11GSY/datafile/o1_mf_undotbs1_9r1cglfr_.dbf

Datafile 4 is already restored to file/ u01/app/oradata/ORA11GSY/datafile/o1_mf_users_9r1c6gb9_.dbf

Restore not done; all files read only, offline, or already restored

Finished restore at 24-MAY-14

7. Standby work configuration

After the Standby restore is complete, create a special standby redo log for use during the recovery process.

SQL > alter database add standby logfile size 50m

Database altered

SQL > alter database add standby logfile size 50m

Database altered

SQL > select group#, sequence#, dbid from v$standby_log

GROUP# SEQUENCE# DBID

4 0 UNASSIGNED

5 0 UNASSIGNED

Start the standby recover action.

SQL > alter database recover managed standby database using current logfile disconnect from session

Database altered.

SQL > select name, OPEN_MODE, database_role from v$database

NAME OPEN_MODE DATABASE_ROLE

ORA11G MOUNTED PHYSICAL STANDBY

The whole process of Primary is always in the mount state, and there is no redo log generation. Start Primary to mount status.

[oracle@SimpleLinux ~] $sqlplus / nolog

SQL*Plus: Release 11.2.0.4.0 Production on Sat May 24 23:06:49 2014

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

SQL > conn / as sysdba

Connected.

SQL > alter database open

Database altered.

Check whether the transmission channel on the Primary side is normal. Check the v$archived_dest_status.

SQL > col dest_name for A20

SQL > select dest_id, dest_name, status, type, database_mode, recovery_mode, DESTINATION from v$archive_dest_status where dest_id select recid,name, sequence#, STANDBY_DEST, ARCHIVED, APPLIED from v$archived_log

RECID NAME SEQUENCE# STANDBY_DEST ARCHIVED APPLIED

-

1/ u01/app/fast_recovery_area/ORA11G/archivelog/2014_05_24/o1_mf_1_6_9r1fdo70_.arc 6 NO YES NO

2 / u01/app/fast_recovery_area/ORA11G/archivelog/2014_05_24/o1_mf_1_7_9r1fdvt1_.arc 7 NO YES NO

3 ora11gsy 6 YES YES YES

4 ora11gsy 7 YES YES YES

5 / u01/app/fast_recovery_area/ORA11G/archivelog/2014_05_24/o1_mf_1_8_9r1fmzv9_.arc 8 NO YES NO

6 ora11gsy 8 YES YES YES

6 rows selected

The data of sequence#=6-8 has been successfully transferred to Ora11gsy, and the apply prompt flag has been set to YES. On the standby side, we can also check the application.

SQL > conn sys/oracle@ora11gsy as sysdba

Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.4.0

Connected as SYS

SQL > select recid,name, sequence#, STANDBY_DEST, ARCHIVED, APPLIED from v$archived_log

RECID NAME SEQUENCE# STANDBY_DEST ARCHIVED APPLIED

-

1/ u01/app/fast_recovery_area/ORA11GSY/archivelog/2014_05_24/o1_mf_1_6_9r1ff3t6_.a 6 NO YES YES

2 / u01/app/fast_recovery_area/ORA11GSY/archivelog/2014_05_24/o1_mf_1_7_9r1ff3dn_.a 7 NO YES YES

3 / u01/app/fast_recovery_area/ORA11GSY/archivelog/2014_05_24/o1_mf_1_8_9r1fn28z_.a 8 NO YES YES

SQL > select group#, dbid, sequence# from v$standby_log

GROUP# DBID SEQUENCE#

4 4239941846 9

5 UNASSIGNED 0

Successful application! But this is not the whole configuration, some problems buried in the installation process, some supplementary configuration also need to be completed later, in order to serve as a sound DG environment.

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